{"name":"@mdx-js/react","version":"2.3.0","description":"React context for MDX","license":"MIT","keywords":["mdx","markdown","react","jsx","remark","mdxast"],"homepage":"https://mdxjs.com","repository":{"type":"git","url":"git+https://github.com/mdx-js/mdx.git","directory":"packages/react"},"bugs":{"url":"https://github.com/mdx-js/mdx/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"John Otander","email":"johnotander@gmail.com","url":"https://johno.com"},"contributors":[{"name":"John Otander","email":"johnotander@gmail.com","url":"https://johno.com"},{"name":"Tim Neutkens","email":"tim@vercel.com"},{"name":"Matija Marohnić","email":"matija.marohnic@gmail.com"},{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},{"name":"JounQin","email":"admin@1stg.me","url":"https://www.1stg.me"},{"name":"Christian Murphy","email":"christian.murphy.42@gmail.com"}],"type":"module","sideEffects":false,"main":"index.js","types":"index.d.ts","dependencies":{"@types/mdx":"^2.0.0","@types/react":">=16"},"peerDependencies":{"react":">=16"},"devDependencies":{"@mdx-js/mdx":"^2.0.0","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","react":"^18.0.0","react-dom":"^18.0.0"},"scripts":{"prepack":"npm run build","build":"tsc --build --clean && tsc --build && type-coverage","test-api":"node --no-warnings --experimental-loader=../../script/jsx-loader.js ../../node_modules/uvu/bin.js test \"\\.jsx?$\"","test-coverage":"c8 --check-coverage --100 --reporter lcov npm run test-api","test":"npm run build && npm run test-coverage"},"xo":false,"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"gitHead":"bf7deab69996449cb99c2217dff75e65855eb2c1","_id":"@mdx-js/react@2.3.0","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-zQH//gdOmuu7nt2oJR29vFhDv88oGPmVw6BggmrHeMI+xgEkp1B2dX9/bMBSYtK0dyLX/aOmesKS09g222K1/g==","shasum":"4208bd6d70f0d0831def28ef28c26149b03180b3","tarball":"http://registry-npm.ywwl.com/@mdx-js/react/download/@mdx-js/react-2.3.0.tgz","fileCount":7,"unpackedSize":14608,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDyWxdjpXpF3L0qmXAVClgLWLSf2s9wN3GKoAzwUcEAPAIgVBDr+UGrVsc4b/I2+xpoHRbCMF33iIS9VkYj04amzi4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5UOwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr0HRAAm7eKDwXXV3wpbsZqrY8M4uXpxtzCB2KkX5ecqJALzYw3Hoyt\r\nWszLg3Q91azYmVHFCjGErV/aT1cwsBTMoeUR0wWAz22R9SS7noc4L1SDm5oJ\r\n6rnNP3rFV2AGv0hisd6mteI529e53WK6hfd+/t1rSVpqaUo73WPtYHoditct\r\nSGbbFAmaT0ymjmmXH50qVVkq0ftW6sbXqURY1BkRzK9FbnCHCjxt3Lx/5WcG\r\nB3irrusvG0p4pMRHfYCdd2iGiBl4hv/iDCGQq+7nxgBRG89nMYCOWlXVdYSy\r\nGnf2+0jgtAHc/rRvgbV416Qf+/zEousV3gB1/un/vzPWtxFK+/5A+iPq69Nz\r\n9ueNVH/BsCNdLWqM9RRGYf7LJyOElVxw0STMzM25VymcSC7a6dhb8+XGvNxz\r\nzqJLdkudYBZB3YC3mBj/gAm9hCsykgV7tg5L8cuVuchfhTtQUwEydWmlWwXM\r\nRiZsd06KJCU9dnb3tCJJvi6xJd9e1y8Wx7xhYv6D65S3/MEZcgcMeWli11l5\r\nJOcs5UvbqH1mpUSYeBmHnZf/OFDQ2wvy3t6IUyaa13g8Q6DpFwD6M31ag/SR\r\n6SuZpmAY8ClrufvP2/2xsp8E6SzyOxaShV7lfFKwmHVHk4rD8VO12UHu+zYa\r\ncD8CIwdmHNrp60UORbQh82tihYDKUdJK0yQ=\r\n=VE5Y\r\n-----END PGP SIGNATURE-----\r\n","size":4931,"noattachment":false,"key":"/@mdx-js/react/-/@mdx-js/react-2.3.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"johno","email":"johnotander@gmail.com"},{"name":"silvenon","email":"matija.marohnic@gmail.com"},{"name":"timneutkens","email":"tim@timneutkens.nl"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react_2.3.0_1675969455841_0.2865015583790167"},"_hasShrinkwrap":false,"readme":"# `@mdx-js/react`\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\nReact context for MDX.\n\n<!-- more -->\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`MDXProvider(properties?)`](#mdxproviderproperties)\n  * [`useMDXComponents(components?)`](#usemdxcomponentscomponents)\n  * [`MergeComponents`](#mergecomponents)\n  * [`Props`](#props)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a *context* based components provider for combining React with\nMDX.\n\n## When should I use this?\n\nThis package is **not needed** for MDX to work with React.\nSee [¶ MDX provider in § Using MDX][use-provider] for when and how to use an MDX\nprovider.\n\nIf you use Next.js, **do not use this**.\nAdd an `mdx-components.tsx` (in `src/` or `/`) file instead.\nSee [Configuring MDX on `nextjs.org`][next-configuring-mdx] for more info.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install @mdx-js/react\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```tsx\nimport {MDXProvider} from 'https://esm.sh/@mdx-js/react@3'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {MDXProvider} from 'https://esm.sh/@mdx-js/react@3?bundle'\n</script>\n```\n\n## Use\n\n```tsx\nimport {MDXProvider} from '@mdx-js/react'\nimport Post from './post.mdx'\n// ^-- Assumes an integration is used to compile MDX to JS, such as\n// `@mdx-js/esbuild`, `@mdx-js/loader`, `@mdx-js/node-loader`, or\n// `@mdx-js/rollup`, and that it is configured with\n// `options.providerImportSource: '@mdx-js/react'`.\n\n/** @type {import('mdx/types.js').MDXComponents} */\nconst components = {\n  em(properties) {\n    return <i {...properties} />\n  }\n}\n\nconsole.log(\n  <MDXProvider components={components}>\n    <Post />\n  </MDXProvider>\n)\n```\n\n> 👉 **Note**: you don’t have to use `MDXProvider` and can pass components\n> directly:\n>\n> ```diff\n> -<MDXProvider components={components}>\n> -  <Post />\n> -</MDXProvider>\n> +<Post components={components} />\n> ```\n\nSee [¶ React in § Getting started][start-react] for how to get started with MDX\nand React.\nSee [¶ MDX provider in § Using MDX][use-provider] for how to use an MDX\nprovider.\n\n## API\n\nThis package exports the identifiers [`MDXProvider`][api-mdx-provider] and\n[`useMDXComponents`][api-use-mdx-components].\nThere is no default export.\n\n### `MDXProvider(properties?)`\n\nProvider for MDX context.\n\n###### Parameters\n\n* `properties` ([`Props`][api-props])\n  — configuration\n\n##### Returns\n\nElement (`JSX.Element`).\n\n### `useMDXComponents(components?)`\n\nGet current components from the MDX Context.\n\n###### Parameters\n\n* `components` ([`MDXComponents` from `mdx/types.js`][mdx-types-components]\n  or [`MergeComponents`][api-merge-components], optional)\n  — additional components to use or a function that creates them\n\n###### Returns\n\nCurrent components ([`MDXComponents` from\n`mdx/types.js`][mdx-types-components]).\n\n### `MergeComponents`\n\nCustom merge function (TypeScript type).\n\n###### Parameters\n\n* `components` ([`MDXComponents` from `mdx/types.js`][mdx-types-components])\n  — current components from the context\n\n###### Returns\n\nAdditional components ([`MDXComponents` from\n`mdx/types.js`][mdx-types-components]).\n\n### `Props`\n\nConfiguration for `MDXProvider` (TypeScript type).\n\n###### Fields\n\n* `children` ([`ReactNode` from `react`][react-node],\n  optional)\n  — children\n* `components` ([`MDXComponents` from `mdx/types.js`][mdx-types-components]\n  or [`MergeComponents`][api-merge-components], optional)\n  — additional components to use or a function that creates them\n* `disableParentContext` (`boolean`, default: `false`)\n  — turn off outer component context\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types [`MergeComponents`][api-merge-components] and\n[`Props`][api-props].\n\nFor types to work, make sure the TypeScript `JSX` namespace is typed.\nThis is done by installing and using the types of your framework, as in\n[`@types/react`](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react).\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `@mdx-js/react@^3`,\ncompatible with Node.js 16.\n\n## Security\n\nSee [§ Security][security] on our website for information.\n\n## Contribute\n\nSee [§ Contribute][contribute] on our website for ways to get started.\nSee [§ Support][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][] © Compositor and [Vercel][]\n\n[build-badge]: https://github.com/mdx-js/mdx/workflows/main/badge.svg\n\n[build]: https://github.com/mdx-js/mdx/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/mdx-js/mdx/main.svg\n\n[coverage]: https://codecov.io/github/mdx-js/mdx\n\n[downloads-badge]: https://img.shields.io/npm/dm/@mdx-js/react.svg\n\n[downloads]: https://www.npmjs.com/package/@mdx-js/react\n\n[size-badge]: https://img.shields.io/bundlejs/size/@mdx-js/react\n\n[size]: https://bundlejs.com/?q=@mdx-js/react\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/mdx-js/mdx/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[contribute]: https://mdxjs.com/community/contribute/\n\n[support]: https://mdxjs.com/community/support/\n\n[coc]: https://github.com/mdx-js/.github/blob/main/code-of-conduct.md\n\n[mit]: https://github.com/mdx-js/mdx/blob/main/packages/react/license\n\n[vercel]: https://vercel.com\n\n[start-react]: https://mdxjs.com/getting-started/#react\n\n[use-provider]: https://mdxjs.com/docs/using-mdx/#mdx-provider\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[security]: https://mdxjs.com/getting-started/#security\n\n[typescript]: https://www.typescriptlang.org\n\n[mdx-types-components]: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/HEAD/types/mdx/types.d.ts#L65\n\n[react-node]: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/HEAD/types/react/index.d.ts#L244\n\n[next-configuring-mdx]: https://nextjs.org/docs/pages/building-your-application/configuring/mdx\n\n[api-mdx-provider]: #mdxproviderproperties\n\n[api-merge-components]: #mergecomponents\n\n[api-props]: #props\n\n[api-use-mdx-components]: #usemdxcomponentscomponents\n","publish_time":1675969455997,"_cnpm_publish_time":1675969455997,"dist-tags":{"ci":"2.0.0-ci.53","latest":"3.1.1","next":"2.0.0-rc.2"}}