@shikijs/core 1.28.0 → 1.29.1
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 +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.mjs +3 -2
- package/dist/shared/core.Bn_XU0Iv.mjs +19 -0
- package/dist/wasm-inlined.mjs +1 -1
- package/package.json +4 -4
- package/dist/shared/core.DVV8c4RZ.mjs +0 -10
package/dist/index.d.mts
CHANGED
|
@@ -278,17 +278,18 @@ declare function createPositionConverter(code: string): {
|
|
|
278
278
|
posToIndex: (line: number, character: number) => number;
|
|
279
279
|
};
|
|
280
280
|
|
|
281
|
+
type DeprecationTarget = 3;
|
|
281
282
|
/**
|
|
282
283
|
* Enable runtime warning for deprecated APIs, for the future versions of Shiki.
|
|
283
284
|
*
|
|
284
|
-
*
|
|
285
|
+
* You can pass a major version to only warn for deprecations that will be removed in that version.
|
|
285
286
|
*
|
|
286
|
-
*
|
|
287
|
+
* By default, deprecation warning is set to 3 since Shiki v2.0.0
|
|
287
288
|
*/
|
|
288
|
-
declare function enableDeprecationWarnings(
|
|
289
|
+
declare function enableDeprecationWarnings(emitDeprecation?: DeprecationTarget | boolean, emitError?: boolean): void;
|
|
289
290
|
/**
|
|
290
291
|
* @internal
|
|
291
292
|
*/
|
|
292
|
-
declare function warnDeprecated(message: string): void;
|
|
293
|
+
declare function warnDeprecated(message: string, version?: DeprecationTarget): void;
|
|
293
294
|
|
|
294
295
|
export { 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, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, loadWasm, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
|
package/dist/index.d.ts
CHANGED
|
@@ -278,17 +278,18 @@ declare function createPositionConverter(code: string): {
|
|
|
278
278
|
posToIndex: (line: number, character: number) => number;
|
|
279
279
|
};
|
|
280
280
|
|
|
281
|
+
type DeprecationTarget = 3;
|
|
281
282
|
/**
|
|
282
283
|
* Enable runtime warning for deprecated APIs, for the future versions of Shiki.
|
|
283
284
|
*
|
|
284
|
-
*
|
|
285
|
+
* You can pass a major version to only warn for deprecations that will be removed in that version.
|
|
285
286
|
*
|
|
286
|
-
*
|
|
287
|
+
* By default, deprecation warning is set to 3 since Shiki v2.0.0
|
|
287
288
|
*/
|
|
288
|
-
declare function enableDeprecationWarnings(
|
|
289
|
+
declare function enableDeprecationWarnings(emitDeprecation?: DeprecationTarget | boolean, emitError?: boolean): void;
|
|
289
290
|
/**
|
|
290
291
|
* @internal
|
|
291
292
|
*/
|
|
292
|
-
declare function warnDeprecated(message: string): void;
|
|
293
|
+
declare function warnDeprecated(message: string, version?: DeprecationTarget): void;
|
|
293
294
|
|
|
294
295
|
export { 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, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, loadWasm, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ShikiError as ShikiError$1 } from '@shikijs/types';
|
|
2
2
|
export * from '@shikijs/types';
|
|
3
3
|
import { createOnigurumaEngine as createOnigurumaEngine$1, loadWasm as loadWasm$1, getDefaultWasmLoader } from '@shikijs/engine-oniguruma';
|
|
4
|
-
import { w as warnDeprecated } from './shared/core.
|
|
5
|
-
export { e as enableDeprecationWarnings } from './shared/core.
|
|
4
|
+
import { w as warnDeprecated } from './shared/core.Bn_XU0Iv.mjs';
|
|
5
|
+
export { e as enableDeprecationWarnings } from './shared/core.Bn_XU0Iv.mjs';
|
|
6
6
|
import { FontStyle, INITIAL, EncodedTokenMetadata, Registry as Registry$1, Theme } from '@shikijs/vscode-textmate';
|
|
7
7
|
export { FontStyle, EncodedTokenMetadata as StackElementMetadata } from '@shikijs/vscode-textmate';
|
|
8
8
|
import { toHtml } from 'hast-util-to-html';
|
|
@@ -233,6 +233,7 @@ class GrammarState {
|
|
|
233
233
|
* @deprecated use `getScopes` instead
|
|
234
234
|
*/
|
|
235
235
|
get scopes() {
|
|
236
|
+
warnDeprecated("GrammarState.scopes is deprecated, use GrammarState.getScopes() instead");
|
|
236
237
|
return getScopes(this._stacks[this.theme]);
|
|
237
238
|
}
|
|
238
239
|
getScopes(theme = this.theme) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
let _emitDeprecation = false;
|
|
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/wasm-inlined.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.29.1",
|
|
5
5
|
"description": "Core of Shiki",
|
|
6
6
|
"author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"@shikijs/vscode-textmate": "^10.0.1",
|
|
64
64
|
"@types/hast": "^3.0.4",
|
|
65
65
|
"hast-util-to-html": "^9.0.4",
|
|
66
|
-
"@shikijs/
|
|
67
|
-
"@shikijs/
|
|
68
|
-
"@shikijs/engine-
|
|
66
|
+
"@shikijs/types": "1.29.1",
|
|
67
|
+
"@shikijs/engine-javascript": "1.29.1",
|
|
68
|
+
"@shikijs/engine-oniguruma": "1.29.1"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "unbuild",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
let emitDeprecation = false;
|
|
2
|
-
function enableDeprecationWarnings(value = true) {
|
|
3
|
-
emitDeprecation = value;
|
|
4
|
-
}
|
|
5
|
-
function warnDeprecated(message) {
|
|
6
|
-
if (emitDeprecation)
|
|
7
|
-
console.trace(`[SHIKI DEPRECATE]: ${message}`);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { enableDeprecationWarnings as e, warnDeprecated as w };
|