index.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import type {Program} from 'estree-jsx'
  2. import type {Data as HastData, Literal as HastLiteral} from 'hast'
  3. import type {Data as MdastData, Literal as MdastLiteral} from 'mdast'
  4. export {mdxjsEsmFromMarkdown, mdxjsEsmToMarkdown} from './lib/index.js'
  5. /**
  6. * MDX ESM (import/export) node.
  7. */
  8. export interface MdxjsEsm extends MdastLiteral {
  9. /**
  10. * Node type.
  11. */
  12. type: 'mdxjsEsm'
  13. /**
  14. * Data associated with mdast MDX.js ESM.
  15. */
  16. data?: MdxjsEsmData | undefined
  17. }
  18. /**
  19. * Info associated with mdast MDX.js ESM nodes by the ecosystem.
  20. */
  21. export interface MdxjsEsmData extends MdastData {
  22. /**
  23. * Program node from estree.
  24. */
  25. estree?: Program | null | undefined
  26. }
  27. /**
  28. * MDX ESM (import/export) node (for hast).
  29. */
  30. export interface MdxjsEsmHast extends HastLiteral {
  31. /**
  32. * Node type.
  33. */
  34. type: 'mdxjsEsm'
  35. /**
  36. * Data associated with hast MDX.js ESM.
  37. */
  38. data?: MdxjsEsmHastData | undefined
  39. }
  40. /**
  41. * Info associated with hast MDX.js ESM nodes by the ecosystem.
  42. */
  43. export interface MdxjsEsmHastData extends HastData {
  44. /**
  45. * Program node from estree.
  46. */
  47. estree?: Program | null | undefined
  48. }
  49. // Add nodes to mdast content.
  50. declare module 'mdast' {
  51. interface FrontmatterContentMap {
  52. /**
  53. * MDX ESM.
  54. */
  55. mdxjsEsm: MdxjsEsm
  56. }
  57. interface RootContentMap {
  58. /**
  59. * MDX ESM.
  60. */
  61. mdxjsEsm: MdxjsEsm
  62. }
  63. }
  64. // Add nodes to hast content.
  65. declare module 'hast' {
  66. interface RootContentMap {
  67. /**
  68. * MDX ESM.
  69. */
  70. mdxjsEsm: MdxjsEsmHast
  71. }
  72. }