Skip to content

Commit 27270d3

Browse files
committed
Refactor to use @imports
1 parent 4d9581a commit 27270d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+87
-147
lines changed

lib/configure.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('./types.js').Options} Options
3-
* @typedef {import('./types.js').State} State
2+
* @import {Options, State} from './types.js'
43
*/
54

65
const own = {}.hasOwnProperty

lib/handle/blockquote.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Blockquote} Blockquote
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').Map} Map
6-
* @typedef {import('../types.js').State} State
2+
* @import {Blockquote, Parents} from 'mdast'
3+
* @import {Info, Map, State} from 'mdast-util-to-markdown'
74
*/
85

96
/**

lib/handle/break.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Break} Break
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Break, Parents} from 'mdast'
3+
* @import {Info, State} from 'mdast-util-to-markdown'
64
*/
75

86
import {patternInScope} from '../util/pattern-in-scope.js'

lib/handle/code.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Code} Code
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').Map} Map
6-
* @typedef {import('../types.js').State} State
2+
* @import {Info, Map, State} from 'mdast-util-to-markdown'
3+
* @import {Code, Parents} from 'mdast'
74
*/
85

96
import {longestStreak} from 'longest-streak'

lib/handle/definition.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Definition} Definition
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {Definition, Parents} from 'mdast'
64
*/
75

86
import {checkQuote} from '../util/check-quote.js'

lib/handle/emphasis.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Emphasis} Emphasis
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {Emphasis, Parents} from 'mdast'
64
*/
75

86
import {checkEmphasis} from '../util/check-emphasis.js'

lib/handle/heading.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Heading} Heading
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {Heading, Parents} from 'mdast'
64
*/
75

86
import {formatHeadingAsSetext} from '../util/format-heading-as-setext.js'

lib/handle/html.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('mdast').Html} Html
2+
* @import {Html} from 'mdast'
33
*/
44

55
html.peek = htmlPeek

lib/handle/image-reference.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').ImageReference} ImageReference
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {ImageReference, Parents} from 'mdast'
64
*/
75

86
imageReference.peek = imageReferencePeek

lib/handle/image.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Image} Image
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {Image, Parents} from 'mdast'
64
*/
75

86
import {checkQuote} from '../util/check-quote.js'

lib/handle/inline-code.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
2-
* @typedef {import('mdast').InlineCode} InlineCode
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').State} State
2+
* @import {State} from 'mdast-util-to-markdown'
3+
* @import {InlineCode, Parents} from 'mdast'
54
*/
65

76
inlineCode.peek = inlineCodePeek

lib/handle/link-reference.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').LinkReference} LinkReference
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {LinkReference, Parents} from 'mdast'
64
*/
75

86
linkReference.peek = linkReferencePeek

lib/handle/link.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('mdast').Link} Link
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Exit} Exit
5-
* @typedef {import('../types.js').Info} Info
6-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {Link, Parents} from 'mdast'
4+
* @import {Exit} from '../types.js'
75
*/
86

97
import {checkQuote} from '../util/check-quote.js'

lib/handle/list-item.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
/**
2-
* @typedef {import('mdast').ListItem} ListItem
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').Map} Map
6-
* @typedef {import('../types.js').State} State
2+
* @import {Info, Map, State} from 'mdast-util-to-markdown'
3+
* @import {ListItem, Parents} from 'mdast'
74
*/
85

96
import {checkBullet} from '../util/check-bullet.js'

lib/handle/list.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').List} List
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {List, Parents} from 'mdast'
64
*/
75

86
import {checkBullet} from '../util/check-bullet.js'

lib/handle/paragraph.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Paragraph} Paragraph
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {Paragraph, Parents} from 'mdast'
64
*/
75

86
/**

lib/handle/root.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Parents} Parents
3-
* @typedef {import('mdast').Root} Root
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {Parents, Root} from 'mdast'
64
*/
75

86
import {phrasing} from 'mdast-util-phrasing'

lib/handle/strong.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Parents} Parents
3-
* @typedef {import('mdast').Strong} Strong
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {Parents, Strong} from 'mdast'
64
*/
75

86
import {checkStrong} from '../util/check-strong.js'

lib/handle/text.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Parents} Parents
3-
* @typedef {import('mdast').Text} Text
4-
* @typedef {import('../types.js').Info} Info
5-
* @typedef {import('../types.js').State} State
2+
* @import {Info, State} from 'mdast-util-to-markdown'
3+
* @import {Parents, Text} from 'mdast'
64
*/
75

86
/**

lib/handle/thematic-break.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Parents} Parents
3-
* @typedef {import('mdast').ThematicBreak} ThematicBreak
4-
* @typedef {import('../types.js').State} State
2+
* @import {State} from 'mdast-util-to-markdown'
3+
* @import {Parents, ThematicBreak} from 'mdast'
54
*/
65

76
import {checkRuleRepetition} from '../util/check-rule-repetition.js'

lib/index.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
/**
2-
* @typedef {import('mdast').Nodes} Nodes
3-
* @typedef {import('./types.js').Enter} Enter
4-
* @typedef {import('./types.js').Info} Info
5-
* @typedef {import('./types.js').Join} Join
6-
* @typedef {import('./types.js').FlowParents} FlowParents
7-
* @typedef {import('./types.js').Options} Options
8-
* @typedef {import('./types.js').PhrasingParents} PhrasingParents
9-
* @typedef {import('./types.js').SafeConfig} SafeConfig
10-
* @typedef {import('./types.js').State} State
11-
* @typedef {import('./types.js').TrackFields} TrackFields
2+
* @import {Info, Join, Options, SafeConfig, State} from 'mdast-util-to-markdown'
3+
* @import {Nodes} from 'mdast'
4+
* @import {Enter, FlowParents, PhrasingParents, TrackFields} from './types.js'
125
*/
136

147
import {zwitch} from 'zwitch'

lib/join.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('./types.js').Join} Join
2+
* @import {Join} from 'mdast-util-to-markdown'
33
*/
44

55
import {formatCodeAsIndented} from './util/format-code-as-indented.js'

lib/types.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/**
2-
* @typedef {import('unist').Point} Point
3-
* @typedef {import('mdast').Association} Association
4-
* @typedef {import('mdast').Nodes} Nodes
5-
* @typedef {import('mdast').Parents} Parents
6-
* @typedef {import('mdast').PhrasingContent} PhrasingContent
7-
* @typedef {import('mdast').TableCell} TableCell
8-
* @typedef {import('mdast').TableRow} TableRow
9-
* @typedef {import('../index.js').ConstructName} ConstructName
2+
* @import {ConstructName} from 'mdast-util-to-markdown'
3+
* @import {
4+
* Association,
5+
* Nodes,
6+
* Parents,
7+
* PhrasingContent,
8+
* TableCell,
9+
* TableRow
10+
* } from 'mdast'
11+
* @import {Point} from 'unist'
1012
*/
1113

1214
/**

lib/unsafe.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('./types.js').ConstructName} ConstructName
3-
* @typedef {import('./types.js').Unsafe} Unsafe
2+
* @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'
43
*/
54

65
/**

lib/util/association.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').AssociationId} AssociationId
2+
* @import {AssociationId} from '../types.js'
33
*/
44

55
import {decodeString} from 'micromark-util-decode-string'

lib/util/check-bullet-ordered.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').Options} Options
3-
* @typedef {import('../types.js').State} State
2+
* @import {Options, State} from 'mdast-util-to-markdown'
43
*/
54

65
/**

lib/util/check-bullet-other.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').Options} Options
3-
* @typedef {import('../types.js').State} State
2+
* @import {Options, State} from 'mdast-util-to-markdown'
43
*/
54

65
import {checkBullet} from './check-bullet.js'

lib/util/check-bullet.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').Options} Options
3-
* @typedef {import('../types.js').State} State
2+
* @import {Options, State} from 'mdast-util-to-markdown'
43
*/
54

65
/**

lib/util/check-emphasis.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').Options} Options
3-
* @typedef {import('../types.js').State} State
2+
* @import {Options, State} from 'mdast-util-to-markdown'
43
*/
54

65
/**

lib/util/check-fence.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').Options} Options
3-
* @typedef {import('../types.js').State} State
2+
* @import {Options, State} from 'mdast-util-to-markdown'
43
*/
54

65
/**

lib/util/check-list-item-indent.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').Options} Options
3-
* @typedef {import('../types.js').State} State
2+
* @import {Options, State} from 'mdast-util-to-markdown'
43
*/
54

65
/**

lib/util/check-quote.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').Options} Options
3-
* @typedef {import('../types.js').State} State
2+
* @import {Options, State} from 'mdast-util-to-markdown'
43
*/
54

65
/**

lib/util/check-rule-repetition.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').Options} Options
3-
* @typedef {import('../types.js').State} State
2+
* @import {Options, State} from 'mdast-util-to-markdown'
43
*/
54

65
/**

lib/util/check-rule.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').Options} Options
3-
* @typedef {import('../types.js').State} State
2+
* @import {Options, State} from 'mdast-util-to-markdown'
43
*/
54

65
/**

lib/util/check-strong.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').Options} Options
3-
* @typedef {import('../types.js').State} State
2+
* @import {Options, State} from 'mdast-util-to-markdown'
43
*/
54

65
/**

lib/util/compile-pattern.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('../types.js').CompilePattern} CompilePattern
2+
* @import {CompilePattern} from '../types.js'
33
*/
44

55
/**

lib/util/container-flow.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('../types.js').FlowParents} FlowParents
3-
* @typedef {import('../types.js').FlowChildren} FlowChildren
4-
* @typedef {import('../types.js').State} State
5-
* @typedef {import('../types.js').TrackFields} TrackFields
2+
* @import {State} from 'mdast-util-to-markdown'
3+
* @import {FlowChildren, FlowParents, TrackFields} from '../types.js'
64
*/
75

86
/**

lib/util/container-phrasing.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('../types.js').Handle} Handle
3-
* @typedef {import('../types.js').Info} Info
4-
* @typedef {import('../types.js').PhrasingParents} PhrasingParents
5-
* @typedef {import('../types.js').State} State
2+
* @import {Handle, Info, State} from 'mdast-util-to-markdown'
3+
* @import {PhrasingParents} from '../types.js'
64
*/
75

86
/**

lib/util/format-code-as-indented.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Code} Code
3-
* @typedef {import('../types.js').State} State
2+
* @import {State} from 'mdast-util-to-markdown'
3+
* @import {Code} from 'mdast'
44
*/
55

66
/**

0 commit comments

Comments
 (0)