shiki 3.0.0 → 3.2.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.
@@ -12,7 +12,7 @@ declare const bundledLanguagesBase: {
12
12
  declare const bundledLanguagesAlias: {
13
13
  [k: string]: DynamicImportLanguageRegistration;
14
14
  };
15
- type BundledLanguage = 'angular-html' | 'angular-ts' | 'astro' | 'bash' | 'blade' | 'c' | 'c++' | 'coffee' | 'coffeescript' | 'cpp' | 'css' | 'glsl' | 'gql' | 'graphql' | 'haml' | 'handlebars' | 'hbs' | 'html' | 'html-derivative' | 'http' | 'imba' | 'jade' | 'java' | 'javascript' | 'jinja' | 'jison' | 'jl' | 'js' | 'json' | 'json5' | 'jsonc' | 'jsonl' | 'jsx' | 'julia' | 'less' | 'lit' | 'markdown' | 'marko' | 'md' | 'mdc' | 'mdx' | 'php' | 'postcss' | 'pug' | 'py' | 'python' | 'r' | 'regex' | 'regexp' | 'sass' | 'scss' | 'sh' | 'shell' | 'shellscript' | 'sql' | 'styl' | 'stylus' | 'svelte' | 'ts' | 'ts-tags' | 'tsx' | 'typescript' | 'vue' | 'vue-html' | 'wasm' | 'wgsl' | 'xml' | 'yaml' | 'yml' | 'zsh';
15
+ type BundledLanguage = 'angular-html' | 'angular-ts' | 'astro' | 'bash' | 'blade' | 'c' | 'c++' | 'coffee' | 'coffeescript' | 'cpp' | 'css' | 'glsl' | 'gql' | 'graphql' | 'haml' | 'handlebars' | 'hbs' | 'html' | 'html-derivative' | 'http' | 'imba' | 'jade' | 'java' | 'javascript' | 'jinja' | 'jison' | 'jl' | 'js' | 'json' | 'json5' | 'jsonc' | 'jsonl' | 'jsx' | 'julia' | 'less' | 'lit' | 'markdown' | 'marko' | 'md' | 'mdc' | 'mdx' | 'php' | 'postcss' | 'pug' | 'py' | 'python' | 'r' | 'regex' | 'regexp' | 'sass' | 'scss' | 'sh' | 'shell' | 'shellscript' | 'sql' | 'styl' | 'stylus' | 'svelte' | 'ts' | 'ts-tags' | 'tsx' | 'typescript' | 'vue' | 'vue-html' | 'wasm' | 'wgsl' | 'wit' | 'xml' | 'yaml' | 'yml' | 'zsh';
16
16
  declare const bundledLanguages: Record<BundledLanguage, DynamicImportLanguageRegistration>;
17
17
 
18
18
  type Highlighter = HighlighterGeneric<BundledLanguage, BundledTheme>;
@@ -300,6 +300,11 @@ const bundledLanguagesInfo = [
300
300
  "name": "WGSL",
301
301
  "import": () => import('@shikijs/langs/wgsl')
302
302
  },
303
+ {
304
+ "id": "wit",
305
+ "name": "WebAssembly Interface Types",
306
+ "import": () => import('@shikijs/langs/wit')
307
+ },
303
308
  {
304
309
  "id": "xml",
305
310
  "name": "XML",
@@ -1,492 +1 @@
1
- import { HighlighterGeneric, Awaitable, CodeToHastOptions, CodeToTokensOptions, TokensResult, RequireKeys, CodeToTokensBaseOptions, ThemedToken, CodeToTokensWithThemesOptions, ThemedTokenWithVariants, BundledHighlighterOptions, GrammarState, ShikiInternal, ShikiTransformerContextCommon, ThemeRegistration, HighlighterCoreOptions, HighlighterCore, Position, CreateHighlighterFactory, CreatedBundledHighlighterOptions, TokenStyles, ThemeInput, PlainTextLanguage, SpecialLanguage, SpecialTheme, MaybeGetter, ThemeRegistrationAny, ThemeRegistrationResolved, TokenizeWithThemeOptions, MaybeArray, Grammar, CodeToHastRenderOptions, ShikiTransformerContextSource, ShikiTransformer } from '@shikijs/types';
2
- export * from '@shikijs/types';
3
- import { a as RootContent, N as Nodes, R as Root, E as Element } from './types/index.d.mjs';
4
-
5
- type FormatSmartOptions = {
6
- /**
7
- * Prefer named character references (`&amp;`) where possible.
8
- */
9
- useNamedReferences?: boolean;
10
- /**
11
- * Prefer the shortest possible reference, if that results in less bytes.
12
- * **Note**: `useNamedReferences` can be omitted when using `useShortestReferences`.
13
- */
14
- useShortestReferences?: boolean;
15
- /**
16
- * Whether to omit semicolons when possible.
17
- * **Note**: This creates what HTML calls “parse errors” but is otherwise still valid HTML — don’t use this except when building a minifier.
18
- * Omitting semicolons is possible for certain named and numeric references in some cases.
19
- */
20
- omitOptionalSemicolons?: boolean;
21
- /**
22
- * Create character references which don’t fail in attributes.
23
- * **Note**: `attribute` only applies when operating dangerously with
24
- * `omitOptionalSemicolons: true`.
25
- */
26
- attribute?: boolean;
27
- };
28
-
29
- type CoreOptions = {
30
- /**
31
- * Whether to only escape the given subset of characters.
32
- */
33
- subset?: ReadonlyArray<string>;
34
- /**
35
- * Whether to only escape possibly dangerous characters.
36
- * Those characters are `"`, `&`, `'`, `<`, `>`, and `` ` ``.
37
- */
38
- escapeOnly?: boolean;
39
- };
40
-
41
- type Options$2 = CoreOptions & FormatSmartOptions;
42
-
43
- type Options$1 = Options$2;
44
-
45
- /**
46
- * Serialize hast as HTML.
47
- *
48
- * @param {Array<RootContent> | Nodes} tree
49
- * Tree to serialize.
50
- * @param {Options | null | undefined} [options]
51
- * Configuration (optional).
52
- * @returns {string}
53
- * Serialized HTML.
54
- */
55
- declare function toHtml(tree: Array<RootContent> | Nodes, options?: Options | null | undefined): string;
56
- type CharacterReferences = Omit<Options$1, "attribute" | "escapeOnly" | "subset">;
57
- /**
58
- * Configuration.
59
- */
60
- type Options = {
61
- /**
62
- * Do not encode some characters which cause XSS vulnerabilities in older
63
- * browsers (default: `false`).
64
- *
65
- * > ⚠️ **Danger**: only set this if you completely trust the content.
66
- */
67
- allowDangerousCharacters?: boolean | null | undefined;
68
- /**
69
- * Allow `raw` nodes and insert them as raw HTML (default: `false`).
70
- *
71
- * When `false`, `Raw` nodes are encoded.
72
- *
73
- * > ⚠️ **Danger**: only set this if you completely trust the content.
74
- */
75
- allowDangerousHtml?: boolean | null | undefined;
76
- /**
77
- * Do not encode characters which cause parse errors (even though they work),
78
- * to save bytes (default: `false`).
79
- *
80
- * Not used in the SVG space.
81
- *
82
- * > 👉 **Note**: intentionally creates parse errors in markup (how parse
83
- * > errors are handled is well defined, so this works but isn’t pretty).
84
- */
85
- allowParseErrors?: boolean | null | undefined;
86
- /**
87
- * Use “bogus comments” instead of comments to save byes: `<?charlie>`
88
- * instead of `<!--charlie-->` (default: `false`).
89
- *
90
- * > 👉 **Note**: intentionally creates parse errors in markup (how parse
91
- * > errors are handled is well defined, so this works but isn’t pretty).
92
- */
93
- bogusComments?: boolean | null | undefined;
94
- /**
95
- * Configure how to serialize character references (optional).
96
- */
97
- characterReferences?: CharacterReferences | null | undefined;
98
- /**
99
- * Close SVG elements without any content with slash (`/`) on the opening tag
100
- * instead of an end tag: `<circle />` instead of `<circle></circle>`
101
- * (default: `false`).
102
- *
103
- * See `tightSelfClosing` to control whether a space is used before the
104
- * slash.
105
- *
106
- * Not used in the HTML space.
107
- */
108
- closeEmptyElements?: boolean | null | undefined;
109
- /**
110
- * Close self-closing nodes with an extra slash (`/`): `<img />` instead of
111
- * `<img>` (default: `false`).
112
- *
113
- * See `tightSelfClosing` to control whether a space is used before the
114
- * slash.
115
- *
116
- * Not used in the SVG space.
117
- */
118
- closeSelfClosing?: boolean | null | undefined;
119
- /**
120
- * Collapse empty attributes: get `class` instead of `class=""` (default:
121
- * `false`).
122
- *
123
- * Not used in the SVG space.
124
- *
125
- * > 👉 **Note**: boolean attributes (such as `hidden`) are always collapsed.
126
- */
127
- collapseEmptyAttributes?: boolean | null | undefined;
128
- /**
129
- * Omit optional opening and closing tags (default: `false`).
130
- *
131
- * For example, in `<ol><li>one</li><li>two</li></ol>`, both `</li>` closing
132
- * tags can be omitted.
133
- * The first because it’s followed by another `li`, the last because it’s
134
- * followed by nothing.
135
- *
136
- * Not used in the SVG space.
137
- */
138
- omitOptionalTags?: boolean | null | undefined;
139
- /**
140
- * Leave attributes unquoted if that results in less bytes (default: `false`).
141
- *
142
- * Not used in the SVG space.
143
- */
144
- preferUnquoted?: boolean | null | undefined;
145
- /**
146
- * Use the other quote if that results in less bytes (default: `false`).
147
- */
148
- quoteSmart?: boolean | null | undefined;
149
- /**
150
- * Preferred quote to use (default: `'"'`).
151
- */
152
- quote?: Quote | null | undefined;
153
- /**
154
- * When an `<svg>` element is found in the HTML space, this package already
155
- * automatically switches to and from the SVG space when entering and exiting
156
- * it (default: `'html'`).
157
- *
158
- * > 👉 **Note**: hast is not XML.
159
- * > It supports SVG as embedded in HTML.
160
- * > It does not support the features available in XML.
161
- * > Passing SVG might break but fragments of modern SVG should be fine.
162
- * > Use [`xast`][xast] if you need to support SVG as XML.
163
- */
164
- space?: Space | null | undefined;
165
- /**
166
- * Join attributes together, without whitespace, if possible: get
167
- * `class="a b"title="c d"` instead of `class="a b" title="c d"` to save
168
- * bytes (default: `false`).
169
- *
170
- * Not used in the SVG space.
171
- *
172
- * > 👉 **Note**: intentionally creates parse errors in markup (how parse
173
- * > errors are handled is well defined, so this works but isn’t pretty).
174
- */
175
- tightAttributes?: boolean | null | undefined;
176
- /**
177
- * Join known comma-separated attribute values with just a comma (`,`),
178
- * instead of padding them on the right as well (`,␠`, where `␠` represents a
179
- * space) (default: `false`).
180
- */
181
- tightCommaSeparatedLists?: boolean | null | undefined;
182
- /**
183
- * Drop unneeded spaces in doctypes: `<!doctypehtml>` instead of
184
- * `<!doctype html>` to save bytes (default: `false`).
185
- *
186
- * > 👉 **Note**: intentionally creates parse errors in markup (how parse
187
- * > errors are handled is well defined, so this works but isn’t pretty).
188
- */
189
- tightDoctype?: boolean | null | undefined;
190
- /**
191
- * Do not use an extra space when closing self-closing elements: `<img/>`
192
- * instead of `<img />` (default: `false`).
193
- *
194
- * > 👉 **Note**: only used if `closeSelfClosing: true` or
195
- * > `closeEmptyElements: true`.
196
- */
197
- tightSelfClosing?: boolean | null | undefined;
198
- /**
199
- * Use a `<!DOCTYPE…` instead of `<!doctype…` (default: `false`).
200
- *
201
- * Useless except for XHTML.
202
- */
203
- upperDoctype?: boolean | null | undefined;
204
- /**
205
- * Tag names of elements to serialize without closing tag (default: `html-void-elements`).
206
- *
207
- * Not used in the SVG space.
208
- *
209
- * > 👉 **Note**: It’s highly unlikely that you want to pass this, because
210
- * > hast is not for XML, and HTML will not add more void elements.
211
- */
212
- voids?: ReadonlyArray<string> | null | undefined;
213
- };
214
- /**
215
- * HTML quotes for attribute values.
216
- */
217
- type Quote = "\"" | "'";
218
- /**
219
- * Namespace.
220
- */
221
- type Space = "html" | "svg";
222
-
223
- /**
224
- * Create a `createHighlighter` function with bundled themes, languages, and engine.
225
- *
226
- * @example
227
- * ```ts
228
- * const createHighlighter = createdBundledHighlighter({
229
- * langs: {
230
- * typescript: () => import('@shikijs/langs/typescript'),
231
- * // ...
232
- * },
233
- * themes: {
234
- * nord: () => import('@shikijs/themes/nord'),
235
- * // ...
236
- * },
237
- * engine: () => createOnigurumaEngine(), // or createJavaScriptRegexEngine()
238
- * })
239
- * ```
240
- *
241
- * @param options
242
- */
243
- declare function createdBundledHighlighter<BundledLangs extends string, BundledThemes extends string>(options: CreatedBundledHighlighterOptions<BundledLangs, BundledThemes>): CreateHighlighterFactory<BundledLangs, BundledThemes>;
244
- interface ShorthandsBundle<L extends string, T extends string> {
245
- /**
246
- * Shorthand for `codeToHtml` with auto-loaded theme and language.
247
- * A singleton highlighter it maintained internally.
248
- *
249
- * Differences from `highlighter.codeToHtml()`, this function is async.
250
- */
251
- codeToHtml: (code: string, options: CodeToHastOptions<L, T>) => Promise<string>;
252
- /**
253
- * Shorthand for `codeToHtml` with auto-loaded theme and language.
254
- * A singleton highlighter it maintained internally.
255
- *
256
- * Differences from `highlighter.codeToHtml()`, this function is async.
257
- */
258
- codeToHast: (code: string, options: CodeToHastOptions<L, T>) => Promise<Root>;
259
- /**
260
- * Shorthand for `codeToTokens` with auto-loaded theme and language.
261
- * A singleton highlighter it maintained internally.
262
- *
263
- * Differences from `highlighter.codeToTokens()`, this function is async.
264
- */
265
- codeToTokens: (code: string, options: CodeToTokensOptions<L, T>) => Promise<TokensResult>;
266
- /**
267
- * Shorthand for `codeToTokensBase` with auto-loaded theme and language.
268
- * A singleton highlighter it maintained internally.
269
- *
270
- * Differences from `highlighter.codeToTokensBase()`, this function is async.
271
- */
272
- codeToTokensBase: (code: string, options: RequireKeys<CodeToTokensBaseOptions<L, T>, 'theme' | 'lang'>) => Promise<ThemedToken[][]>;
273
- /**
274
- * Shorthand for `codeToTokensWithThemes` with auto-loaded theme and language.
275
- * A singleton highlighter it maintained internally.
276
- *
277
- * Differences from `highlighter.codeToTokensWithThemes()`, this function is async.
278
- */
279
- codeToTokensWithThemes: (code: string, options: RequireKeys<CodeToTokensWithThemesOptions<L, T>, 'themes' | 'lang'>) => Promise<ThemedTokenWithVariants[][]>;
280
- /**
281
- * Get the singleton highlighter.
282
- */
283
- getSingletonHighlighter: (options?: Partial<BundledHighlighterOptions<L, T>>) => Promise<HighlighterGeneric<L, T>>;
284
- /**
285
- * Shorthand for `getLastGrammarState` with auto-loaded theme and language.
286
- * A singleton highlighter it maintained internally.
287
- */
288
- getLastGrammarState: ((element: ThemedToken[][] | Root) => GrammarState) | ((code: string, options: CodeToTokensBaseOptions<L, T>) => Promise<GrammarState>);
289
- }
290
- declare function makeSingletonHighlighter<L extends string, T extends string>(createHighlighter: CreateHighlighterFactory<L, T>): (options?: Partial<BundledHighlighterOptions<L, T>>) => Promise<HighlighterGeneric<L, T>>;
291
- interface CreateSingletonShorthandsOptions<L extends string, T extends string> {
292
- /**
293
- * A custom function to guess embedded languages to be loaded.
294
- */
295
- guessEmbeddedLanguages?: (code: string, lang: string | undefined, highlighter: HighlighterGeneric<L, T>) => Awaitable<string[] | undefined>;
296
- }
297
- declare function createSingletonShorthands<L extends string, T extends string>(createHighlighter: CreateHighlighterFactory<L, T>, config?: CreateSingletonShorthandsOptions<L, T>): ShorthandsBundle<L, T>;
298
-
299
- /**
300
- * Create a Shiki core highlighter instance, with no languages or themes bundled.
301
- * Wasm and each language and theme must be loaded manually.
302
- *
303
- * @see http://shiki.style/guide/bundles#fine-grained-bundle
304
- */
305
- declare function createHighlighterCore(options: HighlighterCoreOptions<false>): Promise<HighlighterCore>;
306
- /**
307
- * Create a Shiki core highlighter instance, with no languages or themes bundled.
308
- * Wasm and each language and theme must be loaded manually.
309
- *
310
- * Synchronous version of `createHighlighterCore`, which requires to provide the engine and all themes and languages upfront.
311
- *
312
- * @see http://shiki.style/guide/bundles#fine-grained-bundle
313
- */
314
- declare function createHighlighterCoreSync(options: HighlighterCoreOptions<true>): HighlighterCore;
315
- declare function makeSingletonHighlighterCore(createHighlighter: typeof createHighlighterCore): (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
316
- declare const getSingletonHighlighterCore: (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
317
-
318
- /**
319
- * Get the minimal shiki context for rendering.
320
- */
321
- declare function createShikiInternal(options: HighlighterCoreOptions): Promise<ShikiInternal>;
322
-
323
- /**
324
- * Get the minimal shiki context for rendering.
325
- *
326
- * Synchronous version of `createShikiInternal`, which requires to provide the engine and all themes and languages upfront.
327
- */
328
- declare function createShikiInternalSync(options: HighlighterCoreOptions<true>): ShikiInternal;
329
-
330
- declare function codeToHast(internal: ShikiInternal, code: string, options: CodeToHastOptions, transformerContext?: ShikiTransformerContextCommon): Root;
331
- declare function tokensToHast(tokens: ThemedToken[][], options: CodeToHastRenderOptions, transformerContext: ShikiTransformerContextSource, grammarState?: GrammarState | undefined): Root;
332
-
333
- declare const hastToHtml: typeof toHtml;
334
- /**
335
- * Get highlighted code in HTML.
336
- */
337
- declare function codeToHtml(internal: ShikiInternal, code: string, options: CodeToHastOptions): string;
338
-
339
- /**
340
- * High-level code-to-tokens API.
341
- *
342
- * It will use `codeToTokensWithThemes` or `codeToTokensBase` based on the options.
343
- */
344
- declare function codeToTokens(internal: ShikiInternal, code: string, options: CodeToTokensOptions): TokensResult;
345
-
346
- declare function tokenizeAnsiWithTheme(theme: ThemeRegistrationResolved, fileContents: string, options?: TokenizeWithThemeOptions): ThemedToken[][];
347
-
348
- /**
349
- * Code to tokens, with a simple theme.
350
- */
351
- declare function codeToTokensBase(internal: ShikiInternal, code: string, options?: CodeToTokensBaseOptions): ThemedToken[][];
352
- declare function tokenizeWithTheme(code: string, grammar: Grammar, theme: ThemeRegistrationResolved, colorMap: string[], options: TokenizeWithThemeOptions): ThemedToken[][];
353
-
354
- /**
355
- * Get tokens with multiple themes
356
- */
357
- declare function codeToTokensWithThemes(internal: ShikiInternal, code: string, options: CodeToTokensWithThemesOptions): ThemedTokenWithVariants[][];
358
-
359
- /**
360
- * Normalize a textmate theme to shiki theme
361
- */
362
- declare function normalizeTheme(rawTheme: ThemeRegistrationAny): ThemeRegistrationResolved;
363
-
364
- interface CssVariablesThemeOptions {
365
- /**
366
- * Theme name. Need to unique if multiple css variables themes are created
367
- *
368
- * @default 'css-variables'
369
- */
370
- name?: string;
371
- /**
372
- * Prefix for css variables
373
- *
374
- * @default '--shiki-'
375
- */
376
- variablePrefix?: string;
377
- /**
378
- * Default value for css variables, the key is without the prefix
379
- *
380
- * @example `{ 'token-comment': '#888' }` will generate `var(--shiki-token-comment, #888)` for comments
381
- */
382
- variableDefaults?: Record<string, string>;
383
- /**
384
- * Enable font style
385
- *
386
- * @default true
387
- */
388
- fontStyle?: boolean;
389
- }
390
- /**
391
- * A factory function to create a css-variable-based theme
392
- *
393
- * @see https://shiki.style/guide/theme-colors#css-variables-theme
394
- */
395
- declare function createCssVariablesTheme(options?: CssVariablesThemeOptions): ThemeRegistration;
396
-
397
- /**
398
- * A built-in transformer to add decorations to the highlighted code.
399
- */
400
- declare function transformerDecorations(): ShikiTransformer;
401
-
402
- declare function resolveColorReplacements(theme: ThemeRegistrationAny | string, options?: TokenizeWithThemeOptions): Record<string, string | undefined>;
403
- declare function applyColorReplacements(color: string, replacements?: Record<string, string | undefined>): string;
404
- declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string | undefined>): string | undefined;
405
-
406
- declare function toArray<T>(x: MaybeArray<T>): T[];
407
- /**
408
- * Normalize a getter to a promise.
409
- */
410
- declare function normalizeGetter<T>(p: MaybeGetter<T>): Promise<T>;
411
- /**
412
- * Check if the language is plaintext that is ignored by Shiki.
413
- *
414
- * Hard-coded plain text languages: `plaintext`, `txt`, `text`, `plain`.
415
- */
416
- declare function isPlainLang(lang: string | null | undefined): lang is PlainTextLanguage;
417
- /**
418
- * Check if the language is specially handled or bypassed by Shiki.
419
- *
420
- * Hard-coded languages: `ansi` and plaintexts like `plaintext`, `txt`, `text`, `plain`.
421
- */
422
- declare function isSpecialLang(lang: any): lang is SpecialLanguage;
423
- /**
424
- * Check if the theme is specially handled or bypassed by Shiki.
425
- *
426
- * Hard-coded themes: `none`.
427
- */
428
- declare function isNoneTheme(theme: string | ThemeInput | null | undefined): theme is 'none';
429
- /**
430
- * Check if the theme is specially handled or bypassed by Shiki.
431
- *
432
- * Hard-coded themes: `none`.
433
- */
434
- declare function isSpecialTheme(theme: string | ThemeInput | null | undefined): theme is SpecialTheme;
435
-
436
- /**
437
- * Utility to append class to a hast node
438
- *
439
- * If the `property.class` is a string, it will be splitted by space and converted to an array.
440
- */
441
- declare function addClassToHast(node: Element, className: string | string[]): Element;
442
-
443
- /**
444
- * Split a string into lines, each line preserves the line ending.
445
- */
446
- declare function splitLines(code: string, preserveEnding?: boolean): [string, number][];
447
- /**
448
- * Creates a converter between index and position in a code block.
449
- *
450
- * Overflow/underflow are unchecked.
451
- */
452
- declare function createPositionConverter(code: string): {
453
- lines: string[];
454
- indexToPos: (index: number) => Position;
455
- posToIndex: (line: number, character: number) => number;
456
- };
457
- /**
458
- * Guess embedded languages from given code and highlighter.
459
- *
460
- * When highlighter is provided, only bundled languages will be included.
461
- */
462
- declare function guessEmbeddedLanguages(code: string, _lang: string | undefined, highlighter?: HighlighterGeneric<any, any>): string[];
463
-
464
- /**
465
- * Split a token into multiple tokens by given offsets.
466
- *
467
- * The offsets are relative to the token, and should be sorted.
468
- */
469
- declare function splitToken<T extends Pick<ThemedToken, 'content' | 'offset'>>(token: T, offsets: number[]): T[];
470
- /**
471
- * Split 2D tokens array by given breakpoints.
472
- */
473
- declare function splitTokens<T extends Pick<ThemedToken, 'content' | 'offset'>>(tokens: T[][], breakpoints: number[] | Set<number>): T[][];
474
- declare function flatTokenVariants(merged: ThemedTokenWithVariants, variantsOrder: string[], cssVariablePrefix: string, defaultColor: string | boolean): ThemedToken;
475
- declare function getTokenStyleObject(token: TokenStyles): Record<string, string>;
476
- declare function stringifyTokenStyle(token: string | Record<string, string>): string;
477
-
478
- type DeprecationTarget = 3;
479
- /**
480
- * Enable runtime warning for deprecated APIs, for the future versions of Shiki.
481
- *
482
- * You can pass a major version to only warn for deprecations that will be removed in that version.
483
- *
484
- * By default, deprecation warning is set to 3 since Shiki v2.0.0
485
- */
486
- declare function enableDeprecationWarnings(emitDeprecation?: DeprecationTarget | boolean, emitError?: boolean): void;
487
- /**
488
- * @internal
489
- */
490
- declare function warnDeprecated(message: string, version?: DeprecationTarget): void;
491
-
492
- 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 };
1
+ export * from '@shikijs/core';
@@ -1,4 +1 @@
1
- import { setDefaultWasmLoader } from '@shikijs/engine-oniguruma';
2
1
  export * from '@shikijs/core';
3
-
4
- setDefaultWasmLoader(() => import('shiki/wasm'));
@@ -0,0 +1 @@
1
+ import { LanguageRegistration } from '@shikijs/core';declare const reg: LanguageRegistration[];export default reg
@@ -0,0 +1 @@
1
+ export { default } from '@shikijs/langs/llvm'
@@ -0,0 +1 @@
1
+ import { LanguageRegistration } from '@shikijs/core';declare const reg: LanguageRegistration[];export default reg
@@ -0,0 +1 @@
1
+ export { default } from '@shikijs/langs/wit'
package/dist/langs.d.mts CHANGED
@@ -7,7 +7,7 @@ declare const bundledLanguagesBase: {
7
7
  declare const bundledLanguagesAlias: {
8
8
  [k: string]: DynamicImportLanguageRegistration;
9
9
  };
10
- type BundledLanguage = '1c' | '1c-query' | 'abap' | 'actionscript-3' | 'ada' | 'adoc' | 'angular-html' | 'angular-ts' | 'apache' | 'apex' | 'apl' | 'applescript' | 'ara' | 'asciidoc' | 'asm' | 'astro' | 'awk' | 'ballerina' | 'bash' | 'bat' | 'batch' | 'be' | 'beancount' | 'berry' | 'bibtex' | 'bicep' | 'blade' | 'bsl' | 'c' | 'c#' | 'c++' | 'cadence' | 'cairo' | 'cdc' | 'clarity' | 'clj' | 'clojure' | 'closure-templates' | 'cmake' | 'cmd' | 'cobol' | 'codeowners' | 'codeql' | 'coffee' | 'coffeescript' | 'common-lisp' | 'console' | 'coq' | 'cpp' | 'cql' | 'crystal' | 'cs' | 'csharp' | 'css' | 'csv' | 'cue' | 'cypher' | 'd' | 'dart' | 'dax' | 'desktop' | 'diff' | 'docker' | 'dockerfile' | 'dotenv' | 'dream-maker' | 'edge' | 'elisp' | 'elixir' | 'elm' | 'emacs-lisp' | 'erb' | 'erl' | 'erlang' | 'f' | 'f#' | 'f03' | 'f08' | 'f18' | 'f77' | 'f90' | 'f95' | 'fennel' | 'fish' | 'fluent' | 'for' | 'fortran-fixed-form' | 'fortran-free-form' | 'fs' | 'fsharp' | 'fsl' | 'ftl' | 'gdresource' | 'gdscript' | 'gdshader' | 'genie' | 'gherkin' | 'git-commit' | 'git-rebase' | 'gjs' | 'gleam' | 'glimmer-js' | 'glimmer-ts' | 'glsl' | 'gnuplot' | 'go' | 'gql' | 'graphql' | 'groovy' | 'gts' | 'hack' | 'haml' | 'handlebars' | 'haskell' | 'haxe' | 'hbs' | 'hcl' | 'hjson' | 'hlsl' | 'hs' | 'html' | 'html-derivative' | 'http' | 'hxml' | 'hy' | 'imba' | 'ini' | 'jade' | 'java' | 'javascript' | 'jinja' | 'jison' | 'jl' | 'js' | 'json' | 'json5' | 'jsonc' | 'jsonl' | 'jsonnet' | 'jssm' | 'jsx' | 'julia' | 'kotlin' | 'kql' | 'kt' | 'kts' | 'kusto' | 'latex' | 'lean' | 'lean4' | 'less' | 'liquid' | 'lisp' | 'lit' | 'log' | 'logo' | 'lua' | 'luau' | 'make' | 'makefile' | 'markdown' | 'marko' | 'matlab' | 'md' | 'mdc' | 'mdx' | 'mediawiki' | 'mermaid' | 'mips' | 'mipsasm' | 'mmd' | 'mojo' | 'move' | 'nar' | 'narrat' | 'nextflow' | 'nf' | 'nginx' | 'nim' | 'nix' | 'nu' | 'nushell' | 'objc' | 'objective-c' | 'objective-cpp' | 'ocaml' | 'pascal' | 'perl' | 'perl6' | 'php' | 'plsql' | 'po' | 'polar' | 'postcss' | 'pot' | 'potx' | 'powerquery' | 'powershell' | 'prisma' | 'prolog' | 'properties' | 'proto' | 'protobuf' | 'ps' | 'ps1' | 'pug' | 'puppet' | 'purescript' | 'py' | 'python' | 'ql' | 'qml' | 'qmldir' | 'qss' | 'r' | 'racket' | 'raku' | 'razor' | 'rb' | 'reg' | 'regex' | 'regexp' | 'rel' | 'riscv' | 'rs' | 'rst' | 'ruby' | 'rust' | 'sas' | 'sass' | 'scala' | 'scheme' | 'scss' | 'sdbl' | 'sh' | 'shader' | 'shaderlab' | 'shell' | 'shellscript' | 'shellsession' | 'smalltalk' | 'solidity' | 'soy' | 'sparql' | 'spl' | 'splunk' | 'sql' | 'ssh-config' | 'stata' | 'styl' | 'stylus' | 'svelte' | 'swift' | 'system-verilog' | 'systemd' | 'talon' | 'talonscript' | 'tasl' | 'tcl' | 'templ' | 'terraform' | 'tex' | 'tf' | 'tfvars' | 'toml' | 'ts' | 'ts-tags' | 'tsp' | 'tsv' | 'tsx' | 'turtle' | 'twig' | 'typ' | 'typescript' | 'typespec' | 'typst' | 'v' | 'vala' | 'vb' | 'verilog' | 'vhdl' | 'vim' | 'viml' | 'vimscript' | 'vue' | 'vue-html' | 'vy' | 'vyper' | 'wasm' | 'wenyan' | 'wgsl' | 'wiki' | 'wikitext' | 'wl' | 'wolfram' | 'xml' | 'xsl' | 'yaml' | 'yml' | 'zenscript' | 'zig' | 'zsh' | '文言';
10
+ type BundledLanguage = '1c' | '1c-query' | 'abap' | 'actionscript-3' | 'ada' | 'adoc' | 'angular-html' | 'angular-ts' | 'apache' | 'apex' | 'apl' | 'applescript' | 'ara' | 'asciidoc' | 'asm' | 'astro' | 'awk' | 'ballerina' | 'bash' | 'bat' | 'batch' | 'be' | 'beancount' | 'berry' | 'bibtex' | 'bicep' | 'blade' | 'bsl' | 'c' | 'c#' | 'c++' | 'cadence' | 'cairo' | 'cdc' | 'clarity' | 'clj' | 'clojure' | 'closure-templates' | 'cmake' | 'cmd' | 'cobol' | 'codeowners' | 'codeql' | 'coffee' | 'coffeescript' | 'common-lisp' | 'console' | 'coq' | 'cpp' | 'cql' | 'crystal' | 'cs' | 'csharp' | 'css' | 'csv' | 'cue' | 'cypher' | 'd' | 'dart' | 'dax' | 'desktop' | 'diff' | 'docker' | 'dockerfile' | 'dotenv' | 'dream-maker' | 'edge' | 'elisp' | 'elixir' | 'elm' | 'emacs-lisp' | 'erb' | 'erl' | 'erlang' | 'f' | 'f#' | 'f03' | 'f08' | 'f18' | 'f77' | 'f90' | 'f95' | 'fennel' | 'fish' | 'fluent' | 'for' | 'fortran-fixed-form' | 'fortran-free-form' | 'fs' | 'fsharp' | 'fsl' | 'ftl' | 'gdresource' | 'gdscript' | 'gdshader' | 'genie' | 'gherkin' | 'git-commit' | 'git-rebase' | 'gjs' | 'gleam' | 'glimmer-js' | 'glimmer-ts' | 'glsl' | 'gnuplot' | 'go' | 'gql' | 'graphql' | 'groovy' | 'gts' | 'hack' | 'haml' | 'handlebars' | 'haskell' | 'haxe' | 'hbs' | 'hcl' | 'hjson' | 'hlsl' | 'hs' | 'html' | 'html-derivative' | 'http' | 'hxml' | 'hy' | 'imba' | 'ini' | 'jade' | 'java' | 'javascript' | 'jinja' | 'jison' | 'jl' | 'js' | 'json' | 'json5' | 'jsonc' | 'jsonl' | 'jsonnet' | 'jssm' | 'jsx' | 'julia' | 'kotlin' | 'kql' | 'kt' | 'kts' | 'kusto' | 'latex' | 'lean' | 'lean4' | 'less' | 'liquid' | 'lisp' | 'lit' | 'llvm' | 'log' | 'logo' | 'lua' | 'luau' | 'make' | 'makefile' | 'markdown' | 'marko' | 'matlab' | 'md' | 'mdc' | 'mdx' | 'mediawiki' | 'mermaid' | 'mips' | 'mipsasm' | 'mmd' | 'mojo' | 'move' | 'nar' | 'narrat' | 'nextflow' | 'nf' | 'nginx' | 'nim' | 'nix' | 'nu' | 'nushell' | 'objc' | 'objective-c' | 'objective-cpp' | 'ocaml' | 'pascal' | 'perl' | 'perl6' | 'php' | 'plsql' | 'po' | 'polar' | 'postcss' | 'pot' | 'potx' | 'powerquery' | 'powershell' | 'prisma' | 'prolog' | 'properties' | 'proto' | 'protobuf' | 'ps' | 'ps1' | 'pug' | 'puppet' | 'purescript' | 'py' | 'python' | 'ql' | 'qml' | 'qmldir' | 'qss' | 'r' | 'racket' | 'raku' | 'razor' | 'rb' | 'reg' | 'regex' | 'regexp' | 'rel' | 'riscv' | 'rs' | 'rst' | 'ruby' | 'rust' | 'sas' | 'sass' | 'scala' | 'scheme' | 'scss' | 'sdbl' | 'sh' | 'shader' | 'shaderlab' | 'shell' | 'shellscript' | 'shellsession' | 'smalltalk' | 'solidity' | 'soy' | 'sparql' | 'spl' | 'splunk' | 'sql' | 'ssh-config' | 'stata' | 'styl' | 'stylus' | 'svelte' | 'swift' | 'system-verilog' | 'systemd' | 'talon' | 'talonscript' | 'tasl' | 'tcl' | 'templ' | 'terraform' | 'tex' | 'tf' | 'tfvars' | 'toml' | 'ts' | 'ts-tags' | 'tsp' | 'tsv' | 'tsx' | 'turtle' | 'twig' | 'typ' | 'typescript' | 'typespec' | 'typst' | 'v' | 'vala' | 'vb' | 'verilog' | 'vhdl' | 'vim' | 'viml' | 'vimscript' | 'vue' | 'vue-html' | 'vy' | 'vyper' | 'wasm' | 'wenyan' | 'wgsl' | 'wiki' | 'wikitext' | 'wit' | 'wl' | 'wolfram' | 'xml' | 'xsl' | 'yaml' | 'yml' | 'zenscript' | 'zig' | 'zsh' | '文言';
11
11
  declare const bundledLanguages: Record<BundledLanguage, DynamicImportLanguageRegistration>;
12
12
 
13
13
  export { type BundledLanguage, bundledLanguages, bundledLanguagesAlias, bundledLanguagesBase, bundledLanguagesInfo };
package/dist/langs.mjs CHANGED
@@ -646,6 +646,11 @@ const bundledLanguagesInfo = [
646
646
  "name": "Liquid",
647
647
  "import": () => import('@shikijs/langs/liquid')
648
648
  },
649
+ {
650
+ "id": "llvm",
651
+ "name": "LLVM IR",
652
+ "import": () => import('@shikijs/langs/llvm')
653
+ },
649
654
  {
650
655
  "id": "log",
651
656
  "name": "Log file",
@@ -1274,6 +1279,11 @@ const bundledLanguagesInfo = [
1274
1279
  ],
1275
1280
  "import": () => import('@shikijs/langs/wikitext')
1276
1281
  },
1282
+ {
1283
+ "id": "wit",
1284
+ "name": "WebAssembly Interface Types",
1285
+ "import": () => import('@shikijs/langs/wit')
1286
+ },
1277
1287
  {
1278
1288
  "id": "wolfram",
1279
1289
  "name": "Wolfram",
@@ -0,0 +1 @@
1
+ import { ThemeRegistrationRaw } from '@shikijs/core';declare const reg: ThemeRegistrationRaw;export default reg
@@ -0,0 +1 @@
1
+ export { default } from '@shikijs/themes/gruvbox-dark-hard'
@@ -0,0 +1 @@
1
+ import { ThemeRegistrationRaw } from '@shikijs/core';declare const reg: ThemeRegistrationRaw;export default reg
@@ -0,0 +1 @@
1
+ export { default } from '@shikijs/themes/gruvbox-dark-medium'
@@ -0,0 +1 @@
1
+ import { ThemeRegistrationRaw } from '@shikijs/core';declare const reg: ThemeRegistrationRaw;export default reg
@@ -0,0 +1 @@
1
+ export { default } from '@shikijs/themes/gruvbox-dark-soft'
@@ -0,0 +1 @@
1
+ import { ThemeRegistrationRaw } from '@shikijs/core';declare const reg: ThemeRegistrationRaw;export default reg
@@ -0,0 +1 @@
1
+ export { default } from '@shikijs/themes/gruvbox-light-hard'
@@ -0,0 +1 @@
1
+ import { ThemeRegistrationRaw } from '@shikijs/core';declare const reg: ThemeRegistrationRaw;export default reg
@@ -0,0 +1 @@
1
+ export { default } from '@shikijs/themes/gruvbox-light-medium'
@@ -0,0 +1 @@
1
+ import { ThemeRegistrationRaw } from '@shikijs/core';declare const reg: ThemeRegistrationRaw;export default reg
@@ -0,0 +1 @@
1
+ export { default } from '@shikijs/themes/gruvbox-light-soft'
package/dist/themes.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { BundledThemeInfo, DynamicImportThemeRegistration } from '@shikijs/core';
1
+ import { BundledThemeInfo, DynamicImportThemeRegistration } from '@shikijs/types';
2
2
 
3
3
  declare const bundledThemesInfo: BundledThemeInfo[];
4
- type BundledTheme = 'andromeeda' | 'aurora-x' | 'ayu-dark' | 'catppuccin-frappe' | 'catppuccin-latte' | 'catppuccin-macchiato' | 'catppuccin-mocha' | 'dark-plus' | 'dracula' | 'dracula-soft' | 'everforest-dark' | 'everforest-light' | 'github-dark' | 'github-dark-default' | 'github-dark-dimmed' | 'github-dark-high-contrast' | 'github-light' | 'github-light-default' | 'github-light-high-contrast' | 'houston' | 'kanagawa-dragon' | 'kanagawa-lotus' | 'kanagawa-wave' | 'laserwave' | 'light-plus' | 'material-theme' | 'material-theme-darker' | 'material-theme-lighter' | 'material-theme-ocean' | 'material-theme-palenight' | 'min-dark' | 'min-light' | 'monokai' | 'night-owl' | 'nord' | 'one-dark-pro' | 'one-light' | 'plastic' | 'poimandres' | 'red' | 'rose-pine' | 'rose-pine-dawn' | 'rose-pine-moon' | 'slack-dark' | 'slack-ochin' | 'snazzy-light' | 'solarized-dark' | 'solarized-light' | 'synthwave-84' | 'tokyo-night' | 'vesper' | 'vitesse-black' | 'vitesse-dark' | 'vitesse-light';
4
+ type BundledTheme = 'andromeeda' | 'aurora-x' | 'ayu-dark' | 'catppuccin-frappe' | 'catppuccin-latte' | 'catppuccin-macchiato' | 'catppuccin-mocha' | 'dark-plus' | 'dracula' | 'dracula-soft' | 'everforest-dark' | 'everforest-light' | 'github-dark' | 'github-dark-default' | 'github-dark-dimmed' | 'github-dark-high-contrast' | 'github-light' | 'github-light-default' | 'github-light-high-contrast' | 'gruvbox-dark-hard' | 'gruvbox-dark-medium' | 'gruvbox-dark-soft' | 'gruvbox-light-hard' | 'gruvbox-light-medium' | 'gruvbox-light-soft' | 'houston' | 'kanagawa-dragon' | 'kanagawa-lotus' | 'kanagawa-wave' | 'laserwave' | 'light-plus' | 'material-theme' | 'material-theme-darker' | 'material-theme-lighter' | 'material-theme-ocean' | 'material-theme-palenight' | 'min-dark' | 'min-light' | 'monokai' | 'night-owl' | 'nord' | 'one-dark-pro' | 'one-light' | 'plastic' | 'poimandres' | 'red' | 'rose-pine' | 'rose-pine-dawn' | 'rose-pine-moon' | 'slack-dark' | 'slack-ochin' | 'snazzy-light' | 'solarized-dark' | 'solarized-light' | 'synthwave-84' | 'tokyo-night' | 'vesper' | 'vitesse-black' | 'vitesse-dark' | 'vitesse-light';
5
5
  declare const bundledThemes: Record<BundledTheme, DynamicImportThemeRegistration>;
6
6
 
7
7
  export { type BundledTheme, bundledThemes, bundledThemesInfo };
package/dist/themes.mjs CHANGED
@@ -113,6 +113,42 @@ const bundledThemesInfo = [
113
113
  "type": "light",
114
114
  "import": () => import('@shikijs/themes/github-light-high-contrast')
115
115
  },
116
+ {
117
+ "id": "gruvbox-dark-hard",
118
+ "displayName": "Gruvbox Dark Hard",
119
+ "type": "dark",
120
+ "import": () => import('@shikijs/themes/gruvbox-dark-hard')
121
+ },
122
+ {
123
+ "id": "gruvbox-dark-medium",
124
+ "displayName": "Gruvbox Dark Medium",
125
+ "type": "dark",
126
+ "import": () => import('@shikijs/themes/gruvbox-dark-medium')
127
+ },
128
+ {
129
+ "id": "gruvbox-dark-soft",
130
+ "displayName": "Gruvbox Dark Soft",
131
+ "type": "dark",
132
+ "import": () => import('@shikijs/themes/gruvbox-dark-soft')
133
+ },
134
+ {
135
+ "id": "gruvbox-light-hard",
136
+ "displayName": "Gruvbox Light Hard",
137
+ "type": "light",
138
+ "import": () => import('@shikijs/themes/gruvbox-light-hard')
139
+ },
140
+ {
141
+ "id": "gruvbox-light-medium",
142
+ "displayName": "Gruvbox Light Medium",
143
+ "type": "light",
144
+ "import": () => import('@shikijs/themes/gruvbox-light-medium')
145
+ },
146
+ {
147
+ "id": "gruvbox-light-soft",
148
+ "displayName": "Gruvbox Light Soft",
149
+ "type": "light",
150
+ "import": () => import('@shikijs/themes/gruvbox-light-soft')
151
+ },
116
152
  {
117
153
  "id": "houston",
118
154
  "displayName": "Houston",
@@ -160,15 +160,6 @@ interface RootContentMap {
160
160
  text: Text;
161
161
  }
162
162
 
163
- /**
164
- * Union of registered hast nodes.
165
- *
166
- * To register custom hast nodes, add them to {@link RootContentMap} and other
167
- * places where relevant.
168
- * They will be automatically added here.
169
- */
170
- type Nodes = Root | RootContent;
171
-
172
163
  // ## Abstract nodes
173
164
 
174
165
  /**
@@ -341,4 +332,4 @@ interface Text extends Literal {
341
332
  */
342
333
  interface TextData extends Data {}
343
334
 
344
- export type { Element as E, Nodes as N, Root as R, RootContent as a };
335
+ export type { Root as R };
package/dist/types.d.mts CHANGED
@@ -2,7 +2,6 @@ import { BundledLanguage } from './langs.mjs';
2
2
  import { BundledTheme } from './themes.mjs';
3
3
  export * from '@shikijs/core/types';
4
4
  import '@shikijs/types';
5
- import '@shikijs/core';
6
5
 
7
6
  type BuiltinLanguage = BundledLanguage;
8
7
  type BuiltinTheme = BundledTheme;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shiki",
3
3
  "type": "module",
4
- "version": "3.0.0",
4
+ "version": "3.2.0",
5
5
  "description": "A beautiful Syntax Highlighter.",
6
6
  "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -48,17 +48,17 @@
48
48
  "dependencies": {
49
49
  "@shikijs/vscode-textmate": "^10.0.2",
50
50
  "@types/hast": "^3.0.4",
51
- "@shikijs/core": "3.0.0",
52
- "@shikijs/engine-javascript": "3.0.0",
53
- "@shikijs/engine-oniguruma": "3.0.0",
54
- "@shikijs/themes": "3.0.0",
55
- "@shikijs/langs": "3.0.0",
56
- "@shikijs/types": "3.0.0"
51
+ "@shikijs/core": "3.2.0",
52
+ "@shikijs/engine-oniguruma": "3.2.0",
53
+ "@shikijs/engine-javascript": "3.2.0",
54
+ "@shikijs/themes": "3.2.0",
55
+ "@shikijs/types": "3.2.0",
56
+ "@shikijs/langs": "3.2.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "rollup-plugin-copy": "^3.5.0",
60
- "tm-grammars": "^1.22.14",
61
- "tm-themes": "^1.9.12",
60
+ "tm-grammars": "^1.23.1",
61
+ "tm-themes": "^1.10.1",
62
62
  "vscode-oniguruma": "1.7.0"
63
63
  },
64
64
  "scripts": {