@shikijs/core 2.4.2 → 3.0.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 +4 -41
- package/dist/index.mjs +31 -71
- package/dist/types.d.mts +0 -1
- package/package.json +3 -29
- package/dist/index.d.ts +0 -312
- package/dist/shared/core.5hv0Law9.mjs +0 -19
- package/dist/textmate.d.ts +0 -1
- package/dist/types.d.ts +0 -3
- package/dist/wasm-inlined.d.mts +0 -2
- package/dist/wasm-inlined.d.ts +0 -2
- package/dist/wasm-inlined.mjs +0 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { CreatedBundledHighlighterOptions, CreateHighlighterFactory,
|
|
1
|
+
import { CreatedBundledHighlighterOptions, 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, TokenStyles } from '@shikijs/types';
|
|
2
2
|
export * from '@shikijs/types';
|
|
3
3
|
import { Root, Element } from 'hast';
|
|
4
|
-
import {
|
|
5
|
-
export { FontStyle, EncodedTokenMetadata as StackElementMetadata } from '@shikijs/vscode-textmate';
|
|
6
|
-
export { toHtml as hastToHtml } from 'hast-util-to-html';
|
|
4
|
+
import { toHtml } from 'hast-util-to-html';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* Create a `createHighlighter` function with bundled themes, languages, and engine.
|
|
@@ -26,12 +24,6 @@ export { toHtml as hastToHtml } from 'hast-util-to-html';
|
|
|
26
24
|
* @param options
|
|
27
25
|
*/
|
|
28
26
|
declare function createdBundledHighlighter<BundledLangs extends string, BundledThemes extends string>(options: CreatedBundledHighlighterOptions<BundledLangs, BundledThemes>): CreateHighlighterFactory<BundledLangs, BundledThemes>;
|
|
29
|
-
/**
|
|
30
|
-
* Create a `createHighlighter` function with bundled themes and languages.
|
|
31
|
-
*
|
|
32
|
-
* @deprecated Use `createdBundledHighlighter({ langs, themes, engine })` signature instead.
|
|
33
|
-
*/
|
|
34
|
-
declare function createdBundledHighlighter<BundledLangs extends string, BundledThemes extends string>(bundledLanguages: Record<BundledLangs, LanguageInput>, bundledThemes: Record<BundledThemes, ThemeInput>, loadWasm: HighlighterCoreOptions['loadWasm']): CreateHighlighterFactory<BundledLangs, BundledThemes>;
|
|
35
27
|
interface ShorthandsBundle<L extends string, T extends string> {
|
|
36
28
|
/**
|
|
37
29
|
* Shorthand for `codeToHtml` with auto-loaded theme and language.
|
|
@@ -105,19 +97,11 @@ declare function createHighlighterCore(options: HighlighterCoreOptions<false>):
|
|
|
105
97
|
declare function createHighlighterCoreSync(options: HighlighterCoreOptions<true>): HighlighterCore;
|
|
106
98
|
declare function makeSingletonHighlighterCore(createHighlighter: typeof createHighlighterCore): (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
|
|
107
99
|
declare const getSingletonHighlighterCore: (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
|
|
108
|
-
/**
|
|
109
|
-
* @deprecated Use `createHighlighterCore` or `getSingletonHighlighterCore` instead.
|
|
110
|
-
*/
|
|
111
|
-
declare function getHighlighterCore(options: HighlighterCoreOptions): Promise<HighlighterCore>;
|
|
112
100
|
|
|
113
101
|
/**
|
|
114
102
|
* Get the minimal shiki context for rendering.
|
|
115
103
|
*/
|
|
116
104
|
declare function createShikiInternal(options: HighlighterCoreOptions): Promise<ShikiInternal>;
|
|
117
|
-
/**
|
|
118
|
-
* @deprecated Use `createShikiInternal` instead.
|
|
119
|
-
*/
|
|
120
|
-
declare function getShikiInternal(options: HighlighterCoreOptions): Promise<ShikiInternal>;
|
|
121
105
|
|
|
122
106
|
/**
|
|
123
107
|
* Get the minimal shiki context for rendering.
|
|
@@ -126,31 +110,10 @@ declare function getShikiInternal(options: HighlighterCoreOptions): Promise<Shik
|
|
|
126
110
|
*/
|
|
127
111
|
declare function createShikiInternalSync(options: HighlighterCoreOptions<true>): ShikiInternal;
|
|
128
112
|
|
|
129
|
-
/**
|
|
130
|
-
* @deprecated Import `createJavaScriptRegexEngine` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead.
|
|
131
|
-
*/
|
|
132
|
-
declare function createJavaScriptRegexEngine(options?: JavaScriptRegexEngineOptions): RegexEngine;
|
|
133
|
-
/**
|
|
134
|
-
* @deprecated Import `defaultJavaScriptRegexConstructor` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead.
|
|
135
|
-
*/
|
|
136
|
-
declare function defaultJavaScriptRegexConstructor(pattern: string): RegExp;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead.
|
|
140
|
-
*/
|
|
141
|
-
declare function createOnigurumaEngine(options?: LoadWasmOptions | null): Promise<RegexEngine>;
|
|
142
|
-
/**
|
|
143
|
-
* @deprecated Import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead.
|
|
144
|
-
*/
|
|
145
|
-
declare function createWasmOnigEngine(options?: LoadWasmOptions | null): Promise<RegexEngine>;
|
|
146
|
-
/**
|
|
147
|
-
* @deprecated Import `loadWasm` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead.
|
|
148
|
-
*/
|
|
149
|
-
declare function loadWasm(options: LoadWasmOptions): Promise<void>;
|
|
150
|
-
|
|
151
113
|
declare function codeToHast(internal: ShikiInternal, code: string, options: CodeToHastOptions, transformerContext?: ShikiTransformerContextCommon): Root;
|
|
152
114
|
declare function tokensToHast(tokens: ThemedToken[][], options: CodeToHastRenderOptions, transformerContext: ShikiTransformerContextSource, grammarState?: GrammarState | undefined): Root;
|
|
153
115
|
|
|
116
|
+
declare const hastToHtml: typeof toHtml;
|
|
154
117
|
/**
|
|
155
118
|
* Get highlighted code in HTML.
|
|
156
119
|
*/
|
|
@@ -309,4 +272,4 @@ declare function enableDeprecationWarnings(emitDeprecation?: DeprecationTarget |
|
|
|
309
272
|
*/
|
|
310
273
|
declare function warnDeprecated(message: string, version?: DeprecationTarget): void;
|
|
311
274
|
|
|
312
|
-
export { type CreateSingletonShorthandsOptions, type CssVariablesThemeOptions, type ShorthandsBundle, addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync,
|
|
275
|
+
export { type CreateSingletonShorthandsOptions, type CssVariablesThemeOptions, type ShorthandsBundle, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
import { ShikiError as ShikiError$1 } from '@shikijs/types';
|
|
2
2
|
export * from '@shikijs/types';
|
|
3
|
-
import { createOnigurumaEngine as createOnigurumaEngine$1, loadWasm as loadWasm$1, getDefaultWasmLoader } from '@shikijs/engine-oniguruma';
|
|
4
|
-
import { w as warnDeprecated } from './shared/core.5hv0Law9.mjs';
|
|
5
|
-
export { e as enableDeprecationWarnings } from './shared/core.5hv0Law9.mjs';
|
|
6
3
|
import { FontStyle, INITIAL, EncodedTokenMetadata, Registry as Registry$1, Theme } from '@shikijs/vscode-textmate';
|
|
7
|
-
export { FontStyle, EncodedTokenMetadata as StackElementMetadata } from '@shikijs/vscode-textmate';
|
|
8
4
|
import { toHtml } from 'hast-util-to-html';
|
|
9
|
-
export { toHtml as hastToHtml } from 'hast-util-to-html';
|
|
10
|
-
import { createJavaScriptRegexEngine as createJavaScriptRegexEngine$1, defaultJavaScriptRegexConstructor as defaultJavaScriptRegexConstructor$1 } from '@shikijs/engine-javascript';
|
|
11
|
-
|
|
12
|
-
function createOnigurumaEngine(options) {
|
|
13
|
-
warnDeprecated("import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead");
|
|
14
|
-
return createOnigurumaEngine$1(options);
|
|
15
|
-
}
|
|
16
|
-
function createWasmOnigEngine(options) {
|
|
17
|
-
warnDeprecated("import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead");
|
|
18
|
-
return createOnigurumaEngine$1(options);
|
|
19
|
-
}
|
|
20
|
-
function loadWasm(options) {
|
|
21
|
-
warnDeprecated("import `loadWasm` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead");
|
|
22
|
-
return loadWasm$1(options);
|
|
23
|
-
}
|
|
24
5
|
|
|
25
6
|
function resolveColorReplacements(theme, options) {
|
|
26
7
|
const replacements = typeof theme === "string" ? {} : { ...theme.colorReplacements };
|
|
@@ -266,13 +247,6 @@ class GrammarState {
|
|
|
266
247
|
getInternalStack(theme = this.theme) {
|
|
267
248
|
return this._stacks[theme];
|
|
268
249
|
}
|
|
269
|
-
/**
|
|
270
|
-
* @deprecated use `getScopes` instead
|
|
271
|
-
*/
|
|
272
|
-
get scopes() {
|
|
273
|
-
warnDeprecated("GrammarState.scopes is deprecated, use GrammarState.getScopes() instead");
|
|
274
|
-
return getScopes(this._stacks[this.theme]);
|
|
275
|
-
}
|
|
276
250
|
getScopes(theme = this.theme) {
|
|
277
251
|
return getScopes(this._stacks[theme]);
|
|
278
252
|
}
|
|
@@ -1297,8 +1271,6 @@ function tokensToHast(tokens, options, transformerContext, grammarState = getLas
|
|
|
1297
1271
|
},
|
|
1298
1272
|
children: [{ type: "text", value: token.content }]
|
|
1299
1273
|
};
|
|
1300
|
-
if (typeof token.htmlStyle === "string")
|
|
1301
|
-
warnDeprecated("`htmlStyle` as a string is deprecated. Use an object instead.");
|
|
1302
1274
|
const style = stringifyTokenStyle(token.htmlStyle || getTokenStyleObject(token));
|
|
1303
1275
|
if (style)
|
|
1304
1276
|
tokenNode.properties.style = style;
|
|
@@ -1404,6 +1376,7 @@ function splitWhitespaceTokens(tokens) {
|
|
|
1404
1376
|
});
|
|
1405
1377
|
}
|
|
1406
1378
|
|
|
1379
|
+
const hastToHtml = toHtml;
|
|
1407
1380
|
function codeToHtml(internal, code, options) {
|
|
1408
1381
|
const context = {
|
|
1409
1382
|
meta: {},
|
|
@@ -1411,7 +1384,7 @@ function codeToHtml(internal, code, options) {
|
|
|
1411
1384
|
codeToHast: (_code, _options) => codeToHast(internal, _code, _options),
|
|
1412
1385
|
codeToTokens: (_code, _options) => codeToTokens(internal, _code, _options)
|
|
1413
1386
|
};
|
|
1414
|
-
let result =
|
|
1387
|
+
let result = hastToHtml(codeToHast(internal, code, options, context));
|
|
1415
1388
|
for (const transformer of getTransformers(options))
|
|
1416
1389
|
result = transformer.postprocess?.call(context, result, options) || result;
|
|
1417
1390
|
return result;
|
|
@@ -1525,6 +1498,24 @@ async function resolveThemes(themes) {
|
|
|
1525
1498
|
return resolved.filter((i) => !!i);
|
|
1526
1499
|
}
|
|
1527
1500
|
|
|
1501
|
+
let _emitDeprecation = 3;
|
|
1502
|
+
let _emitError = false;
|
|
1503
|
+
function enableDeprecationWarnings(emitDeprecation = true, emitError = false) {
|
|
1504
|
+
_emitDeprecation = emitDeprecation;
|
|
1505
|
+
_emitError = emitError;
|
|
1506
|
+
}
|
|
1507
|
+
function warnDeprecated(message, version = 3) {
|
|
1508
|
+
if (!_emitDeprecation)
|
|
1509
|
+
return;
|
|
1510
|
+
if (typeof _emitDeprecation === "number" && version > _emitDeprecation)
|
|
1511
|
+
return;
|
|
1512
|
+
if (_emitError) {
|
|
1513
|
+
throw new Error(`[SHIKI DEPRECATE]: ${message}`);
|
|
1514
|
+
} else {
|
|
1515
|
+
console.trace(`[SHIKI DEPRECATE]: ${message}`);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1528
1519
|
class ShikiError extends Error {
|
|
1529
1520
|
constructor(message) {
|
|
1530
1521
|
super(message);
|
|
@@ -1806,9 +1797,6 @@ function createShikiInternalSync(options) {
|
|
|
1806
1797
|
}
|
|
1807
1798
|
|
|
1808
1799
|
async function createShikiInternal(options) {
|
|
1809
|
-
if (options.loadWasm) {
|
|
1810
|
-
warnDeprecated("`loadWasm` option is deprecated. Use `engine: createOnigurumaEngine(loadWasm)` instead.");
|
|
1811
|
-
}
|
|
1812
1800
|
if (!options.engine) {
|
|
1813
1801
|
warnDeprecated("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");
|
|
1814
1802
|
}
|
|
@@ -1819,7 +1807,7 @@ async function createShikiInternal(options) {
|
|
|
1819
1807
|
] = await Promise.all([
|
|
1820
1808
|
resolveThemes(options.themes || []),
|
|
1821
1809
|
resolveLangs(options.langs || []),
|
|
1822
|
-
options.engine
|
|
1810
|
+
options.engine
|
|
1823
1811
|
]);
|
|
1824
1812
|
return createShikiInternalSync({
|
|
1825
1813
|
...options,
|
|
@@ -1828,10 +1816,6 @@ async function createShikiInternal(options) {
|
|
|
1828
1816
|
engine
|
|
1829
1817
|
});
|
|
1830
1818
|
}
|
|
1831
|
-
function getShikiInternal(options) {
|
|
1832
|
-
warnDeprecated("`getShikiInternal` is deprecated. Use `createShikiInternal` instead.");
|
|
1833
|
-
return createShikiInternal(options);
|
|
1834
|
-
}
|
|
1835
1819
|
|
|
1836
1820
|
async function createHighlighterCore(options) {
|
|
1837
1821
|
const internal = await createShikiInternal(options);
|
|
@@ -1885,27 +1869,12 @@ function makeSingletonHighlighterCore(createHighlighter) {
|
|
|
1885
1869
|
return getSingletonHighlighterCore2;
|
|
1886
1870
|
}
|
|
1887
1871
|
const getSingletonHighlighterCore = /* @__PURE__ */ makeSingletonHighlighterCore(createHighlighterCore);
|
|
1888
|
-
function getHighlighterCore(options) {
|
|
1889
|
-
warnDeprecated("`getHighlighterCore` is deprecated. Use `createHighlighterCore` or `getSingletonHighlighterCore` instead.");
|
|
1890
|
-
return createHighlighterCore(options);
|
|
1891
|
-
}
|
|
1892
1872
|
|
|
1893
|
-
function createdBundledHighlighter(
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
warnDeprecated("`createdBundledHighlighter` signature with `bundledLanguages` and `bundledThemes` is deprecated. Use the options object signature instead.");
|
|
1899
|
-
bundledLanguages = arg1;
|
|
1900
|
-
bundledThemes = arg2;
|
|
1901
|
-
engine = () => createOnigurumaEngine(arg3);
|
|
1902
|
-
} else {
|
|
1903
|
-
const options = arg1;
|
|
1904
|
-
bundledLanguages = options.langs;
|
|
1905
|
-
bundledThemes = options.themes;
|
|
1906
|
-
engine = options.engine;
|
|
1907
|
-
}
|
|
1908
|
-
async function createHighlighter(options) {
|
|
1873
|
+
function createdBundledHighlighter(options) {
|
|
1874
|
+
const bundledLanguages = options.langs;
|
|
1875
|
+
const bundledThemes = options.themes;
|
|
1876
|
+
const engine = options.engine;
|
|
1877
|
+
async function createHighlighter(options2) {
|
|
1909
1878
|
function resolveLang(lang) {
|
|
1910
1879
|
if (typeof lang === "string") {
|
|
1911
1880
|
if (isSpecialLang(lang))
|
|
@@ -1928,11 +1897,11 @@ function createdBundledHighlighter(arg1, arg2, arg3) {
|
|
|
1928
1897
|
}
|
|
1929
1898
|
return theme;
|
|
1930
1899
|
}
|
|
1931
|
-
const _themes = (
|
|
1932
|
-
const langs = (
|
|
1900
|
+
const _themes = (options2.themes ?? []).map((i) => resolveTheme(i));
|
|
1901
|
+
const langs = (options2.langs ?? []).map((i) => resolveLang(i));
|
|
1933
1902
|
const core = await createHighlighterCore({
|
|
1934
|
-
engine:
|
|
1935
|
-
...
|
|
1903
|
+
engine: options2.engine ?? engine(),
|
|
1904
|
+
...options2,
|
|
1936
1905
|
themes: _themes,
|
|
1937
1906
|
langs
|
|
1938
1907
|
});
|
|
@@ -2022,15 +1991,6 @@ function createSingletonShorthands(createHighlighter, config) {
|
|
|
2022
1991
|
};
|
|
2023
1992
|
}
|
|
2024
1993
|
|
|
2025
|
-
function createJavaScriptRegexEngine(options) {
|
|
2026
|
-
warnDeprecated("import `createJavaScriptRegexEngine` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead");
|
|
2027
|
-
return createJavaScriptRegexEngine$1(options);
|
|
2028
|
-
}
|
|
2029
|
-
function defaultJavaScriptRegexConstructor(pattern) {
|
|
2030
|
-
warnDeprecated("import `defaultJavaScriptRegexConstructor` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead");
|
|
2031
|
-
return defaultJavaScriptRegexConstructor$1(pattern);
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
1994
|
function createCssVariablesTheme(options = {}) {
|
|
2035
1995
|
const {
|
|
2036
1996
|
name = "css-variables",
|
|
@@ -2266,4 +2226,4 @@ function createCssVariablesTheme(options = {}) {
|
|
|
2266
2226
|
return theme;
|
|
2267
2227
|
}
|
|
2268
2228
|
|
|
2269
|
-
export { addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync,
|
|
2229
|
+
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 };
|
package/dist/types.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"description": "Core of Shiki",
|
|
6
6
|
"author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -17,14 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"exports": {
|
|
20
|
-
".":
|
|
21
|
-
"types": "./dist/index.d.mts",
|
|
22
|
-
"default": "./dist/index.mjs"
|
|
23
|
-
},
|
|
24
|
-
"./wasm-inlined": {
|
|
25
|
-
"types": "./dist/wasm-inlined.d.mts",
|
|
26
|
-
"default": "./dist/wasm-inlined.mjs"
|
|
27
|
-
},
|
|
20
|
+
".": "./dist/index.mjs",
|
|
28
21
|
"./textmate": {
|
|
29
22
|
"types": "./dist/textmate.d.mts",
|
|
30
23
|
"default": "./dist/textmate.mjs"
|
|
@@ -39,23 +32,6 @@
|
|
|
39
32
|
"main": "./dist/index.mjs",
|
|
40
33
|
"module": "./dist/index.mjs",
|
|
41
34
|
"types": "./dist/index.d.mts",
|
|
42
|
-
"typesVersions": {
|
|
43
|
-
"*": {
|
|
44
|
-
"wasm-inlined": [
|
|
45
|
-
"./dist/wasm-inlined.d.mts"
|
|
46
|
-
],
|
|
47
|
-
"types": [
|
|
48
|
-
"./dist/types.d.mts"
|
|
49
|
-
],
|
|
50
|
-
"textmate": [
|
|
51
|
-
"./dist/textmate.d.mts"
|
|
52
|
-
],
|
|
53
|
-
"*": [
|
|
54
|
-
"./dist/*",
|
|
55
|
-
"./*"
|
|
56
|
-
]
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
35
|
"files": [
|
|
60
36
|
"dist"
|
|
61
37
|
],
|
|
@@ -63,9 +39,7 @@
|
|
|
63
39
|
"@shikijs/vscode-textmate": "^10.0.2",
|
|
64
40
|
"@types/hast": "^3.0.4",
|
|
65
41
|
"hast-util-to-html": "^9.0.4",
|
|
66
|
-
"@shikijs/
|
|
67
|
-
"@shikijs/types": "2.4.2",
|
|
68
|
-
"@shikijs/engine-javascript": "2.4.2"
|
|
42
|
+
"@shikijs/types": "3.0.0"
|
|
69
43
|
},
|
|
70
44
|
"scripts": {
|
|
71
45
|
"build": "unbuild",
|
package/dist/index.d.ts
DELETED
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
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';
|
|
2
|
-
export * from '@shikijs/types';
|
|
3
|
-
import { Root, Element } from 'hast';
|
|
4
|
-
import { JavaScriptRegexEngineOptions } from '@shikijs/engine-javascript';
|
|
5
|
-
export { FontStyle, EncodedTokenMetadata as StackElementMetadata } from '@shikijs/vscode-textmate';
|
|
6
|
-
export { toHtml as hastToHtml } from 'hast-util-to-html';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Create a `createHighlighter` function with bundled themes, languages, and engine.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* const createHighlighter = createdBundledHighlighter({
|
|
14
|
-
* langs: {
|
|
15
|
-
* typescript: () => import('@shikijs/langs/typescript'),
|
|
16
|
-
* // ...
|
|
17
|
-
* },
|
|
18
|
-
* themes: {
|
|
19
|
-
* nord: () => import('@shikijs/themes/nord'),
|
|
20
|
-
* // ...
|
|
21
|
-
* },
|
|
22
|
-
* engine: () => createOnigurumaEngine(), // or createJavaScriptRegexEngine()
|
|
23
|
-
* })
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @param options
|
|
27
|
-
*/
|
|
28
|
-
declare function createdBundledHighlighter<BundledLangs extends string, BundledThemes extends string>(options: CreatedBundledHighlighterOptions<BundledLangs, BundledThemes>): CreateHighlighterFactory<BundledLangs, BundledThemes>;
|
|
29
|
-
/**
|
|
30
|
-
* Create a `createHighlighter` function with bundled themes and languages.
|
|
31
|
-
*
|
|
32
|
-
* @deprecated Use `createdBundledHighlighter({ langs, themes, engine })` signature instead.
|
|
33
|
-
*/
|
|
34
|
-
declare function createdBundledHighlighter<BundledLangs extends string, BundledThemes extends string>(bundledLanguages: Record<BundledLangs, LanguageInput>, bundledThemes: Record<BundledThemes, ThemeInput>, loadWasm: HighlighterCoreOptions['loadWasm']): CreateHighlighterFactory<BundledLangs, BundledThemes>;
|
|
35
|
-
interface ShorthandsBundle<L extends string, T extends string> {
|
|
36
|
-
/**
|
|
37
|
-
* Shorthand for `codeToHtml` with auto-loaded theme and language.
|
|
38
|
-
* A singleton highlighter it maintained internally.
|
|
39
|
-
*
|
|
40
|
-
* Differences from `highlighter.codeToHtml()`, this function is async.
|
|
41
|
-
*/
|
|
42
|
-
codeToHtml: (code: string, options: CodeToHastOptions<L, T>) => Promise<string>;
|
|
43
|
-
/**
|
|
44
|
-
* Shorthand for `codeToHtml` with auto-loaded theme and language.
|
|
45
|
-
* A singleton highlighter it maintained internally.
|
|
46
|
-
*
|
|
47
|
-
* Differences from `highlighter.codeToHtml()`, this function is async.
|
|
48
|
-
*/
|
|
49
|
-
codeToHast: (code: string, options: CodeToHastOptions<L, T>) => Promise<Root>;
|
|
50
|
-
/**
|
|
51
|
-
* Shorthand for `codeToTokens` with auto-loaded theme and language.
|
|
52
|
-
* A singleton highlighter it maintained internally.
|
|
53
|
-
*
|
|
54
|
-
* Differences from `highlighter.codeToTokens()`, this function is async.
|
|
55
|
-
*/
|
|
56
|
-
codeToTokens: (code: string, options: CodeToTokensOptions<L, T>) => Promise<TokensResult>;
|
|
57
|
-
/**
|
|
58
|
-
* Shorthand for `codeToTokensBase` with auto-loaded theme and language.
|
|
59
|
-
* A singleton highlighter it maintained internally.
|
|
60
|
-
*
|
|
61
|
-
* Differences from `highlighter.codeToTokensBase()`, this function is async.
|
|
62
|
-
*/
|
|
63
|
-
codeToTokensBase: (code: string, options: RequireKeys<CodeToTokensBaseOptions<L, T>, 'theme' | 'lang'>) => Promise<ThemedToken[][]>;
|
|
64
|
-
/**
|
|
65
|
-
* Shorthand for `codeToTokensWithThemes` with auto-loaded theme and language.
|
|
66
|
-
* A singleton highlighter it maintained internally.
|
|
67
|
-
*
|
|
68
|
-
* Differences from `highlighter.codeToTokensWithThemes()`, this function is async.
|
|
69
|
-
*/
|
|
70
|
-
codeToTokensWithThemes: (code: string, options: RequireKeys<CodeToTokensWithThemesOptions<L, T>, 'themes' | 'lang'>) => Promise<ThemedTokenWithVariants[][]>;
|
|
71
|
-
/**
|
|
72
|
-
* Get the singleton highlighter.
|
|
73
|
-
*/
|
|
74
|
-
getSingletonHighlighter: (options?: Partial<BundledHighlighterOptions<L, T>>) => Promise<HighlighterGeneric<L, T>>;
|
|
75
|
-
/**
|
|
76
|
-
* Shorthand for `getLastGrammarState` with auto-loaded theme and language.
|
|
77
|
-
* A singleton highlighter it maintained internally.
|
|
78
|
-
*/
|
|
79
|
-
getLastGrammarState: ((element: ThemedToken[][] | Root) => GrammarState) | ((code: string, options: CodeToTokensBaseOptions<L, T>) => Promise<GrammarState>);
|
|
80
|
-
}
|
|
81
|
-
declare function makeSingletonHighlighter<L extends string, T extends string>(createHighlighter: CreateHighlighterFactory<L, T>): (options?: Partial<BundledHighlighterOptions<L, T>>) => Promise<HighlighterGeneric<L, T>>;
|
|
82
|
-
interface CreateSingletonShorthandsOptions<L extends string, T extends string> {
|
|
83
|
-
/**
|
|
84
|
-
* A custom function to guess embedded languages to be loaded.
|
|
85
|
-
*/
|
|
86
|
-
guessEmbeddedLanguages?: (code: string, lang: string | undefined, highlighter: HighlighterGeneric<L, T>) => Awaitable<string[] | undefined>;
|
|
87
|
-
}
|
|
88
|
-
declare function createSingletonShorthands<L extends string, T extends string>(createHighlighter: CreateHighlighterFactory<L, T>, config?: CreateSingletonShorthandsOptions<L, T>): ShorthandsBundle<L, T>;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Create a Shiki core highlighter instance, with no languages or themes bundled.
|
|
92
|
-
* Wasm and each language and theme must be loaded manually.
|
|
93
|
-
*
|
|
94
|
-
* @see http://shiki.style/guide/bundles#fine-grained-bundle
|
|
95
|
-
*/
|
|
96
|
-
declare function createHighlighterCore(options: HighlighterCoreOptions<false>): Promise<HighlighterCore>;
|
|
97
|
-
/**
|
|
98
|
-
* Create a Shiki core highlighter instance, with no languages or themes bundled.
|
|
99
|
-
* Wasm and each language and theme must be loaded manually.
|
|
100
|
-
*
|
|
101
|
-
* Synchronous version of `createHighlighterCore`, which requires to provide the engine and all themes and languages upfront.
|
|
102
|
-
*
|
|
103
|
-
* @see http://shiki.style/guide/bundles#fine-grained-bundle
|
|
104
|
-
*/
|
|
105
|
-
declare function createHighlighterCoreSync(options: HighlighterCoreOptions<true>): HighlighterCore;
|
|
106
|
-
declare function makeSingletonHighlighterCore(createHighlighter: typeof createHighlighterCore): (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
|
|
107
|
-
declare const getSingletonHighlighterCore: (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
|
|
108
|
-
/**
|
|
109
|
-
* @deprecated Use `createHighlighterCore` or `getSingletonHighlighterCore` instead.
|
|
110
|
-
*/
|
|
111
|
-
declare function getHighlighterCore(options: HighlighterCoreOptions): Promise<HighlighterCore>;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Get the minimal shiki context for rendering.
|
|
115
|
-
*/
|
|
116
|
-
declare function createShikiInternal(options: HighlighterCoreOptions): Promise<ShikiInternal>;
|
|
117
|
-
/**
|
|
118
|
-
* @deprecated Use `createShikiInternal` instead.
|
|
119
|
-
*/
|
|
120
|
-
declare function getShikiInternal(options: HighlighterCoreOptions): Promise<ShikiInternal>;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Get the minimal shiki context for rendering.
|
|
124
|
-
*
|
|
125
|
-
* Synchronous version of `createShikiInternal`, which requires to provide the engine and all themes and languages upfront.
|
|
126
|
-
*/
|
|
127
|
-
declare function createShikiInternalSync(options: HighlighterCoreOptions<true>): ShikiInternal;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* @deprecated Import `createJavaScriptRegexEngine` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead.
|
|
131
|
-
*/
|
|
132
|
-
declare function createJavaScriptRegexEngine(options?: JavaScriptRegexEngineOptions): RegexEngine;
|
|
133
|
-
/**
|
|
134
|
-
* @deprecated Import `defaultJavaScriptRegexConstructor` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead.
|
|
135
|
-
*/
|
|
136
|
-
declare function defaultJavaScriptRegexConstructor(pattern: string): RegExp;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead.
|
|
140
|
-
*/
|
|
141
|
-
declare function createOnigurumaEngine(options?: LoadWasmOptions | null): Promise<RegexEngine>;
|
|
142
|
-
/**
|
|
143
|
-
* @deprecated Import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead.
|
|
144
|
-
*/
|
|
145
|
-
declare function createWasmOnigEngine(options?: LoadWasmOptions | null): Promise<RegexEngine>;
|
|
146
|
-
/**
|
|
147
|
-
* @deprecated Import `loadWasm` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead.
|
|
148
|
-
*/
|
|
149
|
-
declare function loadWasm(options: LoadWasmOptions): Promise<void>;
|
|
150
|
-
|
|
151
|
-
declare function codeToHast(internal: ShikiInternal, code: string, options: CodeToHastOptions, transformerContext?: ShikiTransformerContextCommon): Root;
|
|
152
|
-
declare function tokensToHast(tokens: ThemedToken[][], options: CodeToHastRenderOptions, transformerContext: ShikiTransformerContextSource, grammarState?: GrammarState | undefined): Root;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Get highlighted code in HTML.
|
|
156
|
-
*/
|
|
157
|
-
declare function codeToHtml(internal: ShikiInternal, code: string, options: CodeToHastOptions): string;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* High-level code-to-tokens API.
|
|
161
|
-
*
|
|
162
|
-
* It will use `codeToTokensWithThemes` or `codeToTokensBase` based on the options.
|
|
163
|
-
*/
|
|
164
|
-
declare function codeToTokens(internal: ShikiInternal, code: string, options: CodeToTokensOptions): TokensResult;
|
|
165
|
-
|
|
166
|
-
declare function tokenizeAnsiWithTheme(theme: ThemeRegistrationResolved, fileContents: string, options?: TokenizeWithThemeOptions): ThemedToken[][];
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Code to tokens, with a simple theme.
|
|
170
|
-
*/
|
|
171
|
-
declare function codeToTokensBase(internal: ShikiInternal, code: string, options?: CodeToTokensBaseOptions): ThemedToken[][];
|
|
172
|
-
declare function tokenizeWithTheme(code: string, grammar: Grammar, theme: ThemeRegistrationResolved, colorMap: string[], options: TokenizeWithThemeOptions): ThemedToken[][];
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Get tokens with multiple themes
|
|
176
|
-
*/
|
|
177
|
-
declare function codeToTokensWithThemes(internal: ShikiInternal, code: string, options: CodeToTokensWithThemesOptions): ThemedTokenWithVariants[][];
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Normalize a textmate theme to shiki theme
|
|
181
|
-
*/
|
|
182
|
-
declare function normalizeTheme(rawTheme: ThemeRegistrationAny): ThemeRegistrationResolved;
|
|
183
|
-
|
|
184
|
-
interface CssVariablesThemeOptions {
|
|
185
|
-
/**
|
|
186
|
-
* Theme name. Need to unique if multiple css variables themes are created
|
|
187
|
-
*
|
|
188
|
-
* @default 'css-variables'
|
|
189
|
-
*/
|
|
190
|
-
name?: string;
|
|
191
|
-
/**
|
|
192
|
-
* Prefix for css variables
|
|
193
|
-
*
|
|
194
|
-
* @default '--shiki-'
|
|
195
|
-
*/
|
|
196
|
-
variablePrefix?: string;
|
|
197
|
-
/**
|
|
198
|
-
* Default value for css variables, the key is without the prefix
|
|
199
|
-
*
|
|
200
|
-
* @example `{ 'token-comment': '#888' }` will generate `var(--shiki-token-comment, #888)` for comments
|
|
201
|
-
*/
|
|
202
|
-
variableDefaults?: Record<string, string>;
|
|
203
|
-
/**
|
|
204
|
-
* Enable font style
|
|
205
|
-
*
|
|
206
|
-
* @default true
|
|
207
|
-
*/
|
|
208
|
-
fontStyle?: boolean;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* A factory function to create a css-variable-based theme
|
|
212
|
-
*
|
|
213
|
-
* @see https://shiki.style/guide/theme-colors#css-variables-theme
|
|
214
|
-
*/
|
|
215
|
-
declare function createCssVariablesTheme(options?: CssVariablesThemeOptions): ThemeRegistration;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* A built-in transformer to add decorations to the highlighted code.
|
|
219
|
-
*/
|
|
220
|
-
declare function transformerDecorations(): ShikiTransformer;
|
|
221
|
-
|
|
222
|
-
declare function resolveColorReplacements(theme: ThemeRegistrationAny | string, options?: TokenizeWithThemeOptions): Record<string, string | undefined>;
|
|
223
|
-
declare function applyColorReplacements(color: string, replacements?: Record<string, string | undefined>): string;
|
|
224
|
-
declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string | undefined>): string | undefined;
|
|
225
|
-
|
|
226
|
-
declare function toArray<T>(x: MaybeArray<T>): T[];
|
|
227
|
-
/**
|
|
228
|
-
* Normalize a getter to a promise.
|
|
229
|
-
*/
|
|
230
|
-
declare function normalizeGetter<T>(p: MaybeGetter<T>): Promise<T>;
|
|
231
|
-
/**
|
|
232
|
-
* Check if the language is plaintext that is ignored by Shiki.
|
|
233
|
-
*
|
|
234
|
-
* Hard-coded plain text languages: `plaintext`, `txt`, `text`, `plain`.
|
|
235
|
-
*/
|
|
236
|
-
declare function isPlainLang(lang: string | null | undefined): lang is PlainTextLanguage;
|
|
237
|
-
/**
|
|
238
|
-
* Check if the language is specially handled or bypassed by Shiki.
|
|
239
|
-
*
|
|
240
|
-
* Hard-coded languages: `ansi` and plaintexts like `plaintext`, `txt`, `text`, `plain`.
|
|
241
|
-
*/
|
|
242
|
-
declare function isSpecialLang(lang: any): lang is SpecialLanguage;
|
|
243
|
-
/**
|
|
244
|
-
* Check if the theme is specially handled or bypassed by Shiki.
|
|
245
|
-
*
|
|
246
|
-
* Hard-coded themes: `none`.
|
|
247
|
-
*/
|
|
248
|
-
declare function isNoneTheme(theme: string | ThemeInput | null | undefined): theme is 'none';
|
|
249
|
-
/**
|
|
250
|
-
* Check if the theme is specially handled or bypassed by Shiki.
|
|
251
|
-
*
|
|
252
|
-
* Hard-coded themes: `none`.
|
|
253
|
-
*/
|
|
254
|
-
declare function isSpecialTheme(theme: string | ThemeInput | null | undefined): theme is SpecialTheme;
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Utility to append class to a hast node
|
|
258
|
-
*
|
|
259
|
-
* If the `property.class` is a string, it will be splitted by space and converted to an array.
|
|
260
|
-
*/
|
|
261
|
-
declare function addClassToHast(node: Element, className: string | string[]): Element;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Split a string into lines, each line preserves the line ending.
|
|
265
|
-
*/
|
|
266
|
-
declare function splitLines(code: string, preserveEnding?: boolean): [string, number][];
|
|
267
|
-
/**
|
|
268
|
-
* Creates a converter between index and position in a code block.
|
|
269
|
-
*
|
|
270
|
-
* Overflow/underflow are unchecked.
|
|
271
|
-
*/
|
|
272
|
-
declare function createPositionConverter(code: string): {
|
|
273
|
-
lines: string[];
|
|
274
|
-
indexToPos: (index: number) => Position;
|
|
275
|
-
posToIndex: (line: number, character: number) => number;
|
|
276
|
-
};
|
|
277
|
-
/**
|
|
278
|
-
* Guess embedded languages from given code and highlighter.
|
|
279
|
-
*
|
|
280
|
-
* When highlighter is provided, only bundled languages will be included.
|
|
281
|
-
*/
|
|
282
|
-
declare function guessEmbeddedLanguages(code: string, _lang: string | undefined, highlighter?: HighlighterGeneric<any, any>): string[];
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Split a token into multiple tokens by given offsets.
|
|
286
|
-
*
|
|
287
|
-
* The offsets are relative to the token, and should be sorted.
|
|
288
|
-
*/
|
|
289
|
-
declare function splitToken<T extends Pick<ThemedToken, 'content' | 'offset'>>(token: T, offsets: number[]): T[];
|
|
290
|
-
/**
|
|
291
|
-
* Split 2D tokens array by given breakpoints.
|
|
292
|
-
*/
|
|
293
|
-
declare function splitTokens<T extends Pick<ThemedToken, 'content' | 'offset'>>(tokens: T[][], breakpoints: number[] | Set<number>): T[][];
|
|
294
|
-
declare function flatTokenVariants(merged: ThemedTokenWithVariants, variantsOrder: string[], cssVariablePrefix: string, defaultColor: string | boolean): ThemedToken;
|
|
295
|
-
declare function getTokenStyleObject(token: TokenStyles): Record<string, string>;
|
|
296
|
-
declare function stringifyTokenStyle(token: string | Record<string, string>): string;
|
|
297
|
-
|
|
298
|
-
type DeprecationTarget = 3;
|
|
299
|
-
/**
|
|
300
|
-
* Enable runtime warning for deprecated APIs, for the future versions of Shiki.
|
|
301
|
-
*
|
|
302
|
-
* You can pass a major version to only warn for deprecations that will be removed in that version.
|
|
303
|
-
*
|
|
304
|
-
* By default, deprecation warning is set to 3 since Shiki v2.0.0
|
|
305
|
-
*/
|
|
306
|
-
declare function enableDeprecationWarnings(emitDeprecation?: DeprecationTarget | boolean, emitError?: boolean): void;
|
|
307
|
-
/**
|
|
308
|
-
* @internal
|
|
309
|
-
*/
|
|
310
|
-
declare function warnDeprecated(message: string, version?: DeprecationTarget): void;
|
|
311
|
-
|
|
312
|
-
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 };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
let _emitDeprecation = 3;
|
|
2
|
-
let _emitError = false;
|
|
3
|
-
function enableDeprecationWarnings(emitDeprecation = true, emitError = false) {
|
|
4
|
-
_emitDeprecation = emitDeprecation;
|
|
5
|
-
_emitError = emitError;
|
|
6
|
-
}
|
|
7
|
-
function warnDeprecated(message, version = 3) {
|
|
8
|
-
if (!_emitDeprecation)
|
|
9
|
-
return;
|
|
10
|
-
if (typeof _emitDeprecation === "number" && version > _emitDeprecation)
|
|
11
|
-
return;
|
|
12
|
-
if (_emitError) {
|
|
13
|
-
throw new Error(`[SHIKI DEPRECATE]: ${message}`);
|
|
14
|
-
} else {
|
|
15
|
-
console.trace(`[SHIKI DEPRECATE]: ${message}`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { enableDeprecationWarnings as e, warnDeprecated as w };
|
package/dist/textmate.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@shikijs/vscode-textmate';
|
package/dist/types.d.ts
DELETED
package/dist/wasm-inlined.d.mts
DELETED
package/dist/wasm-inlined.d.ts
DELETED
package/dist/wasm-inlined.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { w as warnDeprecated } from './shared/core.5hv0Law9.mjs';
|
|
2
|
-
export * from '@shikijs/engine-oniguruma/wasm-inlined';
|
|
3
|
-
export { default } from '@shikijs/engine-oniguruma/wasm-inlined';
|
|
4
|
-
|
|
5
|
-
warnDeprecated("Import from `@shikijs/engine-oniguruma/wasm-inlined` instead");
|