diff --git a/lib/check-files.browser.js b/lib/check-files.default.js similarity index 100% rename from lib/check-files.browser.js rename to lib/check-files.default.js diff --git a/lib/check-files.js b/lib/check-files.node.js similarity index 100% rename from lib/check-files.js rename to lib/check-files.node.js diff --git a/lib/find-repo.browser.js b/lib/find-repo.default.js similarity index 100% rename from lib/find-repo.browser.js rename to lib/find-repo.default.js diff --git a/lib/find-repo.js b/lib/find-repo.node.js similarity index 100% rename from lib/find-repo.js rename to lib/find-repo.node.js diff --git a/lib/index.js b/lib/index.js index 5029608..97e5996 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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_) diff --git a/package.json b/package.json index 032c11b..d777ee1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/index.js b/test/index.js index 37ddf55..28dd8af 100644 --- a/test/index.js +++ b/test/index.js @@ -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) @@ -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 () {