Repository: slidevjs/slidev
File: packages/types/src/setups.ts (TypeScript)

Code before:
}

export interface ShortcutOptions {
  key: string | Ref<boolean>
  fn?: () => void
  autoRepeat?: boolean
  name?: string
}

export interface ShikiContext {
  /**
   * @deprecated Pass directly the theme name it's supported by Shiki.
   * For custom themes, load it manually via `JSON.parse(fs.readFileSync(path, 'utf-8'))` and pass the raw JSON object instead.
   */
  loadTheme: (path: string) => Promise<any>
}

export type ShikiSetupReturn =
  Partial<
    & Omit<CodeToHastOptionsCommon<BuiltinLanguage>, 'lang'>
    & CodeOptionsThemes<BuiltinTheme>
    & CodeOptionsMeta
    & {
      langs: (MaybeArray<LanguageRegistration> | BuiltinLanguage)[] | Record<string, LanguageInput>
    }
  >

export interface TransformersSetupReturn {
  pre: (MarkdownTransformer | false)[]
  preCodeblock: (MarkdownTransformer | false)[]
  postCodeblock: (MarkdownTransformer | false)[]
  post: (MarkdownTransformer | false)[]
}

// node side
export type ShikiSetup = (shiki: ShikiContext) => Awaitable<ShikiSetupReturn | void>
export type KatexSetup = () => Awaitable<Partial<KatexOptions> | void>
export type UnoSetup = () => Awaitable<Partial<UnoCssConfig> | void>
export type TransformersSetup = () => Awaitable<Partial<TransformersSetupReturn>>
export type PreparserSetup = (context: {
  filepath: string
  headmatter: Record<string, unknown>
  mode?: string
}) => Awaitable<SlidevPreparserExtension[]>

// client side
export type MonacoSetup = (m: typeof monaco) => Awaitable<MonacoSetupReturn | void>
export type AppSetup = (context: AppContext) => Awaitable<void>
export type RootSetup = () => Awaitable<void>
export type RoutesSetup = (routes: RouteRecordRaw[]) => RouteRecordRaw[]
export type MermaidSetup = () => Awaitable<Partial<MermaidConfig> | void>

Review comment (suggestion):
It seems that this function is never called. And I don't know how to support it because there's no longer a `Highlighter`

Code after:
  escapeOverview: () => void
  showGotoDialog: () => void
}

export interface ShortcutOptions {
  key: string | Ref<boolean>
  fn?: () => void
  autoRepeat?: boolean
  name?: string
}

export interface ShikiContext {
  /**
   * @deprecated Pass directly the theme name it's supported by Shiki.
   * For custom themes, load it manually via `JSON.parse(fs.readFileSync(path, 'utf-8'))` and pass the raw JSON object instead.
   */
  loadTheme: (path: string) => Promise<any>
}

export type ShikiSetupReturn
  = Partial<
    & Omit<CodeToHastOptionsCommon<BuiltinLanguage>, 'lang'>
    & CodeOptionsThemes<BuiltinTheme>
    & CodeOptionsMeta
    & {
      langs: (MaybeArray<LanguageRegistration> | BuiltinLanguage)[] | Record<string, LanguageInput>
    }
  >

export interface TransformersSetupReturn {
  pre: (MarkdownTransformer | false)[]
  preCodeblock: (MarkdownTransformer | false)[]
  postCodeblock: (MarkdownTransformer | false)[]
  post: (MarkdownTransformer | false)[]
}

// node side
export type ShikiSetup = (shiki: ShikiContext) => Awaitable<ShikiSetupReturn | void>
export type KatexSetup = () => Awaitable<Partial<KatexOptions> | void>
export type UnoSetup = () => Awaitable<Partial<UnoCssConfig> | void>
export type TransformersSetup = () => Awaitable<Partial<TransformersSetupReturn>>
export type PreparserSetup = (context: {
  filepath: string
  headmatter: Record<string, unknown>
  mode?: string
}) => Awaitable<SlidevPreparserExtension[]>
export type VitePluginsSetup = (options: ResolvedSlidevOptions) => Awaitable<VitePlugin[]>

// client side
export type MonacoSetup = (m: typeof monaco) => Awaitable<MonacoSetupReturn | void>
export type AppSetup = (context: AppContext) => Awaitable<void>