dumi

  • Version 2.4.13
  • Published
  • 2.95 MB
  • 68 dependencies
  • MIT license

Install

npm i dumi
yarn add dumi
pnpm add dumi

Overview

📖 Documentation Generator of React Component

Index

Variables

variable unistUtilVisit

let unistUtilVisit: any;

    Functions

    function defineConfig

    defineConfig: (config: IDumiUserConfig) => IDumiUserConfig;

      function getProjectRoot

      getProjectRoot: (cwd: string) => string;
      • get root dir for monorepo project

      Classes

      class IDumiTechStack

      abstract class IDumiTechStack {}

        property name

        abstract name: string;
        • tech stack name, such as 'react'

        property runtimeOpts

        abstract runtimeOpts?: IDumiTechStackRuntimeOpts;
        • runtime options

        method generateMetadata

        abstract generateMetadata: (
        asset: ExampleBlockAsset,
        opts: {
        type: Parameters<IDumiTechStack['transformCode']>[1]['type'];
        mdAbsPath: string;
        fileAbsPath?: string;
        entryPointCode?: string;
        }
        ) => Promise<ExampleBlockAsset> | ExampleBlockAsset;
        • generator for return asset metadata

        method generatePreviewerProps

        abstract generatePreviewerProps: (
        props: IDumiDemoProps['previewerProps'],
        opts: Parameters<NonNullable<IDumiTechStack['generateMetadata']>>[1]
        ) =>
        | Promise<IDumiDemoProps['previewerProps']>
        | IDumiDemoProps['previewerProps'];
        • generator for return previewer props

        method generateSources

        abstract generateSources: (
        source: IParsedBlockAsset['resolveMap'],
        opts: Parameters<NonNullable<IDumiTechStack['generateMetadata']>>[1]
        ) => Promise<IParsedBlockAsset['resolveMap']> | IParsedBlockAsset['resolveMap'];
        • generator for return file path of demo source

        method isSupported

        abstract isSupported: (node: Element, lang: string) => boolean;
        • Is the lang supported by the current tech stack?

          Parameter lang

          Parameter node

          hast Element https://github.com/syntax-tree/hast?tab=readme-ov-file#element

        method onBlockLoad

        abstract onBlockLoad: (
        args: IDumiTechStackOnBlockLoadArgs
        ) => IDumiTechStackOnBlockLoadResult | null;
        • Use current function as onLoad CallBack(https://esbuild.github.io/plugins/#on-load) Why use this method? By default, dumi can only support the parsing of js/ts related code blocks, but many front-end frameworks have custom extensions, so this method is provided to facilitate developers to convert codes.

        method transformCode

        abstract transformCode: (
        raw: string,
        opts: { type: 'external' | 'code-block'; fileAbsPath: string }
        ) => string;
        • transform for parse demo source to expression/function/class

        Interfaces

        interface IDumiTechStackRuntimeOpts

        interface IDumiTechStackRuntimeOpts {}

          property compilePath

          compilePath?: string;
          • path to runtime compile function module

          property pluginPath

          pluginPath?: string;
          • path to runtime plugin for this tech stack

          property preflightPath

          preflightPath?: string;
          • Component detection function path, used to detect errors that occur from application creation to component mounting.

          property rendererPath

          rendererPath?: string;
          • path of the cancelableIDemoCancelableFn function that manipulate(mount/unmount) third-party framework component

          Type Aliases

          type IApi

          type IApi = IUmiApi & {
          config: IDumiConfig & {
          [key: string]: any;
          };
          userConfig: IDumiUserConfig;
          service: IUmiApi['service'] & {
          themeData: IThemeLoadResult;
          atomParser: IAtomAssetsParser;
          };
          /**
          * register a new tech stack
          */
          registerTechStack: (fn: () => IDumiTechStack) => void;
          /**
          * modify original theme data
          */
          modifyTheme: IModify<IThemeLoadResult, null>;
          /**
          * add content tab
          */
          addContentTab: (fn: () => IContentTab) => void;
          /**
          * modify assets metadata
          */
          modifyAssetsMetadata: IModify<AssetsPackage, null>;
          /**
          * get assets metadata
          */
          getAssetsMetadata?: () => Promise<AssetsPackage>;
          };

            Namespaces

            namespace *.svg

            module '*.svg' {}

              variable ReactComponent

              const ReactComponent: React.FunctionComponent<any>;

                variable src

                const src: string;

                  Package Files (5)

                  Dependencies (68)

                  Dev Dependencies (35)

                  Peer Dependencies (2)

                  Badge

                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/dumi.

                  • Markdown
                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/dumi)
                  • HTML
                    <a href="https://www.jsdocs.io/package/dumi"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>