@shikijs/core
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import { CreatedBundledHighlighterOptions, CreateHighlighterFactory, LanguageInput, ThemeInput, HighlighterCoreOptions, CodeToHastOptions, CodeToTokensOptions, TokensResult, RequireKeys, CodeToTokensBaseOptions, ThemedToken, CodeToTokensWithThemesOptions, ThemedTokenWithVariants, BundledHighlighterOptions, HighlighterGeneric, GrammarState, Awaitable, HighlighterCore, ShikiInternal, RegexEngine, LoadWasmOptions, ShikiTransformerContextCommon, CodeToHastRenderOptions, ShikiTransformerContextSource, ThemeRegistrationResolved, TokenizeWithThemeOptions, Grammar, ThemeRegistrationAny, ThemeRegistration, ShikiTransformer, MaybeArray, PlainTextLanguage, SpecialLanguage, SpecialTheme, MaybeGetter, TokenStyles, Position } from '@shikijs/types'; | ||
import { CreatedBundledHighlighterOptions, CreateHighlighterFactory, LanguageInput, ThemeInput, HighlighterCoreOptions, CodeToHastOptions, CodeToTokensOptions, TokensResult, RequireKeys, CodeToTokensBaseOptions, ThemedToken, CodeToTokensWithThemesOptions, ThemedTokenWithVariants, BundledHighlighterOptions, HighlighterGeneric, GrammarState, Awaitable, HighlighterCore, ShikiInternal, RegexEngine, LoadWasmOptions, ShikiTransformerContextCommon, CodeToHastRenderOptions, ShikiTransformerContextSource, ThemeRegistrationResolved, TokenizeWithThemeOptions, Grammar, ThemeRegistrationAny, ThemeRegistration, ShikiTransformer, MaybeArray, MaybeGetter, PlainTextLanguage, SpecialLanguage, SpecialTheme, Position, TokenStyles } from '@shikijs/types'; | ||
export * from '@shikijs/types'; | ||
@@ -222,7 +222,11 @@ import { Root, Element } from 'hast'; | ||
declare function resolveColorReplacements(theme: ThemeRegistrationAny | string, options?: TokenizeWithThemeOptions): Record<string, string | undefined>; | ||
declare function applyColorReplacements(color: string, replacements?: Record<string, string | undefined>): string; | ||
declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string | undefined>): string | undefined; | ||
declare function toArray<T>(x: MaybeArray<T>): T[]; | ||
/** | ||
* Split a string into lines, each line preserves the line ending. | ||
* Normalize a getter to a promise. | ||
*/ | ||
declare function splitLines(code: string, preserveEnding?: boolean): [string, number][]; | ||
declare function normalizeGetter<T>(p: MaybeGetter<T>): Promise<T>; | ||
/** | ||
@@ -252,2 +256,3 @@ * Check if the language is plaintext that is ignored by Shiki. | ||
declare function isSpecialTheme(theme: string | ThemeInput | null | undefined): theme is SpecialTheme; | ||
/** | ||
@@ -259,22 +264,8 @@ * Utility to append class to a hast node | ||
declare function addClassToHast(node: Element, className: string | string[]): Element; | ||
/** | ||
* Split a token into multiple tokens by given offsets. | ||
* | ||
* The offsets are relative to the token, and should be sorted. | ||
* Split a string into lines, each line preserves the line ending. | ||
*/ | ||
declare function splitToken<T extends Pick<ThemedToken, 'content' | 'offset'>>(token: T, offsets: number[]): T[]; | ||
declare function splitLines(code: string, preserveEnding?: boolean): [string, number][]; | ||
/** | ||
* Split 2D tokens array by given breakpoints. | ||
*/ | ||
declare function splitTokens<T extends Pick<ThemedToken, 'content' | 'offset'>>(tokens: T[][], breakpoints: number[] | Set<number>): T[][]; | ||
/** | ||
* Normalize a getter to a promise. | ||
*/ | ||
declare function normalizeGetter<T>(p: MaybeGetter<T>): Promise<T>; | ||
declare function resolveColorReplacements(theme: ThemeRegistrationAny | string, options?: TokenizeWithThemeOptions): Record<string, string | undefined>; | ||
declare function applyColorReplacements(color: string, replacements?: Record<string, string | undefined>): string; | ||
declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string | undefined>): string | undefined; | ||
declare function getTokenStyleObject(token: TokenStyles): Record<string, string>; | ||
declare function stringifyTokenStyle(token: string | Record<string, string>): string; | ||
/** | ||
* Creates a converter between index and position in a code block. | ||
@@ -296,2 +287,16 @@ * | ||
/** | ||
* Split a token into multiple tokens by given offsets. | ||
* | ||
* The offsets are relative to the token, and should be sorted. | ||
*/ | ||
declare function splitToken<T extends Pick<ThemedToken, 'content' | 'offset'>>(token: T, offsets: number[]): T[]; | ||
/** | ||
* Split 2D tokens array by given breakpoints. | ||
*/ | ||
declare function splitTokens<T extends Pick<ThemedToken, 'content' | 'offset'>>(tokens: T[][], breakpoints: number[] | Set<number>): T[][]; | ||
declare function flatTokenVariants(merged: ThemedTokenWithVariants, variantsOrder: string[], cssVariablePrefix: string, defaultColor: string | boolean): ThemedToken; | ||
declare function getTokenStyleObject(token: TokenStyles): Record<string, string>; | ||
declare function stringifyTokenStyle(token: string | Record<string, string>): string; | ||
type DeprecationTarget = 3; | ||
@@ -311,2 +316,2 @@ /** | ||
export { type CreateSingletonShorthandsOptions, type CssVariablesThemeOptions, type ShorthandsBundle, addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync, createJavaScriptRegexEngine, createOnigurumaEngine, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, createWasmOnigEngine, createdBundledHighlighter, defaultJavaScriptRegexConstructor, enableDeprecationWarnings, getHighlighterCore, getShikiInternal, getSingletonHighlighterCore, getTokenStyleObject, guessEmbeddedLanguages, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, loadWasm, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated }; | ||
export { type CreateSingletonShorthandsOptions, type CssVariablesThemeOptions, type ShorthandsBundle, addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync, createJavaScriptRegexEngine, createOnigurumaEngine, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, createWasmOnigEngine, createdBundledHighlighter, defaultJavaScriptRegexConstructor, enableDeprecationWarnings, flatTokenVariants, getHighlighterCore, getShikiInternal, getSingletonHighlighterCore, getTokenStyleObject, guessEmbeddedLanguages, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, loadWasm, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated }; |
{ | ||
"name": "@shikijs/core", | ||
"type": "module", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"description": "Core of Shiki", | ||
@@ -66,5 +66,5 @@ "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>", | ||
"hast-util-to-html": "^9.0.4", | ||
"@shikijs/engine-javascript": "2.4.1", | ||
"@shikijs/engine-oniguruma": "2.4.1", | ||
"@shikijs/types": "2.4.1" | ||
"@shikijs/engine-oniguruma": "2.4.2", | ||
"@shikijs/types": "2.4.2", | ||
"@shikijs/engine-javascript": "2.4.2" | ||
}, | ||
@@ -71,0 +71,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
109444
0.4%2567
0.04%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated