From 1a7cb9f1b029efa7b371949e013b36da4f0ce295 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 7 Aug 2023 15:52:55 +0200 Subject: [PATCH] Change to use `exports` --- lib/id.js | 2 +- package.json | 3 +-- test/core.js | 4 ++-- test/matches.js | 2 +- test/select-all.js | 2 +- test/select.js | 2 +- test/svg.js | 2 +- 7 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/id.js b/lib/id.js index b52aad9..426453a 100644 --- a/lib/id.js +++ b/lib/id.js @@ -1,7 +1,7 @@ /** * @typedef {import('css-selector-parser').AstRule} AstRule * - * @typedef {import('./index.js').Element} Element + * @typedef {import('hast').Element} Element */ import {ok as assert} from 'devlop' diff --git a/package.json b/package.json index 2735688..fbe033f 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,7 @@ ], "sideEffects": false, "type": "module", - "main": "index.js", - "types": "index.d.ts", + "exports": "./index.js", "files": [ "lib/", "index.d.ts", diff --git a/test/core.js b/test/core.js index c095236..127b380 100644 --- a/test/core.js +++ b/test/core.js @@ -1,12 +1,12 @@ import assert from 'node:assert/strict' import test from 'node:test' import {h} from 'hastscript' +import {selectAll} from 'hast-util-select' import {u} from 'unist-builder' -import {selectAll} from '../index.js' test('hast-util-select', 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('hast-util-select')).sort(), [ 'matches', 'select', 'selectAll' diff --git a/test/matches.js b/test/matches.js index 7fdf8ef..cbfeeb1 100644 --- a/test/matches.js +++ b/test/matches.js @@ -1,8 +1,8 @@ import assert from 'node:assert/strict' import test from 'node:test' import {h, s} from 'hastscript' +import {matches} from 'hast-util-select' import {u} from 'unist-builder' -import {matches} from '../index.js' test('select.matches()', async function (t) { await t.test('invalid selector', async function (t) { diff --git a/test/select-all.js b/test/select-all.js index e5def03..e8dca64 100644 --- a/test/select-all.js +++ b/test/select-all.js @@ -1,8 +1,8 @@ import assert from 'node:assert/strict' import test from 'node:test' import {h, s} from 'hastscript' +import {selectAll} from 'hast-util-select' import {u} from 'unist-builder' -import {selectAll} from '../index.js' test('select.selectAll()', async function (t) { await t.test('invalid selectors', async function (t) { diff --git a/test/select.js b/test/select.js index a4628be..f5f3e57 100644 --- a/test/select.js +++ b/test/select.js @@ -1,8 +1,8 @@ import assert from 'node:assert/strict' import test from 'node:test' import {h, s} from 'hastscript' +import {select} from 'hast-util-select' import {u} from 'unist-builder' -import {select} from '../index.js' test('select.select()', async function (t) { await t.test('invalid selectors', async function (t) { diff --git a/test/svg.js b/test/svg.js index ec10113..058cecb 100644 --- a/test/svg.js +++ b/test/svg.js @@ -1,8 +1,8 @@ import assert from 'node:assert/strict' import test from 'node:test' import {h, s} from 'hastscript' +import {select, selectAll} from 'hast-util-select' import {u} from 'unist-builder' -import {select, selectAll} from '../index.js' test('svg', async function (t) { await t.test('should match svg (#1)', async function () {