Files
2026-01-19 19:13:27 +01:00

51 lines
1.8 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type * as estree from 'estree';
import type * as hast from 'hast';
import type * as mdast from 'mdast';
import { type VFile } from 'vfile';
export declare namespace define {
/**
* A mapping of variables to define. They keys are the names. The values are the ESTree expression
* to represent them.
*/
type Variables = Record<string, estree.Expression>;
/**
* Options for {@link define}
*/
interface Options {
/**
* If and how to export the variable.
*
* - `'module'`: Export the value using an ESM const export declaration.
* - `'namespace'`: Attach the value as a property on `MDXContent`.
* - `false`: Define the variable locally, but dont export it.
*
* @default 'module'
*/
export?: 'module' | 'namespace' | false | undefined;
/**
* What to do if theres a name conflict.
*
* - `'skip'`: Dont insert the variable if theres a name conflict.
* - `'throw'`: Throw if theres a name conflict.
* - `'warn'`: Emit a vfile warning, but dont throw.
*
* @default 'throw'
*/
conflict?: 'skip' | 'throw' | 'warn' | undefined;
}
}
/**
* Define variables in an MDX related AST.
*
* @param ast
* The AST in which to define an export
* @param file
* The {@link VFile} to emit warnings to.
* @param variables
* A mapping of variables to define. They keys are the names. The values are the ESTree expression
* to represent them.
* @param options
* Additional options to configure behaviour.
*/
export declare function define(ast: estree.Program | hast.Root | mdast.Root, file: VFile, variables: define.Variables, options?: define.Options | undefined): undefined;
//# sourceMappingURL=unist-util-mdx-define.d.ts.map