Skip to content

Commit

Permalink
chore: adjust types;
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanuo committed Jun 4, 2024
1 parent 2999d96 commit bfd8f75
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
28 changes: 28 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export type Framework = 'vue' | 'react'

export interface BaseOptions {
/**
* if use controller
*/
isController?: boolean
/**
* framework name
*/
framework?: Framework
}

export interface PlantumlOptions extends BaseOptions {
/**
* image format
*/
imageFormat?: string
/**
* server url
*/
server?: string
[key: string]: any
}

export interface MermaidOptions extends BaseOptions {
[key: string]: any
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type MarkdownIt from 'markdown-it/index.js'
import type { Renderer, Token } from 'markdown-it/index.js'
import * as mermaidFunctions from './mermaid-parser'
import * as platumlFunctions from './plantuml-parser'
import type { PlantumlOptions } from './types'
import type { PlantumlOptions } from './index.d'

export default function umlPlugin(md: MarkdownIt, options: PlantumlOptions = {}) {
platumlFunctions.default.functions.initialize(options)
Expand Down
2 changes: 1 addition & 1 deletion src/mermaid-parser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

import { getController } from './render-control'
import type { MermaidOptions } from './types'
import type { MermaidOptions } from '.'

Check failure on line 4 in src/mermaid-parser.ts

View workflow job for this annotation

GitHub Actions / typecheck

Module '"."' has no exported member 'MermaidOptions'. Did you mean to use 'import MermaidOptions from "."' instead?

const functions = {
options: {
Expand Down
2 changes: 1 addition & 1 deletion src/plantuml-parser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Process block-level uml diagrams
//
'use strict'
import type { PlantumlOptions } from './index.d'
import deflate from './deflate'
import { getController } from './render-control'
import type { PlantumlOptions } from './types'

const functions = {
options: {
Expand Down
2 changes: 1 addition & 1 deletion src/render-control.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Framework } from './types'
import type { Framework } from './index.d'

/**
* Render controller for other frameworks
Expand Down
14 changes: 0 additions & 14 deletions src/types.ts

This file was deleted.

0 comments on commit bfd8f75

Please sign in to comment.