polytypo 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -0
- package/dist/{chunk-KAO74OJ6.js → chunk-4GYU4TXA.js} +2 -2
- package/dist/{chunk-6NTDU63P.js → chunk-5NCJ3Y65.js} +35 -11
- package/dist/chunk-5NCJ3Y65.js.map +1 -0
- package/dist/chunk-5U3DRTV7.js +205 -0
- package/dist/chunk-5U3DRTV7.js.map +1 -0
- package/dist/chunk-5VNPHCL2.cjs +264 -0
- package/dist/chunk-5VNPHCL2.cjs.map +1 -0
- package/dist/{chunk-POGDWVG5.cjs → chunk-AR6FDQAX.cjs} +40 -16
- package/dist/chunk-AR6FDQAX.cjs.map +1 -0
- package/dist/chunk-B7WXSXRG.js +31 -0
- package/dist/chunk-B7WXSXRG.js.map +1 -0
- package/dist/{chunk-VARU43JT.js → chunk-DXWMSR26.js} +4 -154
- package/dist/chunk-DXWMSR26.js.map +1 -0
- package/dist/chunk-ECYUONLP.cjs +205 -0
- package/dist/chunk-ECYUONLP.cjs.map +1 -0
- package/dist/chunk-FK3F3YZT.cjs +33 -0
- package/dist/chunk-FK3F3YZT.cjs.map +1 -0
- package/dist/chunk-QNSBCZU5.cjs +31 -0
- package/dist/chunk-QNSBCZU5.cjs.map +1 -0
- package/dist/chunk-THTCAO3O.cjs +147 -0
- package/dist/chunk-THTCAO3O.cjs.map +1 -0
- package/dist/chunk-UBEV2AC3.js +264 -0
- package/dist/chunk-UBEV2AC3.js.map +1 -0
- package/dist/chunk-V4EOJ44S.cjs +5778 -0
- package/dist/chunk-V4EOJ44S.cjs.map +1 -0
- package/dist/chunk-VC5XLP6O.js +33 -0
- package/dist/chunk-VC5XLP6O.js.map +1 -0
- package/dist/chunk-VKJVMMCI.js +5778 -0
- package/dist/chunk-VKJVMMCI.js.map +1 -0
- package/dist/{chunk-YYHKX5HE.cjs → chunk-W2T7B2SH.cjs} +3 -3
- package/dist/{chunk-YYHKX5HE.cjs.map → chunk-W2T7B2SH.cjs.map} +1 -1
- package/dist/{errors-joZChNws.d.ts → errors-CGFOVO3h.d.cts} +34 -4
- package/dist/{errors-joZChNws.d.cts → errors-CGFOVO3h.d.ts} +34 -4
- package/dist/html.cjs +15 -7
- package/dist/html.cjs.map +1 -1
- package/dist/html.d.cts +9 -3
- package/dist/html.d.ts +9 -3
- package/dist/html.js +12 -4
- package/dist/html.js.map +1 -1
- package/dist/index.cjs +33 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +28 -7
- package/dist/index.js.map +1 -1
- package/dist/markdown.cjs +15 -7
- package/dist/markdown.cjs.map +1 -1
- package/dist/markdown.d.cts +9 -3
- package/dist/markdown.d.ts +9 -3
- package/dist/markdown.js +12 -4
- package/dist/markdown.js.map +1 -1
- package/dist/text.cjs +13 -6
- package/dist/text.cjs.map +1 -1
- package/dist/text.d.cts +8 -3
- package/dist/text.d.ts +8 -3
- package/dist/text.js +10 -3
- package/dist/text.js.map +1 -1
- package/dist/yaml.cjs +29 -0
- package/dist/yaml.cjs.map +1 -0
- package/dist/yaml.d.cts +27 -0
- package/dist/yaml.d.ts +27 -0
- package/dist/yaml.js +29 -0
- package/dist/yaml.js.map +1 -0
- package/package.json +12 -2
- package/dist/chunk-44A6YP7S.js +0 -21
- package/dist/chunk-44A6YP7S.js.map +0 -1
- package/dist/chunk-5VBDCDS6.cjs +0 -19
- package/dist/chunk-5VBDCDS6.cjs.map +0 -1
- package/dist/chunk-6NTDU63P.js.map +0 -1
- package/dist/chunk-B4O4R6HI.cjs +0 -5633
- package/dist/chunk-B4O4R6HI.cjs.map +0 -1
- package/dist/chunk-HGUA2NVX.cjs +0 -21
- package/dist/chunk-HGUA2NVX.cjs.map +0 -1
- package/dist/chunk-LS57O4KJ.cjs +0 -297
- package/dist/chunk-LS57O4KJ.cjs.map +0 -1
- package/dist/chunk-OHF7OFWY.js +0 -5633
- package/dist/chunk-OHF7OFWY.js.map +0 -1
- package/dist/chunk-POGDWVG5.cjs.map +0 -1
- package/dist/chunk-RC3UKUYZ.js +0 -19
- package/dist/chunk-RC3UKUYZ.js.map +0 -1
- package/dist/chunk-VARU43JT.js.map +0 -1
- /package/dist/{chunk-KAO74OJ6.js.map → chunk-4GYU4TXA.js.map} +0 -0
package/dist/markdown.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Options, D as Dialect } from './errors-
|
|
2
|
-
export { L as LocaleData, a as LocaleSource, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-
|
|
1
|
+
import { O as Options, D as Dialect, C as Change } from './errors-CGFOVO3h.cjs';
|
|
2
|
+
export { L as LocaleData, a as LocaleSource, N as NarrowNbsp, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-CGFOVO3h.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `polytypo/markdown` — Markdown-only entry point. Its module graph includes the Micromark/MDX
|
|
@@ -15,5 +15,11 @@ type MarkdownOptions = Omit<Options, "mode"> & {
|
|
|
15
15
|
dialect: Dialect;
|
|
16
16
|
};
|
|
17
17
|
declare function transform(input: string, options: MarkdownOptions): string;
|
|
18
|
+
/**
|
|
19
|
+
* The same pipeline as this entry's `transform`, reporting instead of applying
|
|
20
|
+
* (spec/rules/analyze.md). Offsets are code-point offsets into `input` — into the document,
|
|
21
|
+
* not into a span (analyze.md §6).
|
|
22
|
+
*/
|
|
23
|
+
declare function analyze(input: string, options: MarkdownOptions): Change[];
|
|
18
24
|
|
|
19
|
-
export { Dialect, type MarkdownOptions, transform };
|
|
25
|
+
export { Dialect, type MarkdownOptions, analyze, transform };
|
package/dist/markdown.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Options, D as Dialect } from './errors-
|
|
2
|
-
export { L as LocaleData, a as LocaleSource, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-
|
|
1
|
+
import { O as Options, D as Dialect, C as Change } from './errors-CGFOVO3h.js';
|
|
2
|
+
export { L as LocaleData, a as LocaleSource, N as NarrowNbsp, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-CGFOVO3h.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `polytypo/markdown` — Markdown-only entry point. Its module graph includes the Micromark/MDX
|
|
@@ -15,5 +15,11 @@ type MarkdownOptions = Omit<Options, "mode"> & {
|
|
|
15
15
|
dialect: Dialect;
|
|
16
16
|
};
|
|
17
17
|
declare function transform(input: string, options: MarkdownOptions): string;
|
|
18
|
+
/**
|
|
19
|
+
* The same pipeline as this entry's `transform`, reporting instead of applying
|
|
20
|
+
* (spec/rules/analyze.md). Offsets are code-point offsets into `input` — into the document,
|
|
21
|
+
* not into a span (analyze.md §6).
|
|
22
|
+
*/
|
|
23
|
+
declare function analyze(input: string, options: MarkdownOptions): Change[];
|
|
18
24
|
|
|
19
|
-
export { Dialect, type MarkdownOptions, transform };
|
|
25
|
+
export { Dialect, type MarkdownOptions, analyze, transform };
|
package/dist/markdown.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
+
analyzeMarkdownPipeline,
|
|
2
3
|
runMarkdownPipeline
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-5NCJ3Y65.js";
|
|
5
|
+
import "./chunk-DXWMSR26.js";
|
|
6
|
+
import "./chunk-5U3DRTV7.js";
|
|
5
7
|
import {
|
|
6
8
|
assertFixedMode
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4GYU4TXA.js";
|
|
8
10
|
import {
|
|
9
11
|
PolytypoError
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VKJVMMCI.js";
|
|
11
13
|
|
|
12
14
|
// src/index.markdown.ts
|
|
13
15
|
function transform(input, options) {
|
|
@@ -15,8 +17,14 @@ function transform(input, options) {
|
|
|
15
17
|
assertFixedMode(given.mode, "markdown", "polytypo/markdown");
|
|
16
18
|
return runMarkdownPipeline(input, given);
|
|
17
19
|
}
|
|
20
|
+
function analyze(input, options) {
|
|
21
|
+
const given = options ?? {};
|
|
22
|
+
assertFixedMode(given.mode, "markdown", "polytypo/markdown");
|
|
23
|
+
return analyzeMarkdownPipeline(input, given);
|
|
24
|
+
}
|
|
18
25
|
export {
|
|
19
26
|
PolytypoError,
|
|
27
|
+
analyze,
|
|
20
28
|
transform
|
|
21
29
|
};
|
|
22
30
|
//# sourceMappingURL=markdown.js.map
|
package/dist/markdown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.markdown.ts"],"sourcesContent":["import { assertFixedMode } from \"./engine/assert-fixed-mode.js\";\nimport { runMarkdownPipeline } from \"./engine/markdown-pipeline.js\";\nimport type { Dialect, Options } from \"./types.js\";\n\n/**\n * `polytypo/markdown` — Markdown-only entry point. Its module graph includes the Micromark/MDX\n * stack and `parse5` (the latter via `./modes/markdown.js` importing `./modes/html.js` for\n * normative embedded-HTML handling, modes.md 3.7) — both are legitimately reachable here\n * (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1). It imports `./engine/markdown-pipeline.js`\n * directly and never `./engine/pipeline.js`.\n *\n * `mode` is absent from `MarkdownOptions`, since this entry only ever runs `markdown` mode.\n * `dialect` keeps the aggregate entry's contract: required, no default (types.ts).\n */\nexport type MarkdownOptions = Omit<Options, \"mode\"> & {\n dialect: Dialect;\n};\n\nexport function transform(input: string, options: MarkdownOptions): string {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"markdown\", \"polytypo/markdown\");\n return runMarkdownPipeline(input, given);\n}\n\nexport { PolytypoError } from \"./errors.js\";\nexport type { PolytypoErrorCode } from \"./errors.js\";\nexport type {\n Dialect,\n LocaleData,\n LocaleSource,\n QuotePair,\n Rule,\n RuleContext,\n RuleId,\n} from \"./types.js\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.markdown.ts"],"sourcesContent":["import { assertFixedMode } from \"./engine/assert-fixed-mode.js\";\nimport { analyzeMarkdownPipeline, runMarkdownPipeline } from \"./engine/markdown-pipeline.js\";\nimport type { Change } from \"./engine/origin.js\";\nimport type { Dialect, Options } from \"./types.js\";\n\n/**\n * `polytypo/markdown` — Markdown-only entry point. Its module graph includes the Micromark/MDX\n * stack and `parse5` (the latter via `./modes/markdown.js` importing `./modes/html.js` for\n * normative embedded-HTML handling, modes.md 3.7) — both are legitimately reachable here\n * (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1). It imports `./engine/markdown-pipeline.js`\n * directly and never `./engine/pipeline.js`.\n *\n * `mode` is absent from `MarkdownOptions`, since this entry only ever runs `markdown` mode.\n * `dialect` keeps the aggregate entry's contract: required, no default (types.ts).\n */\nexport type MarkdownOptions = Omit<Options, \"mode\"> & {\n dialect: Dialect;\n};\n\nexport function transform(input: string, options: MarkdownOptions): string {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"markdown\", \"polytypo/markdown\");\n return runMarkdownPipeline(input, given);\n}\n\n/**\n * The same pipeline as this entry's `transform`, reporting instead of applying\n * (spec/rules/analyze.md). Offsets are code-point offsets into `input` — into the document,\n * not into a span (analyze.md §6).\n */\nexport function analyze(input: string, options: MarkdownOptions): Change[] {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"markdown\", \"polytypo/markdown\");\n return analyzeMarkdownPipeline(input, given);\n}\n\nexport { PolytypoError } from \"./errors.js\";\nexport type { PolytypoErrorCode } from \"./errors.js\";\nexport type {\n Dialect,\n LocaleData,\n LocaleSource,\n NarrowNbsp,\n QuotePair,\n Rule,\n RuleContext,\n RuleId,\n} from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;;AAmBO,SAAS,UAAU,OAAe,SAAkC;AACzE,QAAM,QAAS,WAAW,CAAC;AAC3B,kBAAgB,MAAM,MAAM,YAAY,mBAAmB;AAC3D,SAAO,oBAAoB,OAAO,KAAK;AACzC;AAOO,SAAS,QAAQ,OAAe,SAAoC;AACzE,QAAM,QAAS,WAAW,CAAC;AAC3B,kBAAgB,MAAM,MAAM,YAAY,mBAAmB;AAC3D,SAAO,wBAAwB,OAAO,KAAK;AAC7C;","names":[]}
|
package/dist/text.cjs
CHANGED
|
@@ -1,21 +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
|
-
var _chunk5VBDCDS6cjs = require('./chunk-5VBDCDS6.cjs');
|
|
4
3
|
|
|
4
|
+
var _chunkQNSBCZU5cjs = require('./chunk-QNSBCZU5.cjs');
|
|
5
5
|
|
|
6
|
-
var _chunkYYHKX5HEcjs = require('./chunk-YYHKX5HE.cjs');
|
|
7
6
|
|
|
7
|
+
var _chunkW2T7B2SHcjs = require('./chunk-W2T7B2SH.cjs');
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
var _chunkV4EOJ44Scjs = require('./chunk-V4EOJ44S.cjs');
|
|
10
11
|
|
|
11
12
|
// src/index.text.ts
|
|
12
13
|
function transform(input, options) {
|
|
13
14
|
const given = _nullishCoalesce(options, () => ( {}));
|
|
14
|
-
|
|
15
|
-
return
|
|
15
|
+
_chunkW2T7B2SHcjs.assertFixedMode.call(void 0, given.mode, "text", "polytypo/text");
|
|
16
|
+
return _chunkQNSBCZU5cjs.runTextPipeline.call(void 0, input, given);
|
|
17
|
+
}
|
|
18
|
+
function analyze(input, options) {
|
|
19
|
+
const given = _nullishCoalesce(options, () => ( {}));
|
|
20
|
+
_chunkW2T7B2SHcjs.assertFixedMode.call(void 0, given.mode, "text", "polytypo/text");
|
|
21
|
+
return _chunkQNSBCZU5cjs.analyzeTextPipeline.call(void 0, input, given);
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
|
|
27
|
+
exports.PolytypoError = _chunkV4EOJ44Scjs.PolytypoError; exports.analyze = analyze; exports.transform = transform;
|
|
21
28
|
//# sourceMappingURL=text.cjs.map
|
package/dist/text.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/text.cjs","../src/index.text.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACMO,SAAS,SAAA,CAAU,KAAA,EAAe,OAAA,EAA8B;AACrE,EAAA,MAAM,MAAA,mBAAS,OAAA,UAAW,CAAC,GAAA;AAC3B,EAAA,+CAAA,KAAgB,CAAM,IAAA,EAAM,MAAA,EAAQ,eAAe,CAAA;AACnD,EAAA,OAAO,+CAAA,KAAgB,EAAO,KAAK,CAAA;AACrC;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/text.cjs","../src/index.text.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACMO,SAAS,SAAA,CAAU,KAAA,EAAe,OAAA,EAA8B;AACrE,EAAA,MAAM,MAAA,mBAAS,OAAA,UAAW,CAAC,GAAA;AAC3B,EAAA,+CAAA,KAAgB,CAAM,IAAA,EAAM,MAAA,EAAQ,eAAe,CAAA;AACnD,EAAA,OAAO,+CAAA,KAAgB,EAAO,KAAK,CAAA;AACrC;AAMO,SAAS,OAAA,CAAQ,KAAA,EAAe,OAAA,EAAgC;AACrE,EAAA,MAAM,MAAA,mBAAS,OAAA,UAAW,CAAC,GAAA;AAC3B,EAAA,+CAAA,KAAgB,CAAM,IAAA,EAAM,MAAA,EAAQ,eAAe,CAAA;AACnD,EAAA,OAAO,mDAAA,KAAoB,EAAO,KAAK,CAAA;AACzC;ADTA;AACE;AACA;AACA;AACF,kHAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/text.cjs","sourcesContent":[null,"import { assertFixedMode } from \"./engine/assert-fixed-mode.js\";\nimport { analyzeTextPipeline, runTextPipeline } from \"./engine/text-pipeline.js\";\nimport type { Change } from \"./engine/origin.js\";\nimport type { Options } from \"./types.js\";\n\n/**\n * `polytypo/text` — text-only entry point. Its module graph excludes `parse5` and the\n * Micromark/MDX stack entirely (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1): it imports\n * `./engine/text-pipeline.js` directly and never `./engine/pipeline.js`, `./modes/html.js` or\n * `./modes/markdown.js`.\n *\n * `mode` is absent from `TextOptions`, since this entry only ever runs `text` mode. `dialect` is\n * likewise absent — it has no effect in `text` mode even in the aggregate entry (types.ts), so\n * there is nothing for it to conflict with here.\n */\nexport type TextOptions = Omit<Options, \"mode\" | \"dialect\">;\n\nexport function transform(input: string, options: TextOptions): string {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"text\", \"polytypo/text\");\n return runTextPipeline(input, given);\n}\n\n/**\n * The same pipeline as this entry's `transform`, reporting instead of applying\n * (spec/rules/analyze.md). Offsets are code-point offsets into `input`.\n */\nexport function analyze(input: string, options: TextOptions): Change[] {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"text\", \"polytypo/text\");\n return analyzeTextPipeline(input, given);\n}\n\nexport { PolytypoError } from \"./errors.js\";\nexport type { PolytypoErrorCode } from \"./errors.js\";\nexport type { Change } from \"./engine/origin.js\";\nexport type { NarrowNbsp } from \"./types.js\";\nexport type { LocaleData, LocaleSource, QuotePair, Rule, RuleContext, RuleId } from \"./types.js\";\n"]}
|
package/dist/text.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Options } from './errors-
|
|
2
|
-
export { L as LocaleData, a as LocaleSource, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-
|
|
1
|
+
import { O as Options, C as Change } from './errors-CGFOVO3h.cjs';
|
|
2
|
+
export { L as LocaleData, a as LocaleSource, N as NarrowNbsp, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-CGFOVO3h.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `polytypo/text` — text-only entry point. Its module graph excludes `parse5` and the
|
|
@@ -13,5 +13,10 @@ export { L as LocaleData, a as LocaleSource, P as PolytypoError, b as PolytypoEr
|
|
|
13
13
|
*/
|
|
14
14
|
type TextOptions = Omit<Options, "mode" | "dialect">;
|
|
15
15
|
declare function transform(input: string, options: TextOptions): string;
|
|
16
|
+
/**
|
|
17
|
+
* The same pipeline as this entry's `transform`, reporting instead of applying
|
|
18
|
+
* (spec/rules/analyze.md). Offsets are code-point offsets into `input`.
|
|
19
|
+
*/
|
|
20
|
+
declare function analyze(input: string, options: TextOptions): Change[];
|
|
16
21
|
|
|
17
|
-
export { type TextOptions, transform };
|
|
22
|
+
export { Change, type TextOptions, analyze, transform };
|
package/dist/text.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Options } from './errors-
|
|
2
|
-
export { L as LocaleData, a as LocaleSource, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-
|
|
1
|
+
import { O as Options, C as Change } from './errors-CGFOVO3h.js';
|
|
2
|
+
export { L as LocaleData, a as LocaleSource, N as NarrowNbsp, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-CGFOVO3h.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `polytypo/text` — text-only entry point. Its module graph excludes `parse5` and the
|
|
@@ -13,5 +13,10 @@ export { L as LocaleData, a as LocaleSource, P as PolytypoError, b as PolytypoEr
|
|
|
13
13
|
*/
|
|
14
14
|
type TextOptions = Omit<Options, "mode" | "dialect">;
|
|
15
15
|
declare function transform(input: string, options: TextOptions): string;
|
|
16
|
+
/**
|
|
17
|
+
* The same pipeline as this entry's `transform`, reporting instead of applying
|
|
18
|
+
* (spec/rules/analyze.md). Offsets are code-point offsets into `input`.
|
|
19
|
+
*/
|
|
20
|
+
declare function analyze(input: string, options: TextOptions): Change[];
|
|
16
21
|
|
|
17
|
-
export { type TextOptions, transform };
|
|
22
|
+
export { Change, type TextOptions, analyze, transform };
|
package/dist/text.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
+
analyzeTextPipeline,
|
|
2
3
|
runTextPipeline
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-B7WXSXRG.js";
|
|
4
5
|
import {
|
|
5
6
|
assertFixedMode
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4GYU4TXA.js";
|
|
7
8
|
import {
|
|
8
9
|
PolytypoError
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VKJVMMCI.js";
|
|
10
11
|
|
|
11
12
|
// src/index.text.ts
|
|
12
13
|
function transform(input, options) {
|
|
@@ -14,8 +15,14 @@ function transform(input, options) {
|
|
|
14
15
|
assertFixedMode(given.mode, "text", "polytypo/text");
|
|
15
16
|
return runTextPipeline(input, given);
|
|
16
17
|
}
|
|
18
|
+
function analyze(input, options) {
|
|
19
|
+
const given = options ?? {};
|
|
20
|
+
assertFixedMode(given.mode, "text", "polytypo/text");
|
|
21
|
+
return analyzeTextPipeline(input, given);
|
|
22
|
+
}
|
|
17
23
|
export {
|
|
18
24
|
PolytypoError,
|
|
25
|
+
analyze,
|
|
19
26
|
transform
|
|
20
27
|
};
|
|
21
28
|
//# sourceMappingURL=text.js.map
|
package/dist/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.text.ts"],"sourcesContent":["import { assertFixedMode } from \"./engine/assert-fixed-mode.js\";\nimport { runTextPipeline } from \"./engine/text-pipeline.js\";\nimport type { Options } from \"./types.js\";\n\n/**\n * `polytypo/text` — text-only entry point. Its module graph excludes `parse5` and the\n * Micromark/MDX stack entirely (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1): it imports\n * `./engine/text-pipeline.js` directly and never `./engine/pipeline.js`, `./modes/html.js` or\n * `./modes/markdown.js`.\n *\n * `mode` is absent from `TextOptions`, since this entry only ever runs `text` mode. `dialect` is\n * likewise absent — it has no effect in `text` mode even in the aggregate entry (types.ts), so\n * there is nothing for it to conflict with here.\n */\nexport type TextOptions = Omit<Options, \"mode\" | \"dialect\">;\n\nexport function transform(input: string, options: TextOptions): string {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"text\", \"polytypo/text\");\n return runTextPipeline(input, given);\n}\n\nexport { PolytypoError } from \"./errors.js\";\nexport type { PolytypoErrorCode } from \"./errors.js\";\nexport type { LocaleData, LocaleSource, QuotePair, Rule, RuleContext, RuleId } from \"./types.js\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.text.ts"],"sourcesContent":["import { assertFixedMode } from \"./engine/assert-fixed-mode.js\";\nimport { analyzeTextPipeline, runTextPipeline } from \"./engine/text-pipeline.js\";\nimport type { Change } from \"./engine/origin.js\";\nimport type { Options } from \"./types.js\";\n\n/**\n * `polytypo/text` — text-only entry point. Its module graph excludes `parse5` and the\n * Micromark/MDX stack entirely (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1): it imports\n * `./engine/text-pipeline.js` directly and never `./engine/pipeline.js`, `./modes/html.js` or\n * `./modes/markdown.js`.\n *\n * `mode` is absent from `TextOptions`, since this entry only ever runs `text` mode. `dialect` is\n * likewise absent — it has no effect in `text` mode even in the aggregate entry (types.ts), so\n * there is nothing for it to conflict with here.\n */\nexport type TextOptions = Omit<Options, \"mode\" | \"dialect\">;\n\nexport function transform(input: string, options: TextOptions): string {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"text\", \"polytypo/text\");\n return runTextPipeline(input, given);\n}\n\n/**\n * The same pipeline as this entry's `transform`, reporting instead of applying\n * (spec/rules/analyze.md). Offsets are code-point offsets into `input`.\n */\nexport function analyze(input: string, options: TextOptions): Change[] {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"text\", \"polytypo/text\");\n return analyzeTextPipeline(input, given);\n}\n\nexport { PolytypoError } from \"./errors.js\";\nexport type { PolytypoErrorCode } from \"./errors.js\";\nexport type { Change } from \"./engine/origin.js\";\nexport type { NarrowNbsp } from \"./types.js\";\nexport type { LocaleData, LocaleSource, QuotePair, Rule, RuleContext, RuleId } from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;AAiBO,SAAS,UAAU,OAAe,SAA8B;AACrE,QAAM,QAAS,WAAW,CAAC;AAC3B,kBAAgB,MAAM,MAAM,QAAQ,eAAe;AACnD,SAAO,gBAAgB,OAAO,KAAK;AACrC;AAMO,SAAS,QAAQ,OAAe,SAAgC;AACrE,QAAM,QAAS,WAAW,CAAC;AAC3B,kBAAgB,MAAM,MAAM,QAAQ,eAAe;AACnD,SAAO,oBAAoB,OAAO,KAAK;AACzC;","names":[]}
|
package/dist/yaml.cjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk5VNPHCL2cjs = require('./chunk-5VNPHCL2.cjs');
|
|
5
|
+
require('./chunk-ECYUONLP.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkW2T7B2SHcjs = require('./chunk-W2T7B2SH.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkV4EOJ44Scjs = require('./chunk-V4EOJ44S.cjs');
|
|
12
|
+
|
|
13
|
+
// src/index.yaml.ts
|
|
14
|
+
function transform(input, options) {
|
|
15
|
+
const given = _nullishCoalesce(options, () => ( {}));
|
|
16
|
+
_chunkW2T7B2SHcjs.assertFixedMode.call(void 0, given.mode, "yaml", "polytypo/yaml");
|
|
17
|
+
return _chunk5VNPHCL2cjs.runYamlPipeline.call(void 0, input, given);
|
|
18
|
+
}
|
|
19
|
+
function analyze(input, options) {
|
|
20
|
+
const given = _nullishCoalesce(options, () => ( {}));
|
|
21
|
+
_chunkW2T7B2SHcjs.assertFixedMode.call(void 0, given.mode, "yaml", "polytypo/yaml");
|
|
22
|
+
return _chunk5VNPHCL2cjs.analyzeYamlPipeline.call(void 0, input, given);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
exports.PolytypoError = _chunkV4EOJ44Scjs.PolytypoError; exports.analyze = analyze; exports.transform = transform;
|
|
29
|
+
//# sourceMappingURL=yaml.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/yaml.cjs","../src/index.yaml.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACUO,SAAS,SAAA,CAAU,KAAA,EAAe,OAAA,EAA8B;AACrE,EAAA,MAAM,MAAA,mBAAS,OAAA,UAAW,CAAC,GAAA;AAC3B,EAAA,+CAAA,KAAgB,CAAM,IAAA,EAAM,MAAA,EAAQ,eAAe,CAAA;AACnD,EAAA,OAAO,+CAAA,KAAgB,EAAO,KAAK,CAAA;AACrC;AAMO,SAAS,OAAA,CAAQ,KAAA,EAAe,OAAA,EAAgC;AACrE,EAAA,MAAM,MAAA,mBAAS,OAAA,UAAW,CAAC,GAAA;AAC3B,EAAA,+CAAA,KAAgB,CAAM,IAAA,EAAM,MAAA,EAAQ,eAAe,CAAA;AACnD,EAAA,OAAO,mDAAA,KAAoB,EAAO,KAAK,CAAA;AACzC;ADbA;AACE;AACA;AACA;AACF,kHAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/yaml.cjs","sourcesContent":[null,"import { assertFixedMode } from \"./engine/assert-fixed-mode.js\";\nimport { analyzeYamlPipeline, runYamlPipeline } from \"./engine/yaml-pipeline.js\";\nimport type { Change } from \"./engine/origin.js\";\nimport type { Options } from \"./types.js\";\n\n/**\n * `polytypo/yaml` — YAML-only entry point, and the lightest of the four: `yaml` mode uses no\n * parser at all (spec/rules/modes.md 3.8.1), so this entry's module graph excludes `parse5` and\n * the Micromark/MDX stack for the same reason `polytypo/text` does — it has nothing to import.\n * `scripts/check-entry-reach.mjs` asserts that against the real module graph, which is what\n * turns \"parser-free\" from a claim in the spec into a fact this package can be held to.\n *\n * `mode` is absent from `YamlOptions`, since this entry only ever runs `yaml` mode. `dialect` is\n * likewise absent — it belongs to `markdown` alone (types.ts). `keys` goes the other way: it is\n * optional on the aggregate `Options` because the other three modes ignore it, and **required**\n * here, where the mode is fixed and the option always applies.\n */\nexport type YamlOptions = Omit<Options, \"mode\" | \"dialect\" | \"keys\"> & {\n /** Required here, with no default — modes.md §3.8.2. An empty list processes nothing. */\n readonly keys: readonly string[];\n};\n\nexport function transform(input: string, options: YamlOptions): string {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"yaml\", \"polytypo/yaml\");\n return runYamlPipeline(input, given);\n}\n\n/**\n * The same pipeline as this entry's `transform`, reporting instead of applying\n * (spec/rules/analyze.md). Offsets are code-point offsets into `input`, not into a span.\n */\nexport function analyze(input: string, options: YamlOptions): Change[] {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"yaml\", \"polytypo/yaml\");\n return analyzeYamlPipeline(input, given);\n}\n\nexport { PolytypoError } from \"./errors.js\";\nexport type { PolytypoErrorCode } from \"./errors.js\";\nexport type { Change } from \"./engine/origin.js\";\nexport type { NarrowNbsp } from \"./types.js\";\nexport type { LocaleData, LocaleSource, QuotePair, Rule, RuleContext, RuleId } from \"./types.js\";\n"]}
|
package/dist/yaml.d.cts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { O as Options, C as Change } from './errors-CGFOVO3h.cjs';
|
|
2
|
+
export { L as LocaleData, a as LocaleSource, N as NarrowNbsp, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-CGFOVO3h.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `polytypo/yaml` — YAML-only entry point, and the lightest of the four: `yaml` mode uses no
|
|
6
|
+
* parser at all (spec/rules/modes.md 3.8.1), so this entry's module graph excludes `parse5` and
|
|
7
|
+
* the Micromark/MDX stack for the same reason `polytypo/text` does — it has nothing to import.
|
|
8
|
+
* `scripts/check-entry-reach.mjs` asserts that against the real module graph, which is what
|
|
9
|
+
* turns "parser-free" from a claim in the spec into a fact this package can be held to.
|
|
10
|
+
*
|
|
11
|
+
* `mode` is absent from `YamlOptions`, since this entry only ever runs `yaml` mode. `dialect` is
|
|
12
|
+
* likewise absent — it belongs to `markdown` alone (types.ts). `keys` goes the other way: it is
|
|
13
|
+
* optional on the aggregate `Options` because the other three modes ignore it, and **required**
|
|
14
|
+
* here, where the mode is fixed and the option always applies.
|
|
15
|
+
*/
|
|
16
|
+
type YamlOptions = Omit<Options, "mode" | "dialect" | "keys"> & {
|
|
17
|
+
/** Required here, with no default — modes.md §3.8.2. An empty list processes nothing. */
|
|
18
|
+
readonly keys: readonly string[];
|
|
19
|
+
};
|
|
20
|
+
declare function transform(input: string, options: YamlOptions): string;
|
|
21
|
+
/**
|
|
22
|
+
* The same pipeline as this entry's `transform`, reporting instead of applying
|
|
23
|
+
* (spec/rules/analyze.md). Offsets are code-point offsets into `input`, not into a span.
|
|
24
|
+
*/
|
|
25
|
+
declare function analyze(input: string, options: YamlOptions): Change[];
|
|
26
|
+
|
|
27
|
+
export { Change, type YamlOptions, analyze, transform };
|
package/dist/yaml.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { O as Options, C as Change } from './errors-CGFOVO3h.js';
|
|
2
|
+
export { L as LocaleData, a as LocaleSource, N as NarrowNbsp, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-CGFOVO3h.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `polytypo/yaml` — YAML-only entry point, and the lightest of the four: `yaml` mode uses no
|
|
6
|
+
* parser at all (spec/rules/modes.md 3.8.1), so this entry's module graph excludes `parse5` and
|
|
7
|
+
* the Micromark/MDX stack for the same reason `polytypo/text` does — it has nothing to import.
|
|
8
|
+
* `scripts/check-entry-reach.mjs` asserts that against the real module graph, which is what
|
|
9
|
+
* turns "parser-free" from a claim in the spec into a fact this package can be held to.
|
|
10
|
+
*
|
|
11
|
+
* `mode` is absent from `YamlOptions`, since this entry only ever runs `yaml` mode. `dialect` is
|
|
12
|
+
* likewise absent — it belongs to `markdown` alone (types.ts). `keys` goes the other way: it is
|
|
13
|
+
* optional on the aggregate `Options` because the other three modes ignore it, and **required**
|
|
14
|
+
* here, where the mode is fixed and the option always applies.
|
|
15
|
+
*/
|
|
16
|
+
type YamlOptions = Omit<Options, "mode" | "dialect" | "keys"> & {
|
|
17
|
+
/** Required here, with no default — modes.md §3.8.2. An empty list processes nothing. */
|
|
18
|
+
readonly keys: readonly string[];
|
|
19
|
+
};
|
|
20
|
+
declare function transform(input: string, options: YamlOptions): string;
|
|
21
|
+
/**
|
|
22
|
+
* The same pipeline as this entry's `transform`, reporting instead of applying
|
|
23
|
+
* (spec/rules/analyze.md). Offsets are code-point offsets into `input`, not into a span.
|
|
24
|
+
*/
|
|
25
|
+
declare function analyze(input: string, options: YamlOptions): Change[];
|
|
26
|
+
|
|
27
|
+
export { Change, type YamlOptions, analyze, transform };
|
package/dist/yaml.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeYamlPipeline,
|
|
3
|
+
runYamlPipeline
|
|
4
|
+
} from "./chunk-UBEV2AC3.js";
|
|
5
|
+
import "./chunk-5U3DRTV7.js";
|
|
6
|
+
import {
|
|
7
|
+
assertFixedMode
|
|
8
|
+
} from "./chunk-4GYU4TXA.js";
|
|
9
|
+
import {
|
|
10
|
+
PolytypoError
|
|
11
|
+
} from "./chunk-VKJVMMCI.js";
|
|
12
|
+
|
|
13
|
+
// src/index.yaml.ts
|
|
14
|
+
function transform(input, options) {
|
|
15
|
+
const given = options ?? {};
|
|
16
|
+
assertFixedMode(given.mode, "yaml", "polytypo/yaml");
|
|
17
|
+
return runYamlPipeline(input, given);
|
|
18
|
+
}
|
|
19
|
+
function analyze(input, options) {
|
|
20
|
+
const given = options ?? {};
|
|
21
|
+
assertFixedMode(given.mode, "yaml", "polytypo/yaml");
|
|
22
|
+
return analyzeYamlPipeline(input, given);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
PolytypoError,
|
|
26
|
+
analyze,
|
|
27
|
+
transform
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=yaml.js.map
|
package/dist/yaml.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.yaml.ts"],"sourcesContent":["import { assertFixedMode } from \"./engine/assert-fixed-mode.js\";\nimport { analyzeYamlPipeline, runYamlPipeline } from \"./engine/yaml-pipeline.js\";\nimport type { Change } from \"./engine/origin.js\";\nimport type { Options } from \"./types.js\";\n\n/**\n * `polytypo/yaml` — YAML-only entry point, and the lightest of the four: `yaml` mode uses no\n * parser at all (spec/rules/modes.md 3.8.1), so this entry's module graph excludes `parse5` and\n * the Micromark/MDX stack for the same reason `polytypo/text` does — it has nothing to import.\n * `scripts/check-entry-reach.mjs` asserts that against the real module graph, which is what\n * turns \"parser-free\" from a claim in the spec into a fact this package can be held to.\n *\n * `mode` is absent from `YamlOptions`, since this entry only ever runs `yaml` mode. `dialect` is\n * likewise absent — it belongs to `markdown` alone (types.ts). `keys` goes the other way: it is\n * optional on the aggregate `Options` because the other three modes ignore it, and **required**\n * here, where the mode is fixed and the option always applies.\n */\nexport type YamlOptions = Omit<Options, \"mode\" | \"dialect\" | \"keys\"> & {\n /** Required here, with no default — modes.md §3.8.2. An empty list processes nothing. */\n readonly keys: readonly string[];\n};\n\nexport function transform(input: string, options: YamlOptions): string {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"yaml\", \"polytypo/yaml\");\n return runYamlPipeline(input, given);\n}\n\n/**\n * The same pipeline as this entry's `transform`, reporting instead of applying\n * (spec/rules/analyze.md). Offsets are code-point offsets into `input`, not into a span.\n */\nexport function analyze(input: string, options: YamlOptions): Change[] {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"yaml\", \"polytypo/yaml\");\n return analyzeYamlPipeline(input, given);\n}\n\nexport { PolytypoError } from \"./errors.js\";\nexport type { PolytypoErrorCode } from \"./errors.js\";\nexport type { Change } from \"./engine/origin.js\";\nexport type { NarrowNbsp } from \"./types.js\";\nexport type { LocaleData, LocaleSource, QuotePair, Rule, RuleContext, RuleId } from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;AAsBO,SAAS,UAAU,OAAe,SAA8B;AACrE,QAAM,QAAS,WAAW,CAAC;AAC3B,kBAAgB,MAAM,MAAM,QAAQ,eAAe;AACnD,SAAO,gBAAgB,OAAO,KAAK;AACrC;AAMO,SAAS,QAAQ,OAAe,SAAgC;AACrE,QAAM,QAAS,WAAW,CAAC;AAC3B,kBAAgB,MAAM,MAAM,QAAQ,eAAe;AACnD,SAAO,oBAAoB,OAAO,KAAK;AACzC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polytypo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Normalize typography across languages: locale-correct quotes, dashes, ellipses and no-break spaces.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typography",
|
|
@@ -79,6 +79,16 @@
|
|
|
79
79
|
"default": "./dist/markdown.cjs"
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
|
+
"./yaml": {
|
|
83
|
+
"import": {
|
|
84
|
+
"types": "./dist/yaml.d.ts",
|
|
85
|
+
"default": "./dist/yaml.js"
|
|
86
|
+
},
|
|
87
|
+
"require": {
|
|
88
|
+
"types": "./dist/yaml.d.cts",
|
|
89
|
+
"default": "./dist/yaml.cjs"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
82
92
|
"./package.json": "./package.json"
|
|
83
93
|
},
|
|
84
94
|
"files": [
|
|
@@ -122,7 +132,7 @@
|
|
|
122
132
|
"typescript": "^6.0.3",
|
|
123
133
|
"typescript-eslint": "^8.67.0",
|
|
124
134
|
"vitest": "^4.1.10",
|
|
125
|
-
"yaml": "^2.9.
|
|
135
|
+
"yaml": "^2.9.1"
|
|
126
136
|
},
|
|
127
137
|
"dependencies": {
|
|
128
138
|
"micromark": "^4.0.2",
|
package/dist/chunk-44A6YP7S.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
htmlSpans,
|
|
3
|
-
runOverSpans
|
|
4
|
-
} from "./chunk-VARU43JT.js";
|
|
5
|
-
import {
|
|
6
|
-
getLocaleData,
|
|
7
|
-
planRules
|
|
8
|
-
} from "./chunk-OHF7OFWY.js";
|
|
9
|
-
|
|
10
|
-
// src/engine/html-pipeline.ts
|
|
11
|
-
function runHtmlPipeline(input, options) {
|
|
12
|
-
const planned = planRules(options.rules);
|
|
13
|
-
const locale = getLocaleData(options.locale);
|
|
14
|
-
const spans = htmlSpans(input);
|
|
15
|
-
return runOverSpans(input, spans, planned, locale, "html");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
runHtmlPipeline
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=chunk-44A6YP7S.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 { planRules } from \"./rule-runner.js\";\nimport { runOverSpans } from \"./span-runner.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 planned = planRules(options.rules);\n const locale = getLocaleData(options.locale);\n const spans = htmlSpans(input);\n return runOverSpans(input, spans, planned, locale, \"html\");\n}\n"],"mappings":";;;;;;;;;;AAeO,SAAS,gBAAgB,OAAe,SAAmC;AAChF,QAAM,UAAU,UAAU,QAAQ,KAAK;AACvC,QAAM,SAAS,cAAc,QAAQ,MAAM;AAC3C,QAAM,QAAQ,UAAU,KAAK;AAC7B,SAAO,aAAa,OAAO,OAAO,SAAS,QAAQ,MAAM;AAC3D;","names":[]}
|
package/dist/chunk-5VBDCDS6.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkB4O4R6HIcjs = require('./chunk-B4O4R6HI.cjs');
|
|
8
|
-
|
|
9
|
-
// src/engine/text-pipeline.ts
|
|
10
|
-
function runTextPipeline(input, options) {
|
|
11
|
-
const planned = _chunkB4O4R6HIcjs.planRules.call(void 0, options.rules);
|
|
12
|
-
const locale = _chunkB4O4R6HIcjs.getLocaleData.call(void 0, options.locale);
|
|
13
|
-
return _chunkB4O4R6HIcjs.fromCodePoints.call(void 0, _chunkB4O4R6HIcjs.runRules.call(void 0, _chunkB4O4R6HIcjs.toCodePoints.call(void 0, input), planned, locale, "text"));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exports.runTextPipeline = runTextPipeline;
|
|
19
|
-
//# sourceMappingURL=chunk-5VBDCDS6.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-5VBDCDS6.cjs","../src/engine/text-pipeline.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACQO,SAAS,eAAA,CAAgB,KAAA,EAAe,OAAA,EAAmC;AAChF,EAAA,MAAM,QAAA,EAAU,yCAAA,OAAU,CAAQ,KAAK,CAAA;AACvC,EAAA,MAAM,OAAA,EAAS,6CAAA,OAAc,CAAQ,MAAM,CAAA;AAC3C,EAAA,OAAO,8CAAA,wCAAe,4CAAS,KAAkB,CAAA,EAAG,OAAA,EAAS,MAAA,EAAQ,MAAM,CAAC,CAAA;AAC9E;ADNA;AACA;AACE;AACF,0CAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-5VBDCDS6.cjs","sourcesContent":[null,"import type { Options } from \"../types.js\";\nimport { fromCodePoints, toCodePoints } from \"./codepoints.js\";\nimport { getLocaleData } from \"./locale.js\";\nimport { planRules, runRules } from \"./rule-runner.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 planned = planRules(options.rules);\n const locale = getLocaleData(options.locale);\n return fromCodePoints(runRules(toCodePoints(input), planned, locale, \"text\"));\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/modes/markdown.ts","../src/engine/markdown-pipeline.ts"],"sourcesContent":["import { parse, postprocess, preprocess } from \"micromark\";\nimport { frontmatter } from \"micromark-extension-frontmatter\";\nimport { gfm } from \"micromark-extension-gfm\";\nimport { mdxjs } from \"micromark-extension-mdxjs\";\nimport type { Event, Extension } from \"micromark-util-types\";\nimport { PolytypoError } from \"../errors.js\";\nimport type { Dialect } from \"../types.js\";\nimport { htmlFragmentSpans, isSkippedElement } from \"./html.js\";\nimport { wrapParserErrors } from \"./parse-error.js\";\nimport type { Span } from \"./spans.js\";\n\n/**\n * spec/rules/modes.md 3.7. Each entry is skipped **whole**, including anything that looks\n * processable inside it. The complement is not enumerated: a span is emitted only for a\n * micromark `data` token, which is the tokenizer's own name for \"literal content\", so list\n * markers, emphasis delimiters, heading sequences, table padding, line endings, hard-break\n * spaces, character escapes and character references are outside every span by construction\n * rather than by a second list that could drift from the first.\n */\nconst SKIPPED_TOKEN_TYPES: ReadonlySet<string> = new Set([\n // fenced code blocks (including the info string and the fences) and indented code blocks\n \"codeFenced\",\n \"codeIndented\",\n // inline code spans, including the backticks\n \"codeText\",\n // autolinks `<https://…>`, and GFM's bare-URL form\n \"autolink\",\n \"literalAutolink\",\n // link and image destinations and titles; the definition line of a reference link. The link\n // *text* is a `labelText`, which is not skipped.\n \"resource\",\n \"reference\",\n \"definition\",\n // MDX: expression containers in full, and every JSX attribute — the whole tag is skipped, so\n // attributes never surface. JSX element *children* sit outside the tag tokens and are\n // processable.\n \"mdxFlowExpression\",\n \"mdxTextExpression\",\n \"mdxjsEsm\",\n // Not in modes.md 3.7, and it has to be: without it the second `---` of a YAML block reads as\n // a setext underline, `title: Une note` becomes a paragraph, and `fr` puts a narrow no-break\n // space in front of the colon of a machine-read metadata field. Reported as a spec gap.\n \"frontmatter\",\n]);\n\n/** Token types whose enter/exit also maintains the skipped-element stack. */\nconst RAW_TAG_TOKEN_TYPES: ReadonlySet<string> = new Set([\n \"htmlText\",\n \"mdxJsxTextTag\",\n \"mdxJsxFlowTag\",\n]);\n\nconst LESS_THAN = 0x3c;\nconst GREATER_THAN = 0x3e;\nconst SLASH = 0x2f;\nconst EXCLAMATION = 0x21;\nconst QUESTION = 0x3f;\n\nfunction isAsciiLetter(unit: number): boolean {\n return (unit >= 0x61 && unit <= 0x7a) || (unit >= 0x41 && unit <= 0x5a);\n}\n\nfunction isTagNameUnit(unit: number): boolean {\n // Deliberately permissive: anything that is not a delimiter belongs to the name. Custom\n // elements (`my-callout`) and member expressions (`Foo.Bar`) must come out whole so that they\n // fail the skip-list membership test rather than being truncated into something that passes.\n return (\n unit !== GREATER_THAN &&\n unit !== SLASH &&\n unit !== 0x20 &&\n unit !== 0x09 &&\n unit !== 0x0a &&\n unit !== 0x0d\n );\n}\n\n/** ASCII-only, because HTML tag names are ASCII case-insensitive and `toLowerCase()` is not. */\nfunction asciiLower(value: string): string {\n let out = \"\";\n for (let i = 0; i < value.length; i += 1) {\n const unit = value.charCodeAt(i);\n out += unit >= 0x41 && unit <= 0x5a ? String.fromCharCode(unit + 0x20) : value[i];\n }\n return out;\n}\n\ninterface RawTag {\n readonly name: string;\n readonly closing: boolean;\n readonly selfClosing: boolean;\n}\n\nfunction readTag(tag: string): RawTag | null {\n if (tag.charCodeAt(0) !== LESS_THAN) return null;\n let i = 1;\n const closing = tag.charCodeAt(i) === SLASH;\n if (closing) i += 1;\n // Comments, declarations and processing instructions carry no element name.\n if (tag.charCodeAt(i) === EXCLAMATION || tag.charCodeAt(i) === QUESTION) return null;\n if (!isAsciiLetter(tag.charCodeAt(i))) return null;\n const nameAt = i;\n while (i < tag.length && isTagNameUnit(tag.charCodeAt(i))) i += 1;\n const selfClosing = tag.charCodeAt(tag.length - 2) === SLASH;\n return { name: tag.slice(nameAt, i), closing, selfClosing };\n}\n\n/**\n * modes.md 3.7: raw HTML is \"handed to the html skip list of 3.6\". Inline raw HTML reaches the\n * tokenizer as isolated tags with ordinary markdown content between them, so honouring the\n * subtree rule means tracking which skipped element is currently open. JSX names are compared\n * case-sensitively (`<Code>` is a component, `<code>` is an element); HTML names are not.\n */\nfunction updateElementStack(stack: string[], tag: string, caseSensitive: boolean): void {\n const parsed = readTag(tag);\n if (parsed === null) return;\n const name = caseSensitive ? parsed.name : asciiLower(parsed.name);\n if (parsed.closing) {\n if (stack[stack.length - 1] === name) stack.pop();\n return;\n }\n if (!parsed.selfClosing && isSkippedElement(name)) stack.push(name);\n}\n\nfunction tokenize(source: string, extensions: readonly Extension[]): Event[] {\n return postprocess(\n parse({ extensions: [...extensions] })\n .document()\n .write(preprocess()(source, null, true)),\n );\n}\n\n/**\n * modes.md 3.7.1. The dialect is the caller's, never detected: `\"commonmark\"` is CommonMark 0.31\n * plus GFM, `\"mdx\"` is the same minus indented code blocks and `<…>` autolinks, plus JSX and\n * `{…}` expression containers. Both enable frontmatter and GFM, which 3.7.2 makes normative —\n * §4's promise that table alignment rows survive is empty unless tables are recognised at all.\n */\nexport function resolveDialect(dialect: Dialect | undefined): Dialect {\n if (dialect === \"commonmark\" || dialect === \"mdx\") return dialect;\n if (dialect === undefined) {\n throw new PolytypoError(\n \"POLYTYPO_INVALID_DIALECT\",\n 'Mode \"markdown\" requires a dialect. Expected \"commonmark\" or \"mdx\"; there is no default.',\n );\n }\n throw new PolytypoError(\n \"POLYTYPO_INVALID_DIALECT\",\n `Unknown dialect \"${String(dialect)}\". Expected \"commonmark\" or \"mdx\".`,\n );\n}\n\nfunction extensionsFor(dialect: Dialect): Extension[] {\n return dialect === \"mdx\" ? [frontmatter(), gfm(), mdxjs()] : [frontmatter(), gfm()];\n}\n\nexport function markdownSpans(source: string, dialect: Dialect): Span[] {\n const events = wrapParserErrors(dialect, () => tokenize(source, extensionsFor(dialect)));\n const spans: Span[] = [];\n const elementStack: string[] = [];\n let skipDepth = 0;\n\n for (const [kind, token] of events) {\n const type = token.type;\n\n if (SKIPPED_TOKEN_TYPES.has(type)) {\n skipDepth += kind === \"enter\" ? 1 : -1;\n continue;\n }\n\n if (RAW_TAG_TOKEN_TYPES.has(type)) {\n if (kind === \"enter\") {\n updateElementStack(\n elementStack,\n source.slice(token.start.offset, token.end.offset),\n type !== \"htmlText\",\n );\n }\n skipDepth += kind === \"enter\" ? 1 : -1;\n continue;\n }\n\n // An HTML block is handed to the `html` extractor rather than skipped whole, so that the\n // prose inside `<div>…</div>` is typeset while the markup is not.\n if (type === \"htmlFlow\") {\n if (kind === \"enter\" && skipDepth === 0 && elementStack.length === 0) {\n for (const span of htmlFragmentSpans(\n source.slice(token.start.offset, token.end.offset),\n token.start.offset,\n )) {\n spans.push(span);\n }\n }\n skipDepth += kind === \"enter\" ? 1 : -1;\n continue;\n }\n\n if (kind === \"enter\" && type === \"data\" && skipDepth === 0 && elementStack.length === 0) {\n spans.push({ start: token.start.offset, end: token.end.offset });\n }\n }\n\n return spans;\n}\n","import { markdownSpans, resolveDialect } from \"../modes/markdown.js\";\nimport type { Options } from \"../types.js\";\nimport { getLocaleData } from \"./locale.js\";\nimport { planRules } from \"./rule-runner.js\";\nimport { runOverSpans } from \"./span-runner.js\";\n\n/**\n * `markdown` mode only. Imports the Micromark/MDX stack and `parse5` (via `../modes/markdown.js`\n * importing `../modes/html.js` for normative embedded-HTML handling, modes.md 3.7) — both are\n * legitimately reachable from `polytypo/markdown` (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1).\n *\n * Validation order — `planRules`, then `getLocaleData`, then `resolveDialect`/parsing — mirrors\n * the pre-Stage-5 aggregate `runPipeline` exactly: an unknown-rule error wins over an\n * unknown-locale error, which wins over a missing/invalid dialect, which wins over a parse\n * failure. All four are public, tested behaviour this refactor was not authorised to change.\n */\nexport function runMarkdownPipeline(input: string, options: Partial<Options>): string {\n const planned = planRules(options.rules);\n const locale = getLocaleData(options.locale);\n const dialect = resolveDialect(options.dialect);\n const spans = markdownSpans(input, dialect);\n return runOverSpans(input, spans, planned, locale, \"markdown\");\n}\n"],"mappings":"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","names":[]}
|