Skip to content

Commit

Permalink
feat: improve compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 27, 2023
1 parent 7688547 commit 8e11f33
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 4 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ async function getHighlighter(...args) {
return getHighlighter(...args)
}

async function loadTheme(...args) {
const { loadTheme } = await import('./dist/index.mjs')
return loadTheme(...args)
}

module.exports = getHighlighter
module.exports.getHighlighter = getHighlighter
module.exports.loadTheme = loadTheme
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function getHighlighter(options: HighlighterOptions = {}) {
}
}

export type Highlighter = ReturnType<typeof getHighlighter>
export type Highlighter = Awaited<ReturnType<typeof getHighlighter>>

export async function loadTheme(theme: BuiltinTheme | ThemeInput): Promise<ThemeRegistration> {
if (typeof theme === 'string')
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BuiltinLanguage, BuiltinTheme, BundledHighlighterOptions, LanguageRegistration, LineOption, StringLiteralUnion, ThemeRegistration } from 'shikiji'
import type { BuiltinLanguage, BuiltinTheme, BundledHighlighterOptions, LanguageRegistration, LineOption, StringLiteralUnion, ThemeRegistration, ThemeRegistrationRaw } from 'shikiji'

export interface AnsiToHtmlOptions {
theme?: StringLiteralUnion<BuiltinTheme>
Expand All @@ -9,7 +9,9 @@ export interface HighlighterOptions extends BundledHighlighterOptions<BuiltinLan
theme?: BuiltinTheme
}

export interface IThemeRegistration extends ThemeRegistration {}
export type IThemeRegistration = ThemeRegistrationRaw | ThemeRegistration | StringLiteralUnion<BuiltinTheme>

export interface IShikiTheme extends ThemeRegistration {}

export interface ILanguageRegistration extends LanguageRegistration {}

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8e11f33

Please sign in to comment.