@openclaw/diffs 2026.10.2 → 2026.10.5-beta.2
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/.setup/{browser.runtime-B8JeyUXz.mjs → browser.runtime-BfvyJ76b.mjs} +7 -11
- package/dist/assets/viewer-runtime.js +97 -1316
- package/dist/index.js +19 -42
- package/node_modules/@pierre/diffs/dist/components/CodeView.d.ts +2 -4
- package/node_modules/@pierre/diffs/dist/components/CodeView.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/CodeView.js +23 -12
- package/node_modules/@pierre/diffs/dist/components/CodeView.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/File.d.ts +2 -0
- package/node_modules/@pierre/diffs/dist/components/File.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/File.js +6 -0
- package/node_modules/@pierre/diffs/dist/components/File.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/FileDiff.d.ts +18 -1
- package/node_modules/@pierre/diffs/dist/components/FileDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/FileDiff.js +47 -15
- package/node_modules/@pierre/diffs/dist/components/FileDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFile.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFile.js +11 -11
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFile.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFileDiff.js +18 -17
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/constants.d.ts +1 -3
- package/node_modules/@pierre/diffs/dist/constants.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/constants.js +1 -3
- package/node_modules/@pierre/diffs/dist/constants.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editor.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editor.js +16 -3
- package/node_modules/@pierre/diffs/dist/editor/editor.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editor2.js +1 -1
- package/node_modules/@pierre/diffs/dist/index.d.ts +2 -2
- package/node_modules/@pierre/diffs/dist/index.js +2 -2
- package/node_modules/@pierre/diffs/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/useFileDiffInstance.js +47 -11
- package/node_modules/@pierre/diffs/dist/react/utils/useFileDiffInstance.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/renderers/DiffHunksRenderer.js +20 -13
- package/node_modules/@pierre/diffs/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/renderers/FileRenderer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/renderers/FileRenderer.js +30 -11
- package/node_modules/@pierre/diffs/dist/renderers/FileRenderer.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/sprite.d.ts +2 -2
- package/node_modules/@pierre/diffs/dist/sprite.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/sprite.js +57 -0
- package/node_modules/@pierre/diffs/dist/sprite.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/style.js +1 -1
- package/node_modules/@pierre/diffs/dist/types.d.ts +1 -1
- package/node_modules/@pierre/diffs/dist/types.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/editSessionHunks.d.ts +5 -4
- package/node_modules/@pierre/diffs/dist/utils/editSessionHunks.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/editSessionHunks.js +32 -9
- package/node_modules/@pierre/diffs/dist/utils/editSessionHunks.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/parsePatchFiles.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/parsePatchFiles.js +21 -13
- package/node_modules/@pierre/diffs/dist/utils/parsePatchFiles.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/parseQuotedDiffFileName.d.ts +8 -0
- package/node_modules/@pierre/diffs/dist/utils/parseQuotedDiffFileName.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/parseQuotedDiffFileName.js +54 -0
- package/node_modules/@pierre/diffs/dist/utils/parseQuotedDiffFileName.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/realignChangeContent.d.ts +13 -10
- package/node_modules/@pierre/diffs/dist/utils/realignChangeContent.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/realignChangeContent.js +23 -19
- package/node_modules/@pierre/diffs/dist/utils/realignChangeContent.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/renderDiffWithHighlighter.js +39 -0
- package/node_modules/@pierre/diffs/dist/utils/renderDiffWithHighlighter.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/worker-portable.js +39 -0
- package/node_modules/@pierre/diffs/dist/worker/worker-portable.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/worker.js +39 -0
- package/node_modules/@pierre/diffs/dist/worker/worker.js.map +1 -1
- package/node_modules/@pierre/diffs/node_modules/@shikijs/core/dist/index.d.mts +28 -28
- package/node_modules/@pierre/diffs/node_modules/@shikijs/core/dist/index.mjs +15 -12
- package/node_modules/@pierre/diffs/node_modules/@shikijs/core/package.json +4 -4
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/{engine-compile-Bdn9ihA2.d.mts → engine-compile-CtqiSkRk.d.mts} +5 -0
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/engine-compile.d.mts +1 -1
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs +2 -4
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/engine-raw.d.mts +2 -3
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/engine-raw.mjs +2 -4
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/index.d.mts +1 -1
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/index.mjs +1 -1
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/string-TLTPtCPs.mjs +115 -0
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/package.json +3 -3
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-oniguruma/package.json +3 -3
- package/node_modules/@pierre/diffs/node_modules/@shikijs/primitive/dist/index.d.mts +31 -32
- package/node_modules/@pierre/diffs/node_modules/@shikijs/primitive/dist/index.mjs +2 -1
- package/node_modules/@pierre/diffs/node_modules/@shikijs/primitive/package.json +3 -3
- package/node_modules/@pierre/diffs/node_modules/@shikijs/themes/dist/monokai.mjs +1 -1
- package/node_modules/@pierre/diffs/node_modules/@shikijs/themes/dist/one-dark-pro.mjs +1 -1
- package/node_modules/@pierre/diffs/node_modules/@shikijs/themes/dist/red.mjs +1 -1
- package/node_modules/@pierre/diffs/node_modules/@shikijs/themes/dist/solarized-dark.mjs +1 -1
- package/node_modules/@pierre/diffs/node_modules/@shikijs/themes/dist/solarized-light.mjs +1 -1
- package/node_modules/@pierre/diffs/node_modules/@shikijs/themes/package.json +3 -3
- package/node_modules/@pierre/diffs/node_modules/@shikijs/transformers/dist/index.d.mts +58 -35
- package/node_modules/@pierre/diffs/node_modules/@shikijs/transformers/dist/index.mjs +35 -4
- package/node_modules/@pierre/diffs/node_modules/@shikijs/transformers/package.json +3 -3
- package/node_modules/@pierre/diffs/node_modules/@shikijs/types/dist/index.d.mts +76 -76
- package/node_modules/@pierre/diffs/node_modules/@shikijs/types/package.json +1 -1
- package/node_modules/@pierre/diffs/node_modules/micromark-util-types/index.d.ts +6 -3
- package/node_modules/@pierre/diffs/node_modules/micromark-util-types/package.json +2 -36
- package/node_modules/@pierre/diffs/node_modules/shiki/dist/bundle-full.d.mts +4 -4
- package/node_modules/@pierre/diffs/node_modules/shiki/dist/bundle-web.d.mts +9 -9
- package/node_modules/@pierre/diffs/node_modules/shiki/dist/types.d.mts +3 -3
- package/node_modules/@pierre/diffs/node_modules/shiki/package.json +10 -10
- package/node_modules/@pierre/diffs/package.json +1 -1
- package/node_modules/@shikijs/langs/dist/ada.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/ahk.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/beancount.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/coq.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/csharp.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/css.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/dart.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/dotenv.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/emacs-lisp.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/gn.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/handlebars.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/julia.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/latex.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/luau.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/marko.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/moonbit.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/nextflow-groovy.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/nextflow.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/nushell.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/php.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/powershell.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/ruby.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/rust.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/sql.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/svelte.mjs +1 -1
- package/node_modules/@shikijs/langs/dist/twig.mjs +3 -3
- package/node_modules/@shikijs/langs/dist/typespec.mjs +1 -1
- package/node_modules/@shikijs/langs/node_modules/@shikijs/types/dist/index.d.mts +76 -76
- package/node_modules/@shikijs/langs/node_modules/@shikijs/types/package.json +1 -1
- package/node_modules/@shikijs/langs/package.json +3 -3
- package/package.json +6 -6
- package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/scanner-DX8LRFGE.mjs +0 -77
|
@@ -24,8 +24,8 @@ export * from "@shikijs/types";
|
|
|
24
24
|
*
|
|
25
25
|
* @param options
|
|
26
26
|
*/
|
|
27
|
-
declare function createBundledHighlighter<BundledLangs extends string, BundledThemes extends string>(options: CreateBundledHighlighterOptions<BundledLangs, BundledThemes>): CreateHighlighterFactory<BundledLangs, BundledThemes>;
|
|
28
|
-
interface ShorthandsBundle<L extends string, T extends string> {
|
|
27
|
+
export declare function createBundledHighlighter<BundledLangs extends string, BundledThemes extends string>(options: CreateBundledHighlighterOptions<BundledLangs, BundledThemes>): CreateHighlighterFactory<BundledLangs, BundledThemes>;
|
|
28
|
+
export interface ShorthandsBundle<L extends string, T extends string> {
|
|
29
29
|
/**
|
|
30
30
|
* Shorthand for `codeToHtml` with auto-loaded theme and language.
|
|
31
31
|
* A singleton highlighter it maintained internally.
|
|
@@ -71,14 +71,14 @@ interface ShorthandsBundle<L extends string, T extends string> {
|
|
|
71
71
|
*/
|
|
72
72
|
getLastGrammarState: ((element: ThemedToken[][] | Root) => GrammarState) | ((code: string, options: CodeToTokensBaseOptions<L, T>) => Promise<GrammarState>);
|
|
73
73
|
}
|
|
74
|
-
declare function makeSingletonHighlighter<L extends string, T extends string>(createHighlighter: CreateHighlighterFactory<L, T>): (options?: Partial<BundledHighlighterOptions<L, T>>) => Promise<HighlighterGeneric<L, T>>;
|
|
75
|
-
interface CreateSingletonShorthandsOptions<L extends string, T extends string> {
|
|
74
|
+
export declare function makeSingletonHighlighter<L extends string, T extends string>(createHighlighter: CreateHighlighterFactory<L, T>): (options?: Partial<BundledHighlighterOptions<L, T>>) => Promise<HighlighterGeneric<L, T>>;
|
|
75
|
+
export interface CreateSingletonShorthandsOptions<L extends string, T extends string> {
|
|
76
76
|
/**
|
|
77
77
|
* A custom function to guess embedded languages to be loaded.
|
|
78
78
|
*/
|
|
79
79
|
guessEmbeddedLanguages?: (code: string, lang: string | undefined, highlighter: HighlighterGeneric<L, T>) => Awaitable<string[] | undefined>;
|
|
80
80
|
}
|
|
81
|
-
declare function createSingletonShorthands<L extends string, T extends string>(createHighlighter: CreateHighlighterFactory<L, T>, config?: CreateSingletonShorthandsOptions<L, T>): ShorthandsBundle<L, T>;
|
|
81
|
+
export declare function createSingletonShorthands<L extends string, T extends string>(createHighlighter: CreateHighlighterFactory<L, T>, config?: CreateSingletonShorthandsOptions<L, T>): ShorthandsBundle<L, T>;
|
|
82
82
|
//#endregion
|
|
83
83
|
//#region src/constructors/highlighter.d.ts
|
|
84
84
|
/**
|
|
@@ -87,7 +87,7 @@ declare function createSingletonShorthands<L extends string, T extends string>(c
|
|
|
87
87
|
*
|
|
88
88
|
* @see http://shiki.style/guide/bundles#fine-grained-bundle
|
|
89
89
|
*/
|
|
90
|
-
declare function createHighlighterCore(options: HighlighterCoreOptions<false>): Promise<HighlighterCore>;
|
|
90
|
+
export declare function createHighlighterCore(options: HighlighterCoreOptions<false>): Promise<HighlighterCore>;
|
|
91
91
|
/**
|
|
92
92
|
* Create a Shiki core highlighter instance, with no languages or themes bundled.
|
|
93
93
|
* Wasm and each language and theme must be loaded manually.
|
|
@@ -96,20 +96,20 @@ declare function createHighlighterCore(options: HighlighterCoreOptions<false>):
|
|
|
96
96
|
*
|
|
97
97
|
* @see http://shiki.style/guide/bundles#fine-grained-bundle
|
|
98
98
|
*/
|
|
99
|
-
declare function createHighlighterCoreSync(options: HighlighterCoreOptions<true>): HighlighterCore;
|
|
100
|
-
declare function makeSingletonHighlighterCore(createHighlighter: typeof createHighlighterCore): (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
|
|
101
|
-
declare const getSingletonHighlighterCore: (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
|
|
99
|
+
export declare function createHighlighterCoreSync(options: HighlighterCoreOptions<true>): HighlighterCore;
|
|
100
|
+
export declare function makeSingletonHighlighterCore(createHighlighter: typeof createHighlighterCore): (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
|
|
101
|
+
export declare const getSingletonHighlighterCore: (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
|
|
102
102
|
//#endregion
|
|
103
103
|
//#region src/highlight/code-to-hast.d.ts
|
|
104
|
-
declare function codeToHast(primitive: ShikiPrimitive, code: string, options: CodeToHastOptions, transformerContext?: ShikiTransformerContextCommon): Root;
|
|
105
|
-
declare function tokensToHast(tokens: ThemedToken[][], options: CodeToHastRenderOptions, transformerContext: ShikiTransformerContextSource, grammarState?: GrammarState | undefined): Root;
|
|
104
|
+
export declare function codeToHast(primitive: ShikiPrimitive, code: string, options: CodeToHastOptions, transformerContext?: ShikiTransformerContextCommon): Root;
|
|
105
|
+
export declare function tokensToHast(tokens: ThemedToken[][], options: CodeToHastRenderOptions, transformerContext: ShikiTransformerContextSource, grammarState?: GrammarState | undefined): Root;
|
|
106
106
|
//#endregion
|
|
107
107
|
//#region src/highlight/code-to-html.d.ts
|
|
108
|
-
declare const hastToHtml: typeof toHtml;
|
|
108
|
+
export declare const hastToHtml: typeof toHtml;
|
|
109
109
|
/**
|
|
110
110
|
* Get highlighted code in HTML.
|
|
111
111
|
*/
|
|
112
|
-
declare function codeToHtml(primitive: ShikiPrimitive, code: string, options: CodeToHastOptions): string;
|
|
112
|
+
export declare function codeToHtml(primitive: ShikiPrimitive, code: string, options: CodeToHastOptions): string;
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region src/highlight/code-to-tokens.d.ts
|
|
115
115
|
/**
|
|
@@ -117,20 +117,20 @@ declare function codeToHtml(primitive: ShikiPrimitive, code: string, options: Co
|
|
|
117
117
|
*
|
|
118
118
|
* It will use `codeToTokensWithThemes` or `codeToTokensBase` based on the options.
|
|
119
119
|
*/
|
|
120
|
-
declare function codeToTokens(primitive: ShikiPrimitive, code: string, options: CodeToTokensOptions): TokensResult;
|
|
120
|
+
export declare function codeToTokens(primitive: ShikiPrimitive, code: string, options: CodeToTokensOptions): TokensResult;
|
|
121
121
|
//#endregion
|
|
122
122
|
//#region src/highlight/code-to-tokens-ansi.d.ts
|
|
123
|
-
declare function tokenizeAnsiWithTheme(theme: ThemeRegistrationResolved, fileContents: string, options?: TokenizeWithThemeOptions): ThemedToken[][];
|
|
123
|
+
export declare function tokenizeAnsiWithTheme(theme: ThemeRegistrationResolved, fileContents: string, options?: TokenizeWithThemeOptions): ThemedToken[][];
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/highlight/code-to-tokens-base.d.ts
|
|
126
126
|
/**
|
|
127
127
|
* Code to tokens, with a simple theme.
|
|
128
128
|
* This wraps the tokenizer's implementation to add ANSI support.
|
|
129
129
|
*/
|
|
130
|
-
declare function codeToTokensBase(primitive: ShikiPrimitive, code: string, options?: CodeToTokensBaseOptions): ThemedToken[][];
|
|
130
|
+
export declare function codeToTokensBase(primitive: ShikiPrimitive, code: string, options?: CodeToTokensBaseOptions): ThemedToken[][];
|
|
131
131
|
//#endregion
|
|
132
132
|
//#region src/theme-css-variables.d.ts
|
|
133
|
-
interface CssVariablesThemeOptions {
|
|
133
|
+
export interface CssVariablesThemeOptions {
|
|
134
134
|
/**
|
|
135
135
|
* Theme name. Need to unique if multiple css variables themes are created
|
|
136
136
|
*
|
|
@@ -161,13 +161,13 @@ interface CssVariablesThemeOptions {
|
|
|
161
161
|
*
|
|
162
162
|
* @see https://shiki.style/guide/theme-colors#css-variables-theme
|
|
163
163
|
*/
|
|
164
|
-
declare function createCssVariablesTheme(options?: CssVariablesThemeOptions): ThemeRegistration;
|
|
164
|
+
export declare function createCssVariablesTheme(options?: CssVariablesThemeOptions): ThemeRegistration;
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region src/transformer-decorations.d.ts
|
|
167
167
|
/**
|
|
168
168
|
* A built-in transformer to add decorations to the highlighted code.
|
|
169
169
|
*/
|
|
170
|
-
declare function transformerDecorations(): ShikiTransformer;
|
|
170
|
+
export declare function transformerDecorations(): ShikiTransformer;
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region src/utils/hast.d.ts
|
|
173
173
|
/**
|
|
@@ -175,7 +175,7 @@ declare function transformerDecorations(): ShikiTransformer;
|
|
|
175
175
|
*
|
|
176
176
|
* If the `property.class` is a string, it will be splitted by space and converted to an array.
|
|
177
177
|
*/
|
|
178
|
-
declare function addClassToHast(node: Element, className: string | string[]): Element;
|
|
178
|
+
export declare function addClassToHast(node: Element, className: string | string[]): Element;
|
|
179
179
|
//#endregion
|
|
180
180
|
//#region src/utils/strings.d.ts
|
|
181
181
|
/**
|
|
@@ -183,7 +183,7 @@ declare function addClassToHast(node: Element, className: string | string[]): El
|
|
|
183
183
|
*
|
|
184
184
|
* Overflow/underflow are unchecked.
|
|
185
185
|
*/
|
|
186
|
-
declare function createPositionConverter(code: string): {
|
|
186
|
+
export declare function createPositionConverter(code: string): {
|
|
187
187
|
lines: string[];
|
|
188
188
|
indexToPos: (index: number) => Position;
|
|
189
189
|
posToIndex: (line: number, character: number) => number;
|
|
@@ -207,7 +207,7 @@ declare function createPositionConverter(code: string): {
|
|
|
207
207
|
* guessEmbeddedLanguages('```python\nprint("hi")\n```')
|
|
208
208
|
* ```
|
|
209
209
|
*/
|
|
210
|
-
declare function guessEmbeddedLanguages(code: string, _lang: string | undefined, highlighter?: HighlighterGeneric<any, any>): string[];
|
|
210
|
+
export declare function guessEmbeddedLanguages(code: string, _lang: string | undefined, highlighter?: HighlighterGeneric<any, any>): string[];
|
|
211
211
|
//#endregion
|
|
212
212
|
//#region src/utils/tokens.d.ts
|
|
213
213
|
/**
|
|
@@ -215,13 +215,13 @@ declare function guessEmbeddedLanguages(code: string, _lang: string | undefined,
|
|
|
215
215
|
*
|
|
216
216
|
* The offsets are relative to the token, and should be sorted.
|
|
217
217
|
*/
|
|
218
|
-
declare function splitToken<T extends Pick<ThemedToken, 'content' | 'offset'>>(token: T, offsets: number[]): T[];
|
|
218
|
+
export declare function splitToken<T extends Pick<ThemedToken, 'content' | 'offset'>>(token: T, offsets: number[]): T[];
|
|
219
219
|
/**
|
|
220
220
|
* Split 2D tokens array by given breakpoints.
|
|
221
221
|
*/
|
|
222
|
-
declare function splitTokens<T extends Pick<ThemedToken, 'content' | 'offset'>>(tokens: T[][], breakpoints: number[] | Set<number>): T[][];
|
|
223
|
-
declare function flatTokenVariants(merged: ThemedTokenWithVariants, variantsOrder: string[], cssVariablePrefix: string, defaultColor: CodeOptionsMultipleThemes['defaultColor'], colorsRendering?: CodeOptionsMultipleThemes['colorsRendering']): ThemedToken;
|
|
224
|
-
declare function getTokenStyleObject(token: TokenStyles): Record<string, string>;
|
|
225
|
-
declare function stringifyTokenStyle(token: string | Record<string, string>): string;
|
|
222
|
+
export declare function splitTokens<T extends Pick<ThemedToken, 'content' | 'offset'>>(tokens: T[][], breakpoints: number[] | Set<number>): T[][];
|
|
223
|
+
export declare function flatTokenVariants(merged: ThemedTokenWithVariants, variantsOrder: string[], cssVariablePrefix: string, defaultColor: CodeOptionsMultipleThemes['defaultColor'], colorsRendering?: CodeOptionsMultipleThemes['colorsRendering']): ThemedToken;
|
|
224
|
+
export declare function getTokenStyleObject(token: TokenStyles): Record<string, string>;
|
|
225
|
+
export declare function stringifyTokenStyle(token: string | Record<string, string>): string;
|
|
226
226
|
//#endregion
|
|
227
|
-
export {
|
|
227
|
+
export { ShikiError, applyColorReplacements, codeToTokensWithThemes, createShikiInternal, createShikiInternalSync, createShikiPrimitive, createShikiPrimitiveAsync, getLastGrammarState, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, toArray, tokenizeWithTheme };
|
|
@@ -177,16 +177,17 @@ function flatTokenVariants(merged, variantsOrder, cssVariablePrefix, defaultColo
|
|
|
177
177
|
styles.forEach((cur, idx) => {
|
|
178
178
|
for (const key of styleKeys) {
|
|
179
179
|
const value = cur[key] || "inherit";
|
|
180
|
-
if (idx === 0 && defaultColor && COLOR_KEYS.includes(key))
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
180
|
+
if (idx === 0 && defaultColor && COLOR_KEYS.includes(key)) {
|
|
181
|
+
if (defaultColor === "light-dark()" && styles.length > 1) {
|
|
182
|
+
const lightIndex = variantsOrder.findIndex((t) => t === "light");
|
|
183
|
+
const darkIndex = variantsOrder.findIndex((t) => t === "dark");
|
|
184
|
+
if (lightIndex === -1 || darkIndex === -1) throw new ShikiError$1("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
|
|
185
|
+
const lightValue = styles[lightIndex][key] || "inherit";
|
|
186
|
+
const darkValue = styles[darkIndex][key] || "inherit";
|
|
187
|
+
mergedStyles[key] = `light-dark(${lightValue}, ${darkValue})`;
|
|
188
|
+
if (colorsRendering === "css-vars") mergedStyles[varKey(idx, key)] = value;
|
|
189
|
+
} else mergedStyles[key] = value;
|
|
190
|
+
} else if (colorsRendering === "css-vars") mergedStyles[varKey(idx, key)] = value;
|
|
190
191
|
}
|
|
191
192
|
});
|
|
192
193
|
token.htmlStyle = mergedStyles;
|
|
@@ -829,8 +830,10 @@ function tokensToHast(tokens, options, transformerContext, grammarState = getLas
|
|
|
829
830
|
};
|
|
830
831
|
const { structure = "classic", tabindex = "0" } = options;
|
|
831
832
|
const properties = { class: `shiki ${options.themeName || ""}` };
|
|
832
|
-
if (options.rootStyle !== false)
|
|
833
|
-
|
|
833
|
+
if (options.rootStyle !== false) {
|
|
834
|
+
if (options.rootStyle != null) properties.style = options.rootStyle;
|
|
835
|
+
else properties.style = `background-color:${options.bg};color:${options.fg}`;
|
|
836
|
+
}
|
|
834
837
|
if (tabindex !== false && tabindex != null) properties.tabindex = tabindex.toString();
|
|
835
838
|
for (const [key, value] of Object.entries(options.meta || {})) if (!key.startsWith("_")) properties[key] = value;
|
|
836
839
|
let preNode = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.5.0",
|
|
5
5
|
"description": "Core of Shiki",
|
|
6
6
|
"author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"node": ">=20"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
+
"@shikijs/primitive": "4.5.0",
|
|
50
|
+
"@shikijs/types": "4.5.0",
|
|
49
51
|
"@shikijs/vscode-textmate": "^10.0.2",
|
|
50
52
|
"@types/hast": "^3.0.5",
|
|
51
|
-
"hast-util-to-html": "^9.0.5"
|
|
52
|
-
"@shikijs/primitive": "4.4.3",
|
|
53
|
-
"@shikijs/types": "4.4.3"
|
|
53
|
+
"hast-util-to-html": "^9.0.5"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "tsdown",
|
|
@@ -24,6 +24,11 @@ declare class JavaScriptScanner implements PatternScanner {
|
|
|
24
24
|
patterns: (string | RegExp)[];
|
|
25
25
|
options: JavaScriptRegexScannerOptions;
|
|
26
26
|
regexps: (RegExp | null)[];
|
|
27
|
+
/**
|
|
28
|
+
* Last search of each regexp on the current string, reused the way `vscode-oniguruma` does.
|
|
29
|
+
* `null` for regexps whose searches can't be reused.
|
|
30
|
+
*/
|
|
31
|
+
private lastSearches;
|
|
27
32
|
constructor(patterns: (string | RegExp)[], options?: JavaScriptRegexScannerOptions);
|
|
28
33
|
findNextMatchSync(string: string | RegexEngineString, startPosition: number, _options: number): IOnigMatch | null;
|
|
29
34
|
}
|
package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/engine-compile.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createJavaScriptRegexEngine, r as defaultJavaScriptRegexConstructor, t as JavaScriptRegexEngineOptions } from "./engine-compile-
|
|
1
|
+
import { n as createJavaScriptRegexEngine, r as defaultJavaScriptRegexConstructor, t as JavaScriptRegexEngineOptions } from "./engine-compile-CtqiSkRk.mjs";
|
|
2
2
|
export { JavaScriptRegexEngineOptions, createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor };
|
package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as JavaScriptScanner, t as createJavaScriptEngineString } from "./string-TLTPtCPs.mjs";
|
|
2
2
|
import { toRegExp } from "oniguruma-to-es";
|
|
3
3
|
//#region src/engine-compile.ts
|
|
4
4
|
/**
|
|
@@ -38,9 +38,7 @@ function createJavaScriptRegexEngine(options = {}) {
|
|
|
38
38
|
createScanner(patterns) {
|
|
39
39
|
return new JavaScriptScanner(patterns, _options);
|
|
40
40
|
},
|
|
41
|
-
createString
|
|
42
|
-
return { content: s };
|
|
43
|
-
}
|
|
41
|
+
createString: createJavaScriptEngineString
|
|
44
42
|
};
|
|
45
43
|
}
|
|
46
44
|
//#endregion
|
package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/engine-raw.d.mts
CHANGED
|
@@ -7,6 +7,5 @@ import { RegexEngine } from "@shikijs/types";
|
|
|
7
7
|
*
|
|
8
8
|
* Zero dependencies.
|
|
9
9
|
*/
|
|
10
|
-
declare function createJavaScriptRawEngine(): RegexEngine;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { createJavaScriptRawEngine };
|
|
10
|
+
export declare function createJavaScriptRawEngine(): RegexEngine;
|
|
11
|
+
//#endregion
|
package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/engine-raw.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as JavaScriptScanner, t as createJavaScriptEngineString } from "./string-TLTPtCPs.mjs";
|
|
2
2
|
//#region src/engine-raw.ts
|
|
3
3
|
/**
|
|
4
4
|
* Raw JavaScript regex engine that only supports precompiled grammars.
|
|
@@ -18,9 +18,7 @@ function createJavaScriptRawEngine() {
|
|
|
18
18
|
createScanner(patterns) {
|
|
19
19
|
return new JavaScriptScanner(patterns, options);
|
|
20
20
|
},
|
|
21
|
-
createString
|
|
22
|
-
return { content: s };
|
|
23
|
-
}
|
|
21
|
+
createString: createJavaScriptEngineString
|
|
24
22
|
};
|
|
25
23
|
}
|
|
26
24
|
//#endregion
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as JavaScriptScanner, i as JavaScriptRegexScannerOptions, n as createJavaScriptRegexEngine, r as defaultJavaScriptRegexConstructor, t as JavaScriptRegexEngineOptions } from "./engine-compile-
|
|
1
|
+
import { a as JavaScriptScanner, i as JavaScriptRegexScannerOptions, n as createJavaScriptRegexEngine, r as defaultJavaScriptRegexConstructor, t as JavaScriptRegexEngineOptions } from "./engine-compile-CtqiSkRk.mjs";
|
|
2
2
|
import { createJavaScriptRawEngine } from "./engine-raw.mjs";
|
|
3
3
|
export { JavaScriptRegexEngineOptions, JavaScriptRegexScannerOptions, JavaScriptScanner, createJavaScriptRawEngine, createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as JavaScriptScanner } from "./string-TLTPtCPs.mjs";
|
|
2
2
|
import { createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor } from "./engine-compile.mjs";
|
|
3
3
|
import { createJavaScriptRawEngine } from "./engine-raw.mjs";
|
|
4
4
|
export { JavaScriptScanner, createJavaScriptRawEngine, createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor };
|
package/node_modules/@pierre/diffs/node_modules/@shikijs/engine-javascript/dist/string-TLTPtCPs.mjs
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
//#region src/scanner.ts
|
|
2
|
+
const MAX = 4294967295;
|
|
3
|
+
function isSearchCacheable(regexp) {
|
|
4
|
+
return !regexp.sticky && !regexp.rawOptions?.strategy;
|
|
5
|
+
}
|
|
6
|
+
function toResult(index, indices) {
|
|
7
|
+
return {
|
|
8
|
+
index,
|
|
9
|
+
captureIndices: indices.map((indice) => {
|
|
10
|
+
if (indice == null) return {
|
|
11
|
+
start: MAX,
|
|
12
|
+
end: MAX,
|
|
13
|
+
length: 0
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
start: indice[0],
|
|
17
|
+
end: indice[1],
|
|
18
|
+
length: indice[1] - indice[0]
|
|
19
|
+
};
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
var JavaScriptScanner = class {
|
|
24
|
+
patterns;
|
|
25
|
+
options;
|
|
26
|
+
regexps;
|
|
27
|
+
/**
|
|
28
|
+
* Last search of each regexp on the current string, reused the way `vscode-oniguruma` does.
|
|
29
|
+
* `null` for regexps whose searches can't be reused.
|
|
30
|
+
*/
|
|
31
|
+
lastSearches;
|
|
32
|
+
constructor(patterns, options = {}) {
|
|
33
|
+
this.patterns = patterns;
|
|
34
|
+
this.options = options;
|
|
35
|
+
const { forgiving = false, cache, regexConstructor } = options;
|
|
36
|
+
if (!regexConstructor) throw new Error("Option `regexConstructor` is not provided");
|
|
37
|
+
this.regexps = patterns.map((p) => {
|
|
38
|
+
if (typeof p !== "string") return p;
|
|
39
|
+
const cached = cache?.get(p);
|
|
40
|
+
if (cached) {
|
|
41
|
+
if (cached instanceof RegExp) return cached;
|
|
42
|
+
if (forgiving) return null;
|
|
43
|
+
throw cached;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const regex = regexConstructor(p);
|
|
47
|
+
cache?.set(p, regex);
|
|
48
|
+
return regex;
|
|
49
|
+
} catch (e) {
|
|
50
|
+
cache?.set(p, e);
|
|
51
|
+
if (forgiving) return null;
|
|
52
|
+
throw e;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
this.lastSearches = this.regexps.map((regexp) => regexp && isSearchCacheable(regexp) ? {
|
|
56
|
+
strId: 0,
|
|
57
|
+
searchedFrom: 0,
|
|
58
|
+
matchIndex: -1,
|
|
59
|
+
indices: null
|
|
60
|
+
} : null);
|
|
61
|
+
}
|
|
62
|
+
findNextMatchSync(string, startPosition, _options) {
|
|
63
|
+
const str = typeof string === "string" ? string : string.content;
|
|
64
|
+
const strId = typeof string === "string" ? 0 : string.id || 0;
|
|
65
|
+
let bestIndex = -1;
|
|
66
|
+
let bestMatchIndex = 0;
|
|
67
|
+
let bestIndices = null;
|
|
68
|
+
for (let i = 0; i < this.regexps.length; i++) {
|
|
69
|
+
const regexp = this.regexps[i];
|
|
70
|
+
if (!regexp) continue;
|
|
71
|
+
try {
|
|
72
|
+
const last = strId ? this.lastSearches[i] : null;
|
|
73
|
+
let matchIndex;
|
|
74
|
+
let indices;
|
|
75
|
+
if (last && last.strId === strId && last.searchedFrom <= startPosition && (last.matchIndex === -1 || last.matchIndex >= startPosition)) {
|
|
76
|
+
matchIndex = last.matchIndex;
|
|
77
|
+
indices = last.indices;
|
|
78
|
+
} else {
|
|
79
|
+
regexp.lastIndex = startPosition;
|
|
80
|
+
const match = regexp.exec(str);
|
|
81
|
+
matchIndex = match ? match.index : -1;
|
|
82
|
+
indices = match ? match.indices : null;
|
|
83
|
+
if (last) {
|
|
84
|
+
last.strId = strId;
|
|
85
|
+
last.searchedFrom = startPosition;
|
|
86
|
+
last.matchIndex = matchIndex;
|
|
87
|
+
last.indices = indices;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (matchIndex === -1) continue;
|
|
91
|
+
if (matchIndex === startPosition) return toResult(i, indices);
|
|
92
|
+
if (bestIndex === -1 || matchIndex < bestMatchIndex) {
|
|
93
|
+
bestIndex = i;
|
|
94
|
+
bestMatchIndex = matchIndex;
|
|
95
|
+
bestIndices = indices;
|
|
96
|
+
}
|
|
97
|
+
} catch (e) {
|
|
98
|
+
if (this.options.forgiving) continue;
|
|
99
|
+
throw e;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return bestIndex === -1 ? null : toResult(bestIndex, bestIndices);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/string.ts
|
|
107
|
+
let lastStringId = 0;
|
|
108
|
+
function createJavaScriptEngineString(content) {
|
|
109
|
+
return {
|
|
110
|
+
content,
|
|
111
|
+
id: ++lastStringId
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { JavaScriptScanner as n, createJavaScriptEngineString as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/engine-javascript",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.5.0",
|
|
5
5
|
"description": "Engine for Shiki using JavaScript's native RegExp",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"node": ">=20"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@shikijs/types": "4.5.0",
|
|
34
35
|
"@shikijs/vscode-textmate": "^10.0.2",
|
|
35
|
-
"oniguruma-to-es": "^4.3.6"
|
|
36
|
-
"@shikijs/types": "4.4.3"
|
|
36
|
+
"oniguruma-to-es": "^4.3.6"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsdown",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/engine-oniguruma",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.5.0",
|
|
5
5
|
"description": "Engine for Shiki using Oniguruma RegExp engine in WebAssembly",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"node": ">=20"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@shikijs/
|
|
36
|
-
"@shikijs/
|
|
35
|
+
"@shikijs/types": "4.5.0",
|
|
36
|
+
"@shikijs/vscode-textmate": "^10.0.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"vscode-oniguruma": "1.7.0"
|
|
@@ -6,11 +6,11 @@ export * from "@shikijs/types";
|
|
|
6
6
|
/**
|
|
7
7
|
* Get the minimal shiki primitive instance.
|
|
8
8
|
*/
|
|
9
|
-
declare function createShikiPrimitiveAsync(options: HighlighterCoreOptions): Promise<ShikiPrimitive>;
|
|
9
|
+
export declare function createShikiPrimitiveAsync(options: HighlighterCoreOptions): Promise<ShikiPrimitive>;
|
|
10
10
|
/**
|
|
11
11
|
* @deprecated Use `createShikiPrimitiveAsync` instead.
|
|
12
12
|
*/
|
|
13
|
-
declare const createShikiInternal: typeof createShikiPrimitiveAsync;
|
|
13
|
+
export declare const createShikiInternal: typeof createShikiPrimitiveAsync;
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/constructors/primitive.d.ts
|
|
16
16
|
/**
|
|
@@ -18,26 +18,26 @@ declare const createShikiInternal: typeof createShikiPrimitiveAsync;
|
|
|
18
18
|
*
|
|
19
19
|
* Requires to provide the engine and all themes and languages upfront.
|
|
20
20
|
*/
|
|
21
|
-
declare function createShikiPrimitive(options: HighlighterCoreOptions<true>): ShikiPrimitive;
|
|
21
|
+
export declare function createShikiPrimitive(options: HighlighterCoreOptions<true>): ShikiPrimitive;
|
|
22
22
|
/**
|
|
23
23
|
* @deprecated Use `createShikiPrimitive` instead.
|
|
24
24
|
*/
|
|
25
|
-
declare const createShikiInternalSync: typeof createShikiPrimitive;
|
|
25
|
+
export declare const createShikiInternalSync: typeof createShikiPrimitive;
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/highlight/code-to-tokens-base.d.ts
|
|
28
28
|
/**
|
|
29
29
|
* Code to tokens, with a simple theme.
|
|
30
30
|
*/
|
|
31
|
-
declare function codeToTokensBase(primitive: ShikiPrimitive, code: string, options?: CodeToTokensBaseOptions): ThemedToken[][];
|
|
32
|
-
declare function getLastGrammarState(primitive: ShikiPrimitive, element: ThemedToken[][] | Root): GrammarState$1 | undefined;
|
|
33
|
-
declare function getLastGrammarState(primitive: ShikiPrimitive, code: string, options?: CodeToTokensBaseOptions): GrammarState$1;
|
|
34
|
-
declare function tokenizeWithTheme(code: string, grammar: Grammar, theme: ThemeRegistrationResolved, colorMap: string[], options: TokenizeWithThemeOptions): ThemedToken[][];
|
|
31
|
+
export declare function codeToTokensBase(primitive: ShikiPrimitive, code: string, options?: CodeToTokensBaseOptions): ThemedToken[][];
|
|
32
|
+
export declare function getLastGrammarState(primitive: ShikiPrimitive, element: ThemedToken[][] | Root): GrammarState$1 | undefined;
|
|
33
|
+
export declare function getLastGrammarState(primitive: ShikiPrimitive, code: string, options?: CodeToTokensBaseOptions): GrammarState$1;
|
|
34
|
+
export declare function tokenizeWithTheme(code: string, grammar: Grammar, theme: ThemeRegistrationResolved, colorMap: string[], options: TokenizeWithThemeOptions): ThemedToken[][];
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/highlight/code-to-tokens-themes.d.ts
|
|
37
37
|
/**
|
|
38
38
|
* Get tokens with multiple themes
|
|
39
39
|
*/
|
|
40
|
-
declare function codeToTokensWithThemes(primitive: ShikiPrimitive, code: string, options: CodeToTokensWithThemesOptions, codeToTokensBaseFn?: typeof codeToTokensBase): ThemedTokenWithVariants[][];
|
|
40
|
+
export declare function codeToTokensWithThemes(primitive: ShikiPrimitive, code: string, options: CodeToTokensWithThemesOptions, codeToTokensBaseFn?: typeof codeToTokensBase): ThemedTokenWithVariants[][];
|
|
41
41
|
/**
|
|
42
42
|
* Break tokens from multiple themes into same tokenization.
|
|
43
43
|
*
|
|
@@ -51,24 +51,24 @@ declare function codeToTokensWithThemes(primitive: ShikiPrimitive, code: string,
|
|
|
51
51
|
* - `console . log ( " hello " )` (8 tokens)
|
|
52
52
|
* - `console . log ( " hello " )` (8 tokens)
|
|
53
53
|
*/
|
|
54
|
-
declare function alignThemesTokenization(...themes: ThemedToken[][][]): ThemedToken[][][];
|
|
54
|
+
export declare function alignThemesTokenization(...themes: ThemedToken[][][]): ThemedToken[][][];
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/textmate/getters-resolve.d.ts
|
|
57
57
|
/**
|
|
58
58
|
* Resolve
|
|
59
59
|
*/
|
|
60
|
-
declare function resolveLangs(langs: (LanguageInput | SpecialLanguage)[]): Promise<LanguageRegistration[]>;
|
|
61
|
-
declare function resolveThemes(themes: (ThemeInput | SpecialTheme)[]): Promise<ThemeRegistrationResolved[]>;
|
|
60
|
+
export declare function resolveLangs(langs: (LanguageInput | SpecialLanguage)[]): Promise<LanguageRegistration[]>;
|
|
61
|
+
export declare function resolveThemes(themes: (ThemeInput | SpecialTheme)[]): Promise<ThemeRegistrationResolved[]>;
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/textmate/grammar-state.d.ts
|
|
64
|
-
declare function setLastGrammarStateToMap(keys: GrammarStateMapKey, state: GrammarState$1): void;
|
|
65
|
-
declare function getLastGrammarStateFromMap(keys: GrammarStateMapKey): GrammarState$1 | undefined;
|
|
64
|
+
export declare function setLastGrammarStateToMap(keys: GrammarStateMapKey, state: GrammarState$1): void;
|
|
65
|
+
export declare function getLastGrammarStateFromMap(keys: GrammarStateMapKey): GrammarState$1 | undefined;
|
|
66
66
|
/**
|
|
67
67
|
* GrammarState is a special reference object that holds the state of a grammar.
|
|
68
68
|
*
|
|
69
69
|
* It's used to highlight code snippets that are part of the target language.
|
|
70
70
|
*/
|
|
71
|
-
declare class GrammarState implements GrammarState$1 {
|
|
71
|
+
export declare class GrammarState implements GrammarState$1 {
|
|
72
72
|
/**
|
|
73
73
|
* Theme to Stack mapping
|
|
74
74
|
*/
|
|
@@ -96,16 +96,16 @@ declare class GrammarState implements GrammarState$1 {
|
|
|
96
96
|
scopes: string[];
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
declare function getGrammarStack(state: GrammarState | GrammarState$1, theme?: string): StateStack | undefined;
|
|
99
|
+
export declare function getGrammarStack(state: GrammarState | GrammarState$1, theme?: string): StateStack | undefined;
|
|
100
100
|
//#endregion
|
|
101
101
|
//#region src/textmate/normalize-theme.d.ts
|
|
102
102
|
/**
|
|
103
103
|
* Normalize a textmate theme to shiki theme
|
|
104
104
|
*/
|
|
105
|
-
declare function normalizeTheme(rawTheme: ThemeRegistrationAny): ThemeRegistrationResolved;
|
|
105
|
+
export declare function normalizeTheme(rawTheme: ThemeRegistrationAny): ThemeRegistrationResolved;
|
|
106
106
|
//#endregion
|
|
107
107
|
//#region src/textmate/resolver.d.ts
|
|
108
|
-
declare class Resolver implements RegistryOptions {
|
|
108
|
+
export declare class Resolver implements RegistryOptions {
|
|
109
109
|
private readonly _langs;
|
|
110
110
|
private readonly _scopeToLang;
|
|
111
111
|
private readonly _injections;
|
|
@@ -119,7 +119,7 @@ declare class Resolver implements RegistryOptions {
|
|
|
119
119
|
}
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region src/textmate/registry.d.ts
|
|
122
|
-
declare class Registry extends Registry$1 {
|
|
122
|
+
export declare class Registry extends Registry$1 {
|
|
123
123
|
private _resolver;
|
|
124
124
|
private _themes;
|
|
125
125
|
private _langs;
|
|
@@ -145,45 +145,44 @@ declare class Registry extends Registry$1 {
|
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
147
|
//#region src/utils/colors.d.ts
|
|
148
|
-
declare function resolveColorReplacements(theme: ThemeRegistrationAny | string, options?: TokenizeWithThemeOptions): Record<string, string | undefined>;
|
|
149
|
-
declare function applyColorReplacements(color: string, replacements?: Record<string, string | undefined>): string;
|
|
150
|
-
declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string | undefined>): string | undefined;
|
|
148
|
+
export declare function resolveColorReplacements(theme: ThemeRegistrationAny | string, options?: TokenizeWithThemeOptions): Record<string, string | undefined>;
|
|
149
|
+
export declare function applyColorReplacements(color: string, replacements?: Record<string, string | undefined>): string;
|
|
150
|
+
export declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string | undefined>): string | undefined;
|
|
151
151
|
//#endregion
|
|
152
152
|
//#region src/utils/general.d.ts
|
|
153
|
-
declare function toArray<T>(x: MaybeArray<T>): T[];
|
|
153
|
+
export declare function toArray<T>(x: MaybeArray<T>): T[];
|
|
154
154
|
/**
|
|
155
155
|
* Normalize a getter to a promise.
|
|
156
156
|
*/
|
|
157
|
-
declare function normalizeGetter<T>(p: MaybeGetter<T>): Promise<T>;
|
|
157
|
+
export declare function normalizeGetter<T>(p: MaybeGetter<T>): Promise<T>;
|
|
158
158
|
/**
|
|
159
159
|
* Check if the language is plaintext that is ignored by Shiki.
|
|
160
160
|
*
|
|
161
161
|
* Hard-coded plain text languages: `plaintext`, `txt`, `text`, `plain`.
|
|
162
162
|
*/
|
|
163
|
-
declare function isPlainLang(lang: string | null | undefined): lang is PlainTextLanguage;
|
|
163
|
+
export declare function isPlainLang(lang: string | null | undefined): lang is PlainTextLanguage;
|
|
164
164
|
/**
|
|
165
165
|
* Check if the language is specially handled or bypassed by Shiki.
|
|
166
166
|
*
|
|
167
167
|
* Hard-coded languages: `ansi` and plaintexts like `plaintext`, `txt`, `text`, `plain`.
|
|
168
168
|
*/
|
|
169
|
-
declare function isSpecialLang(lang: any): lang is SpecialLanguage;
|
|
169
|
+
export declare function isSpecialLang(lang: any): lang is SpecialLanguage;
|
|
170
170
|
/**
|
|
171
171
|
* Check if the theme is specially handled or bypassed by Shiki.
|
|
172
172
|
*
|
|
173
173
|
* Hard-coded themes: `none`.
|
|
174
174
|
*/
|
|
175
|
-
declare function isNoneTheme(theme: string | ThemeInput | null | undefined): theme is 'none';
|
|
175
|
+
export declare function isNoneTheme(theme: string | ThemeInput | null | undefined): theme is 'none';
|
|
176
176
|
/**
|
|
177
177
|
* Check if the theme is specially handled or bypassed by Shiki.
|
|
178
178
|
*
|
|
179
179
|
* Hard-coded themes: `none`.
|
|
180
180
|
*/
|
|
181
|
-
declare function isSpecialTheme(theme: string | ThemeInput | null | undefined): theme is SpecialTheme;
|
|
181
|
+
export declare function isSpecialTheme(theme: string | ThemeInput | null | undefined): theme is SpecialTheme;
|
|
182
182
|
//#endregion
|
|
183
183
|
//#region src/utils/strings.d.ts
|
|
184
|
-
declare function splitLines(code: string, preserveEnding?: boolean): [string, number][];
|
|
184
|
+
export declare function splitLines(code: string, preserveEnding?: boolean): [string, number][];
|
|
185
185
|
//#endregion
|
|
186
186
|
//#region src/utils/alias.d.ts
|
|
187
|
-
declare function resolveLangAlias(name: string, alias?: Record<string, string>): string;
|
|
188
|
-
//#endregion
|
|
189
|
-
export { GrammarState, Registry, Resolver, alignThemesTokenization, applyColorReplacements, codeToTokensBase, codeToTokensWithThemes, createShikiInternal, createShikiInternalSync, createShikiPrimitive, createShikiPrimitiveAsync, getGrammarStack, getLastGrammarState, getLastGrammarStateFromMap, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, normalizeGetter, normalizeTheme, resolveColorReplacements, resolveLangAlias, resolveLangs, resolveThemes, setLastGrammarStateToMap, splitLines, toArray, tokenizeWithTheme };
|
|
187
|
+
export declare function resolveLangAlias(name: string, alias?: Record<string, string>): string;
|
|
188
|
+
//#endregion
|
|
@@ -287,6 +287,7 @@ var Registry = class extends Registry$1 {
|
|
|
287
287
|
});
|
|
288
288
|
this._loadedLanguagesCache = null;
|
|
289
289
|
if (embeddedLazilyBy.size) for (const e of embeddedLazilyBy) {
|
|
290
|
+
this._syncRegistry?._grammars?.get(e.scopeName)?.dispose();
|
|
290
291
|
this._resolvedGrammars.delete(e.name);
|
|
291
292
|
this._loadedLanguagesCache = null;
|
|
292
293
|
this._syncRegistry?._injectionGrammars?.delete(e.scopeName);
|
|
@@ -358,7 +359,7 @@ var Resolver = class {
|
|
|
358
359
|
this._scopeToLang.set(l.scopeName, l);
|
|
359
360
|
if (l.injectTo) l.injectTo.forEach((i) => {
|
|
360
361
|
if (!this._injections.get(i)) this._injections.set(i, []);
|
|
361
|
-
this._injections.get(i).push(l.scopeName);
|
|
362
|
+
if (!this._injections.get(i).includes(l.scopeName)) this._injections.get(i).push(l.scopeName);
|
|
362
363
|
});
|
|
363
364
|
}
|
|
364
365
|
getInjections(scopeName) {
|