Skip to content

🔨 options #1

@unicornware

Description

@unicornware

Proposed work

implementing plugin options.

the options interface will extend ParserOptions as well as add several new options:

  • apply?: conditional application
  • enforce?: plugin ordering
  • exclude?: glob patterns matching files to exclude from parsing. Applied after include
  • handler?: augment ComponentDoc before added to a component as __docgenInfo
  • include?: glob patterns matching files to parse for docgen information
  • name?: generate the name of the component to add a __docgenInfo property to
  • tsconfig?: name of tsconfig file or path to tsconfig file

Success criteria

  • interface Options extends ParserOptions
  • apply?
  • enforce?
  • exclude?
  • handler?
  • include?
  • name?
  • tsconfig?

Related documents

  • interface draft
    import type { ComponentDoc, ParserOptions } from 'react-docgen-typescript'
    
    interface Options extends ParserOptions {
      apply?: Plugin['apply']
    
      /** @default 'pre' */
      enforce?: Plugin['enforce']
    
      /** @default [] */
      exclude?: string[]
    
      /** @default doc=>doc */
      handler?(doc: ComponentDoc, code: string, id: string): ComponentDoc | Promise<ComponentDoc>
    
      /** @default ['**.tsx'] */
      include?: string[]
    
      /** @default doc=>doc.displayName */
      name?(doc: ComponentDoc, code: string, id: string): Promise<string> | string
    
      /** @default path.resolve('tsconfig.json') */
      tsconfig?: string
    }
  • Vite Plugin API

Metadata

Metadata

Assignees

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions