@shikijs/core 1.2.2 → 1.2.4

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.
@@ -394,6 +394,18 @@ type RuleId = {
394
394
  __brand: typeof ruleIdSymbol;
395
395
  };
396
396
 
397
+ declare class Theme {
398
+ private readonly _colorMap;
399
+ private readonly _defaults;
400
+ private readonly _root;
401
+ static createFromRawTheme(source: IRawTheme | undefined, colorMap?: string[]): Theme;
402
+ static createFromParsedTheme(source: ParsedThemeRule[], colorMap?: string[]): Theme;
403
+ private readonly _cachedMatchRoot;
404
+ constructor(_colorMap: ColorMap, _defaults: StyleAttributes, _root: ThemeTrieElement);
405
+ getColorMap(): string[];
406
+ getDefaults(): StyleAttributes;
407
+ match(scopePath: ScopeStack | null): StyleAttributes | null;
408
+ }
397
409
  /**
398
410
  * Identifiers with a binary dot operator.
399
411
  * Examples: `baz` or `foo.bar`
@@ -423,6 +435,76 @@ interface IRawThemeSetting {
423
435
  readonly background?: string;
424
436
  };
425
437
  }
438
+ declare class ScopeStack {
439
+ readonly parent: ScopeStack | null;
440
+ readonly scopeName: ScopeName;
441
+ static push(path: ScopeStack | null, scopeNames: ScopeName[]): ScopeStack | null;
442
+ static from(first: ScopeName, ...segments: ScopeName[]): ScopeStack;
443
+ static from(...segments: ScopeName[]): ScopeStack | null;
444
+ constructor(parent: ScopeStack | null, scopeName: ScopeName);
445
+ push(scopeName: ScopeName): ScopeStack;
446
+ getSegments(): ScopeName[];
447
+ toString(): string;
448
+ extends(other: ScopeStack): boolean;
449
+ getExtensionIfDefined(base: ScopeStack | null): string[] | undefined;
450
+ }
451
+ declare class StyleAttributes {
452
+ readonly fontStyle: OrMask<FontStyle$1>;
453
+ readonly foregroundId: number;
454
+ readonly backgroundId: number;
455
+ constructor(fontStyle: OrMask<FontStyle$1>, foregroundId: number, backgroundId: number);
456
+ }
457
+ declare class ParsedThemeRule {
458
+ readonly scope: ScopeName;
459
+ readonly parentScopes: ScopeName[] | null;
460
+ readonly index: number;
461
+ readonly fontStyle: OrMask<FontStyle$1>;
462
+ readonly foreground: string | null;
463
+ readonly background: string | null;
464
+ constructor(scope: ScopeName, parentScopes: ScopeName[] | null, index: number, fontStyle: OrMask<FontStyle$1>, foreground: string | null, background: string | null);
465
+ }
466
+ declare const enum FontStyle$1 {
467
+ NotSet = -1,
468
+ None = 0,
469
+ Italic = 1,
470
+ Bold = 2,
471
+ Underline = 4,
472
+ Strikethrough = 8
473
+ }
474
+ declare class ColorMap {
475
+ private readonly _isFrozen;
476
+ private _lastColorId;
477
+ private _id2color;
478
+ private _color2id;
479
+ constructor(_colorMap?: string[]);
480
+ getId(color: string | null): number;
481
+ getColorMap(): string[];
482
+ }
483
+ declare class ThemeTrieElementRule {
484
+ scopeDepth: number;
485
+ parentScopes: ScopeName[] | null;
486
+ fontStyle: number;
487
+ foreground: number;
488
+ background: number;
489
+ constructor(scopeDepth: number, parentScopes: ScopeName[] | null, fontStyle: number, foreground: number, background: number);
490
+ clone(): ThemeTrieElementRule;
491
+ static cloneArr(arr: ThemeTrieElementRule[]): ThemeTrieElementRule[];
492
+ acceptOverwrite(scopeDepth: number, fontStyle: number, foreground: number, background: number): void;
493
+ }
494
+ interface ITrieChildrenMap {
495
+ [segment: string]: ThemeTrieElement;
496
+ }
497
+ declare class ThemeTrieElement {
498
+ private readonly _mainRule;
499
+ private readonly _children;
500
+ private readonly _rulesWithParentScopes;
501
+ constructor(_mainRule: ThemeTrieElementRule, rulesWithParentScopes?: ThemeTrieElementRule[], _children?: ITrieChildrenMap);
502
+ private static _sortBySpecificity;
503
+ private static _cmpBySpecificity;
504
+ match(scope: ScopeName): ThemeTrieElementRule[];
505
+ insert(scopeDepth: number, scope: ScopeName, parentScopes: ScopeName[] | null, fontStyle: number, foreground: number, background: number): void;
506
+ private _doInsertHere;
507
+ }
426
508
 
427
509
  interface IRawGrammar extends ILocatable {
428
510
  repository: IRawRepository;
@@ -1228,4 +1310,4 @@ declare enum FontStyle {
1228
1310
  Underline = 4
1229
1311
  }
1230
1312
 
1231
- export { type DynamicImportThemeRegistration as $, type ShikiTransformer as A, type BundledHighlighterOptions as B, type CodeToHastOptions as C, type AnsiLanguage as D, type Element as E, FontStyle as F, type ResolveBundleKey as G, type HighlighterCoreOptions as H, INITIAL as I, type LanguageRegistration as J, type BundledLanguageInfo as K, type LanguageInput as L, type MaybeArray as M, type Nodes as N, type DynamicImportLanguageRegistration as O, type PlainTextLanguage as P, type CodeOptionsSingleTheme as Q, Registry as R, type StateStack as S, type ThemeInput as T, type CodeOptionsMultipleThemes as U, type CodeOptionsThemes as V, type CodeToHastOptionsCommon as W, type CodeOptionsMeta as X, type CodeToHastRenderOptionsCommon as Y, type ThemeRegistrationRaw as Z, type ThemeRegistration as _, type IRawTheme as a, type BundledThemeInfo as a0, type ThemedTokenScopeExplanation as a1, type ThemedTokenExplanation as a2, type TokenBase as a3, type TransformerOptions as a4, type ShikiTransformerContextMeta as a5, type ShikiTransformerContext as a6, type Awaitable as a7, type MaybeGetter as a8, type MaybeModule as a9, type StringLiteralUnion as aa, type DecorationOptions as ab, type DecorationItem as ac, type ResolvedDecorationItem as ad, type DecorationTransformType as ae, type Offset as af, type OffsetOrPosition as ag, type ResolvedPosition as ah, type IRawGrammar as b, type IGrammar as c, type IGrammarConfiguration as d, type IOnigLib as e, type RegistryOptions as f, type IRawThemeSetting as g, type Root as h, type CodeToTokensOptions as i, type TokensResult as j, type RequireKeys as k, type CodeToTokensBaseOptions as l, type ThemedToken as m, type CodeToTokensWithThemesOptions as n, type ThemedTokenWithVariants as o, type SpecialLanguage as p, type SpecialTheme as q, type TokenStyles as r, type Position as s, type ThemeRegistrationResolved as t, type TokenizeWithThemeOptions as u, type ShikiTransformerContextCommon as v, type CodeToHastRenderOptions as w, type ShikiTransformerContextSource as x, type RootContent as y, type ThemeRegistrationAny as z };
1313
+ export { type ThemeRegistration as $, type ThemeRegistrationAny as A, type BundledHighlighterOptions as B, type CodeToHastOptions as C, type ShikiTransformer as D, type Element as E, FontStyle as F, type AnsiLanguage as G, type HighlighterCoreOptions as H, INITIAL as I, type ResolveBundleKey as J, type LanguageRegistration as K, type LanguageInput as L, type MaybeArray as M, type Nodes as N, type BundledLanguageInfo as O, type PlainTextLanguage as P, type DynamicImportLanguageRegistration as Q, Registry as R, type StateStack as S, Theme as T, type CodeOptionsSingleTheme as U, type CodeOptionsMultipleThemes as V, type CodeOptionsThemes as W, type CodeToHastOptionsCommon as X, type CodeOptionsMeta as Y, type CodeToHastRenderOptionsCommon as Z, type ThemeRegistrationRaw as _, type IRawTheme as a, type DynamicImportThemeRegistration as a0, type BundledThemeInfo as a1, type ThemedTokenScopeExplanation as a2, type ThemedTokenExplanation as a3, type TokenBase as a4, type TransformerOptions as a5, type ShikiTransformerContextMeta as a6, type ShikiTransformerContext as a7, type Awaitable as a8, type MaybeGetter as a9, type MaybeModule as aa, type StringLiteralUnion as ab, type DecorationOptions as ac, type DecorationItem as ad, type ResolvedDecorationItem as ae, type DecorationTransformType as af, type Offset as ag, type OffsetOrPosition as ah, type ResolvedPosition as ai, type IRawGrammar as b, type IGrammar as c, type IGrammarConfiguration as d, type IOnigLib as e, type RegistryOptions as f, type IRawThemeSetting as g, type ThemeInput as h, type Root as i, type CodeToTokensOptions as j, type TokensResult as k, type RequireKeys as l, type CodeToTokensBaseOptions as m, type ThemedToken as n, type CodeToTokensWithThemesOptions as o, type ThemedTokenWithVariants as p, type SpecialLanguage as q, type SpecialTheme as r, type TokenStyles as s, type Position as t, type ThemeRegistrationResolved as u, type TokenizeWithThemeOptions as v, type ShikiTransformerContextCommon as w, type CodeToHastRenderOptions as x, type ShikiTransformerContextSource as y, type RootContent as z };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { HighlighterCore, HighlighterGeneric, ShikiInternal } from './types.mjs';
2
- import { H as HighlighterCoreOptions, B as BundledHighlighterOptions, L as LanguageInput, T as ThemeInput, C as CodeToHastOptions, h as Root, i as CodeToTokensOptions, j as TokensResult, k as RequireKeys, l as CodeToTokensBaseOptions, m as ThemedToken, n as CodeToTokensWithThemesOptions, o as ThemedTokenWithVariants, M as MaybeArray, P as PlainTextLanguage, p as SpecialLanguage, q as SpecialTheme, E as Element, r as TokenStyles, s as Position, c as IGrammar, t as ThemeRegistrationResolved, u as TokenizeWithThemeOptions, v as ShikiTransformerContextCommon, w as CodeToHastRenderOptions, x as ShikiTransformerContextSource, N as Nodes$1, y as RootContent$1, z as ThemeRegistrationAny, A as ShikiTransformer } from './chunk-tokens.mjs';
3
- export { D as AnsiLanguage, a7 as Awaitable, K as BundledLanguageInfo, a0 as BundledThemeInfo, X as CodeOptionsMeta, U as CodeOptionsMultipleThemes, Q as CodeOptionsSingleTheme, V as CodeOptionsThemes, W as CodeToHastOptionsCommon, Y as CodeToHastRenderOptionsCommon, ac as DecorationItem, ab as DecorationOptions, ae as DecorationTransformType, O as DynamicImportLanguageRegistration, $ as DynamicImportThemeRegistration, F as FontStyle, J as LanguageRegistration, a8 as MaybeGetter, a9 as MaybeModule, af as Offset, ag as OffsetOrPosition, b as RawGrammar, a as RawTheme, g as RawThemeSetting, G as ResolveBundleKey, ad as ResolvedDecorationItem, ah as ResolvedPosition, a6 as ShikiTransformerContext, a5 as ShikiTransformerContextMeta, aa as StringLiteralUnion, _ as ThemeRegistration, Z as ThemeRegistrationRaw, a2 as ThemedTokenExplanation, a1 as ThemedTokenScopeExplanation, a3 as TokenBase, a4 as TransformerOptions } from './chunk-tokens.mjs';
2
+ import { H as HighlighterCoreOptions, B as BundledHighlighterOptions, L as LanguageInput, h as ThemeInput, C as CodeToHastOptions, i as Root, j as CodeToTokensOptions, k as TokensResult, l as RequireKeys, m as CodeToTokensBaseOptions, n as ThemedToken, o as CodeToTokensWithThemesOptions, p as ThemedTokenWithVariants, M as MaybeArray, P as PlainTextLanguage, q as SpecialLanguage, r as SpecialTheme, E as Element, s as TokenStyles, t as Position, c as IGrammar, u as ThemeRegistrationResolved, v as TokenizeWithThemeOptions, w as ShikiTransformerContextCommon, x as CodeToHastRenderOptions, y as ShikiTransformerContextSource, N as Nodes$1, z as RootContent$1, A as ThemeRegistrationAny, D as ShikiTransformer } from './chunk-tokens.mjs';
3
+ export { G as AnsiLanguage, a8 as Awaitable, O as BundledLanguageInfo, a1 as BundledThemeInfo, Y as CodeOptionsMeta, V as CodeOptionsMultipleThemes, U as CodeOptionsSingleTheme, W as CodeOptionsThemes, X as CodeToHastOptionsCommon, Z as CodeToHastRenderOptionsCommon, ad as DecorationItem, ac as DecorationOptions, af as DecorationTransformType, Q as DynamicImportLanguageRegistration, a0 as DynamicImportThemeRegistration, F as FontStyle, K as LanguageRegistration, a9 as MaybeGetter, aa as MaybeModule, ag as Offset, ah as OffsetOrPosition, b as RawGrammar, a as RawTheme, g as RawThemeSetting, J as ResolveBundleKey, ae as ResolvedDecorationItem, ai as ResolvedPosition, a7 as ShikiTransformerContext, a6 as ShikiTransformerContextMeta, ab as StringLiteralUnion, $ as ThemeRegistration, _ as ThemeRegistrationRaw, a3 as ThemedTokenExplanation, a2 as ThemedTokenScopeExplanation, a4 as TokenBase, a5 as TransformerOptions } from './chunk-tokens.mjs';
4
4
  import { L as LoadWasmOptions } from './chunk-index.mjs';
5
5
  export { W as WebAssemblyInstantiator, l as loadWasm } from './chunk-index.mjs';
6
6
 
@@ -112,6 +112,7 @@ declare function splitToken<T extends Pick<ThemedToken, 'content' | 'offset'>>(t
112
112
  */
113
113
  declare function splitTokens<T extends Pick<ThemedToken, 'content' | 'offset'>>(tokens: T[][], breakpoints: number[] | Set<number>): T[][];
114
114
  declare function applyColorReplacements(color: string, replacements?: Record<string, string>): string;
115
+ declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string>): string | undefined;
115
116
  declare function getTokenStyleObject(token: TokenStyles): Record<string, string>;
116
117
  declare function stringifyTokenStyle(token: Record<string, string>): string;
117
118
  /**
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { StackElementMetadata, INITIAL, Registry as Registry$1 } from './textmate.mjs';
1
+ import { StackElementMetadata, INITIAL, Registry as Registry$1, Theme } from './textmate.mjs';
2
2
  import { FontStyle } from './types.mjs';
3
3
 
4
4
  function toArray(x) {
@@ -122,6 +122,8 @@ function splitTokens(tokens, breakpoints) {
122
122
  });
123
123
  }
124
124
  function applyColorReplacements(color, replacements) {
125
+ if (!color)
126
+ return color;
125
127
  return replacements?.[color?.toLowerCase()] || color;
126
128
  }
127
129
  function getTokenStyleObject(token) {
@@ -458,6 +460,7 @@ function tokenizeAnsiWithTheme(theme, fileContents, options) {
458
460
  bgColor = token.background ? colorPalette.value(token.background) : undefined;
459
461
  }
460
462
  color = applyColorReplacements(color, colorReplacements);
463
+ bgColor = applyColorReplacements(bgColor, colorReplacements);
461
464
  if (token.decorations.has('dim'))
462
465
  color = dimColor(color);
463
466
  let fontStyle = FontStyle.None;
@@ -563,13 +566,12 @@ function tokenizeWithTheme(code, grammar, theme, colorMap, options) {
563
566
  if (startIndex === nextStartIndex)
564
567
  continue;
565
568
  const metadata = result.tokens[2 * j + 1];
566
- const foreground = StackElementMetadata.getForeground(metadata);
567
- const foregroundColor = applyColorReplacements(colorMap[foreground], colorReplacements);
569
+ const color = applyColorReplacements(colorMap[StackElementMetadata.getForeground(metadata)], colorReplacements);
568
570
  const fontStyle = StackElementMetadata.getFontStyle(metadata);
569
571
  const token = {
570
572
  content: line.substring(startIndex, nextStartIndex),
571
573
  offset: lineOffset + startIndex,
572
- color: foregroundColor,
574
+ color,
573
575
  fontStyle,
574
576
  };
575
577
  if (options.includeExplanation) {
@@ -748,7 +750,7 @@ function codeToTokens(internal, code, options) {
748
750
  let themeName;
749
751
  let rootStyle;
750
752
  if ('themes' in options) {
751
- const { defaultColor = 'light', cssVariablePrefix = '--shiki-', } = options;
753
+ const { defaultColor = 'light', cssVariablePrefix = '--shiki-', colorReplacements, } = options;
752
754
  const themes = Object.entries(options.themes)
753
755
  .filter(i => i[1])
754
756
  .map(i => ({ color: i[0], theme: i[1] }))
@@ -762,16 +764,21 @@ function codeToTokens(internal, code, options) {
762
764
  const themesOrder = themes.map(t => t.color);
763
765
  tokens = themeTokens
764
766
  .map(line => line.map(token => mergeToken(token, themesOrder, cssVariablePrefix, defaultColor)));
765
- fg = themes.map((t, idx) => (idx === 0 && defaultColor ? '' : `${cssVariablePrefix + t.color}:`) + (themeRegs[idx].fg || 'inherit')).join(';');
766
- bg = themes.map((t, idx) => (idx === 0 && defaultColor ? '' : `${cssVariablePrefix + t.color}-bg:`) + (themeRegs[idx].bg || 'inherit')).join(';');
767
+ fg = themes.map((t, idx) => (idx === 0 && defaultColor
768
+ ? ''
769
+ : `${cssVariablePrefix + t.color}:`) + (applyColorReplacements(themeRegs[idx].fg, colorReplacements) || 'inherit')).join(';');
770
+ bg = themes.map((t, idx) => (idx === 0 && defaultColor
771
+ ? ''
772
+ : `${cssVariablePrefix + t.color}-bg:`) + (applyColorReplacements(themeRegs[idx].bg, colorReplacements) || 'inherit')).join(';');
767
773
  themeName = `shiki-themes ${themeRegs.map(t => t.name).join(' ')}`;
768
774
  rootStyle = defaultColor ? undefined : [fg, bg].join(';');
769
775
  }
770
776
  else if ('theme' in options) {
777
+ const { colorReplacements, } = options;
771
778
  tokens = codeToTokensBase(internal, code, options);
772
779
  const _theme = internal.getTheme(options.theme);
773
- bg = _theme.bg;
774
- fg = _theme.fg;
780
+ bg = applyColorReplacements(_theme.bg, colorReplacements);
781
+ fg = applyColorReplacements(_theme.fg, colorReplacements);
775
782
  themeName = _theme.name;
776
783
  }
777
784
  else {
@@ -5104,16 +5111,20 @@ class Registry extends Registry$1 {
5104
5111
  _resolver;
5105
5112
  _themes;
5106
5113
  _langs;
5114
+ _alias;
5107
5115
  _resolvedThemes = {};
5108
5116
  _resolvedGrammars = {};
5109
5117
  _langMap = {};
5110
5118
  _langGraph = new Map();
5111
- alias = {};
5112
- constructor(_resolver, _themes, _langs) {
5119
+ _textmateThemeCache = new WeakMap();
5120
+ _loadedThemesCache = null;
5121
+ _loadedLanguagesCache = null;
5122
+ constructor(_resolver, _themes, _langs, _alias = {}) {
5113
5123
  super(_resolver);
5114
5124
  this._resolver = _resolver;
5115
5125
  this._themes = _themes;
5116
5126
  this._langs = _langs;
5127
+ this._alias = _alias;
5117
5128
  _themes.forEach(t => this.loadTheme(t));
5118
5129
  _langs.forEach(l => this.loadLanguage(l));
5119
5130
  }
@@ -5125,18 +5136,37 @@ class Registry extends Registry$1 {
5125
5136
  }
5126
5137
  loadTheme(theme) {
5127
5138
  const _theme = normalizeTheme(theme);
5128
- if (_theme.name)
5139
+ if (_theme.name) {
5129
5140
  this._resolvedThemes[_theme.name] = _theme;
5141
+ // Reset cache
5142
+ this._loadedThemesCache = null;
5143
+ }
5130
5144
  return _theme;
5131
5145
  }
5132
5146
  getLoadedThemes() {
5133
- return Object.keys(this._resolvedThemes);
5147
+ if (!this._loadedThemesCache)
5148
+ this._loadedThemesCache = Object.keys(this._resolvedThemes);
5149
+ return this._loadedThemesCache;
5150
+ }
5151
+ // Override and re-implement this method to cache the textmate themes as `TextMateTheme.createFromRawTheme`
5152
+ // is expensive. Themes can switch often especially for dual-theme support.
5153
+ //
5154
+ // The parent class also accepts `colorMap` as the second parameter, but since we don't use that,
5155
+ // we omit here so it's easier to cache the themes.
5156
+ setTheme(theme) {
5157
+ let textmateTheme = this._textmateThemeCache.get(theme);
5158
+ if (!textmateTheme) {
5159
+ textmateTheme = Theme.createFromRawTheme(theme);
5160
+ this._textmateThemeCache.set(theme, textmateTheme);
5161
+ }
5162
+ // @ts-expect-error Access private `_syncRegistry`, but should work in runtime
5163
+ this._syncRegistry.setTheme(textmateTheme);
5134
5164
  }
5135
5165
  getGrammar(name) {
5136
- if (this.alias[name]) {
5166
+ if (this._alias[name]) {
5137
5167
  const resolved = new Set([name]);
5138
- while (this.alias[name]) {
5139
- name = this.alias[name];
5168
+ while (this._alias[name]) {
5169
+ name = this._alias[name];
5140
5170
  if (resolved.has(name))
5141
5171
  throw new ShikiError(`Circular alias \`${Array.from(resolved).join(' -> ')} -> ${name}\``);
5142
5172
  resolved.add(name);
@@ -5159,13 +5189,17 @@ class Registry extends Registry$1 {
5159
5189
  this._resolvedGrammars[lang.name] = g;
5160
5190
  if (lang.aliases) {
5161
5191
  lang.aliases.forEach((alias) => {
5162
- this.alias[alias] = lang.name;
5192
+ this._alias[alias] = lang.name;
5163
5193
  });
5164
5194
  }
5195
+ // Reset cache
5196
+ this._loadedLanguagesCache = null;
5165
5197
  // If there is a language that embeds this language lazily, we need to reload it
5166
5198
  if (embeddedLazilyBy.size) {
5167
5199
  for (const e of embeddedLazilyBy) {
5168
5200
  delete this._resolvedGrammars[e.name];
5201
+ // Reset cache
5202
+ this._loadedLanguagesCache = null;
5169
5203
  // @ts-expect-error clear cache
5170
5204
  this._syncRegistry?._injectionGrammars?.delete(e.scopeName);
5171
5205
  // @ts-expect-error clear cache
@@ -5195,7 +5229,9 @@ class Registry extends Registry$1 {
5195
5229
  await this.loadLanguage(lang);
5196
5230
  }
5197
5231
  getLoadedLanguages() {
5198
- return Object.keys({ ...this._resolvedGrammars, ...this.alias });
5232
+ if (!this._loadedLanguagesCache)
5233
+ this._loadedLanguagesCache = Object.keys({ ...this._resolvedGrammars, ...this._alias });
5234
+ return this._loadedLanguagesCache;
5199
5235
  }
5200
5236
  resolveEmbeddedLanguages(lang) {
5201
5237
  this._langMap[lang.name] = lang;
@@ -5286,8 +5322,7 @@ async function getShikiInternal(options = {}) {
5286
5322
  return createOnigString(s);
5287
5323
  },
5288
5324
  }), langs);
5289
- const _registry = new Registry(resolver, themes, langs);
5290
- Object.assign(_registry.alias, options.langAlias);
5325
+ const _registry = new Registry(resolver, themes, langs, options.langAlias);
5291
5326
  await _registry.init();
5292
5327
  let _lastTheme;
5293
5328
  function getLanguage(name) {
@@ -1,5 +1,5 @@
1
1
  import { F as FontStyle } from './chunk-tokens.mjs';
2
- export { c as IGrammar, d as IGrammarConfiguration, I as INITIAL, e as IOnigLib, b as IRawGrammar, a as IRawTheme, g as IRawThemeSetting, R as Registry, f as RegistryOptions, S as StateStack } from './chunk-tokens.mjs';
2
+ export { c as IGrammar, d as IGrammarConfiguration, I as INITIAL, e as IOnigLib, b as IRawGrammar, a as IRawTheme, g as IRawThemeSetting, R as Registry, f as RegistryOptions, S as StateStack, T as Theme } from './chunk-tokens.mjs';
3
3
  import './chunk-index.mjs';
4
4
 
5
5
  declare const enum TemporaryStandardTokenType {
package/dist/textmate.mjs CHANGED
@@ -3132,4 +3132,4 @@ class StackElementMetadata {
3132
3132
  }
3133
3133
  }
3134
3134
 
3135
- export { INITIAL, Registry$1 as Registry, StackElementMetadata };
3135
+ export { INITIAL, Registry$1 as Registry, StackElementMetadata, Theme };
package/dist/types.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as ThemeInput, q as SpecialTheme, L as LanguageInput, p as SpecialLanguage, z as ThemeRegistrationAny, t as ThemeRegistrationResolved, J as LanguageRegistration, c as IGrammar, C as CodeToHastOptions, G as ResolveBundleKey, h as Root, i as CodeToTokensOptions, j as TokensResult, l as CodeToTokensBaseOptions, m as ThemedToken, n as CodeToTokensWithThemesOptions, o as ThemedTokenWithVariants } from './chunk-tokens.mjs';
2
- export { D as AnsiLanguage, a7 as Awaitable, B as BundledHighlighterOptions, K as BundledLanguageInfo, a0 as BundledThemeInfo, X as CodeOptionsMeta, U as CodeOptionsMultipleThemes, Q as CodeOptionsSingleTheme, V as CodeOptionsThemes, W as CodeToHastOptionsCommon, w as CodeToHastRenderOptions, Y as CodeToHastRenderOptionsCommon, ac as DecorationItem, ab as DecorationOptions, ae as DecorationTransformType, O as DynamicImportLanguageRegistration, $ as DynamicImportThemeRegistration, F as FontStyle, H as HighlighterCoreOptions, M as MaybeArray, a8 as MaybeGetter, a9 as MaybeModule, af as Offset, ag as OffsetOrPosition, P as PlainTextLanguage, s as Position, b as RawGrammar, a as RawTheme, g as RawThemeSetting, k as RequireKeys, ad as ResolvedDecorationItem, ah as ResolvedPosition, A as ShikiTransformer, a6 as ShikiTransformerContext, v as ShikiTransformerContextCommon, a5 as ShikiTransformerContextMeta, x as ShikiTransformerContextSource, aa as StringLiteralUnion, _ as ThemeRegistration, Z as ThemeRegistrationRaw, a2 as ThemedTokenExplanation, a1 as ThemedTokenScopeExplanation, a3 as TokenBase, r as TokenStyles, u as TokenizeWithThemeOptions, a4 as TransformerOptions } from './chunk-tokens.mjs';
1
+ import { h as ThemeInput, r as SpecialTheme, L as LanguageInput, q as SpecialLanguage, A as ThemeRegistrationAny, u as ThemeRegistrationResolved, K as LanguageRegistration, c as IGrammar, C as CodeToHastOptions, J as ResolveBundleKey, i as Root, j as CodeToTokensOptions, k as TokensResult, m as CodeToTokensBaseOptions, n as ThemedToken, o as CodeToTokensWithThemesOptions, p as ThemedTokenWithVariants } from './chunk-tokens.mjs';
2
+ export { G as AnsiLanguage, a8 as Awaitable, B as BundledHighlighterOptions, O as BundledLanguageInfo, a1 as BundledThemeInfo, Y as CodeOptionsMeta, V as CodeOptionsMultipleThemes, U as CodeOptionsSingleTheme, W as CodeOptionsThemes, X as CodeToHastOptionsCommon, x as CodeToHastRenderOptions, Z as CodeToHastRenderOptionsCommon, ad as DecorationItem, ac as DecorationOptions, af as DecorationTransformType, Q as DynamicImportLanguageRegistration, a0 as DynamicImportThemeRegistration, F as FontStyle, H as HighlighterCoreOptions, M as MaybeArray, a9 as MaybeGetter, aa as MaybeModule, ag as Offset, ah as OffsetOrPosition, P as PlainTextLanguage, t as Position, b as RawGrammar, a as RawTheme, g as RawThemeSetting, l as RequireKeys, ae as ResolvedDecorationItem, ai as ResolvedPosition, D as ShikiTransformer, a7 as ShikiTransformerContext, w as ShikiTransformerContextCommon, a6 as ShikiTransformerContextMeta, y as ShikiTransformerContextSource, ab as StringLiteralUnion, $ as ThemeRegistration, _ as ThemeRegistrationRaw, a3 as ThemedTokenExplanation, a2 as ThemedTokenScopeExplanation, a4 as TokenBase, s as TokenStyles, v as TokenizeWithThemeOptions, a5 as TransformerOptions } from './chunk-tokens.mjs';
3
3
  export { W as WebAssemblyInstantiator } from './chunk-index.mjs';
4
4
 
5
5
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/core",
3
3
  "type": "module",
4
- "version": "1.2.2",
4
+ "version": "1.2.4",
5
5
  "description": "Core of Shiki",
6
6
  "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",