From c1bcc32db7ed986fe0481e83a09cad2ad86d4204 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 31 Jan 2022 19:00:29 +0100 Subject: [PATCH] Update `mdast-util-mdx-jsx` --- index.js | 24 +++++++++++++++++------- package.json | 2 +- test.js | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 061e94f..2aac14b 100644 --- a/index.js +++ b/index.js @@ -3,12 +3,22 @@ * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension * @typedef {import('mdast-util-mdx-expression').MDXFlowExpression} MDXFlowExpression * @typedef {import('mdast-util-mdx-expression').MDXTextExpression} MDXTextExpression - * @typedef {import('mdast-util-mdx-jsx').MDXJsxAttributeValueExpression} MDXJsxAttributeValueExpression - * @typedef {import('mdast-util-mdx-jsx').MDXJsxAttribute} MDXJsxAttribute - * @typedef {import('mdast-util-mdx-jsx').MDXJsxExpressionAttribute} MDXJsxExpressionAttribute - * @typedef {import('mdast-util-mdx-jsx').MDXJsxFlowElement} MDXJsxFlowElement - * @typedef {import('mdast-util-mdx-jsx').MDXJsxTextElement} MDXJsxTextElement * @typedef {import('mdast-util-mdxjs-esm').MDXJSEsm} MDXJSEsm + * @typedef {import('mdast-util-mdx-jsx').MdxJsxAttributeValueExpression} MdxJsxAttributeValueExpression + * @typedef {import('mdast-util-mdx-jsx').MdxJsxAttribute} MdxJsxAttribute + * @typedef {import('mdast-util-mdx-jsx').MdxJsxExpressionAttribute} MdxJsxExpressionAttribute + * @typedef {import('mdast-util-mdx-jsx').MdxJsxFlowElement} MdxJsxFlowElement + * @typedef {import('mdast-util-mdx-jsx').MdxJsxTextElement} MdxJsxTextElement + */ + +/** + * Deprecated: remove next major: + * + * @typedef {MdxJsxAttributeValueExpression} MDXJsxAttributeValueExpression + * @typedef {MdxJsxAttribute} MDXJsxAttribute + * @typedef {MdxJsxExpressionAttribute} MDXJsxExpressionAttribute + * @typedef {MdxJsxFlowElement} MDXJsxFlowElement + * @typedef {MdxJsxTextElement} MDXJsxTextElement */ import { @@ -23,7 +33,7 @@ import {mdxjsEsmFromMarkdown, mdxjsEsmToMarkdown} from 'mdast-util-mdxjs-esm' * @return {Array} */ export function mdxFromMarkdown() { - return [mdxExpressionFromMarkdown, mdxJsxFromMarkdown, mdxjsEsmFromMarkdown] + return [mdxExpressionFromMarkdown, mdxJsxFromMarkdown(), mdxjsEsmFromMarkdown] } /** @return {ToMarkdownExtension} */ @@ -31,7 +41,7 @@ export function mdxToMarkdown() { return { extensions: [ mdxExpressionToMarkdown, - mdxJsxToMarkdown, + mdxJsxToMarkdown(), mdxjsEsmToMarkdown ] } diff --git a/package.json b/package.json index 95bf28d..be55ca1 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ ], "dependencies": { "mdast-util-mdx-expression": "^1.0.0", - "mdast-util-mdx-jsx": "^1.0.0", + "mdast-util-mdx-jsx": "^2.0.0", "mdast-util-mdxjs-esm": "^1.0.0" }, "devDependencies": { diff --git a/test.js b/test.js index 5144313..e9e4ff1 100644 --- a/test.js +++ b/test.js @@ -221,7 +221,7 @@ test('mdast -> markdown', (t) => { {type: 'mdxJsxFlowElement', name: 'x', attributes: [], children: []}, {extensions: [mdxToMarkdown()]} ), - '\n', + '\n', 'should support jsx' )