Comparing version 2.0.6 to 2.1.0
@@ -0,1 +1,2 @@ | ||
/// <reference types="./registry" /> | ||
export {createProcessor} from './lib/core.js' | ||
@@ -2,0 +3,0 @@ export {compile, compileSync} from './lib/compile.js' |
@@ -6,3 +6,3 @@ /** | ||
* @param {EvaluateOptions} evaluateOptions | ||
* @return {Promise<ExportMap>} | ||
* @return {Promise<MdxModule>} | ||
*/ | ||
@@ -12,3 +12,3 @@ export function evaluate( | ||
evaluateOptions: EvaluateOptions | ||
): Promise<ExportMap> | ||
): Promise<MdxModule> | ||
/** | ||
@@ -19,3 +19,3 @@ * Synchronously evaluate MDX. | ||
* @param {EvaluateOptions} evaluateOptions | ||
* @return {ExportMap} | ||
* @return {MdxModule} | ||
*/ | ||
@@ -25,17 +25,7 @@ export function evaluateSync( | ||
evaluateOptions: EvaluateOptions | ||
): ExportMap | ||
): MdxModule | ||
export type VFileCompatible = import('vfile').VFileCompatible | ||
export type EvaluateOptions = | ||
import('./util/resolve-evaluate-options.js').EvaluateOptions | ||
export type ComponentMap = { | ||
[name: string]: any | ||
} | ||
export type MDXContentProps = { | ||
[props: string]: any | ||
components?: ComponentMap | undefined | ||
} | ||
export type MDXContent = (props: MDXContentProps) => any | ||
export type ExportMap = { | ||
[exports: string]: unknown | ||
default: MDXContent | ||
} | ||
export type MdxModule = import('../complex-types').MdxModule | ||
export type MdxContent = import('../complex-types').MdxContent |
/** | ||
* @typedef {import('vfile').VFileCompatible} VFileCompatible | ||
* @typedef {import('./util/resolve-evaluate-options.js').EvaluateOptions} EvaluateOptions | ||
* | ||
* @typedef {{[name: string]: any}} ComponentMap | ||
* @typedef {{[props: string]: any, components?: ComponentMap}} MDXContentProps | ||
* @typedef {(props: MDXContentProps) => any} MDXContent | ||
* @typedef {{[exports: string]: unknown, default: MDXContent}} ExportMap | ||
* @typedef {import('../complex-types').MdxModule} MdxModule | ||
* @typedef {import('../complex-types').MdxContent} MdxContent | ||
*/ | ||
@@ -20,3 +17,3 @@ | ||
* @param {EvaluateOptions} evaluateOptions | ||
* @return {Promise<ExportMap>} | ||
* @return {Promise<MdxModule>} | ||
*/ | ||
@@ -35,3 +32,3 @@ export async function evaluate(vfileCompatible, evaluateOptions) { | ||
* @param {EvaluateOptions} evaluateOptions | ||
* @return {ExportMap} | ||
* @return {MdxModule} | ||
*/ | ||
@@ -38,0 +35,0 @@ export function evaluateSync(vfileCompatible, evaluateOptions) { |
/** | ||
* Asynchronously run code. | ||
* | ||
* @param {VFile} file JS document to run | ||
* @param {{toString(): string}} file JS document to run | ||
* @param {unknown} options | ||
* @return {Promise<*>} | ||
*/ | ||
export function run(file: VFile, options: unknown): Promise<any> | ||
export function run( | ||
file: { | ||
toString(): string | ||
}, | ||
options: unknown | ||
): Promise<any> | ||
/** | ||
* Synchronously run code. | ||
* | ||
* @param {VFile} file JS document to run | ||
* @param {{toString(): string}} file JS document to run | ||
* @param {unknown} options | ||
* @return {*} | ||
*/ | ||
export function runSync(file: VFile, options: unknown): any | ||
export function runSync( | ||
file: { | ||
toString(): string | ||
}, | ||
options: unknown | ||
): any | ||
export type VFile = import('vfile').VFile |
@@ -11,3 +11,3 @@ /** | ||
* | ||
* @param {VFile} file JS document to run | ||
* @param {{toString(): string}} file JS document to run | ||
* @param {unknown} options | ||
@@ -25,3 +25,3 @@ * @return {Promise<*>} | ||
* | ||
* @param {VFile} file JS document to run | ||
* @param {{toString(): string}} file JS document to run | ||
* @param {unknown} options | ||
@@ -28,0 +28,0 @@ * @return {*} |
/** | ||
* @typedef {import('../core.js').ProcessorOptions} ProcessorOptions | ||
* | ||
* @typedef RunnerOptions | ||
* @typedef RuntimeOptions | ||
* @property {*} Fragment Symbol to use for fragments | ||
* @property {*} jsx Function to generate an element with static children | ||
* @property {*} jsxs Function to generate an element with dynamic children | ||
* | ||
* @typedef ProviderOptions | ||
* @property {*} [useMDXComponents] Function to get `MDXComponents` from context | ||
* | ||
* @typedef {RuntimeOptions & ProviderOptions} RunnerOptions | ||
* | ||
* @typedef {Omit<ProcessorOptions, 'jsx' | 'jsxImportSource' | 'jsxRuntime' | 'pragma' | 'pragmaFrag' | 'pragmaImportSource' | 'providerImportSource' | 'outputFormat'> } EvaluateProcessorOptions | ||
@@ -25,3 +29,3 @@ * | ||
export type ProcessorOptions = import('../core.js').ProcessorOptions | ||
export type RunnerOptions = { | ||
export type RuntimeOptions = { | ||
/** | ||
@@ -39,2 +43,4 @@ * Symbol to use for fragments | ||
jsxs: any | ||
} | ||
export type ProviderOptions = { | ||
/** | ||
@@ -45,2 +51,3 @@ * Function to get `MDXComponents` from context | ||
} | ||
export type RunnerOptions = RuntimeOptions & ProviderOptions | ||
export type EvaluateProcessorOptions = Omit< | ||
@@ -47,0 +54,0 @@ ProcessorOptions, |
/** | ||
* @typedef {import('../core.js').ProcessorOptions} ProcessorOptions | ||
* | ||
* @typedef RunnerOptions | ||
* @typedef RuntimeOptions | ||
* @property {*} Fragment Symbol to use for fragments | ||
* @property {*} jsx Function to generate an element with static children | ||
* @property {*} jsxs Function to generate an element with dynamic children | ||
* | ||
* @typedef ProviderOptions | ||
* @property {*} [useMDXComponents] Function to get `MDXComponents` from context | ||
* | ||
* @typedef {RuntimeOptions & ProviderOptions} RunnerOptions | ||
* | ||
* @typedef {Omit<ProcessorOptions, 'jsx' | 'jsxImportSource' | 'jsxRuntime' | 'pragma' | 'pragmaFrag' | 'pragmaImportSource' | 'providerImportSource' | 'outputFormat'> } EvaluateProcessorOptions | ||
@@ -24,3 +28,4 @@ * | ||
if (!Fragment) throw new Error('Expected `Fragment` given to `evaluate`') | ||
if (!options || !('Fragment' in options)) | ||
throw new Error('Expected `Fragment` given to `evaluate`') | ||
if (!jsx) throw new Error('Expected `jsx` given to `evaluate`') | ||
@@ -27,0 +32,0 @@ if (!jsxs) throw new Error('Expected `jsxs` given to `evaluate`') |
{ | ||
"name": "xdm", | ||
"version": "2.0.6", | ||
"version": "2.1.0", | ||
"description": "an MDX compiler", | ||
@@ -28,2 +28,4 @@ "license": "MIT", | ||
"lib/", | ||
"complex-types.d.ts", | ||
"registry.d.ts", | ||
"esbuild.js", | ||
@@ -111,3 +113,3 @@ "esbuild.d.ts", | ||
"prepack": "npm run build && npm run format", | ||
"build": "rimraf \"{lib/**/**,test/**/**,script/**,}*.d.ts\" && tsc && type-coverage", | ||
"build": "rimraf \"{lib/**/**,test/**/**,script/**}*.d.ts\" \"{esbuild,esm-loader,index,rollup}.d.ts\" && tsc && type-coverage", | ||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", | ||
@@ -114,0 +116,0 @@ "test-api": "node --no-warnings --experimental-loader=./esm-loader.js test/index.js && node test/register.cjs", |
Sorry, the diff of this file is too big to display
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
175090
67
3015
2448