From b5f36de38759270558c08a4b65970cd8eedf0a45 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 6 Jul 2023 13:15:37 +0200 Subject: [PATCH] Change to use `export` map --- .gitignore | 4 ++-- index.test-d.ts | 2 +- package.json | 13 +++++++++++-- test.js | 4 ++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 07ec94c..d8239d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .DS_Store -lib/index.d.ts -test.d.ts +*.d.ts *.log coverage/ node_modules/ yarn.lock +!/index.d.ts diff --git a/index.test-d.ts b/index.test-d.ts index cf964e0..a17a554 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -18,7 +18,7 @@ import type { TableRow } from 'mdast' import type {Node, Parent} from 'unist' -import {CONTINUE, EXIT, SKIP, visit} from './index.js' +import {CONTINUE, EXIT, SKIP, visit} from 'unist-util-visit' // To do: use `mdast` when released. type Nodes = Root | Content diff --git a/package.json b/package.json index 2d9c039..f482cb9 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,7 @@ ], "sideEffects": false, "type": "module", - "main": "index.js", - "types": "index.d.ts", + "exports": "./index.js", "files": [ "lib/", "index.d.ts", @@ -99,6 +98,16 @@ "strict": true }, "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "import/no-extraneous-dependencies": "off" + } + } + ], "prettier": true } } diff --git a/test.js b/test.js index 8f5934b..e471347 100644 --- a/test.js +++ b/test.js @@ -9,7 +9,7 @@ import test from 'node:test' import {fromMarkdown} from 'mdast-util-from-markdown' import {gfmFromMarkdown} from 'mdast-util-gfm' import {gfm} from 'micromark-extension-gfm' -import {CONTINUE, EXIT, SKIP, visit} from './index.js' +import {CONTINUE, EXIT, SKIP, visit} from 'unist-util-visit' const tree = fromMarkdown('Some _emphasis_, **importance**, and `code`.') @@ -50,7 +50,7 @@ const reverseTypes = [ test('visit', async function (t) { await t.test('should expose the public api', async function () { - assert.deepEqual(Object.keys(await import('./index.js')).sort(), [ + assert.deepEqual(Object.keys(await import('unist-util-visit')).sort(), [ 'CONTINUE', 'EXIT', 'SKIP',