shiki 2.3.2 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle-full.d.mts +2 -2
- package/dist/bundle-full.mjs +4 -3
- package/dist/bundle-web.d.mts +2 -2
- package/dist/bundle-web.mjs +4 -3
- package/dist/core-unwasm.d.mts +562 -1
- package/dist/core-unwasm.mjs +3 -0
- package/dist/core.d.mts +1 -1
- package/dist/engine-oniguruma.d.mts +87 -1
- package/dist/index.d.mts +2 -74
- package/dist/textmate.d.mts +1 -675
- package/dist/themes.d.mts +1 -1
- package/dist/types/index.d.d.mts +344 -0
- package/dist/types/wasm-dynamic.d.mts +1 -335
- package/dist/types.d.mts +1 -0
- package/package.json +9 -9
|
@@ -1 +1,87 @@
|
|
|
1
|
-
|
|
1
|
+
interface IOnigCaptureIndex {
|
|
2
|
+
start: number;
|
|
3
|
+
end: number;
|
|
4
|
+
length: number;
|
|
5
|
+
}
|
|
6
|
+
interface IOnigMatch {
|
|
7
|
+
index: number;
|
|
8
|
+
captureIndices: IOnigCaptureIndex[];
|
|
9
|
+
}
|
|
10
|
+
declare const enum FindOption {
|
|
11
|
+
None = 0,
|
|
12
|
+
/**
|
|
13
|
+
* equivalent of ONIG_OPTION_NOT_BEGIN_STRING: (str) isn't considered as begin of string (* fail \A)
|
|
14
|
+
*/
|
|
15
|
+
NotBeginString = 1,
|
|
16
|
+
/**
|
|
17
|
+
* equivalent of ONIG_OPTION_NOT_END_STRING: (end) isn't considered as end of string (* fail \z, \Z)
|
|
18
|
+
*/
|
|
19
|
+
NotEndString = 2,
|
|
20
|
+
/**
|
|
21
|
+
* equivalent of ONIG_OPTION_NOT_BEGIN_POSITION: (start) isn't considered as start position of search (* fail \G)
|
|
22
|
+
*/
|
|
23
|
+
NotBeginPosition = 4,
|
|
24
|
+
/**
|
|
25
|
+
* used for debugging purposes.
|
|
26
|
+
*/
|
|
27
|
+
DebugCall = 8
|
|
28
|
+
}
|
|
29
|
+
interface OnigScanner {
|
|
30
|
+
findNextMatchSync(string: string | OnigString, startPosition: number, options: OrMask<FindOption>): IOnigMatch | null;
|
|
31
|
+
dispose?(): void;
|
|
32
|
+
}
|
|
33
|
+
interface OnigString {
|
|
34
|
+
readonly content: string;
|
|
35
|
+
dispose?(): void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A union of given const enum values.
|
|
40
|
+
*/
|
|
41
|
+
type OrMask<T extends number> = number;
|
|
42
|
+
|
|
43
|
+
type Awaitable<T> = T | Promise<T>;
|
|
44
|
+
|
|
45
|
+
interface PatternScanner extends OnigScanner {
|
|
46
|
+
}
|
|
47
|
+
interface RegexEngineString extends OnigString {
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Engine for RegExp matching and scanning.
|
|
51
|
+
*/
|
|
52
|
+
interface RegexEngine {
|
|
53
|
+
createScanner: (patterns: (string | RegExp)[]) => PatternScanner;
|
|
54
|
+
createString: (s: string) => RegexEngineString;
|
|
55
|
+
}
|
|
56
|
+
interface WebAssemblyInstantiator {
|
|
57
|
+
(importObject: Record<string, Record<string, WebAssembly.ImportValue>> | undefined): Promise<WebAssemblyInstance>;
|
|
58
|
+
}
|
|
59
|
+
type WebAssemblyInstance = WebAssembly.WebAssemblyInstantiatedSource | WebAssembly.Instance | WebAssembly.Instance['exports'];
|
|
60
|
+
type OnigurumaLoadOptions = {
|
|
61
|
+
instantiator: WebAssemblyInstantiator;
|
|
62
|
+
} | {
|
|
63
|
+
default: WebAssemblyInstantiator;
|
|
64
|
+
} | {
|
|
65
|
+
data: ArrayBufferView | ArrayBuffer | Response;
|
|
66
|
+
};
|
|
67
|
+
type LoadWasmOptionsPlain = OnigurumaLoadOptions | WebAssemblyInstantiator | ArrayBufferView | ArrayBuffer | Response;
|
|
68
|
+
type LoadWasmOptions = Awaitable<LoadWasmOptionsPlain> | (() => Awaitable<LoadWasmOptionsPlain>);
|
|
69
|
+
|
|
70
|
+
declare function loadWasm(options: LoadWasmOptions): Promise<void>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Set the default wasm loader for `loadWasm`.
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
declare function setDefaultWasmLoader(_loader: LoadWasmOptions): void;
|
|
77
|
+
/**
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
declare function getDefaultWasmLoader(): LoadWasmOptions | undefined;
|
|
81
|
+
declare function createOnigurumaEngine(options?: LoadWasmOptions | null): Promise<RegexEngine>;
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated Use `createOnigurumaEngine` instead.
|
|
84
|
+
*/
|
|
85
|
+
declare function createWasmOnigEngine(options?: LoadWasmOptions | null): Promise<RegexEngine>;
|
|
86
|
+
|
|
87
|
+
export { createOnigurumaEngine, createWasmOnigEngine, getDefaultWasmLoader, loadWasm, setDefaultWasmLoader };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,83 +1,11 @@
|
|
|
1
1
|
export { Highlighter, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createHighlighter, getHighlighter, getLastGrammarState, getSingletonHighlighter } from './bundle-full.mjs';
|
|
2
2
|
export { BuiltinLanguage, BuiltinTheme } from './types.mjs';
|
|
3
3
|
export { createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor } from '@shikijs/engine-javascript';
|
|
4
|
+
export { createOnigurumaEngine, loadWasm } from './engine-oniguruma.mjs';
|
|
4
5
|
export { g as getWasmInlined } from './types/wasm-dynamic.mjs';
|
|
5
6
|
export * from '@shikijs/core';
|
|
6
7
|
export { BundledLanguage, bundledLanguages, bundledLanguagesAlias, bundledLanguagesBase, bundledLanguagesInfo } from './langs.mjs';
|
|
7
8
|
export { BundledTheme, bundledThemes, bundledThemesInfo } from './themes.mjs';
|
|
9
|
+
import './types/index.d.mjs';
|
|
8
10
|
import '@shikijs/types';
|
|
9
11
|
import '@shikijs/core/types';
|
|
10
|
-
|
|
11
|
-
interface IOnigCaptureIndex {
|
|
12
|
-
start: number;
|
|
13
|
-
end: number;
|
|
14
|
-
length: number;
|
|
15
|
-
}
|
|
16
|
-
interface IOnigMatch {
|
|
17
|
-
index: number;
|
|
18
|
-
captureIndices: IOnigCaptureIndex[];
|
|
19
|
-
}
|
|
20
|
-
declare const enum FindOption {
|
|
21
|
-
None = 0,
|
|
22
|
-
/**
|
|
23
|
-
* equivalent of ONIG_OPTION_NOT_BEGIN_STRING: (str) isn't considered as begin of string (* fail \A)
|
|
24
|
-
*/
|
|
25
|
-
NotBeginString = 1,
|
|
26
|
-
/**
|
|
27
|
-
* equivalent of ONIG_OPTION_NOT_END_STRING: (end) isn't considered as end of string (* fail \z, \Z)
|
|
28
|
-
*/
|
|
29
|
-
NotEndString = 2,
|
|
30
|
-
/**
|
|
31
|
-
* equivalent of ONIG_OPTION_NOT_BEGIN_POSITION: (start) isn't considered as start position of search (* fail \G)
|
|
32
|
-
*/
|
|
33
|
-
NotBeginPosition = 4,
|
|
34
|
-
/**
|
|
35
|
-
* used for debugging purposes.
|
|
36
|
-
*/
|
|
37
|
-
DebugCall = 8
|
|
38
|
-
}
|
|
39
|
-
interface OnigScanner {
|
|
40
|
-
findNextMatchSync(string: string | OnigString, startPosition: number, options: OrMask<FindOption>): IOnigMatch | null;
|
|
41
|
-
dispose?(): void;
|
|
42
|
-
}
|
|
43
|
-
interface OnigString {
|
|
44
|
-
readonly content: string;
|
|
45
|
-
dispose?(): void;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* A union of given const enum values.
|
|
50
|
-
*/
|
|
51
|
-
type OrMask<T extends number> = number;
|
|
52
|
-
|
|
53
|
-
type Awaitable<T> = T | Promise<T>;
|
|
54
|
-
|
|
55
|
-
interface PatternScanner extends OnigScanner {
|
|
56
|
-
}
|
|
57
|
-
interface RegexEngineString extends OnigString {
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Engine for RegExp matching and scanning.
|
|
61
|
-
*/
|
|
62
|
-
interface RegexEngine {
|
|
63
|
-
createScanner: (patterns: (string | RegExp)[]) => PatternScanner;
|
|
64
|
-
createString: (s: string) => RegexEngineString;
|
|
65
|
-
}
|
|
66
|
-
interface WebAssemblyInstantiator {
|
|
67
|
-
(importObject: Record<string, Record<string, WebAssembly.ImportValue>> | undefined): Promise<WebAssemblyInstance>;
|
|
68
|
-
}
|
|
69
|
-
type WebAssemblyInstance = WebAssembly.WebAssemblyInstantiatedSource | WebAssembly.Instance | WebAssembly.Instance['exports'];
|
|
70
|
-
type OnigurumaLoadOptions = {
|
|
71
|
-
instantiator: WebAssemblyInstantiator;
|
|
72
|
-
} | {
|
|
73
|
-
default: WebAssemblyInstantiator;
|
|
74
|
-
} | {
|
|
75
|
-
data: ArrayBufferView | ArrayBuffer | Response;
|
|
76
|
-
};
|
|
77
|
-
type LoadWasmOptionsPlain = OnigurumaLoadOptions | WebAssemblyInstantiator | ArrayBufferView | ArrayBuffer | Response;
|
|
78
|
-
type LoadWasmOptions = Awaitable<LoadWasmOptionsPlain> | (() => Awaitable<LoadWasmOptionsPlain>);
|
|
79
|
-
|
|
80
|
-
declare function loadWasm(options: LoadWasmOptions): Promise<void>;
|
|
81
|
-
declare function createOnigurumaEngine(options?: LoadWasmOptions | null): Promise<RegexEngine>;
|
|
82
|
-
|
|
83
|
-
export { createOnigurumaEngine, loadWasm };
|