@shikijs/core 3.16.0 → 3.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +8 -4
- package/dist/index.mjs +6 -4
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateBundledHighlighterOptions, CreateHighlighterFactory, CodeToHastOptions, CodeToTokensOptions, TokensResult, RequireKeys, CodeToTokensBaseOptions, ThemedToken, CodeToTokensWithThemesOptions, ThemedTokenWithVariants, BundledHighlighterOptions, HighlighterGeneric, GrammarState, Awaitable, HighlighterCoreOptions, HighlighterCore, ShikiInternal, ShikiTransformerContextCommon, CodeToHastRenderOptions, ShikiTransformerContextSource, ThemeRegistrationResolved, TokenizeWithThemeOptions, Grammar, ThemeRegistrationAny, ThemeRegistration, ShikiTransformer, MaybeArray, MaybeGetter, PlainTextLanguage, SpecialLanguage, ThemeInput, SpecialTheme, Position, CodeOptionsMultipleThemes, TokenStyles } from '@shikijs/types';
|
|
2
2
|
export * from '@shikijs/types';
|
|
3
3
|
import { Root, Element } from 'hast';
|
|
4
4
|
import { toHtml } from 'hast-util-to-html';
|
|
@@ -8,7 +8,7 @@ import { toHtml } from 'hast-util-to-html';
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```ts
|
|
11
|
-
* const createHighlighter =
|
|
11
|
+
* const createHighlighter = createBundledHighlighter({
|
|
12
12
|
* langs: {
|
|
13
13
|
* typescript: () => import('@shikijs/langs/typescript'),
|
|
14
14
|
* // ...
|
|
@@ -23,7 +23,7 @@ import { toHtml } from 'hast-util-to-html';
|
|
|
23
23
|
*
|
|
24
24
|
* @param options
|
|
25
25
|
*/
|
|
26
|
-
declare function
|
|
26
|
+
declare function createBundledHighlighter<BundledLangs extends string, BundledThemes extends string>(options: CreateBundledHighlighterOptions<BundledLangs, BundledThemes>): CreateHighlighterFactory<BundledLangs, BundledThemes>;
|
|
27
27
|
interface ShorthandsBundle<L extends string, T extends string> {
|
|
28
28
|
/**
|
|
29
29
|
* Shorthand for `codeToHtml` with auto-loaded theme and language.
|
|
@@ -78,6 +78,10 @@ interface CreateSingletonShorthandsOptions<L extends string, T extends string> {
|
|
|
78
78
|
guessEmbeddedLanguages?: (code: string, lang: string | undefined, highlighter: HighlighterGeneric<L, T>) => Awaitable<string[] | undefined>;
|
|
79
79
|
}
|
|
80
80
|
declare function createSingletonShorthands<L extends string, T extends string>(createHighlighter: CreateHighlighterFactory<L, T>, config?: CreateSingletonShorthandsOptions<L, T>): ShorthandsBundle<L, T>;
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated Use `createBundledHighlighter` instead.
|
|
83
|
+
*/
|
|
84
|
+
declare const createdBundledHighlighter: typeof createBundledHighlighter;
|
|
81
85
|
|
|
82
86
|
/**
|
|
83
87
|
* Create a Shiki core highlighter instance, with no languages or themes bundled.
|
|
@@ -272,5 +276,5 @@ declare function enableDeprecationWarnings(emitDeprecation?: DeprecationTarget |
|
|
|
272
276
|
*/
|
|
273
277
|
declare function warnDeprecated(message: string, version?: DeprecationTarget): void;
|
|
274
278
|
|
|
275
|
-
export { addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, createdBundledHighlighter, enableDeprecationWarnings, flatTokenVariants, getSingletonHighlighterCore, getTokenStyleObject, guessEmbeddedLanguages, hastToHtml, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
|
|
279
|
+
export { addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createBundledHighlighter, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, createdBundledHighlighter, enableDeprecationWarnings, flatTokenVariants, getSingletonHighlighterCore, getTokenStyleObject, guessEmbeddedLanguages, hastToHtml, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
|
|
276
280
|
export type { CreateSingletonShorthandsOptions, CssVariablesThemeOptions, ShorthandsBundle };
|
package/dist/index.mjs
CHANGED
|
@@ -1810,8 +1810,9 @@ class Registry extends Registry$1 {
|
|
|
1810
1810
|
resolveEmbeddedLanguages(lang) {
|
|
1811
1811
|
this._langMap.set(lang.name, lang);
|
|
1812
1812
|
this._langGraph.set(lang.name, lang);
|
|
1813
|
-
|
|
1814
|
-
|
|
1813
|
+
const embedded = lang.embeddedLanguages ?? lang.embeddedLangs;
|
|
1814
|
+
if (embedded) {
|
|
1815
|
+
for (const embeddedLang of embedded)
|
|
1815
1816
|
this._langGraph.set(embeddedLang, this._langMap.get(embeddedLang));
|
|
1816
1817
|
}
|
|
1817
1818
|
}
|
|
@@ -2032,7 +2033,7 @@ function makeSingletonHighlighterCore(createHighlighter) {
|
|
|
2032
2033
|
}
|
|
2033
2034
|
const getSingletonHighlighterCore = /* @__PURE__ */ makeSingletonHighlighterCore(createHighlighterCore);
|
|
2034
2035
|
|
|
2035
|
-
function
|
|
2036
|
+
function createBundledHighlighter(options) {
|
|
2036
2037
|
const bundledLanguages = options.langs;
|
|
2037
2038
|
const bundledThemes = options.themes;
|
|
2038
2039
|
const engine = options.engine;
|
|
@@ -2158,6 +2159,7 @@ function createSingletonShorthands(createHighlighter, config) {
|
|
|
2158
2159
|
}
|
|
2159
2160
|
};
|
|
2160
2161
|
}
|
|
2162
|
+
const createdBundledHighlighter = createBundledHighlighter;
|
|
2161
2163
|
|
|
2162
2164
|
function createCssVariablesTheme(options = {}) {
|
|
2163
2165
|
const {
|
|
@@ -2394,4 +2396,4 @@ function createCssVariablesTheme(options = {}) {
|
|
|
2394
2396
|
return theme;
|
|
2395
2397
|
}
|
|
2396
2398
|
|
|
2397
|
-
export { addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, createdBundledHighlighter, enableDeprecationWarnings, flatTokenVariants, getSingletonHighlighterCore, getTokenStyleObject, guessEmbeddedLanguages, hastToHtml, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
|
|
2399
|
+
export { addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createBundledHighlighter, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, createdBundledHighlighter, enableDeprecationWarnings, flatTokenVariants, getSingletonHighlighterCore, getTokenStyleObject, guessEmbeddedLanguages, hastToHtml, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.17.0",
|
|
5
5
|
"description": "Core of Shiki",
|
|
6
6
|
"author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@shikijs/vscode-textmate": "^10.0.2",
|
|
40
40
|
"@types/hast": "^3.0.4",
|
|
41
41
|
"hast-util-to-html": "^9.0.5",
|
|
42
|
-
"@shikijs/types": "3.
|
|
42
|
+
"@shikijs/types": "3.17.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "unbuild",
|