UNPKG

next-mdx-remote-client

Version:

A wrapper of the `@mdx-js/mdx` for the `nextjs` applications in order to load MDX content. It is a fork of `next-mdx-remote`.

47 lines (46 loc) 1.38 kB
/** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 * * reference to https://github.com/hashicorp/next-mdx-remote/blob/main/src/format-mdx-error.ts * * improved the types */ type Position = { start: { line: number; column: number; }; }; type PositionedError = Error & { position?: Position; }; /** * prints a nicely formatted error message from an error caught during MDX compilation. * * @param error Error caught from the mdx compiler * @param source Raw MDX string * @returns Error */ export declare function createFormattedMDXError(error: PositionedError, source: string): Error; /** * Copyright (c) @talatkuyuk AKA @ipikuka * SPDX-License-Identifier: MPL-2.0 */ export type VfileDataIntoScope = true | string | { name: string; as: string; } | Array<string | { name: string; as: string; }>; /** * copies some fields of vfile.data into scope by mutating the scope * pay attention that it provides reference copy for objects (including arrays) * * @param data vfile.data from copied * @param vfileDataIntoScope refers the fields of vfile.data, some or all (if true) * @param scope an object to copied in a mutable way */ export declare function passVfileDataIntoScope(data: Record<string, unknown>, vfileDataIntoScope: VfileDataIntoScope, scope: Record<string, unknown>): undefined; export {};