Skip to content

Commit

Permalink
Change to use exports
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 25, 2023
1 parent 8763a11 commit 7c75796
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ import {toString} from 'mdast-util-to-string'
import propose_ from 'propose'
import {visit} from 'unist-util-visit'
import {VFile} from 'vfile'
import {checkFiles} from './check-files.js'
import {constants} from './constants.js'
import {findRepo} from './find-repo.js'
import {checkFiles} from '#check-files'
import {findRepo} from '#find-repo'

const propose = /** @type {Propose} */ (propose_)

Expand Down
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,22 @@
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"imports": {
"#check-files": {
"node": "./lib/check-files.node.js",
"default": "./lib/check-files.default.js"
},
"#find-repo": {
"node": "./lib/find-repo.node.js",
"default": "./lib/find-repo.default.js"
}
},
"files": [
"lib/",
"index.d.ts",
"index.js"
],
"browser": {
"./lib/check-files.js": "./lib/check-files.browser.js",
"./lib/find-repo.js": "./lib/find-repo.browser.js"
},
"dependencies": {
"@types/mdast": "^4.0.0",
"github-slugger": "^2.0.0",
Expand Down
9 changes: 5 additions & 4 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {fileURLToPath} from 'node:url'
import test from 'node:test'
import {promisify} from 'node:util'
import {remark} from 'remark'
import remarkValidateLinks from 'remark-validate-links'
import strip from 'strip-ansi'
import {read} from 'to-vfile'
import remarkValidateLinks from '../index.js'
import sort from './sort.js'

const exec = promisify(execCallback)
Expand All @@ -36,9 +36,10 @@ test('remark-validate-links', async function (t) {
process.chdir(fileURLToPath(fakeBaseUrl))

await t.test('should expose the public api', async function () {
assert.deepEqual(Object.keys(await import('../index.js')).sort(), [
'default'
])
assert.deepEqual(
Object.keys(await import('remark-validate-links')).sort(),
['default']
)
})

await t.test('should work on the API', async function () {
Expand Down

0 comments on commit 7c75796

Please sign in to comment.