From 17079b0782cb42e3e4703421980e85c3e62a043f Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 25 Aug 2023 18:53:09 +0200 Subject: [PATCH] Change to use `exports` --- packages/rehype-cli/cli.js | 8 +++++--- packages/rehype-cli/package.json | 2 +- packages/rehype-parse/package.json | 3 +-- packages/rehype-stringify/package.json | 3 +-- packages/rehype/package.json | 3 +-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/rehype-cli/cli.js b/packages/rehype-cli/cli.js index 2a33e69a..ba10b6e9 100755 --- a/packages/rehype-cli/cli.js +++ b/packages/rehype-cli/cli.js @@ -19,13 +19,15 @@ import {args} from 'unified-args' /** @type {Pack} */ const proc = JSON.parse( String( - // To do: this will break when we add export maps. - await fs.readFile(new URL(resolve('rehype/package.json', import.meta.url))) + await fs.readFile( + new URL('package.json', resolve('rehype', import.meta.url)) + ) ) ) + /** @type {Pack} */ const cli = JSON.parse( - String(await fs.readFile(new URL(resolve('./package.json', import.meta.url)))) + String(await fs.readFile(new URL('package.json', import.meta.url))) ) args({ diff --git a/packages/rehype-cli/package.json b/packages/rehype-cli/package.json index 4eeb26ca..ef403513 100644 --- a/packages/rehype-cli/package.json +++ b/packages/rehype-cli/package.json @@ -21,7 +21,7 @@ "Titus Wormer (https://wooorm.com)" ], "type": "module", - "main": "cli.js", + "exports": [], "bin": { "rehype": "cli.js" }, diff --git a/packages/rehype-parse/package.json b/packages/rehype-parse/package.json index 44a07e8d..100c2beb 100644 --- a/packages/rehype-parse/package.json +++ b/packages/rehype-parse/package.json @@ -28,8 +28,7 @@ ], "sideEffects": false, "type": "module", - "main": "index.js", - "types": "index.d.ts", + "exports": "./index.js", "files": [ "lib/", "index.d.ts", diff --git a/packages/rehype-stringify/package.json b/packages/rehype-stringify/package.json index 5cfc29a3..1128d6a2 100644 --- a/packages/rehype-stringify/package.json +++ b/packages/rehype-stringify/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/packages/rehype/package.json b/packages/rehype/package.json index e8c32ccd..24523406 100644 --- a/packages/rehype/package.json +++ b/packages/rehype/package.json @@ -35,8 +35,7 @@ ], "sideEffects": false, "type": "module", - "main": "index.js", - "types": "index.d.ts", + "exports": "./index.js", "files": [ "index.d.ts", "index.js"