From 79d640b2686b4ecc9b3f4f43305d49d0d4617eaf Mon Sep 17 00:00:00 2001 From: Evan Jacobs Date: Sat, 30 Dec 2023 15:34:00 -0500 Subject: [PATCH] refactor: compile away priority mapping --- index.tsx | 46 +++++++++++++++++++++++----------------------- tsconfig.json | 4 ++-- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/index.tsx b/index.tsx index 736d7bc4..8bed8b11 100644 --- a/index.tsx +++ b/index.tsx @@ -54,6 +54,29 @@ export const RuleType = { unorderedList: 33, } as const +const enum Priority { + /** + * anything that must scan the tree before everything else + */ + MAX, + /** + * scans for block-level constructs + */ + HIGH, + /** + * inline w/ more priority than other inline + */ + MED, + /** + * inline elements + */ + LOW, + /** + * bare text and stuff that is considered leftovers + */ + MIN, +} + export namespace MarkdownToJSX { /** * RequireAtLeastOne<{ ... }> <- only requires at least one key @@ -1220,29 +1243,6 @@ function getTag(tag: string, overrides: MarkdownToJSX.Overrides) { : get(overrides, `${tag}.component`, tag) } -enum Priority { - /** - * anything that must scan the tree before everything else - */ - MAX, - /** - * scans for block-level constructs - */ - HIGH, - /** - * inline w/ more priority than other inline - */ - MED, - /** - * inline elements - */ - LOW, - /** - * bare text and stuff that is considered leftovers - */ - MIN, -} - export function compiler( markdown: string, options: MarkdownToJSX.Options = {} diff --git a/tsconfig.json b/tsconfig.json index c4bbb32f..92941a34 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,8 +8,8 @@ "module": "ESNext", "moduleResolution": "node", "outDir": "./dist", - "target": "ESNext", - "preserveConstEnums": true + "preserveConstEnums": true, + "target": "ESNext" }, "files": ["index.tsx"] }