mdast-util-mdx-jsx
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -13,3 +13,4 @@ /** @type {FromMarkdownExtension} */ | ||
export type ToMarkdownMap = import('mdast-util-to-markdown').Map | ||
export type OnError = import('mdast-util-from-markdown').OnError | ||
export type OnEnterError = import('mdast-util-from-markdown').OnEnterError | ||
export type OnExitError = import('mdast-util-from-markdown').OnExitError | ||
export type Program = import('estree-jsx').Program | ||
@@ -16,0 +17,0 @@ export type MdxJsxAttributeValueExpression = |
31
index.js
@@ -10,3 +10,4 @@ /** | ||
* @typedef {import('mdast-util-to-markdown').Map} ToMarkdownMap | ||
* @typedef {import('mdast-util-from-markdown').OnError} OnError | ||
* @typedef {import('mdast-util-from-markdown').OnEnterError} OnEnterError | ||
* @typedef {import('mdast-util-from-markdown').OnExitError} OnExitError | ||
* @typedef {import('estree-jsx').Program} Program | ||
@@ -316,3 +317,3 @@ * @typedef {import('./complex-types').MdxJsxAttributeValueExpression} MdxJsxAttributeValueExpression | ||
token, | ||
onError | ||
onErrorRightIsTag | ||
) | ||
@@ -322,3 +323,3 @@ } | ||
if (tag.selfClosing || tag.close) { | ||
this.exit(token) | ||
this.exit(token, onErrorLeftIsTag) | ||
} else { | ||
@@ -329,4 +330,4 @@ stack.push(tag) | ||
/** @type {OnError} */ | ||
function onError(closing, open) { | ||
/** @type {OnEnterError} */ | ||
function onErrorRightIsTag(closing, open) { | ||
const tag = /** @type {Tag} */ (this.getData('mdxJsxTag')) | ||
@@ -350,2 +351,22 @@ const place = closing ? ' before the end of `' + closing.type + '`' : '' | ||
/** @type {OnExitError} */ | ||
function onErrorLeftIsTag(a, b) { | ||
const tag = /** @type {Tag} */ (this.getData('mdxJsxTag')) | ||
throw new VFileMessage( | ||
'Expected the closing tag `' + | ||
serializeAbbreviatedTag(tag) + | ||
'` either after the end of `' + | ||
b.type + | ||
'` (' + | ||
stringifyPosition(b.end) + | ||
') or another opening tag after the start of `' + | ||
b.type + | ||
'` (' + | ||
stringifyPosition(b.start) + | ||
')', | ||
{start: a.start, end: a.end}, | ||
'mdast-util-mdx-jsx:end-tag-mismatch' | ||
) | ||
} | ||
/** | ||
@@ -352,0 +373,0 @@ * Serialize a tag, excluding attributes. |
{ | ||
"name": "mdast-util-mdx-jsx", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "mdast extension to parse and serialize MDX or MDX.js JSX", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31903
498