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 23, 2023
1 parent 35b3108 commit 404a8a1
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 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 @@ -38,8 +38,8 @@

import {headingRange} from 'mdast-util-heading-range'
import spdx from 'spdx-license-list'
import {findNearestPackage} from './find-nearest-package.js'
import {findLicense} from './find-license.js'
import {findLicense} from '#find-license'
import {findNearestPackage} from '#find-nearest-package'

const http = 'http://'
const https = 'https://'
Expand Down
15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"browser": {
"./lib/find-license.js": "./lib/find-license.browser.js",
"./lib/find-nearest-package.js": "./lib/find-nearest-package.browser.js"
"exports": "./index.js",
"imports": {
"#find-license": {
"node": "./lib/find-license.node.js",
"default": "./lib/find-license.default.js"
},
"#find-nearest-package": {
"node": "./lib/find-nearest-package.node.js",
"default": "./lib/find-nearest-package.default.js"
}
},
"files": [
"lib/",
Expand Down
6 changes: 3 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('../index.js').Options} Options
* @typedef {import('remark-license').Options} Options
*/

import assert from 'node:assert/strict'
Expand All @@ -8,12 +8,12 @@ import process from 'node:process'
import test from 'node:test'
import {fileURLToPath} from 'node:url'
import {remark} from 'remark'
import license from 'remark-license'
import semver from 'semver'
import license from '../index.js'

test('remark-license', 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('remark-license')).sort(), [
'default'
])
})
Expand Down

0 comments on commit 404a8a1

Please sign in to comment.