Skip to content

Commit 1f933f3

Browse files
committed
Change to use exports
1 parent 35e0420 commit 1f933f3

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

lib/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ const emptyComments = []
5454
* @returns {undefined}
5555
* Nothing.
5656
*/
57-
// To do: next major: don’t return given `tree`.
5857
export function attachComments(tree, comments) {
5958
const list = comments ? [...comments].sort(compare) : emptyComments
6059
if (list.length > 0) walk(tree, {comments: list, index: 0})

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
],
2727
"sideEffects": false,
2828
"type": "module",
29-
"main": "index.js",
30-
"types": "index.d.ts",
29+
"exports": "./index.js",
3130
"files": [
3231
"lib/",
3332
"index.d.ts",

test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
import assert from 'node:assert/strict'
88
import test from 'node:test'
99
import {parse as acornParse} from 'acorn'
10-
import recast from 'recast'
10+
import {attachComments} from 'estree-util-attach-comments'
1111
import {visit} from 'estree-util-visit'
12-
import {attachComments} from './index.js'
12+
import recast from 'recast'
1313

1414
test('attachComments', async function (t) {
1515
await t.test('should expose the public api', async function () {
16-
assert.deepEqual(Object.keys(await import('./index.js')).sort(), [
17-
'attachComments'
18-
])
16+
assert.deepEqual(
17+
Object.keys(await import('estree-util-attach-comments')).sort(),
18+
['attachComments']
19+
)
1920
})
2021

2122
await t.test('should support an empty document', async function () {

0 commit comments

Comments
 (0)