shiki 2.4.0 → 2.4.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.
@@ -1,11 +1,10 @@
1
- import { a as guessEmbeddedLanguages } from './wasm-dynamic-DgcGSsZr.js';
2
- export { g as getWasmInlined } from './wasm-dynamic-DgcGSsZr.js';
1
+ import { createSingletonShorthands, createdBundledHighlighter, guessEmbeddedLanguages, warnDeprecated } from '@shikijs/core';
2
+ export * from '@shikijs/core';
3
3
  import { bundledLanguages } from './langs.mjs';
4
4
  export { bundledLanguagesAlias, bundledLanguagesBase, bundledLanguagesInfo } from './langs.mjs';
5
5
  import { bundledThemes } from './themes.mjs';
6
6
  export { bundledThemesInfo } from './themes.mjs';
7
- import { createSingletonShorthands, createdBundledHighlighter, warnDeprecated } from '@shikijs/core';
8
- export * from '@shikijs/core';
7
+ export { g as getWasmInlined } from './wasm-dynamic-K7LwWlz7.js';
9
8
  import { createOnigurumaEngine } from '@shikijs/engine-oniguruma';
10
9
 
11
10
  const createHighlighter = /* @__PURE__ */ createdBundledHighlighter({
@@ -1,9 +1,8 @@
1
- import { a as guessEmbeddedLanguages } from './wasm-dynamic-DgcGSsZr.js';
2
- export { g as getWasmInlined } from './wasm-dynamic-DgcGSsZr.js';
1
+ import { createSingletonShorthands, createdBundledHighlighter, guessEmbeddedLanguages, warnDeprecated } from '@shikijs/core';
2
+ export * from '@shikijs/core';
3
3
  import { bundledThemes } from './themes.mjs';
4
4
  export { bundledThemesInfo } from './themes.mjs';
5
- import { createSingletonShorthands, createdBundledHighlighter, warnDeprecated } from '@shikijs/core';
6
- export * from '@shikijs/core';
5
+ export { g as getWasmInlined } from './wasm-dynamic-K7LwWlz7.js';
7
6
  import { createOnigurumaEngine } from '@shikijs/engine-oniguruma';
8
7
 
9
8
  const bundledLanguagesInfo = [
@@ -538,6 +538,12 @@ declare function createPositionConverter(code: string): {
538
538
  indexToPos: (index: number) => Position;
539
539
  posToIndex: (line: number, character: number) => number;
540
540
  };
541
+ /**
542
+ * Guess embedded languages from given code and highlighter.
543
+ *
544
+ * When highlighter is provided, only bundled languages will be included.
545
+ */
546
+ declare function guessEmbeddedLanguages(code: string, _lang: string | undefined, highlighter?: HighlighterGeneric<any, any>): string[];
541
547
 
542
548
  type DeprecationTarget = 3;
543
549
  /**
@@ -553,4 +559,4 @@ declare function enableDeprecationWarnings(emitDeprecation?: DeprecationTarget |
553
559
  */
554
560
  declare function warnDeprecated(message: string, version?: DeprecationTarget): void;
555
561
 
556
- export { type CreateSingletonShorthandsOptions, type CssVariablesThemeOptions, FontStyle, type ShorthandsBundle, EncodedTokenMetadata as StackElementMetadata, addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync, createJavaScriptRegexEngine, createOnigurumaEngine, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, createWasmOnigEngine, createdBundledHighlighter, defaultJavaScriptRegexConstructor, enableDeprecationWarnings, getHighlighterCore, getShikiInternal, getSingletonHighlighterCore, getTokenStyleObject, toHtml as hastToHtml, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, loadWasm, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
562
+ export { type CreateSingletonShorthandsOptions, type CssVariablesThemeOptions, FontStyle, type ShorthandsBundle, EncodedTokenMetadata as StackElementMetadata, 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, toHtml as hastToHtml, 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,7 +1,7 @@
1
1
  export { codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createHighlighter, getHighlighter, getLastGrammarState, getSingletonHighlighter } from './bundle-full.mjs';
2
2
  export { createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor } from '@shikijs/engine-javascript';
3
3
  export { createOnigurumaEngine, loadWasm } from '@shikijs/engine-oniguruma';
4
- export { g as getWasmInlined } from './wasm-dynamic-DgcGSsZr.js';
4
+ export { g as getWasmInlined } from './wasm-dynamic-K7LwWlz7.js';
5
5
  export * from '@shikijs/core';
6
6
  export { bundledLanguages, bundledLanguagesAlias, bundledLanguagesBase, bundledLanguagesInfo } from './langs.mjs';
7
7
  export { bundledThemes, bundledThemesInfo } from './themes.mjs';
@@ -0,0 +1,8 @@
1
+ import { warnDeprecated } from '@shikijs/core';
2
+
3
+ const getWasmInlined = async (info) => {
4
+ warnDeprecated('`getWasmInlined` is deprecated. Use `import("shiki/wasm")` instead.');
5
+ return import('shiki/wasm').then((wasm) => wasm.default(info));
6
+ };
7
+
8
+ export { getWasmInlined as g };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shiki",
3
3
  "type": "module",
4
- "version": "2.4.0",
4
+ "version": "2.4.1",
5
5
  "description": "A beautiful Syntax Highlighter.",
6
6
  "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -119,12 +119,12 @@
119
119
  "dependencies": {
120
120
  "@shikijs/vscode-textmate": "^10.0.2",
121
121
  "@types/hast": "^3.0.4",
122
- "@shikijs/core": "2.4.0",
123
- "@shikijs/engine-oniguruma": "2.4.0",
124
- "@shikijs/engine-javascript": "2.4.0",
125
- "@shikijs/themes": "2.4.0",
126
- "@shikijs/types": "2.4.0",
127
- "@shikijs/langs": "2.4.0"
122
+ "@shikijs/core": "2.4.1",
123
+ "@shikijs/langs": "2.4.1",
124
+ "@shikijs/engine-oniguruma": "2.4.1",
125
+ "@shikijs/types": "2.4.1",
126
+ "@shikijs/themes": "2.4.1",
127
+ "@shikijs/engine-javascript": "2.4.1"
128
128
  },
129
129
  "devDependencies": {
130
130
  "rollup-plugin-copy": "^3.5.0",
@@ -1,23 +0,0 @@
1
- import { warnDeprecated } from '@shikijs/core';
2
-
3
- function guessEmbeddedLanguages(code, _lang, shiki) {
4
- const langs = /* @__PURE__ */ new Set();
5
- for (const match of code.matchAll(/lang=["']([\w-]+)["']/g)) {
6
- langs.add(match[1]);
7
- }
8
- for (const match of code.matchAll(/(?:```|~~~)([\w-]+)/g)) {
9
- langs.add(match[1]);
10
- }
11
- for (const match of code.matchAll(/\\begin\{([\w-]+)\}/g)) {
12
- langs.add(match[1]);
13
- }
14
- const bundle = shiki.getBundledLanguages();
15
- return Array.from(langs).filter((l) => l && bundle[l]);
16
- }
17
-
18
- const getWasmInlined = async (info) => {
19
- warnDeprecated('`getWasmInlined` is deprecated. Use `import("shiki/wasm")` instead.');
20
- return import('shiki/wasm').then((wasm) => wasm.default(info));
21
- };
22
-
23
- export { guessEmbeddedLanguages as a, getWasmInlined as g };