Skip to content

Commit

Permalink
Refactor to use @imports
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Oct 1, 2024
1 parent 34ceb6b commit ee13c50
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/all.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('highlight.js').LanguageFn} LanguageFn
* @import {LanguageFn} from 'highlight.js'
*/

import $1c from 'highlight.js/lib/languages/1c'
Expand Down
2 changes: 1 addition & 1 deletion lib/common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('highlight.js').LanguageFn} LanguageFn
* @import {LanguageFn} from 'highlight.js'
*/

import arduino from 'highlight.js/lib/languages/arduino'
Expand Down
11 changes: 2 additions & 9 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
/**
* @typedef {import('hast').Element} Element
* @typedef {import('hast').ElementContent} ElementContent
* @typedef {import('hast').Root} Root
* @typedef {import('hast').RootData} RootData
*
* @typedef {import('highlight.js').Emitter} Emitter
* @typedef {import('highlight.js').HLJSOptions} HljsOptions
* @typedef {import('highlight.js').HighlightResult} HighlightResult
* @typedef {import('highlight.js').LanguageFn} LanguageFn
* @import {ElementContent, Element, RootData, Root} from 'hast'
* @import {Emitter, HLJSOptions as HljsOptions, HighlightResult, LanguageFn} from 'highlight.js'
*/

/**
Expand Down
5 changes: 2 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,8 @@ somewhere in your types, as that registers the new fields on the file.

```js
/**
* @typedef {import('hast').Root} Root
*
* @typedef {import('lowlight')}
* @import {Root} from 'hast'
* @import {} from 'lowlight'
*/

import {VFile} from 'vfile'
Expand Down
2 changes: 1 addition & 1 deletion script/build-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ console.log(
function generate(list, base) {
return [
'/**',
" * @typedef {import('highlight.js').LanguageFn} LanguageFn",
" * @import {LanguageFn} from 'highlight.js'",
' */',
'',
...(base ? ["import {grammars as base} from './" + base + ".js'"] : []),
Expand Down
7 changes: 2 additions & 5 deletions script/support.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/**
* @typedef {import('highlight.js').LanguageFn} LanguageFn
*
* @typedef {import('mdast').ListItem} ListItem
* @typedef {import('mdast').PhrasingContent} PhrasingContent
* @typedef {import('mdast').Root} Root
* @import {LanguageFn} from 'highlight.js'
* @import {ListItem, PhrasingContent, Root} from 'mdast'
*/

import fs from 'node:fs/promises'
Expand Down

0 comments on commit ee13c50

Please sign in to comment.