From 3599f694bab3d14ae56fd0f1f49e5afd4a2a05b0 Mon Sep 17 00:00:00 2001 From: David Anson Date: Sat, 30 Nov 2024 20:42:14 -0800 Subject: [PATCH] Move micromark-parse.mjs from helpers to library, remove all dependencies from helpers. --- helpers/package.json | 8 -------- lib/markdownlint.mjs | 2 +- lib/md044.mjs | 2 +- {helpers => lib}/micromark-parse.mjs | 4 ++-- {helpers => lib}/micromark-types.d.mts | 0 test/harness.mjs | 2 +- test/markdownlint-test-micromark.mjs | 2 +- 7 files changed, 6 insertions(+), 14 deletions(-) rename {helpers => lib}/micromark-parse.mjs (98%) rename {helpers => lib}/micromark-types.d.mts (100%) diff --git a/helpers/package.json b/helpers/package.json index e047d252..60c19c81 100644 --- a/helpers/package.json +++ b/helpers/package.json @@ -19,14 +19,6 @@ "engines": { "node": ">=18" }, - "dependencies": { - "micromark": "4.0.0", - "micromark-extension-directive": "3.0.2", - "micromark-extension-gfm-autolink-literal": "2.1.0", - "micromark-extension-gfm-footnote": "2.1.0", - "micromark-extension-gfm-table": "2.1.0", - "micromark-extension-math": "3.1.0" - }, "keywords": [ "markdownlint", "markdownlint-rule" diff --git a/lib/markdownlint.mjs b/lib/markdownlint.mjs index 9e2d505b..a98846b0 100644 --- a/lib/markdownlint.mjs +++ b/lib/markdownlint.mjs @@ -9,7 +9,7 @@ import { promisify } from "node:util"; import { initialize as cacheInitialize } from "./cache.mjs"; import { version } from "./constants.mjs"; import rules from "./rules.mjs"; -import { parse as micromarkParse } from "../helpers/micromark-parse.mjs"; +import { parse as micromarkParse } from "./micromark-parse.mjs"; import * as helpers from "../helpers/helpers.cjs"; /** diff --git a/lib/md044.mjs b/lib/md044.mjs index 19001a24..de8b6432 100644 --- a/lib/md044.mjs +++ b/lib/md044.mjs @@ -2,7 +2,7 @@ import { addErrorDetailIf, escapeForRegExp, hasOverlap } from "../helpers/helpers.cjs"; import { filterByPredicate, filterByTypes } from "../helpers/micromark-helpers.cjs"; -import { parse } from "../helpers/micromark-parse.mjs"; +import { parse } from "./micromark-parse.mjs"; const ignoredChildTypes = new Set( [ "codeFencedFence", "definition", "reference", "resource" ] diff --git a/helpers/micromark-parse.mjs b/lib/micromark-parse.mjs similarity index 98% rename from helpers/micromark-parse.mjs rename to lib/micromark-parse.mjs index 27eedfb4..afa49640 100644 --- a/helpers/micromark-parse.mjs +++ b/lib/micromark-parse.mjs @@ -9,8 +9,8 @@ import { parse as micromarkParse, postprocess as micromarkPostprocess, preproces // micromark-core-commonmark is not a dependency because this instance must match what's used by micromark // eslint-disable-next-line n/no-extraneous-import import { labelEnd } from "micromark-core-commonmark"; -import { isHtmlFlowComment } from "./micromark-helpers.cjs"; -import { flatTokensSymbol, htmlFlowSymbol, newLineRe } from "./shared.cjs"; +import { isHtmlFlowComment } from "../helpers/micromark-helpers.cjs"; +import { flatTokensSymbol, htmlFlowSymbol, newLineRe } from "../helpers/shared.cjs"; /** @typedef {import("micromark-util-types").Event} Event */ /** @typedef {import("micromark-util-types").ParseOptions} MicromarkParseOptions */ diff --git a/helpers/micromark-types.d.mts b/lib/micromark-types.d.mts similarity index 100% rename from helpers/micromark-types.d.mts rename to lib/micromark-types.d.mts diff --git a/test/harness.mjs b/test/harness.mjs index 65fe54d4..e9eebe42 100644 --- a/test/harness.mjs +++ b/test/harness.mjs @@ -1,5 +1,5 @@ import { readFile } from "node:fs/promises"; -import { parse } from "../helpers/micromark-parse.mjs"; +import { parse } from "../lib/micromark-parse.mjs"; import library from "../lib/markdownlint.mjs"; const markdownlint = library.promises.markdownlint; diff --git a/test/markdownlint-test-micromark.mjs b/test/markdownlint-test-micromark.mjs index fa44360c..7810128f 100644 --- a/test/markdownlint-test-micromark.mjs +++ b/test/markdownlint-test-micromark.mjs @@ -4,7 +4,7 @@ import fs from "node:fs/promises"; import test from "ava"; import { newLineRe } from "../helpers/helpers.cjs"; import { filterByPredicate, filterByTypes } from "../helpers/micromark-helpers.cjs"; -import { getEvents, parse } from "../helpers/micromark-parse.mjs"; +import { getEvents, parse } from "../lib/micromark-parse.mjs"; const testContent = new Promise((resolve, reject) => { fs