From bf5824f3d4f3ad523862844c5a98305c363728e2 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 27 Sep 2023 17:36:51 +0200 Subject: [PATCH] Change to use `exports` --- package.json | 3 +-- readme.md | 4 ++-- test.jsx | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 188d85b..18a4c63 100644 --- a/package.json +++ b/package.json @@ -69,8 +69,7 @@ ], "sideEffects": false, "type": "module", - "main": "index.js", - "types": "index.d.ts", + "exports": "./index.js", "files": [ "lib/", "index.d.ts", diff --git a/readme.md b/readme.md index 7df6a92..4248596 100644 --- a/readme.md +++ b/readme.md @@ -685,9 +685,9 @@ It lets you define your own schema of what is and isn’t allowed. ## Related -* [`MDX`](https://github.com/mdx-js/mdx) +* [`MDX`][mdx] — JSX *in* markdown -* [`remark-gfm`](https://github.com/remarkjs/remark-gfm) +* [`remark-gfm`][remark-gfm] — add support for GitHub flavored markdown support * [`react-remark`][react-remark] — modern hook based alternative diff --git a/test.jsx b/test.jsx index 1a56847..4d1ba14 100644 --- a/test.jsx +++ b/test.jsx @@ -1,21 +1,21 @@ /* @jsxRuntime automatic @jsxImportSource react */ /** * @typedef {import('hast').Root} Root - * @typedef {import('./index.js').ExtraProps} ExtraProps + * @typedef {import('react-markdown').ExtraProps} ExtraProps */ import assert from 'node:assert/strict' import test from 'node:test' import {renderToStaticMarkup} from 'react-dom/server' +import Markdown from 'react-markdown' import rehypeRaw from 'rehype-raw' import remarkGfm from 'remark-gfm' import remarkToc from 'remark-toc' import {visit} from 'unist-util-visit' -import Markdown from './index.js' test('react-markdown', 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('react-markdown')).sort(), [ 'default', 'defaultUrlTransform' ])