Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

fix: fix ERR_REQUIRE_ESM #377

Merged
merged 1 commit into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/helpers/comment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { fromMarkdown } from "mdast-util-from-markdown";
import { gfmFromMarkdown } from "mdast-util-gfm";
import { gfm } from "micromark-extension-gfm";

type MdastNode = {
type: string;
value: string;
Expand All @@ -24,6 +20,10 @@ const traverse = (node: MdastNode, itemsToExclude: string[]): Record<string, str
};

export const parseComments = async (comments: string[], itemsToExclude: string[]): Promise<Record<string, string[]>> => {
const { fromMarkdown } = await import("mdast-util-from-markdown");
const { gfmFromMarkdown } = await import("mdast-util-gfm");
const { gfm } = await import("micromark-extension-gfm");

const result: Record<string, string[]> = {};
for (const comment of comments) {
const tree = fromMarkdown(comment, {
Expand Down