@shikijs/core 1.26.1 → 1.27.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 CHANGED
@@ -12,11 +12,11 @@ export { toHtml as hastToHtml } from 'hast-util-to-html';
12
12
  * ```ts
13
13
  * const createHighlighter = createdBundledHighlighter({
14
14
  * langs: {
15
- * typescript: () => import('shiki/langs/typescript.mjs'),
15
+ * typescript: () => import('@shikijs/langs/typescript'),
16
16
  * // ...
17
17
  * },
18
18
  * themes: {
19
- * nord: () => import('shiki/themes/nord.mjs'),
19
+ * nord: () => import('@shikijs/themes/nord'),
20
20
  * // ...
21
21
  * },
22
22
  * engine: () => createOnigurumaEngine(), // or createJavaScriptRegexEngine()
package/dist/index.d.ts CHANGED
@@ -12,11 +12,11 @@ export { toHtml as hastToHtml } from 'hast-util-to-html';
12
12
  * ```ts
13
13
  * const createHighlighter = createdBundledHighlighter({
14
14
  * langs: {
15
- * typescript: () => import('shiki/langs/typescript.mjs'),
15
+ * typescript: () => import('@shikijs/langs/typescript'),
16
16
  * // ...
17
17
  * },
18
18
  * themes: {
19
- * nord: () => import('shiki/themes/nord.mjs'),
19
+ * nord: () => import('@shikijs/themes/nord'),
20
20
  * // ...
21
21
  * },
22
22
  * engine: () => createOnigurumaEngine(), // or createJavaScriptRegexEngine()
package/dist/index.mjs CHANGED
@@ -283,7 +283,7 @@ function transformerDecorations() {
283
283
  };
284
284
  } else {
285
285
  const line = converter.lines[p.line];
286
- if (line === void 0)
286
+ if (line === undefined)
287
287
  throw new ShikiError(`Invalid decoration position ${JSON.stringify(p)}. Lines length: ${converter.lines.length}`);
288
288
  if (p.character < 0 || p.character > line.length)
289
289
  throw new ShikiError(`Invalid decoration position ${JSON.stringify(p)}. Line ${p.line} length: ${line.length}`);
@@ -721,7 +721,7 @@ function tokenizeAnsiWithTheme(theme, fileContents, options) {
721
721
  bgColor = token.foreground ? colorPalette.value(token.foreground) : theme.fg;
722
722
  } else {
723
723
  color = token.foreground ? colorPalette.value(token.foreground) : theme.fg;
724
- bgColor = token.background ? colorPalette.value(token.background) : void 0;
724
+ bgColor = token.background ? colorPalette.value(token.background) : undefined;
725
725
  }
726
726
  color = applyColorReplacements(color, colorReplacements);
727
727
  bgColor = applyColorReplacements(bgColor, colorReplacements);
@@ -829,8 +829,8 @@ function _tokenizeWithTheme(code, grammar, theme, colorMap, options) {
829
829
  colorMap,
830
830
  {
831
831
  ...options,
832
- grammarState: void 0,
833
- grammarContextCode: void 0
832
+ grammarState: undefined,
833
+ grammarContextCode: undefined
834
834
  }
835
835
  ).stateStack : INITIAL;
836
836
  let actual = [];
@@ -1019,7 +1019,7 @@ function codeToTokensWithThemes(internal, code, options) {
1019
1019
  const mergedGrammarState = themedTokens[0].state ? new GrammarState(
1020
1020
  Object.fromEntries(themedTokens.map((s) => [s.theme, s.state?.getInternalStack(s.theme)])),
1021
1021
  themedTokens[0].state.lang
1022
- ) : void 0;
1022
+ ) : undefined;
1023
1023
  if (mergedGrammarState)
1024
1024
  setLastGrammarStateToMap(mergedTokens, mergedGrammarState);
1025
1025
  return mergedTokens;
@@ -1090,7 +1090,7 @@ function codeToTokens(internal, code, options) {
1090
1090
  fg = themes.map((t, idx) => (idx === 0 && defaultColor ? "" : `${cssVariablePrefix + t.color}:`) + (applyColorReplacements(themeRegs[idx].fg, themeColorReplacements[idx]) || "inherit")).join(";");
1091
1091
  bg = themes.map((t, idx) => (idx === 0 && defaultColor ? "" : `${cssVariablePrefix + t.color}-bg:`) + (applyColorReplacements(themeRegs[idx].bg, themeColorReplacements[idx]) || "inherit")).join(";");
1092
1092
  themeName = `shiki-themes ${themeRegs.map((t) => t.name).join(" ")}`;
1093
- rootStyle = defaultColor ? void 0 : [fg, bg].join(";");
1093
+ rootStyle = defaultColor ? undefined : [fg, bg].join(";");
1094
1094
  } else if ("theme" in options) {
1095
1095
  const colorReplacements = resolveColorReplacements(options.theme, options);
1096
1096
  tokens = codeToTokensBase(
@@ -1407,7 +1407,7 @@ function normalizeTheme(rawTheme) {
1407
1407
  theme.settings ||= [];
1408
1408
  let { bg, fg } = theme;
1409
1409
  if (!bg || !fg) {
1410
- const globalSetting = theme.settings ? theme.settings.find((s) => !s.name && !s.scope) : void 0;
1410
+ const globalSetting = theme.settings ? theme.settings.find((s) => !s.name && !s.scope) : undefined;
1411
1411
  if (globalSetting?.settings?.foreground)
1412
1412
  fg = globalSetting.settings.foreground;
1413
1413
  if (globalSetting?.settings?.background)
@@ -1785,7 +1785,7 @@ async function createShikiInternal(options = {}) {
1785
1785
  ]);
1786
1786
  return createShikiInternalSync({
1787
1787
  ...options,
1788
- loadWasm: void 0,
1788
+ loadWasm: undefined,
1789
1789
  themes,
1790
1790
  langs,
1791
1791
  engine
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/core",
3
3
  "type": "module",
4
- "version": "1.26.1",
4
+ "version": "1.27.0",
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/engine-javascript": "1.26.1",
67
- "@shikijs/types": "1.26.1",
68
- "@shikijs/engine-oniguruma": "1.26.1"
66
+ "@shikijs/engine-javascript": "1.27.0",
67
+ "@shikijs/engine-oniguruma": "1.27.0",
68
+ "@shikijs/types": "1.27.0"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "unbuild",