diff --git a/packages/shikiji-compact/README.md b/packages/shikiji-compat/README.md similarity index 100% rename from packages/shikiji-compact/README.md rename to packages/shikiji-compat/README.md diff --git a/packages/shikiji-compact/build.config.ts b/packages/shikiji-compat/build.config.ts similarity index 100% rename from packages/shikiji-compact/build.config.ts rename to packages/shikiji-compat/build.config.ts diff --git a/packages/shikiji-compact/index.cjs b/packages/shikiji-compat/index.cjs similarity index 57% rename from packages/shikiji-compact/index.cjs rename to packages/shikiji-compat/index.cjs index ce8bd602c..bb569788d 100644 --- a/packages/shikiji-compact/index.cjs +++ b/packages/shikiji-compat/index.cjs @@ -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 diff --git a/packages/shikiji-compact/package.json b/packages/shikiji-compat/package.json similarity index 100% rename from packages/shikiji-compact/package.json rename to packages/shikiji-compat/package.json diff --git a/packages/shikiji-compact/src/index.ts b/packages/shikiji-compat/src/index.ts similarity index 97% rename from packages/shikiji-compact/src/index.ts rename to packages/shikiji-compat/src/index.ts index c33424fc4..524e8538e 100644 --- a/packages/shikiji-compact/src/index.ts +++ b/packages/shikiji-compat/src/index.ts @@ -72,7 +72,7 @@ export async function getHighlighter(options: HighlighterOptions = {}) { } } -export type Highlighter = ReturnType +export type Highlighter = Awaited> export async function loadTheme(theme: BuiltinTheme | ThemeInput): Promise { if (typeof theme === 'string') diff --git a/packages/shikiji-compact/src/stub.ts b/packages/shikiji-compat/src/stub.ts similarity index 100% rename from packages/shikiji-compact/src/stub.ts rename to packages/shikiji-compat/src/stub.ts diff --git a/packages/shikiji-compact/src/types.ts b/packages/shikiji-compat/src/types.ts similarity index 71% rename from packages/shikiji-compact/src/types.ts rename to packages/shikiji-compat/src/types.ts index 4d6350421..79622cdfa 100644 --- a/packages/shikiji-compact/src/types.ts +++ b/packages/shikiji-compat/src/types.ts @@ -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 @@ -9,7 +9,9 @@ export interface HighlighterOptions extends BundledHighlighterOptions + +export interface IShikiTheme extends ThemeRegistration {} export interface ILanguageRegistration extends LanguageRegistration {} diff --git a/packages/shikiji-compact/test/types.test.ts b/packages/shikiji-compat/test/types.test.ts similarity index 100% rename from packages/shikiji-compact/test/types.test.ts rename to packages/shikiji-compat/test/types.test.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab533fd15..e49f61cba 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -183,7 +183,7 @@ importers: specifier: ^9.0.0 version: 9.0.0 - packages/shikiji-compact: + packages/shikiji-compat: dependencies: shikiji: specifier: workspace:*