From f952db142f1552e627ca05e1bfe9e0f4c6ff0e11 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 22 Jan 2025 14:33:16 +0100 Subject: [PATCH] Refactor to use `@import`s --- lib/index.js | 30 ++++++++++++++---------------- readme.md | 5 +++-- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/lib/index.js b/lib/index.js index 3a414eb..1b0bcad 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,20 +1,18 @@ /** - * @typedef {import('mdast').Nodes} Nodes - * @typedef {import('mdast').Paragraph} Paragraph - * - * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext - * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension - * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle - * @typedef {import('mdast-util-from-markdown').Token} Token - * - * @typedef {import('mdast-util-to-markdown').ConstructName} ConstructName - * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle - * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension - * @typedef {import('mdast-util-to-markdown').State} State - * - * @typedef {import('../index.js').Directives} Directives - * @typedef {import('../index.js').LeafDirective} LeafDirective - * @typedef {import('../index.js').TextDirective} TextDirective + * @import {Directives, LeafDirective, TextDirective} from 'mdast-util-directive' + * @import { + * CompileContext, + * Extension as FromMarkdownExtension, + * Handle as FromMarkdownHandle, + * Token + * } from 'mdast-util-from-markdown' + * @import { + * ConstructName, + * Handle as ToMarkdownHandle, + * Options as ToMarkdownExtension, + * State + * } from 'mdast-util-to-markdown' + * @import {Nodes, Paragraph} from 'mdast' */ import {ok as assert} from 'devlop' diff --git a/readme.md b/readme.md index 59cdd99..3c116da 100644 --- a/readme.md +++ b/readme.md @@ -429,12 +429,13 @@ somewhere in your types, as that registers the new node types in the tree. ```js /** - * @typedef {import('mdast-util-directive')} + * @import {} from 'mdast-util-directive' + * @import {Root} from 'mdast' */ import {visit} from 'unist-util-visit' -/** @type {import('mdast').Root} */ +/** @type {Root} */ const tree = getMdastNodeSomeHow() visit(tree, function (node) {