polytypo 1.0.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.
- package/LICENSE +21 -0
- package/README.md +31 -0
- package/dist/chunk-47XAYIKV.js +5635 -0
- package/dist/chunk-47XAYIKV.js.map +1 -0
- package/dist/chunk-7IZAODBB.cjs +17 -0
- package/dist/chunk-7IZAODBB.cjs.map +1 -0
- package/dist/chunk-7L4ECXDJ.js +19 -0
- package/dist/chunk-7L4ECXDJ.js.map +1 -0
- package/dist/chunk-DZ72ITYV.cjs +19 -0
- package/dist/chunk-DZ72ITYV.cjs.map +1 -0
- package/dist/chunk-E63PQ3N7.js +297 -0
- package/dist/chunk-E63PQ3N7.js.map +1 -0
- package/dist/chunk-F3BDCZSG.cjs +21 -0
- package/dist/chunk-F3BDCZSG.cjs.map +1 -0
- package/dist/chunk-HZPDGNOO.js +163 -0
- package/dist/chunk-HZPDGNOO.js.map +1 -0
- package/dist/chunk-M2UGLSIB.cjs +163 -0
- package/dist/chunk-M2UGLSIB.cjs.map +1 -0
- package/dist/chunk-MMU4UU46.js +17 -0
- package/dist/chunk-MMU4UU46.js.map +1 -0
- package/dist/chunk-MOVY7OL2.cjs +5635 -0
- package/dist/chunk-MOVY7OL2.cjs.map +1 -0
- package/dist/chunk-UKWVAQMR.js +21 -0
- package/dist/chunk-UKWVAQMR.js.map +1 -0
- package/dist/chunk-YS3FXB5V.cjs +297 -0
- package/dist/chunk-YS3FXB5V.cjs.map +1 -0
- package/dist/errors-joZChNws.d.cts +120 -0
- package/dist/errors-joZChNws.d.ts +120 -0
- package/dist/html.cjs +22 -0
- package/dist/html.cjs.map +1 -0
- package/dist/html.d.cts +16 -0
- package/dist/html.d.ts +16 -0
- package/dist/html.js +22 -0
- package/dist/html.js.map +1 -0
- package/dist/index.cjs +40 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown.cjs +22 -0
- package/dist/markdown.cjs.map +1 -0
- package/dist/markdown.d.cts +19 -0
- package/dist/markdown.d.ts +19 -0
- package/dist/markdown.js +22 -0
- package/dist/markdown.js.map +1 -0
- package/dist/text.cjs +21 -0
- package/dist/text.cjs.map +1 -0
- package/dist/text.d.cts +17 -0
- package/dist/text.d.ts +17 -0
- package/dist/text.js +21 -0
- package/dist/text.js.map +1 -0
- package/package.json +134 -0
package/dist/html.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { O as Options } from './errors-joZChNws.js';
|
|
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-joZChNws.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `polytypo/html` — HTML-only entry point. Its module graph includes `parse5` but excludes the
|
|
6
|
+
* Micromark/MDX stack (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1): it imports
|
|
7
|
+
* `./engine/html-pipeline.js` directly and never `./engine/pipeline.js` or `./modes/markdown.js`.
|
|
8
|
+
*
|
|
9
|
+
* `mode` is absent from `HtmlOptions`, since this entry only ever runs `html` mode. `dialect` is
|
|
10
|
+
* likewise absent — it has no effect in `html` mode even in the aggregate entry (types.ts), so
|
|
11
|
+
* there is nothing for it to conflict with here.
|
|
12
|
+
*/
|
|
13
|
+
type HtmlOptions = Omit<Options, "mode" | "dialect">;
|
|
14
|
+
declare function transform(input: string, options: HtmlOptions): string;
|
|
15
|
+
|
|
16
|
+
export { type HtmlOptions, transform };
|
package/dist/html.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runHtmlPipeline
|
|
3
|
+
} from "./chunk-UKWVAQMR.js";
|
|
4
|
+
import "./chunk-E63PQ3N7.js";
|
|
5
|
+
import {
|
|
6
|
+
assertFixedMode
|
|
7
|
+
} from "./chunk-MMU4UU46.js";
|
|
8
|
+
import {
|
|
9
|
+
PolytypoError
|
|
10
|
+
} from "./chunk-47XAYIKV.js";
|
|
11
|
+
|
|
12
|
+
// src/index.html.ts
|
|
13
|
+
function transform(input, options) {
|
|
14
|
+
const given = options ?? {};
|
|
15
|
+
assertFixedMode(given.mode, "html", "polytypo/html");
|
|
16
|
+
return runHtmlPipeline(input, given);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
PolytypoError,
|
|
20
|
+
transform
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=html.js.map
|
package/dist/html.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.html.ts"],"sourcesContent":["import { assertFixedMode } from \"./engine/assert-fixed-mode.js\";\nimport { runHtmlPipeline } from \"./engine/html-pipeline.js\";\nimport type { Options } from \"./types.js\";\n\n/**\n * `polytypo/html` — HTML-only entry point. Its module graph includes `parse5` but excludes the\n * Micromark/MDX stack (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1): it imports\n * `./engine/html-pipeline.js` directly and never `./engine/pipeline.js` or `./modes/markdown.js`.\n *\n * `mode` is absent from `HtmlOptions`, since this entry only ever runs `html` mode. `dialect` is\n * likewise absent — it has no effect in `html` mode even in the aggregate entry (types.ts), so\n * there is nothing for it to conflict with here.\n */\nexport type HtmlOptions = Omit<Options, \"mode\" | \"dialect\">;\n\nexport function transform(input: string, options: HtmlOptions): string {\n const given = (options ?? {}) as Partial<Options>;\n assertFixedMode(given.mode, \"html\", \"polytypo/html\");\n return runHtmlPipeline(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":";;;;;;;;;;;;AAeO,SAAS,UAAU,OAAe,SAA8B;AACrE,QAAM,QAAS,WAAW,CAAC;AAC3B,kBAAgB,MAAM,MAAM,QAAQ,eAAe;AACnD,SAAO,gBAAgB,OAAO,KAAK;AACrC;","names":[]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkDZ72ITYVcjs = require('./chunk-DZ72ITYV.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkF3BDCZSGcjs = require('./chunk-F3BDCZSG.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkM2UGLSIBcjs = require('./chunk-M2UGLSIB.cjs');
|
|
10
|
+
require('./chunk-YS3FXB5V.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkMOVY7OL2cjs = require('./chunk-MOVY7OL2.cjs');
|
|
14
|
+
|
|
15
|
+
// src/engine/pipeline.ts
|
|
16
|
+
function resolveMode(mode) {
|
|
17
|
+
if (mode === void 0 || mode === "text") return "text";
|
|
18
|
+
if (mode === "html" || mode === "markdown") return mode;
|
|
19
|
+
throw new (0, _chunkMOVY7OL2cjs.PolytypoError)(
|
|
20
|
+
"POLYTYPO_INVALID_MODE",
|
|
21
|
+
`Unknown mode "${String(mode)}". Expected "text", "html" or "markdown".`
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
function runPipeline(input, options) {
|
|
25
|
+
const given = _nullishCoalesce(options, () => ( {}));
|
|
26
|
+
const mode = resolveMode(given.mode);
|
|
27
|
+
if (mode === "text") return _chunkDZ72ITYVcjs.runTextPipeline.call(void 0, input, given);
|
|
28
|
+
if (mode === "html") return _chunkF3BDCZSGcjs.runHtmlPipeline.call(void 0, input, given);
|
|
29
|
+
return _chunkM2UGLSIBcjs.runMarkdownPipeline.call(void 0, input, given);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/index.ts
|
|
33
|
+
function transform(input, options) {
|
|
34
|
+
return runPipeline(input, options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
exports.PolytypoError = _chunkMOVY7OL2cjs.PolytypoError; exports.transform = transform;
|
|
40
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/index.cjs","../src/engine/pipeline.ts","../src/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACNA,SAAS,WAAA,CAAY,IAAA,EAA8B;AACjD,EAAA,GAAA,CAAI,KAAA,IAAS,KAAA,EAAA,GAAa,KAAA,IAAS,MAAA,EAAQ,OAAO,MAAA;AAClD,EAAA,GAAA,CAAI,KAAA,IAAS,OAAA,GAAU,KAAA,IAAS,UAAA,EAAY,OAAO,IAAA;AACnD,EAAA,MAAM,IAAI,oCAAA;AAAA,IACR,uBAAA;AAAA,IACA,CAAA,cAAA,EAAiB,MAAA,CAAO,IAAI,CAAC,CAAA,yCAAA;AAAA,EAC/B,CAAA;AACF;AASO,SAAS,WAAA,CAAY,KAAA,EAAe,OAAA,EAA0B;AAInE,EAAA,MAAM,MAAA,mBAA0B,OAAA,UAAW,CAAC,GAAA;AAC5C,EAAA,MAAM,KAAA,EAAO,WAAA,CAAY,KAAA,CAAM,IAAI,CAAA;AACnC,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ,OAAO,+CAAA,KAAgB,EAAO,KAAK,CAAA;AACxD,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ,OAAO,+CAAA,KAAgB,EAAO,KAAK,CAAA;AACxD,EAAA,OAAO,mDAAA,KAAoB,EAAO,KAAK,CAAA;AACzC;ADHA;AACA;AE5BO,SAAS,SAAA,CAAU,KAAA,EAAe,OAAA,EAA0B;AACjE,EAAA,OAAO,WAAA,CAAY,KAAA,EAAO,OAAO,CAAA;AACnC;AF8BA;AACE;AACA;AACF,uFAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/index.cjs","sourcesContent":[null,"import { PolytypoError } from \"../errors.js\";\nimport type { Mode, Options } from \"../types.js\";\nimport { runHtmlPipeline } from \"./html-pipeline.js\";\nimport { runMarkdownPipeline } from \"./markdown-pipeline.js\";\nimport { runTextPipeline } from \"./text-pipeline.js\";\n\nexport { planRules } from \"./rule-runner.js\";\n\nfunction resolveMode(mode: Mode | undefined): Mode {\n if (mode === undefined || mode === \"text\") return \"text\";\n if (mode === \"html\" || mode === \"markdown\") return mode;\n throw new PolytypoError(\n \"POLYTYPO_INVALID_MODE\",\n `Unknown mode \"${String(mode)}\". Expected \"text\", \"html\" or \"markdown\".`,\n );\n}\n\n/**\n * The aggregate entry's dispatcher: every mode is reachable, so it is the only pipeline module\n * that imports all three mode-specific ones (and therefore the only one whose module graph\n * includes both `parse5` and the Micromark/MDX stack). `polytypo/text`, `polytypo/html` and\n * `polytypo/markdown` each call their own mode-specific pipeline directly and never import this\n * module (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1).\n */\nexport function runPipeline(input: string, options: Options): string {\n // A plain-JS caller can omit the options object entirely. Reading through a null here would\n // raise a native TypeError, which is outside the error taxonomy; an absent `locale` is an\n // unknown locale and must say so with a code (locale-resolution.md 3.1).\n const given: Partial<Options> = options ?? {};\n const mode = resolveMode(given.mode);\n if (mode === \"text\") return runTextPipeline(input, given);\n if (mode === \"html\") return runHtmlPipeline(input, given);\n return runMarkdownPipeline(input, given);\n}\n","import { runPipeline } from \"./engine/pipeline.js\";\nimport type { Options } from \"./types.js\";\n\nexport function transform(input: string, options: Options): string {\n return runPipeline(input, options);\n}\n\nexport { PolytypoError } from \"./errors.js\";\nexport type { PolytypoErrorCode } from \"./errors.js\";\nexport type {\n Dialect,\n Edit,\n LocaleData,\n LocaleSource,\n Mode,\n Options,\n QuotePair,\n Rule,\n RuleContext,\n RuleId,\n} from \"./types.js\";\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { O as Options } from './errors-joZChNws.cjs';
|
|
2
|
+
export { D as Dialect, E as Edit, L as LocaleData, a as LocaleSource, M as Mode, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-joZChNws.cjs';
|
|
3
|
+
|
|
4
|
+
declare function transform(input: string, options: Options): string;
|
|
5
|
+
|
|
6
|
+
export { Options, transform };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { O as Options } from './errors-joZChNws.js';
|
|
2
|
+
export { D as Dialect, E as Edit, L as LocaleData, a as LocaleSource, M as Mode, P as PolytypoError, b as PolytypoErrorCode, Q as QuotePair, R as Rule, c as RuleContext, d as RuleId } from './errors-joZChNws.js';
|
|
3
|
+
|
|
4
|
+
declare function transform(input: string, options: Options): string;
|
|
5
|
+
|
|
6
|
+
export { Options, transform };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runTextPipeline
|
|
3
|
+
} from "./chunk-7L4ECXDJ.js";
|
|
4
|
+
import {
|
|
5
|
+
runHtmlPipeline
|
|
6
|
+
} from "./chunk-UKWVAQMR.js";
|
|
7
|
+
import {
|
|
8
|
+
runMarkdownPipeline
|
|
9
|
+
} from "./chunk-HZPDGNOO.js";
|
|
10
|
+
import "./chunk-E63PQ3N7.js";
|
|
11
|
+
import {
|
|
12
|
+
PolytypoError
|
|
13
|
+
} from "./chunk-47XAYIKV.js";
|
|
14
|
+
|
|
15
|
+
// src/engine/pipeline.ts
|
|
16
|
+
function resolveMode(mode) {
|
|
17
|
+
if (mode === void 0 || mode === "text") return "text";
|
|
18
|
+
if (mode === "html" || mode === "markdown") return mode;
|
|
19
|
+
throw new PolytypoError(
|
|
20
|
+
"POLYTYPO_INVALID_MODE",
|
|
21
|
+
`Unknown mode "${String(mode)}". Expected "text", "html" or "markdown".`
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
function runPipeline(input, options) {
|
|
25
|
+
const given = options ?? {};
|
|
26
|
+
const mode = resolveMode(given.mode);
|
|
27
|
+
if (mode === "text") return runTextPipeline(input, given);
|
|
28
|
+
if (mode === "html") return runHtmlPipeline(input, given);
|
|
29
|
+
return runMarkdownPipeline(input, given);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/index.ts
|
|
33
|
+
function transform(input, options) {
|
|
34
|
+
return runPipeline(input, options);
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
PolytypoError,
|
|
38
|
+
transform
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/engine/pipeline.ts","../src/index.ts"],"sourcesContent":["import { PolytypoError } from \"../errors.js\";\nimport type { Mode, Options } from \"../types.js\";\nimport { runHtmlPipeline } from \"./html-pipeline.js\";\nimport { runMarkdownPipeline } from \"./markdown-pipeline.js\";\nimport { runTextPipeline } from \"./text-pipeline.js\";\n\nexport { planRules } from \"./rule-runner.js\";\n\nfunction resolveMode(mode: Mode | undefined): Mode {\n if (mode === undefined || mode === \"text\") return \"text\";\n if (mode === \"html\" || mode === \"markdown\") return mode;\n throw new PolytypoError(\n \"POLYTYPO_INVALID_MODE\",\n `Unknown mode \"${String(mode)}\". Expected \"text\", \"html\" or \"markdown\".`,\n );\n}\n\n/**\n * The aggregate entry's dispatcher: every mode is reachable, so it is the only pipeline module\n * that imports all three mode-specific ones (and therefore the only one whose module graph\n * includes both `parse5` and the Micromark/MDX stack). `polytypo/text`, `polytypo/html` and\n * `polytypo/markdown` each call their own mode-specific pipeline directly and never import this\n * module (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1).\n */\nexport function runPipeline(input: string, options: Options): string {\n // A plain-JS caller can omit the options object entirely. Reading through a null here would\n // raise a native TypeError, which is outside the error taxonomy; an absent `locale` is an\n // unknown locale and must say so with a code (locale-resolution.md 3.1).\n const given: Partial<Options> = options ?? {};\n const mode = resolveMode(given.mode);\n if (mode === \"text\") return runTextPipeline(input, given);\n if (mode === \"html\") return runHtmlPipeline(input, given);\n return runMarkdownPipeline(input, given);\n}\n","import { runPipeline } from \"./engine/pipeline.js\";\nimport type { Options } from \"./types.js\";\n\nexport function transform(input: string, options: Options): string {\n return runPipeline(input, options);\n}\n\nexport { PolytypoError } from \"./errors.js\";\nexport type { PolytypoErrorCode } from \"./errors.js\";\nexport type {\n Dialect,\n Edit,\n LocaleData,\n LocaleSource,\n Mode,\n Options,\n QuotePair,\n Rule,\n RuleContext,\n RuleId,\n} from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;;;AAQA,SAAS,YAAY,MAA8B;AACjD,MAAI,SAAS,UAAa,SAAS,OAAQ,QAAO;AAClD,MAAI,SAAS,UAAU,SAAS,WAAY,QAAO;AACnD,QAAM,IAAI;AAAA,IACR;AAAA,IACA,iBAAiB,OAAO,IAAI,CAAC;AAAA,EAC/B;AACF;AASO,SAAS,YAAY,OAAe,SAA0B;AAInE,QAAM,QAA0B,WAAW,CAAC;AAC5C,QAAM,OAAO,YAAY,MAAM,IAAI;AACnC,MAAI,SAAS,OAAQ,QAAO,gBAAgB,OAAO,KAAK;AACxD,MAAI,SAAS,OAAQ,QAAO,gBAAgB,OAAO,KAAK;AACxD,SAAO,oBAAoB,OAAO,KAAK;AACzC;;;AC9BO,SAAS,UAAU,OAAe,SAA0B;AACjE,SAAO,YAAY,OAAO,OAAO;AACnC;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkM2UGLSIBcjs = require('./chunk-M2UGLSIB.cjs');
|
|
4
|
+
require('./chunk-YS3FXB5V.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunk7IZAODBBcjs = require('./chunk-7IZAODBB.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkMOVY7OL2cjs = require('./chunk-MOVY7OL2.cjs');
|
|
11
|
+
|
|
12
|
+
// src/index.markdown.ts
|
|
13
|
+
function transform(input, options) {
|
|
14
|
+
const given = _nullishCoalesce(options, () => ( {}));
|
|
15
|
+
_chunk7IZAODBBcjs.assertFixedMode.call(void 0, given.mode, "markdown", "polytypo/markdown");
|
|
16
|
+
return _chunkM2UGLSIBcjs.runMarkdownPipeline.call(void 0, input, given);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.PolytypoError = _chunkMOVY7OL2cjs.PolytypoError; exports.transform = transform;
|
|
22
|
+
//# sourceMappingURL=markdown.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/markdown.cjs","../src/index.markdown.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACOO,SAAS,SAAA,CAAU,KAAA,EAAe,OAAA,EAAkC;AACzE,EAAA,MAAM,MAAA,mBAAS,OAAA,UAAW,CAAC,GAAA;AAC3B,EAAA,+CAAA,KAAgB,CAAM,IAAA,EAAM,UAAA,EAAY,mBAAmB,CAAA;AAC3D,EAAA,OAAO,mDAAA,KAAoB,EAAO,KAAK,CAAA;AACzC;ADLA;AACE;AACA;AACF,uFAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/markdown.cjs","sourcesContent":[null,"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"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { O as Options, D as Dialect } from './errors-joZChNws.cjs';
|
|
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-joZChNws.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `polytypo/markdown` — Markdown-only entry point. Its module graph includes the Micromark/MDX
|
|
6
|
+
* stack and `parse5` (the latter via `./modes/markdown.js` importing `./modes/html.js` for
|
|
7
|
+
* normative embedded-HTML handling, modes.md 3.7) — both are legitimately reachable here
|
|
8
|
+
* (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1). It imports `./engine/markdown-pipeline.js`
|
|
9
|
+
* directly and never `./engine/pipeline.js`.
|
|
10
|
+
*
|
|
11
|
+
* `mode` is absent from `MarkdownOptions`, since this entry only ever runs `markdown` mode.
|
|
12
|
+
* `dialect` keeps the aggregate entry's contract: required, no default (types.ts).
|
|
13
|
+
*/
|
|
14
|
+
type MarkdownOptions = Omit<Options, "mode"> & {
|
|
15
|
+
dialect: Dialect;
|
|
16
|
+
};
|
|
17
|
+
declare function transform(input: string, options: MarkdownOptions): string;
|
|
18
|
+
|
|
19
|
+
export { Dialect, type MarkdownOptions, transform };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { O as Options, D as Dialect } from './errors-joZChNws.js';
|
|
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-joZChNws.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `polytypo/markdown` — Markdown-only entry point. Its module graph includes the Micromark/MDX
|
|
6
|
+
* stack and `parse5` (the latter via `./modes/markdown.js` importing `./modes/html.js` for
|
|
7
|
+
* normative embedded-HTML handling, modes.md 3.7) — both are legitimately reachable here
|
|
8
|
+
* (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1). It imports `./engine/markdown-pipeline.js`
|
|
9
|
+
* directly and never `./engine/pipeline.js`.
|
|
10
|
+
*
|
|
11
|
+
* `mode` is absent from `MarkdownOptions`, since this entry only ever runs `markdown` mode.
|
|
12
|
+
* `dialect` keeps the aggregate entry's contract: required, no default (types.ts).
|
|
13
|
+
*/
|
|
14
|
+
type MarkdownOptions = Omit<Options, "mode"> & {
|
|
15
|
+
dialect: Dialect;
|
|
16
|
+
};
|
|
17
|
+
declare function transform(input: string, options: MarkdownOptions): string;
|
|
18
|
+
|
|
19
|
+
export { Dialect, type MarkdownOptions, transform };
|
package/dist/markdown.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runMarkdownPipeline
|
|
3
|
+
} from "./chunk-HZPDGNOO.js";
|
|
4
|
+
import "./chunk-E63PQ3N7.js";
|
|
5
|
+
import {
|
|
6
|
+
assertFixedMode
|
|
7
|
+
} from "./chunk-MMU4UU46.js";
|
|
8
|
+
import {
|
|
9
|
+
PolytypoError
|
|
10
|
+
} from "./chunk-47XAYIKV.js";
|
|
11
|
+
|
|
12
|
+
// src/index.markdown.ts
|
|
13
|
+
function transform(input, options) {
|
|
14
|
+
const given = options ?? {};
|
|
15
|
+
assertFixedMode(given.mode, "markdown", "polytypo/markdown");
|
|
16
|
+
return runMarkdownPipeline(input, given);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
PolytypoError,
|
|
20
|
+
transform
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +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":";;;;;;;;;;;;AAkBO,SAAS,UAAU,OAAe,SAAkC;AACzE,QAAM,QAAS,WAAW,CAAC;AAC3B,kBAAgB,MAAM,MAAM,YAAY,mBAAmB;AAC3D,SAAO,oBAAoB,OAAO,KAAK;AACzC;","names":[]}
|
package/dist/text.cjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkDZ72ITYVcjs = require('./chunk-DZ72ITYV.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk7IZAODBBcjs = require('./chunk-7IZAODBB.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkMOVY7OL2cjs = require('./chunk-MOVY7OL2.cjs');
|
|
10
|
+
|
|
11
|
+
// src/index.text.ts
|
|
12
|
+
function transform(input, options) {
|
|
13
|
+
const given = _nullishCoalesce(options, () => ( {}));
|
|
14
|
+
_chunk7IZAODBBcjs.assertFixedMode.call(void 0, given.mode, "text", "polytypo/text");
|
|
15
|
+
return _chunkDZ72ITYVcjs.runTextPipeline.call(void 0, input, given);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.PolytypoError = _chunkMOVY7OL2cjs.PolytypoError; exports.transform = transform;
|
|
21
|
+
//# sourceMappingURL=text.cjs.map
|
|
@@ -0,0 +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;ADJA;AACE;AACA;AACF,uFAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/text.cjs","sourcesContent":[null,"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"]}
|
package/dist/text.d.cts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { O as Options } from './errors-joZChNws.cjs';
|
|
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-joZChNws.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `polytypo/text` — text-only entry point. Its module graph excludes `parse5` and the
|
|
6
|
+
* Micromark/MDX stack entirely (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1): it imports
|
|
7
|
+
* `./engine/text-pipeline.js` directly and never `./engine/pipeline.js`, `./modes/html.js` or
|
|
8
|
+
* `./modes/markdown.js`.
|
|
9
|
+
*
|
|
10
|
+
* `mode` is absent from `TextOptions`, since this entry only ever runs `text` mode. `dialect` is
|
|
11
|
+
* likewise absent — it has no effect in `text` mode even in the aggregate entry (types.ts), so
|
|
12
|
+
* there is nothing for it to conflict with here.
|
|
13
|
+
*/
|
|
14
|
+
type TextOptions = Omit<Options, "mode" | "dialect">;
|
|
15
|
+
declare function transform(input: string, options: TextOptions): string;
|
|
16
|
+
|
|
17
|
+
export { type TextOptions, transform };
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { O as Options } from './errors-joZChNws.js';
|
|
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-joZChNws.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `polytypo/text` — text-only entry point. Its module graph excludes `parse5` and the
|
|
6
|
+
* Micromark/MDX stack entirely (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1): it imports
|
|
7
|
+
* `./engine/text-pipeline.js` directly and never `./engine/pipeline.js`, `./modes/html.js` or
|
|
8
|
+
* `./modes/markdown.js`.
|
|
9
|
+
*
|
|
10
|
+
* `mode` is absent from `TextOptions`, since this entry only ever runs `text` mode. `dialect` is
|
|
11
|
+
* likewise absent — it has no effect in `text` mode even in the aggregate entry (types.ts), so
|
|
12
|
+
* there is nothing for it to conflict with here.
|
|
13
|
+
*/
|
|
14
|
+
type TextOptions = Omit<Options, "mode" | "dialect">;
|
|
15
|
+
declare function transform(input: string, options: TextOptions): string;
|
|
16
|
+
|
|
17
|
+
export { type TextOptions, transform };
|
package/dist/text.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runTextPipeline
|
|
3
|
+
} from "./chunk-7L4ECXDJ.js";
|
|
4
|
+
import {
|
|
5
|
+
assertFixedMode
|
|
6
|
+
} from "./chunk-MMU4UU46.js";
|
|
7
|
+
import {
|
|
8
|
+
PolytypoError
|
|
9
|
+
} from "./chunk-47XAYIKV.js";
|
|
10
|
+
|
|
11
|
+
// src/index.text.ts
|
|
12
|
+
function transform(input, options) {
|
|
13
|
+
const given = options ?? {};
|
|
14
|
+
assertFixedMode(given.mode, "text", "polytypo/text");
|
|
15
|
+
return runTextPipeline(input, given);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
PolytypoError,
|
|
19
|
+
transform
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=text.js.map
|
package/dist/text.js.map
ADDED
|
@@ -0,0 +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":";;;;;;;;;;;AAgBO,SAAS,UAAU,OAAe,SAA8B;AACrE,QAAM,QAAS,WAAW,CAAC;AAC3B,kBAAgB,MAAM,MAAM,QAAQ,eAAe;AACnD,SAAO,gBAAgB,OAAO,KAAK;AACrC;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "polytypo",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Multilingual microtypography: locale-correct quotes, dashes, ellipses and no-break spaces.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"typography",
|
|
7
|
+
"microtypography",
|
|
8
|
+
"i18n",
|
|
9
|
+
"l10n",
|
|
10
|
+
"locale",
|
|
11
|
+
"quotes",
|
|
12
|
+
"smart-quotes",
|
|
13
|
+
"dashes",
|
|
14
|
+
"em-dash",
|
|
15
|
+
"ellipsis",
|
|
16
|
+
"apostrophe",
|
|
17
|
+
"punctuation",
|
|
18
|
+
"unicode",
|
|
19
|
+
"markdown",
|
|
20
|
+
"html"
|
|
21
|
+
],
|
|
22
|
+
"homepage": "https://polytypo.dev/",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/polytypo/polytypo-js/issues"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/polytypo/polytypo-js.git"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"author": "Iurii Rogulia",
|
|
32
|
+
"type": "module",
|
|
33
|
+
"private": false,
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"provenance": true
|
|
37
|
+
},
|
|
38
|
+
"main": "./dist/index.cjs",
|
|
39
|
+
"module": "./dist/index.js",
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"default": "./dist/index.js"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/index.d.cts",
|
|
49
|
+
"default": "./dist/index.cjs"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"./text": {
|
|
53
|
+
"import": {
|
|
54
|
+
"types": "./dist/text.d.ts",
|
|
55
|
+
"default": "./dist/text.js"
|
|
56
|
+
},
|
|
57
|
+
"require": {
|
|
58
|
+
"types": "./dist/text.d.cts",
|
|
59
|
+
"default": "./dist/text.cjs"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"./html": {
|
|
63
|
+
"import": {
|
|
64
|
+
"types": "./dist/html.d.ts",
|
|
65
|
+
"default": "./dist/html.js"
|
|
66
|
+
},
|
|
67
|
+
"require": {
|
|
68
|
+
"types": "./dist/html.d.cts",
|
|
69
|
+
"default": "./dist/html.cjs"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"./markdown": {
|
|
73
|
+
"import": {
|
|
74
|
+
"types": "./dist/markdown.d.ts",
|
|
75
|
+
"default": "./dist/markdown.js"
|
|
76
|
+
},
|
|
77
|
+
"require": {
|
|
78
|
+
"types": "./dist/markdown.d.cts",
|
|
79
|
+
"default": "./dist/markdown.cjs"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"./package.json": "./package.json"
|
|
83
|
+
},
|
|
84
|
+
"files": [
|
|
85
|
+
"dist"
|
|
86
|
+
],
|
|
87
|
+
"engines": {
|
|
88
|
+
"node": ">=20"
|
|
89
|
+
},
|
|
90
|
+
"scripts": {
|
|
91
|
+
"gen": "node scripts/gen-locales.mjs",
|
|
92
|
+
"test": "npm run gen && vitest run",
|
|
93
|
+
"build": "npm run gen && tsup",
|
|
94
|
+
"prepare": "npm run build",
|
|
95
|
+
"check:entry-reach": "node scripts/check-entry-reach.mjs",
|
|
96
|
+
"check:declaration-resolution": "npx tsc -p tests/packaging/tsconfig.nodenext.json && node scripts/check-declaration-resolution.mjs",
|
|
97
|
+
"check:bundle-size": "node scripts/check-bundle-size.mjs",
|
|
98
|
+
"check:install-footprint": "node scripts/check-install-footprint.mjs",
|
|
99
|
+
"check:package-contents": "node scripts/check-package-contents.mjs",
|
|
100
|
+
"check:workflow-shell-safety": "node scripts/check-workflow-shell-safety.mjs",
|
|
101
|
+
"check:actions-pinned": "node scripts/check-actions-pinned.mjs",
|
|
102
|
+
"test:packaging": "npm run build && node tests/packaging/run.mjs",
|
|
103
|
+
"test:packed-tarball": "node tests/packaging/packed-tarball.mjs",
|
|
104
|
+
"dogfood:m4": "npx tsx scripts/dogfood-m4.ts",
|
|
105
|
+
"lint": "eslint .",
|
|
106
|
+
"format": "prettier --write ."
|
|
107
|
+
},
|
|
108
|
+
"devDependencies": {
|
|
109
|
+
"@eslint/js": "^10.0.1",
|
|
110
|
+
"@types/node": "^26.2.0",
|
|
111
|
+
"ajv": "^8.20.0",
|
|
112
|
+
"ajv-formats": "^3.0.1",
|
|
113
|
+
"diff": "^9.0.0",
|
|
114
|
+
"esbuild": "^0.27.7",
|
|
115
|
+
"eslint": "^10.8.1",
|
|
116
|
+
"fast-check": "^4.9.0",
|
|
117
|
+
"globals": "^17.11.0",
|
|
118
|
+
"micromark-util-types": "^2.0.2",
|
|
119
|
+
"prettier": "^3.9.6",
|
|
120
|
+
"tsup": "^8.5.1",
|
|
121
|
+
"tsx": "^4.23.12",
|
|
122
|
+
"typescript": "^6.0.3",
|
|
123
|
+
"typescript-eslint": "^8.67.0",
|
|
124
|
+
"vitest": "^4.1.10",
|
|
125
|
+
"yaml": "^2.9.0"
|
|
126
|
+
},
|
|
127
|
+
"dependencies": {
|
|
128
|
+
"micromark": "^4.0.2",
|
|
129
|
+
"micromark-extension-frontmatter": "^2.0.0",
|
|
130
|
+
"micromark-extension-gfm": "^3.0.0",
|
|
131
|
+
"micromark-extension-mdxjs": "^3.0.0",
|
|
132
|
+
"parse5": "^8.0.1"
|
|
133
|
+
}
|
|
134
|
+
}
|