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 Jul 5, 2024
1 parent 98bf3b0 commit 1a94c2d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
9 changes: 9 additions & 0 deletions dev/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
export {gfmAutolinkLiteral} from './lib/syntax.js'
export {gfmAutolinkLiteralHtml} from './lib/html.js'

/**
* Augment types.
*/
declare module 'micromark-util-types' {
/**
* Augment token with a field to improve performance.
*/
interface Token {
_gfmAutolinkLiteralWalkedInto?: boolean
}

/**
* Token types.
*/
interface TokenTypeMap {
literalAutolink: 'literalAutolink'
literalAutolinkEmail: 'literalAutolinkEmail'
Expand Down
5 changes: 1 addition & 4 deletions dev/lib/html.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/**
* @typedef {import('micromark-util-types').CompileContext} CompileContext
* @typedef {import('micromark-util-types').Handle} Handle
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
* @typedef {import('micromark-util-types').Token} Token
* @import {CompileContext, Handle, HtmlExtension, Token} from 'micromark-util-types'
*/

import {sanitizeUri} from 'micromark-util-sanitize-uri'
Expand Down
9 changes: 1 addition & 8 deletions dev/lib/syntax.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/**
* @typedef {import('micromark-util-types').Code} Code
* @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord
* @typedef {import('micromark-util-types').Event} Event
* @typedef {import('micromark-util-types').Extension} Extension
* @typedef {import('micromark-util-types').Previous} Previous
* @typedef {import('micromark-util-types').State} State
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
* @import {Code, ConstructRecord, Event, Extension, Previous, State, TokenizeContext, Tokenizer} from 'micromark-util-types'
*/

import {
Expand Down
6 changes: 3 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('micromark-extension-gfm-autolink-literal', async function (t) {
})

await t.test(
'should skip wwwAutolink construct if `disable.null` includes `wwwAutolink`',
'should skip `wwwAutolink` construct if `disable.null` includes `wwwAutolink`',
async function () {
assert.equal(
micromark('www.a.com', {
Expand All @@ -36,7 +36,7 @@ test('micromark-extension-gfm-autolink-literal', async function (t) {
)

await t.test(
'should skip protocolAutolink construct if `disable.null` includes `protocolAutolink`',
'should skip `protocolAutolink` construct if `disable.null` includes `protocolAutolink`',
async function () {
assert.equal(
micromark('http://a.com', {
Expand All @@ -52,7 +52,7 @@ test('micromark-extension-gfm-autolink-literal', async function (t) {
)

await t.test(
'should skip emailAutolink construct if `disable.null` includes `emailAutolink`',
'should skip `emailAutolink` construct if `disable.null` includes `emailAutolink`',
async function () {
assert.equal(
micromark('a@b.com', {
Expand Down

0 comments on commit 1a94c2d

Please sign in to comment.