@mintlify/common
Version:
Commonly shared code within Mintlify
32 lines (31 loc) • 963 B
TypeScript
import type { FindAndRemoveImportsResponse } from '../../types/mdx/index.js';
/**
An import like "import {Chart} from './chart.mdx'" looks like this in the AST:
{
type: 'mdxjsEsm',
data: {
estree: {
type: 'Program',
sourceType: 'module',
body: [{
type: 'ImportDeclaration',
source: {
value: './chart.mdx'
},
specifiers: [{
type: 'ImportSpecifier',
local: {
type: 'Identifier',
name: 'Chart'
}
}]
}]
}
}
}
* this function takes in a string finds and removes imports in it (by detecting the node with the above characteristics)
* @param content mdx file content
* @returns importPaths - an array of the imports
* content - the mdx file content with stripped imports
*/
export declare const findAndRemoveImports: (content: string) => Promise<FindAndRemoveImportsResponse>;