micromark-extension-mdx-jsx
Advanced tools
Comparing version 3.0.0 to 3.0.1
import type {Program} from 'estree' | ||
import type {Acorn, AcornOptions} from 'micromark-util-events-to-acorn' | ||
export {mdxJsx, type Options} from './lib/syntax.js' | ||
export {mdxJsx} from './lib/syntax.js' | ||
/** | ||
* Configuration (optional). | ||
*/ | ||
export interface Options { | ||
/** | ||
* Acorn parser to use (optional). | ||
*/ | ||
acorn?: Acorn | null | undefined | ||
/** | ||
* Configuration for acorn (default: `{ecmaVersion: 2024, locations: true, | ||
* sourceType: 'module'}`); all fields except `locations` can be set. | ||
*/ | ||
acornOptions?: AcornOptions | null | undefined | ||
/** | ||
* Whether to add `estree` fields to tokens with results from acorn | ||
* (default: `false`). | ||
*/ | ||
addResult?: boolean | null | undefined | ||
} | ||
/** | ||
* Augment types. | ||
*/ | ||
declare module 'micromark-util-types' { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
/** | ||
* Token fields. | ||
*/ | ||
interface Token { | ||
@@ -11,3 +37,5 @@ estree?: Program | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
/** | ||
* Token types. | ||
*/ | ||
interface TokenTypeMap { | ||
@@ -14,0 +42,0 @@ esWhitespace: 'esWhitespace' |
@@ -6,5 +6,5 @@ /** | ||
* @param {State} nok | ||
* @param {Acorn | undefined} acorn | ||
* @param {AcornOptions | undefined} acornOptions | ||
* @param {boolean | undefined} addResult | ||
* @param {Acorn | null | undefined} acorn | ||
* @param {AcornOptions | null | undefined} acornOptions | ||
* @param {boolean | null | undefined} addResult | ||
* @param {boolean | undefined} allowLazy | ||
@@ -37,9 +37,9 @@ * @param {TokenType} tagType | ||
*/ | ||
export function factoryTag(this: import("micromark-util-types").TokenizeContext, effects: Effects, ok: State, nok: State, acorn: Acorn | undefined, acornOptions: AcornOptions | undefined, addResult: boolean | undefined, allowLazy: boolean | undefined, tagType: TokenType, tagMarkerType: TokenType, tagClosingMarkerType: TokenType, tagSelfClosingMarker: TokenType, tagNameType: TokenType, tagNamePrimaryType: TokenType, tagNameMemberMarkerType: TokenType, tagNameMemberType: TokenType, tagNamePrefixMarkerType: TokenType, tagNameLocalType: TokenType, tagExpressionAttributeType: TokenType, tagExpressionAttributeMarkerType: TokenType, tagExpressionAttributeValueType: TokenType, tagAttributeType: TokenType, tagAttributeNameType: TokenType, tagAttributeNamePrimaryType: TokenType, tagAttributeNamePrefixMarkerType: TokenType, tagAttributeNameLocalType: TokenType, tagAttributeInitializerMarkerType: TokenType, tagAttributeValueLiteralType: TokenType, tagAttributeValueLiteralMarkerType: TokenType, tagAttributeValueLiteralValueType: TokenType, tagAttributeValueExpressionType: TokenType, tagAttributeValueExpressionMarkerType: TokenType, tagAttributeValueExpressionValueType: TokenType): (code: import("micromark-util-types").Code) => import("micromark-util-types").State | undefined; | ||
export type Acorn = import('micromark-factory-mdx-expression').Acorn; | ||
export type AcornOptions = import('micromark-factory-mdx-expression').AcornOptions; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Effects = import('micromark-util-types').Effects; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type TokenType = import('micromark-util-types').TokenType; | ||
export function factoryTag(this: TokenizeContext, effects: Effects, ok: State, nok: State, acorn: Acorn | null | undefined, acornOptions: AcornOptions | null | undefined, addResult: boolean | null | undefined, allowLazy: boolean | undefined, tagType: TokenType, tagMarkerType: TokenType, tagClosingMarkerType: TokenType, tagSelfClosingMarker: TokenType, tagNameType: TokenType, tagNamePrimaryType: TokenType, tagNameMemberMarkerType: TokenType, tagNameMemberType: TokenType, tagNamePrefixMarkerType: TokenType, tagNameLocalType: TokenType, tagExpressionAttributeType: TokenType, tagExpressionAttributeMarkerType: TokenType, tagExpressionAttributeValueType: TokenType, tagAttributeType: TokenType, tagAttributeNameType: TokenType, tagAttributeNamePrimaryType: TokenType, tagAttributeNamePrefixMarkerType: TokenType, tagAttributeNameLocalType: TokenType, tagAttributeInitializerMarkerType: TokenType, tagAttributeValueLiteralType: TokenType, tagAttributeValueLiteralMarkerType: TokenType, tagAttributeValueLiteralValueType: TokenType, tagAttributeValueExpressionType: TokenType, tagAttributeValueExpressionMarkerType: TokenType, tagAttributeValueExpressionValueType: TokenType): (code: Code) => State | undefined; | ||
import type { Effects } from 'micromark-util-types'; | ||
import type { State } from 'micromark-util-types'; | ||
import type { Acorn } from 'micromark-util-events-to-acorn'; | ||
import type { AcornOptions } from 'micromark-util-events-to-acorn'; | ||
import type { TokenType } from 'micromark-util-types'; | ||
import type { TokenizeContext } from 'micromark-util-types'; | ||
import type { Code } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-factory-mdx-expression').Acorn} Acorn | ||
* @typedef {import('micromark-factory-mdx-expression').AcornOptions} AcornOptions | ||
* @typedef {import('micromark-util-types').Code} Code | ||
* @typedef {import('micromark-util-types').Effects} Effects | ||
* @typedef {import('micromark-util-types').State} State | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
* @typedef {import('micromark-util-types').TokenType} TokenType | ||
* @import {Acorn, AcornOptions} from 'micromark-util-events-to-acorn' | ||
* @import {Code, Effects, State, TokenizeContext, TokenType} from 'micromark-util-types' | ||
*/ | ||
@@ -30,5 +25,5 @@ | ||
* @param {State} nok | ||
* @param {Acorn | undefined} acorn | ||
* @param {AcornOptions | undefined} acornOptions | ||
* @param {boolean | undefined} addResult | ||
* @param {Acorn | null | undefined} acorn | ||
* @param {AcornOptions | null | undefined} acornOptions | ||
* @param {boolean | null | undefined} addResult | ||
* @param {boolean | undefined} allowLazy | ||
@@ -35,0 +30,0 @@ * @param {TokenType} tagType |
@@ -12,20 +12,4 @@ /** | ||
export function jsxFlow(acorn: Acorn | undefined, options: Options): Construct; | ||
export type Acorn = import('micromark-factory-mdx-expression').Acorn; | ||
export type AcornOptions = import('micromark-factory-mdx-expression').AcornOptions; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
/** | ||
* Configuration. | ||
*/ | ||
export type Options = { | ||
/** | ||
* Acorn options. | ||
*/ | ||
acornOptions: AcornOptions | undefined; | ||
/** | ||
* Whether to add `estree` fields to tokens with results from acorn. | ||
*/ | ||
addResult: boolean | undefined; | ||
}; | ||
import type { Acorn } from 'micromark-util-events-to-acorn'; | ||
import type { Options } from 'micromark-extension-mdx-jsx'; | ||
import type { Construct } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-factory-mdx-expression').Acorn} Acorn | ||
* @typedef {import('micromark-factory-mdx-expression').AcornOptions} AcornOptions | ||
* @typedef {import('micromark-util-types').Construct} Construct | ||
* @typedef {import('micromark-util-types').State} State | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer | ||
* @import {Options} from 'micromark-extension-mdx-jsx' | ||
* @import {Acorn} from 'micromark-util-events-to-acorn' | ||
* @import {Construct, State, TokenizeContext, Tokenizer} from 'micromark-util-types' | ||
*/ | ||
/** | ||
* @typedef Options | ||
* Configuration. | ||
* @property {AcornOptions | undefined} acornOptions | ||
* Acorn options. | ||
* @property {boolean | undefined} addResult | ||
* Whether to add `estree` fields to tokens with results from acorn. | ||
*/ | ||
import {ok as assert} from 'devlop' | ||
@@ -154,4 +142,4 @@ import {markdownLineEnding, markdownSpace} from 'micromark-util-character' | ||
: leftBraceValue | ||
? [leftBraceValue] | ||
: [] | ||
? [leftBraceValue] | ||
: [] | ||
const expression = constructs.find((d) => d.name === 'mdxFlowExpression') | ||
@@ -164,8 +152,8 @@ | ||
: code === codes.leftCurlyBrace && expression | ||
? effects.attempt(expression, end, nok)(code) | ||
: code === codes.eof || markdownLineEnding(code) | ||
? ok(code) | ||
: nok(code) | ||
? effects.attempt(expression, end, nok)(code) | ||
: code === codes.eof || markdownLineEnding(code) | ||
? ok(code) | ||
: nok(code) | ||
} | ||
} | ||
} |
@@ -12,19 +12,4 @@ /** | ||
export function jsxText(acorn: Acorn | undefined, options: Options): Construct; | ||
export type Acorn = import('micromark-factory-mdx-expression').Acorn; | ||
export type AcornOptions = import('micromark-factory-mdx-expression').AcornOptions; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
/** | ||
* Configuration. | ||
*/ | ||
export type Options = { | ||
/** | ||
* Acorn options. | ||
*/ | ||
acornOptions: AcornOptions | undefined; | ||
/** | ||
* Whether to add `estree` fields to tokens with results from acorn. | ||
*/ | ||
addResult: boolean | undefined; | ||
}; | ||
import type { Acorn } from 'micromark-util-events-to-acorn'; | ||
import type { Options } from 'micromark-extension-mdx-jsx'; | ||
import type { Construct } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-factory-mdx-expression').Acorn} Acorn | ||
* @typedef {import('micromark-factory-mdx-expression').AcornOptions} AcornOptions | ||
* @typedef {import('micromark-util-types').Construct} Construct | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer | ||
* @import {Options} from 'micromark-extension-mdx-jsx' | ||
* @import {Acorn} from 'micromark-util-events-to-acorn' | ||
* @import {Construct, TokenizeContext, Tokenizer} from 'micromark-util-types' | ||
*/ | ||
/** | ||
* @typedef Options | ||
* Configuration. | ||
* @property {AcornOptions | undefined} acornOptions | ||
* Acorn options. | ||
* @property {boolean | undefined} addResult | ||
* Whether to add `estree` fields to tokens with results from acorn. | ||
*/ | ||
import {factoryTag} from './factory-tag.js' | ||
@@ -19,0 +8,0 @@ |
@@ -11,23 +11,3 @@ /** | ||
export function mdxJsx(options?: Options | null | undefined): Extension; | ||
export type Extension = import('micromark-util-types').Extension; | ||
export type Acorn = import('micromark-factory-mdx-expression').Acorn; | ||
export type AcornOptions = import('micromark-factory-mdx-expression').AcornOptions; | ||
/** | ||
* Configuration (optional). | ||
*/ | ||
export type Options = { | ||
/** | ||
* Acorn parser to use (optional). | ||
*/ | ||
acorn?: Acorn | null | undefined; | ||
/** | ||
* Configuration for acorn (default: `{ecmaVersion: 2024, locations: true, | ||
* sourceType: 'module'}`); all fields except `locations` can be set. | ||
*/ | ||
acornOptions?: AcornOptions | null | undefined; | ||
/** | ||
* Whether to add `estree` fields to tokens with results from acorn | ||
* (default: `false`). | ||
*/ | ||
addResult?: boolean | null | undefined; | ||
}; | ||
import type { Options } from 'micromark-extension-mdx-jsx'; | ||
import type { Extension } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-util-types').Extension} Extension | ||
* @typedef {import('micromark-factory-mdx-expression').Acorn} Acorn | ||
* @typedef {import('micromark-factory-mdx-expression').AcornOptions} AcornOptions | ||
* @import {Options} from 'micromark-extension-mdx-jsx' | ||
* @import {AcornOptions} from 'micromark-util-events-to-acorn' | ||
* @import {Extension} from 'micromark-util-types' | ||
*/ | ||
/** | ||
* @typedef Options | ||
* Configuration (optional). | ||
* @property {Acorn | null | undefined} [acorn] | ||
* Acorn parser to use (optional). | ||
* @property {AcornOptions | null | undefined} [acornOptions] | ||
* Configuration for acorn (default: `{ecmaVersion: 2024, locations: true, | ||
* sourceType: 'module'}`); all fields except `locations` can be set. | ||
* @property {boolean | null | undefined} [addResult=false] | ||
* Whether to add `estree` fields to tokens with results from acorn | ||
* (default: `false`). | ||
*/ | ||
import {codes} from 'micromark-util-symbol' | ||
@@ -21,0 +8,0 @@ import {jsxText} from './jsx-text.js' |
import type {Program} from 'estree' | ||
import type {Acorn, AcornOptions} from 'micromark-util-events-to-acorn' | ||
export {mdxJsx, type Options} from './lib/syntax.js' | ||
export {mdxJsx} from './lib/syntax.js' | ||
/** | ||
* Configuration (optional). | ||
*/ | ||
export interface Options { | ||
/** | ||
* Acorn parser to use (optional). | ||
*/ | ||
acorn?: Acorn | null | undefined | ||
/** | ||
* Configuration for acorn (default: `{ecmaVersion: 2024, locations: true, | ||
* sourceType: 'module'}`); all fields except `locations` can be set. | ||
*/ | ||
acornOptions?: AcornOptions | null | undefined | ||
/** | ||
* Whether to add `estree` fields to tokens with results from acorn | ||
* (default: `false`). | ||
*/ | ||
addResult?: boolean | null | undefined | ||
} | ||
/** | ||
* Augment types. | ||
*/ | ||
declare module 'micromark-util-types' { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
/** | ||
* Token fields. | ||
*/ | ||
interface Token { | ||
@@ -11,3 +37,5 @@ estree?: Program | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
/** | ||
* Token types. | ||
*/ | ||
interface TokenTypeMap { | ||
@@ -14,0 +42,0 @@ esWhitespace: 'esWhitespace' |
@@ -6,5 +6,5 @@ /** | ||
* @param {State} nok | ||
* @param {Acorn | undefined} acorn | ||
* @param {AcornOptions | undefined} acornOptions | ||
* @param {boolean | undefined} addResult | ||
* @param {Acorn | null | undefined} acorn | ||
* @param {AcornOptions | null | undefined} acornOptions | ||
* @param {boolean | null | undefined} addResult | ||
* @param {boolean | undefined} allowLazy | ||
@@ -37,9 +37,9 @@ * @param {TokenType} tagType | ||
*/ | ||
export function factoryTag(this: import("micromark-util-types").TokenizeContext, effects: Effects, ok: State, nok: State, acorn: Acorn | undefined, acornOptions: AcornOptions | undefined, addResult: boolean | undefined, allowLazy: boolean | undefined, tagType: TokenType, tagMarkerType: TokenType, tagClosingMarkerType: TokenType, tagSelfClosingMarker: TokenType, tagNameType: TokenType, tagNamePrimaryType: TokenType, tagNameMemberMarkerType: TokenType, tagNameMemberType: TokenType, tagNamePrefixMarkerType: TokenType, tagNameLocalType: TokenType, tagExpressionAttributeType: TokenType, tagExpressionAttributeMarkerType: TokenType, tagExpressionAttributeValueType: TokenType, tagAttributeType: TokenType, tagAttributeNameType: TokenType, tagAttributeNamePrimaryType: TokenType, tagAttributeNamePrefixMarkerType: TokenType, tagAttributeNameLocalType: TokenType, tagAttributeInitializerMarkerType: TokenType, tagAttributeValueLiteralType: TokenType, tagAttributeValueLiteralMarkerType: TokenType, tagAttributeValueLiteralValueType: TokenType, tagAttributeValueExpressionType: TokenType, tagAttributeValueExpressionMarkerType: TokenType, tagAttributeValueExpressionValueType: TokenType): (code: import("micromark-util-types").Code) => import("micromark-util-types").State | undefined; | ||
export type Acorn = import('micromark-factory-mdx-expression').Acorn; | ||
export type AcornOptions = import('micromark-factory-mdx-expression').AcornOptions; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Effects = import('micromark-util-types').Effects; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type TokenType = import('micromark-util-types').TokenType; | ||
export function factoryTag(this: TokenizeContext, effects: Effects, ok: State, nok: State, acorn: Acorn | null | undefined, acornOptions: AcornOptions | null | undefined, addResult: boolean | null | undefined, allowLazy: boolean | undefined, tagType: TokenType, tagMarkerType: TokenType, tagClosingMarkerType: TokenType, tagSelfClosingMarker: TokenType, tagNameType: TokenType, tagNamePrimaryType: TokenType, tagNameMemberMarkerType: TokenType, tagNameMemberType: TokenType, tagNamePrefixMarkerType: TokenType, tagNameLocalType: TokenType, tagExpressionAttributeType: TokenType, tagExpressionAttributeMarkerType: TokenType, tagExpressionAttributeValueType: TokenType, tagAttributeType: TokenType, tagAttributeNameType: TokenType, tagAttributeNamePrimaryType: TokenType, tagAttributeNamePrefixMarkerType: TokenType, tagAttributeNameLocalType: TokenType, tagAttributeInitializerMarkerType: TokenType, tagAttributeValueLiteralType: TokenType, tagAttributeValueLiteralMarkerType: TokenType, tagAttributeValueLiteralValueType: TokenType, tagAttributeValueExpressionType: TokenType, tagAttributeValueExpressionMarkerType: TokenType, tagAttributeValueExpressionValueType: TokenType): (code: Code) => State | undefined; | ||
import type { Effects } from 'micromark-util-types'; | ||
import type { State } from 'micromark-util-types'; | ||
import type { Acorn } from 'micromark-util-events-to-acorn'; | ||
import type { AcornOptions } from 'micromark-util-events-to-acorn'; | ||
import type { TokenType } from 'micromark-util-types'; | ||
import type { TokenizeContext } from 'micromark-util-types'; | ||
import type { Code } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-factory-mdx-expression').Acorn} Acorn | ||
* @typedef {import('micromark-factory-mdx-expression').AcornOptions} AcornOptions | ||
* @typedef {import('micromark-util-types').Code} Code | ||
* @typedef {import('micromark-util-types').Effects} Effects | ||
* @typedef {import('micromark-util-types').State} State | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
* @typedef {import('micromark-util-types').TokenType} TokenType | ||
* @import {Acorn, AcornOptions} from 'micromark-util-events-to-acorn' | ||
* @import {Code, Effects, State, TokenizeContext, TokenType} from 'micromark-util-types' | ||
*/ | ||
@@ -22,5 +17,5 @@ | ||
* @param {State} nok | ||
* @param {Acorn | undefined} acorn | ||
* @param {AcornOptions | undefined} acornOptions | ||
* @param {boolean | undefined} addResult | ||
* @param {Acorn | null | undefined} acorn | ||
* @param {AcornOptions | null | undefined} acornOptions | ||
* @param {boolean | null | undefined} addResult | ||
* @param {boolean | undefined} allowLazy | ||
@@ -27,0 +22,0 @@ * @param {TokenType} tagType |
@@ -12,20 +12,4 @@ /** | ||
export function jsxFlow(acorn: Acorn | undefined, options: Options): Construct; | ||
export type Acorn = import('micromark-factory-mdx-expression').Acorn; | ||
export type AcornOptions = import('micromark-factory-mdx-expression').AcornOptions; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
/** | ||
* Configuration. | ||
*/ | ||
export type Options = { | ||
/** | ||
* Acorn options. | ||
*/ | ||
acornOptions: AcornOptions | undefined; | ||
/** | ||
* Whether to add `estree` fields to tokens with results from acorn. | ||
*/ | ||
addResult: boolean | undefined; | ||
}; | ||
import type { Acorn } from 'micromark-util-events-to-acorn'; | ||
import type { Options } from 'micromark-extension-mdx-jsx'; | ||
import type { Construct } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-factory-mdx-expression').Acorn} Acorn | ||
* @typedef {import('micromark-factory-mdx-expression').AcornOptions} AcornOptions | ||
* @typedef {import('micromark-util-types').Construct} Construct | ||
* @typedef {import('micromark-util-types').State} State | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer | ||
* @import {Options} from 'micromark-extension-mdx-jsx' | ||
* @import {Acorn} from 'micromark-util-events-to-acorn' | ||
* @import {Construct, State, TokenizeContext, Tokenizer} from 'micromark-util-types' | ||
*/ | ||
/** | ||
* @typedef Options | ||
* Configuration. | ||
* @property {AcornOptions | undefined} acornOptions | ||
* Acorn options. | ||
* @property {boolean | undefined} addResult | ||
* Whether to add `estree` fields to tokens with results from acorn. | ||
*/ | ||
import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; | ||
@@ -20,0 +8,0 @@ import { factorySpace } from 'micromark-factory-space'; |
@@ -12,19 +12,4 @@ /** | ||
export function jsxText(acorn: Acorn | undefined, options: Options): Construct; | ||
export type Acorn = import('micromark-factory-mdx-expression').Acorn; | ||
export type AcornOptions = import('micromark-factory-mdx-expression').AcornOptions; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
/** | ||
* Configuration. | ||
*/ | ||
export type Options = { | ||
/** | ||
* Acorn options. | ||
*/ | ||
acornOptions: AcornOptions | undefined; | ||
/** | ||
* Whether to add `estree` fields to tokens with results from acorn. | ||
*/ | ||
addResult: boolean | undefined; | ||
}; | ||
import type { Acorn } from 'micromark-util-events-to-acorn'; | ||
import type { Options } from 'micromark-extension-mdx-jsx'; | ||
import type { Construct } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-factory-mdx-expression').Acorn} Acorn | ||
* @typedef {import('micromark-factory-mdx-expression').AcornOptions} AcornOptions | ||
* @typedef {import('micromark-util-types').Construct} Construct | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer | ||
* @import {Options} from 'micromark-extension-mdx-jsx' | ||
* @import {Acorn} from 'micromark-util-events-to-acorn' | ||
* @import {Construct, TokenizeContext, Tokenizer} from 'micromark-util-types' | ||
*/ | ||
/** | ||
* @typedef Options | ||
* Configuration. | ||
* @property {AcornOptions | undefined} acornOptions | ||
* Acorn options. | ||
* @property {boolean | undefined} addResult | ||
* Whether to add `estree` fields to tokens with results from acorn. | ||
*/ | ||
import { factoryTag } from './factory-tag.js'; | ||
@@ -19,0 +8,0 @@ |
@@ -11,23 +11,3 @@ /** | ||
export function mdxJsx(options?: Options | null | undefined): Extension; | ||
export type Extension = import('micromark-util-types').Extension; | ||
export type Acorn = import('micromark-factory-mdx-expression').Acorn; | ||
export type AcornOptions = import('micromark-factory-mdx-expression').AcornOptions; | ||
/** | ||
* Configuration (optional). | ||
*/ | ||
export type Options = { | ||
/** | ||
* Acorn parser to use (optional). | ||
*/ | ||
acorn?: Acorn | null | undefined; | ||
/** | ||
* Configuration for acorn (default: `{ecmaVersion: 2024, locations: true, | ||
* sourceType: 'module'}`); all fields except `locations` can be set. | ||
*/ | ||
acornOptions?: AcornOptions | null | undefined; | ||
/** | ||
* Whether to add `estree` fields to tokens with results from acorn | ||
* (default: `false`). | ||
*/ | ||
addResult?: boolean | null | undefined; | ||
}; | ||
import type { Options } from 'micromark-extension-mdx-jsx'; | ||
import type { Extension } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-util-types').Extension} Extension | ||
* @typedef {import('micromark-factory-mdx-expression').Acorn} Acorn | ||
* @typedef {import('micromark-factory-mdx-expression').AcornOptions} AcornOptions | ||
* @import {Options} from 'micromark-extension-mdx-jsx' | ||
* @import {AcornOptions} from 'micromark-util-events-to-acorn' | ||
* @import {Extension} from 'micromark-util-types' | ||
*/ | ||
/** | ||
* @typedef Options | ||
* Configuration (optional). | ||
* @property {Acorn | null | undefined} [acorn] | ||
* Acorn parser to use (optional). | ||
* @property {AcornOptions | null | undefined} [acornOptions] | ||
* Configuration for acorn (default: `{ecmaVersion: 2024, locations: true, | ||
* sourceType: 'module'}`); all fields except `locations` can be set. | ||
* @property {boolean | null | undefined} [addResult=false] | ||
* Whether to add `estree` fields to tokens with results from acorn | ||
* (default: `false`). | ||
*/ | ||
import { jsxText } from './jsx-text.js'; | ||
@@ -21,0 +8,0 @@ import { jsxFlow } from './jsx-flow.js'; |
{ | ||
"name": "micromark-extension-mdx-jsx", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "micromark extension to support MDX or MDX.js JSX", | ||
@@ -49,2 +49,3 @@ "license": "MIT", | ||
"micromark-util-character": "^2.0.0", | ||
"micromark-util-events-to-acorn": "^2.0.0", | ||
"micromark-util-symbol": "^2.0.0", | ||
@@ -58,6 +59,6 @@ "micromark-util-types": "^2.0.0", | ||
"@types/mdast": "^4.0.0", | ||
"@types/node": "^20.0.0", | ||
"@types/node": "^22.0.0", | ||
"acorn": "^8.0.0", | ||
"acorn-jsx": "^5.0.0", | ||
"c8": "^8.0.0", | ||
"c8": "^10.0.0", | ||
"estree-util-visit": "^2.0.0", | ||
@@ -69,7 +70,7 @@ "mdast-zone": "^6.0.0", | ||
"prettier": "^3.0.0", | ||
"remark-cli": "^11.0.0", | ||
"remark-preset-wooorm": "^9.0.0", | ||
"remark-cli": "^12.0.0", | ||
"remark-preset-wooorm": "^10.0.0", | ||
"type-coverage": "^2.0.0", | ||
"typescript": "^5.0.0", | ||
"xo": "^0.56.0" | ||
"xo": "^0.59.0" | ||
}, | ||
@@ -107,2 +108,27 @@ "scripts": { | ||
"xo": { | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"**/*.d.ts" | ||
], | ||
"rules": { | ||
"@typescript-eslint/array-type": [ | ||
"error", | ||
{ | ||
"default": "generic" | ||
} | ||
], | ||
"@typescript-eslint/ban-types": [ | ||
"error", | ||
{ | ||
"extendDefaults": true | ||
} | ||
], | ||
"@typescript-eslint/consistent-type-definitions": [ | ||
"error", | ||
"interface" | ||
] | ||
} | ||
} | ||
], | ||
"prettier": true, | ||
@@ -109,0 +135,0 @@ "rules": { |
202
readme.md
@@ -15,22 +15,22 @@ # micromark-extension-mdx-jsx | ||
* [What is this?](#what-is-this) | ||
* [When to use this](#when-to-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [`mdxJsx(options?)`](#mdxjsxoptions) | ||
* [`Options`](#options) | ||
* [Authoring](#authoring) | ||
* [Syntax](#syntax) | ||
* [Errors](#errors) | ||
* [Unexpected end of file $at, expected $expect](#unexpected-end-of-file-at-expected-expect) | ||
* [Unexpected character $at, expected $expect](#unexpected-character-at-expected-expect) | ||
* [Unexpected lazy line in container, expected line to be…](#unexpected-lazy-line-in-container-expected-line-to-be) | ||
* [Tokens](#tokens) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Related](#related) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
* [What is this?](#what-is-this) | ||
* [When to use this](#when-to-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [`mdxJsx(options?)`](#mdxjsxoptions) | ||
* [`Options`](#options) | ||
* [Authoring](#authoring) | ||
* [Syntax](#syntax) | ||
* [Errors](#errors) | ||
* [Unexpected end of file $at, expected $expect](#unexpected-end-of-file-at-expected-expect) | ||
* [Unexpected character $at, expected $expect](#unexpected-character-at-expected-expect) | ||
* [Unexpected lazy line in container, expected line to be…](#unexpected-lazy-line-in-container-expected-line-to-be) | ||
* [Tokens](#tokens) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Related](#related) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
@@ -123,4 +123,4 @@ ## What is this? | ||
* `options` ([`Options`][api-options], optional) | ||
— configuration | ||
* `options` ([`Options`][api-options], optional) | ||
— configuration | ||
@@ -138,9 +138,9 @@ ###### Returns | ||
* `acorn` ([`Acorn`][acorn], optional) | ||
— acorn parser to use | ||
* `acornOptions` ([`AcornOptions`][acorn-options], default: | ||
`{ecmaVersion: 2024, locations: true, sourceType: 'module'}`) | ||
— configuration for acorn; all fields except `locations` can be set | ||
* `addResult` (`boolean`, default: `false`) | ||
— whether to add `estree` fields to tokens with results from acorn | ||
* `acorn` ([`Acorn`][acorn], optional) | ||
— acorn parser to use | ||
* `acornOptions` ([`AcornOptions`][acorn-options], default: | ||
`{ecmaVersion: 2024, locations: true, sourceType: 'module'}`) | ||
— configuration for acorn; all fields except `locations` can be set | ||
* `addResult` (`boolean`, default: `false`) | ||
— whether to add `estree` fields to tokens with results from acorn | ||
@@ -355,68 +355,68 @@ ## Authoring | ||
* `mdxJsxFlowTag` for the whole JSX tag (`<a>`) | ||
* `mdxJsxTextTag` ^ | ||
* `mdxJsxFlowTagMarker` for the tag markers (`<`, `>`) | ||
* `mdxJsxTextTagMarker` ^ | ||
* `mdxJsxFlowTagClosingMarker` for the `/` marking a closing tag (`</a>`) | ||
* `mdxJsxTextTagClosingMarker` ^ | ||
* `mdxJsxFlowTagSelfClosingMarker` for the `/` marking a self-closing tag | ||
(`<a/>`) | ||
* `mdxJsxTextTagSelfClosingMarker` ^ | ||
* `mdxJsxFlowTagName` for the whole tag name (`a:b` in `<a:b>`) | ||
* `mdxJsxTextTagName` ^ | ||
* `mdxJsxFlowTagNamePrimary` for the first name (`a` in `<a:b>`) | ||
* `mdxJsxTextTagNamePrimary` ^ | ||
* `mdxJsxFlowTagNameMemberMarker` for the `.` marking in members (`<a.b>`) | ||
* `mdxJsxTextTagNameMemberMarker` ^ | ||
* `mdxJsxFlowTagNameMember` for member names (`b` in `<a:b>`) | ||
* `mdxJsxTextTagNameMember` ^ | ||
* `mdxJsxFlowTagNamePrefixMarker` for the `:` between primary and local | ||
(`<a:b>`) | ||
* `mdxJsxTextTagNamePrefixMarker` ^ | ||
* `mdxJsxFlowTagNameLocal` for the local name (`b` in `<a:b>`) | ||
* `mdxJsxTextTagNameLocal` ^ | ||
* `mdxJsxFlowTagExpressionAttribute` for whole expression attributes | ||
(`<a {...b}>`) | ||
* `mdxJsxTextTagExpressionAttribute` ^ | ||
* `mdxJsxFlowTagExpressionAttributeMarker` for `{`, `}` in expression | ||
attributes | ||
* `mdxJsxTextTagExpressionAttributeMarker` ^ | ||
* `mdxJsxFlowTagExpressionAttributeValue` for chunks of what’s inside | ||
expression attributes | ||
* `mdxJsxTextTagExpressionAttributeValue` ^ | ||
* `mdxJsxFlowTagAttribute` for a whole normal attribute (`<a b>`) | ||
* `mdxJsxTextTagAttribute` ^ | ||
* `mdxJsxFlowTagAttributeName` for the whole name of an attribute (`b:c` in | ||
`<a b:c>`) | ||
* `mdxJsxTextTagAttributeName` ^ | ||
* `mdxJsxFlowTagAttributeNamePrimary` for the first name of an attribute (`b` | ||
in `<a b:c>`) | ||
* `mdxJsxTextTagAttributeNamePrimary` ^ | ||
* `mdxJsxFlowTagAttributeNamePrefixMarker` for the `:` between primary and | ||
local (`<a b:c>`) | ||
* `mdxJsxTextTagAttributeNamePrefixMarker` ^ | ||
* `mdxJsxFlowTagAttributeNameLocal` for the local name of an attribute (`c` | ||
in `<a b:c>`) | ||
* `mdxJsxTextTagAttributeNameLocal` ^ | ||
* `mdxJsxFlowTagAttributeInitializerMarker` for the `=` between an attribute | ||
name and value | ||
* `mdxJsxTextTagAttributeInitializerMarker` ^ | ||
* `mdxJsxFlowTagAttributeValueLiteral` for a string attribute value | ||
(`<a b="">`) | ||
* `mdxJsxTextTagAttributeValueLiteral` ^ | ||
* `mdxJsxFlowTagAttributeValueLiteralMarker` for the quotes around a string | ||
attribute value (`"` or `'`) | ||
* `mdxJsxTextTagAttributeValueLiteralMarker` ^ | ||
* `mdxJsxFlowTagAttributeValueLiteralValue` for chunks of what’s inside | ||
string attribute values | ||
* `mdxJsxTextTagAttributeValueLiteralValue` ^ | ||
* `mdxJsxFlowTagAttributeValueExpression` for an expression attribute value | ||
(`<a b={1}>`) | ||
* `mdxJsxTextTagAttributeValueExpression` ^ | ||
* `mdxJsxFlowTagAttributeValueExpressionMarker` for the `{` and `}` of | ||
expression attribute values | ||
* `mdxJsxTextTagAttributeValueExpressionMarker` ^ | ||
* `mdxJsxFlowTagAttributeValueExpressionValue` for chunks of what’s inside | ||
expression attribute values | ||
* `mdxJsxTextTagAttributeValueExpressionValue` ^ | ||
* `mdxJsxFlowTag` for the whole JSX tag (`<a>`) | ||
* `mdxJsxTextTag` ^ | ||
* `mdxJsxFlowTagMarker` for the tag markers (`<`, `>`) | ||
* `mdxJsxTextTagMarker` ^ | ||
* `mdxJsxFlowTagClosingMarker` for the `/` marking a closing tag (`</a>`) | ||
* `mdxJsxTextTagClosingMarker` ^ | ||
* `mdxJsxFlowTagSelfClosingMarker` for the `/` marking a self-closing tag | ||
(`<a/>`) | ||
* `mdxJsxTextTagSelfClosingMarker` ^ | ||
* `mdxJsxFlowTagName` for the whole tag name (`a:b` in `<a:b>`) | ||
* `mdxJsxTextTagName` ^ | ||
* `mdxJsxFlowTagNamePrimary` for the first name (`a` in `<a:b>`) | ||
* `mdxJsxTextTagNamePrimary` ^ | ||
* `mdxJsxFlowTagNameMemberMarker` for the `.` marking in members (`<a.b>`) | ||
* `mdxJsxTextTagNameMemberMarker` ^ | ||
* `mdxJsxFlowTagNameMember` for member names (`b` in `<a:b>`) | ||
* `mdxJsxTextTagNameMember` ^ | ||
* `mdxJsxFlowTagNamePrefixMarker` for the `:` between primary and local | ||
(`<a:b>`) | ||
* `mdxJsxTextTagNamePrefixMarker` ^ | ||
* `mdxJsxFlowTagNameLocal` for the local name (`b` in `<a:b>`) | ||
* `mdxJsxTextTagNameLocal` ^ | ||
* `mdxJsxFlowTagExpressionAttribute` for whole expression attributes | ||
(`<a {...b}>`) | ||
* `mdxJsxTextTagExpressionAttribute` ^ | ||
* `mdxJsxFlowTagExpressionAttributeMarker` for `{`, `}` in expression | ||
attributes | ||
* `mdxJsxTextTagExpressionAttributeMarker` ^ | ||
* `mdxJsxFlowTagExpressionAttributeValue` for chunks of what’s inside | ||
expression attributes | ||
* `mdxJsxTextTagExpressionAttributeValue` ^ | ||
* `mdxJsxFlowTagAttribute` for a whole normal attribute (`<a b>`) | ||
* `mdxJsxTextTagAttribute` ^ | ||
* `mdxJsxFlowTagAttributeName` for the whole name of an attribute (`b:c` in | ||
`<a b:c>`) | ||
* `mdxJsxTextTagAttributeName` ^ | ||
* `mdxJsxFlowTagAttributeNamePrimary` for the first name of an attribute (`b` | ||
in `<a b:c>`) | ||
* `mdxJsxTextTagAttributeNamePrimary` ^ | ||
* `mdxJsxFlowTagAttributeNamePrefixMarker` for the `:` between primary and | ||
local (`<a b:c>`) | ||
* `mdxJsxTextTagAttributeNamePrefixMarker` ^ | ||
* `mdxJsxFlowTagAttributeNameLocal` for the local name of an attribute (`c` | ||
in `<a b:c>`) | ||
* `mdxJsxTextTagAttributeNameLocal` ^ | ||
* `mdxJsxFlowTagAttributeInitializerMarker` for the `=` between an attribute | ||
name and value | ||
* `mdxJsxTextTagAttributeInitializerMarker` ^ | ||
* `mdxJsxFlowTagAttributeValueLiteral` for a string attribute value | ||
(`<a b="">`) | ||
* `mdxJsxTextTagAttributeValueLiteral` ^ | ||
* `mdxJsxFlowTagAttributeValueLiteralMarker` for the quotes around a string | ||
attribute value (`"` or `'`) | ||
* `mdxJsxTextTagAttributeValueLiteralMarker` ^ | ||
* `mdxJsxFlowTagAttributeValueLiteralValue` for chunks of what’s inside | ||
string attribute values | ||
* `mdxJsxTextTagAttributeValueLiteralValue` ^ | ||
* `mdxJsxFlowTagAttributeValueExpression` for an expression attribute value | ||
(`<a b={1}>`) | ||
* `mdxJsxTextTagAttributeValueExpression` ^ | ||
* `mdxJsxFlowTagAttributeValueExpressionMarker` for the `{` and `}` of | ||
expression attribute values | ||
* `mdxJsxTextTagAttributeValueExpressionMarker` ^ | ||
* `mdxJsxFlowTagAttributeValueExpressionValue` for chunks of what’s inside | ||
expression attribute values | ||
* `mdxJsxTextTagAttributeValueExpressionValue` ^ | ||
@@ -446,8 +446,8 @@ ## Types | ||
* [`micromark-extension-mdxjs`][micromark-extension-mdxjs] | ||
— support all MDX syntax | ||
* [`mdast-util-mdx-jsx`][mdast-util-mdx-jsx] | ||
— support MDX JSX in mdast | ||
* [`remark-mdx`][remark-mdx] | ||
— support all MDX syntax in remark | ||
* [`micromark-extension-mdxjs`][micromark-extension-mdxjs] | ||
— support all MDX syntax | ||
* [`mdast-util-mdx-jsx`][mdast-util-mdx-jsx] | ||
— support MDX JSX in mdast | ||
* [`remark-mdx`][remark-mdx] | ||
— support all MDX syntax in remark | ||
@@ -454,0 +454,0 @@ ## Contribute |
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
107592
11
2606