Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mdast-util-mdx-jsx

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-mdx-jsx - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

20

complex-types.d.ts

@@ -5,3 +5,3 @@ import {Node} from 'unist'

export interface MDXJsxAttributeValueExpression extends Literal {
export interface MdxJsxAttributeValueExpression extends Literal {
type: 'mdxJsxAttributeValueExpression'

@@ -11,9 +11,9 @@ data?: {estree?: Program} & Literal['data']

export interface MDXJsxAttribute extends Node {
export interface MdxJsxAttribute extends Node {
type: 'mdxJsxAttribute'
name: string
value?: MDXJsxAttributeValueExpression | string | null
value?: MdxJsxAttributeValueExpression | string | null
}
export interface MDXJsxExpressionAttribute extends Literal {
export interface MdxJsxExpressionAttribute extends Literal {
type: 'mdxJsxExpressionAttribute'

@@ -23,8 +23,8 @@ data?: {estree?: Program} & Literal['data']

interface MDXJsxElementFields {
interface MdxJsxElementFields {
name: string | null
attributes: Array<MDXJsxAttribute | MDXJsxExpressionAttribute>
attributes: Array<MdxJsxAttribute | MdxJsxExpressionAttribute>
}
export interface MDXJsxFlowElement extends MDXJsxElementFields, Parent {
export interface MdxJsxFlowElement extends MdxJsxElementFields, Parent {
type: 'mdxJsxFlowElement'

@@ -34,3 +34,3 @@ children: BlockContent[]

export interface MDXJsxTextElement extends MDXJsxElementFields, Parent {
export interface MdxJsxTextElement extends MdxJsxElementFields, Parent {
type: 'mdxJsxTextElement'

@@ -42,8 +42,8 @@ children: PhrasingContent[]

interface StaticPhrasingContentMap {
mdxJsxTextElement: MDXJsxTextElement
mdxJsxTextElement: MdxJsxTextElement
}
interface BlockContentMap {
mdxJsxFlowElement: MDXJsxFlowElement
mdxJsxFlowElement: MdxJsxFlowElement
}
}

@@ -13,13 +13,14 @@ /** @type {FromMarkdownExtension} */

export type ToMarkdownMap = import('mdast-util-to-markdown').Map
export type OnError = import('mdast-util-from-markdown').OnError
export type Program = import('estree-jsx').Program
export type MDXJsxAttributeValueExpression =
import('./complex-types').MDXJsxAttributeValueExpression
export type MDXJsxAttribute = import('./complex-types').MDXJsxAttribute
export type MDXJsxExpressionAttribute =
import('./complex-types').MDXJsxExpressionAttribute
export type MDXJsxFlowElement = import('./complex-types').MDXJsxFlowElement
export type MDXJsxTextElement = import('./complex-types').MDXJsxTextElement
export type MdxJsxAttributeValueExpression =
import('./complex-types').MdxJsxAttributeValueExpression
export type MdxJsxAttribute = import('./complex-types').MdxJsxAttribute
export type MdxJsxExpressionAttribute =
import('./complex-types').MdxJsxExpressionAttribute
export type MdxJsxFlowElement = import('./complex-types').MdxJsxFlowElement
export type MdxJsxTextElement = import('./complex-types').MdxJsxTextElement
export type Tag = {
name: string | null
attributes: (MDXJsxAttribute | MDXJsxExpressionAttribute)[]
attributes: (MdxJsxAttribute | MdxJsxExpressionAttribute)[]
close?: boolean

@@ -30,1 +31,21 @@ selfClosing?: boolean

}
/**
* Legacy names:
*/
export type MDXJsxAttributeValueExpression = MdxJsxAttributeValueExpression
/**
* Legacy names:
*/
export type MDXJsxAttribute = MdxJsxAttribute
/**
* Legacy names:
*/
export type MDXJsxExpressionAttribute = MdxJsxExpressionAttribute
/**
* Legacy names:
*/
export type MDXJsxFlowElement = MdxJsxFlowElement
/**
* Legacy names:
*/
export type MDXJsxTextElement = MdxJsxTextElement

@@ -10,11 +10,22 @@ /**

* @typedef {import('mdast-util-to-markdown').Map} ToMarkdownMap
* @typedef {import('mdast-util-from-markdown').OnError} OnError
* @typedef {import('estree-jsx').Program} Program
* @typedef {import('./complex-types').MDXJsxAttributeValueExpression} MDXJsxAttributeValueExpression
* @typedef {import('./complex-types').MDXJsxAttribute} MDXJsxAttribute
* @typedef {import('./complex-types').MDXJsxExpressionAttribute} MDXJsxExpressionAttribute
* @typedef {import('./complex-types').MDXJsxFlowElement} MDXJsxFlowElement
* @typedef {import('./complex-types').MDXJsxTextElement} MDXJsxTextElement
* @typedef {{name: string|null, attributes: (MDXJsxAttribute|MDXJsxExpressionAttribute)[], close?: boolean, selfClosing?: boolean, start: Token['start'], end: Token['start']}} Tag
* @typedef {import('./complex-types').MdxJsxAttributeValueExpression} MdxJsxAttributeValueExpression
* @typedef {import('./complex-types').MdxJsxAttribute} MdxJsxAttribute
* @typedef {import('./complex-types').MdxJsxExpressionAttribute} MdxJsxExpressionAttribute
* @typedef {import('./complex-types').MdxJsxFlowElement} MdxJsxFlowElement
* @typedef {import('./complex-types').MdxJsxTextElement} MdxJsxTextElement
* @typedef {{name: string|null, attributes: (MdxJsxAttribute|MdxJsxExpressionAttribute)[], close?: boolean, selfClosing?: boolean, start: Token['start'], end: Token['start']}} Tag
*/
/**
* Legacy names:
*
* @typedef {MdxJsxAttributeValueExpression} MDXJsxAttributeValueExpression
* @typedef {MdxJsxAttribute} MDXJsxAttribute
* @typedef {MdxJsxExpressionAttribute} MDXJsxExpressionAttribute
* @typedef {MdxJsxFlowElement} MDXJsxFlowElement
* @typedef {MdxJsxTextElement} MDXJsxTextElement
*/
import {parseEntities} from 'parse-entities'

@@ -201,3 +212,3 @@ import {stringifyPosition} from 'unist-util-stringify-position'

const tag = /** @type {Tag} */ (this.getData('mdxJsxTag'))
const tail = /** @type {MDXJsxExpressionAttribute} */ (
const tail = /** @type {MdxJsxExpressionAttribute} */ (
tag.attributes[tag.attributes.length - 1]

@@ -219,3 +230,3 @@ )

const tag = /** @type {Tag} */ (this.getData('mdxJsxTag'))
const node = /** @type {MDXJsxAttribute} */ (
const node = /** @type {MdxJsxAttribute} */ (
tag.attributes[tag.attributes.length - 1]

@@ -229,3 +240,3 @@ )

const tag = /** @type {Tag} */ (this.getData('mdxJsxTag'))
const node = /** @type {MDXJsxAttribute} */ (
const node = /** @type {MdxJsxAttribute} */ (
tag.attributes[tag.attributes.length - 1]

@@ -248,6 +259,6 @@ )

const tag = /** @type {Tag} */ (this.getData('mdxJsxTag'))
const tail = /** @type {MDXJsxAttribute} */ (
const tail = /** @type {MdxJsxAttribute} */ (
tag.attributes[tag.attributes.length - 1]
)
/** @type {MDXJsxAttributeValueExpression} */
/** @type {MdxJsxAttributeValueExpression} */
const node = {type: 'mdxJsxAttributeValueExpression', value: this.resume()}

@@ -308,3 +319,4 @@ /** @type {Program|undefined} */

},
token
token,
onError
)

@@ -320,2 +332,22 @@ }

/** @type {OnError} */
function onError(closing, open) {
const tag = /** @type {Tag} */ (this.getData('mdxJsxTag'))
const place = closing ? ' before the end of `' + closing.type + '`' : ''
const position = closing
? {start: closing.start, end: closing.end}
: undefined
throw new VFileMessage(
'Expected a closing tag for `' +
serializeAbbreviatedTag(tag) +
'` (' +
stringifyPosition({start: open.start, end: open.end}) +
')' +
place,
position,
'mdast-util-mdx-jsx:end-tag-mismatch'
)
}
/**

@@ -334,3 +366,3 @@ * Serialize a tag, excluding attributes.

* @type {ToMarkdownHandle}
* @param {MDXJsxFlowElement|MDXJsxTextElement} node
* @param {MdxJsxFlowElement|MdxJsxTextElement} node
*/

@@ -345,3 +377,3 @@ // eslint-disable-next-line complexity

let index = -1
/** @type {Array.<string>} */
/** @type {Array<string>} */
const attributes = []

@@ -348,0 +380,0 @@ /** @type {string} */

{
"name": "mdast-util-mdx-jsx",
"version": "1.1.1",
"version": "1.1.2",
"description": "mdast extension to parse and serialize MDX or MDX.js JSX",

@@ -52,3 +52,3 @@ "license": "MIT",

"c8": "^7.0.0",
"mdast-util-from-markdown": "^1.0.0",
"mdast-util-from-markdown": "^1.1.0",
"micromark-extension-mdx-jsx": "^1.0.0",

@@ -62,3 +62,3 @@ "prettier": "^2.0.0",

"typescript": "^4.0.0",
"xo": "^0.44.0"
"xo": "^0.46.0"
},

@@ -65,0 +65,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc