shiki 2.3.0 → 2.3.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/bundle-full.d.mts +3 -7
- package/dist/bundle-web.d.mts +3 -7
- package/dist/core-unwasm.d.mts +0 -3
- package/dist/core.d.mts +3 -262
- package/dist/engine-oniguruma.d.mts +1 -87
- package/dist/index.d.mts +76 -5
- package/dist/textmate.d.mts +675 -1
- package/dist/theme-css-variables.d.mts +1 -3
- package/dist/themes.d.mts +1 -1
- package/dist/types/wasm-dynamic.d.mts +335 -1
- package/dist/types.d.mts +0 -1
- package/package.json +9 -9
- package/dist/types/theme-css-variables.d.mts +0 -634
|
@@ -1,8 +1,342 @@
|
|
|
1
1
|
import { WebAssemblyInstantiator } from '@shikijs/core/types';
|
|
2
2
|
|
|
3
|
+
// ## Interfaces
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Info associated with nodes by the ecosystem.
|
|
7
|
+
*
|
|
8
|
+
* This space is guaranteed to never be specified by unist or specifications
|
|
9
|
+
* implementing unist.
|
|
10
|
+
* But you can use it in utilities and plugins to store data.
|
|
11
|
+
*
|
|
12
|
+
* This type can be augmented to register custom data.
|
|
13
|
+
* For example:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* declare module 'unist' {
|
|
17
|
+
* interface Data {
|
|
18
|
+
* // `someNode.data.myId` is typed as `number | undefined`
|
|
19
|
+
* myId?: number | undefined
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
interface Data$1 {}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* One place in a source file.
|
|
28
|
+
*/
|
|
29
|
+
interface Point {
|
|
30
|
+
/**
|
|
31
|
+
* Line in a source file (1-indexed integer).
|
|
32
|
+
*/
|
|
33
|
+
line: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Column in a source file (1-indexed integer).
|
|
37
|
+
*/
|
|
38
|
+
column: number;
|
|
39
|
+
/**
|
|
40
|
+
* Character in a source file (0-indexed integer).
|
|
41
|
+
*/
|
|
42
|
+
offset?: number | undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Position of a node in a source document.
|
|
47
|
+
*
|
|
48
|
+
* A position is a range between two points.
|
|
49
|
+
*/
|
|
50
|
+
interface Position {
|
|
51
|
+
/**
|
|
52
|
+
* Place of the first character of the parsed source region.
|
|
53
|
+
*/
|
|
54
|
+
start: Point;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Place of the first character after the parsed source region.
|
|
58
|
+
*/
|
|
59
|
+
end: Point;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Abstract unist node.
|
|
64
|
+
*
|
|
65
|
+
* The syntactic unit in unist syntax trees are called nodes.
|
|
66
|
+
*
|
|
67
|
+
* This interface is supposed to be extended.
|
|
68
|
+
* If you can use {@link Literal} or {@link Parent}, you should.
|
|
69
|
+
* But for example in markdown, a `thematicBreak` (`***`), is neither literal
|
|
70
|
+
* nor parent, but still a node.
|
|
71
|
+
*/
|
|
72
|
+
interface Node$1 {
|
|
73
|
+
/**
|
|
74
|
+
* Node type.
|
|
75
|
+
*/
|
|
76
|
+
type: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Info from the ecosystem.
|
|
80
|
+
*/
|
|
81
|
+
data?: Data$1 | undefined;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Position of a node in a source document.
|
|
85
|
+
*
|
|
86
|
+
* Nodes that are generated (not in the original source document) must not
|
|
87
|
+
* have a position.
|
|
88
|
+
*/
|
|
89
|
+
position?: Position | undefined;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ## Interfaces
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Info associated with hast nodes by the ecosystem.
|
|
96
|
+
*
|
|
97
|
+
* This space is guaranteed to never be specified by unist or hast.
|
|
98
|
+
* But you can use it in utilities and plugins to store data.
|
|
99
|
+
*
|
|
100
|
+
* This type can be augmented to register custom data.
|
|
101
|
+
* For example:
|
|
102
|
+
*
|
|
103
|
+
* ```ts
|
|
104
|
+
* declare module 'hast' {
|
|
105
|
+
* interface Data {
|
|
106
|
+
* // `someNode.data.myId` is typed as `number | undefined`
|
|
107
|
+
* myId?: number | undefined
|
|
108
|
+
* }
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
interface Data extends Data$1 {}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Info associated with an element.
|
|
116
|
+
*/
|
|
117
|
+
interface Properties {
|
|
118
|
+
[PropertyName: string]: boolean | number | string | null | undefined | Array<string | number>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ## Content maps
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Union of registered hast nodes that can occur in {@link Element}.
|
|
125
|
+
*
|
|
126
|
+
* To register mote custom hast nodes, add them to {@link ElementContentMap}.
|
|
127
|
+
* They will be automatically added here.
|
|
128
|
+
*/
|
|
129
|
+
type ElementContent = ElementContentMap[keyof ElementContentMap];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Registry of all hast nodes that can occur as children of {@link Element}.
|
|
133
|
+
*
|
|
134
|
+
* For a union of all {@link Element} children, see {@link ElementContent}.
|
|
135
|
+
*/
|
|
136
|
+
interface ElementContentMap {
|
|
137
|
+
comment: Comment;
|
|
138
|
+
element: Element;
|
|
139
|
+
text: Text;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Union of registered hast nodes that can occur in {@link Root}.
|
|
144
|
+
*
|
|
145
|
+
* To register custom hast nodes, add them to {@link RootContentMap}.
|
|
146
|
+
* They will be automatically added here.
|
|
147
|
+
*/
|
|
148
|
+
type RootContent = RootContentMap[keyof RootContentMap];
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Registry of all hast nodes that can occur as children of {@link Root}.
|
|
152
|
+
*
|
|
153
|
+
* > 👉 **Note**: {@link Root} does not need to be an entire document.
|
|
154
|
+
* > it can also be a fragment.
|
|
155
|
+
*
|
|
156
|
+
* For a union of all {@link Root} children, see {@link RootContent}.
|
|
157
|
+
*/
|
|
158
|
+
interface RootContentMap {
|
|
159
|
+
comment: Comment;
|
|
160
|
+
doctype: Doctype;
|
|
161
|
+
element: Element;
|
|
162
|
+
text: Text;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ## Abstract nodes
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Abstract hast node.
|
|
169
|
+
*
|
|
170
|
+
* This interface is supposed to be extended.
|
|
171
|
+
* If you can use {@link Literal} or {@link Parent}, you should.
|
|
172
|
+
* But for example in HTML, a `Doctype` is neither literal nor parent, but
|
|
173
|
+
* still a node.
|
|
174
|
+
*
|
|
175
|
+
* To register custom hast nodes, add them to {@link RootContentMap} and other
|
|
176
|
+
* places where relevant (such as {@link ElementContentMap}).
|
|
177
|
+
*
|
|
178
|
+
* For a union of all registered hast nodes, see {@link Nodes}.
|
|
179
|
+
*/
|
|
180
|
+
interface Node extends Node$1 {
|
|
181
|
+
/**
|
|
182
|
+
* Info from the ecosystem.
|
|
183
|
+
*/
|
|
184
|
+
data?: Data | undefined;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Abstract hast node that contains the smallest possible value.
|
|
189
|
+
*
|
|
190
|
+
* This interface is supposed to be extended if you make custom hast nodes.
|
|
191
|
+
*
|
|
192
|
+
* For a union of all registered hast literals, see {@link Literals}.
|
|
193
|
+
*/
|
|
194
|
+
interface Literal extends Node {
|
|
195
|
+
/**
|
|
196
|
+
* Plain-text value.
|
|
197
|
+
*/
|
|
198
|
+
value: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Abstract hast node that contains other hast nodes (*children*).
|
|
203
|
+
*
|
|
204
|
+
* This interface is supposed to be extended if you make custom hast nodes.
|
|
205
|
+
*
|
|
206
|
+
* For a union of all registered hast parents, see {@link Parents}.
|
|
207
|
+
*/
|
|
208
|
+
interface Parent extends Node {
|
|
209
|
+
/**
|
|
210
|
+
* List of children.
|
|
211
|
+
*/
|
|
212
|
+
children: RootContent[];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// ## Concrete nodes
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* HTML comment.
|
|
219
|
+
*/
|
|
220
|
+
interface Comment extends Literal {
|
|
221
|
+
/**
|
|
222
|
+
* Node type of HTML comments in hast.
|
|
223
|
+
*/
|
|
224
|
+
type: "comment";
|
|
225
|
+
/**
|
|
226
|
+
* Data associated with the comment.
|
|
227
|
+
*/
|
|
228
|
+
data?: CommentData | undefined;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Info associated with hast comments by the ecosystem.
|
|
233
|
+
*/
|
|
234
|
+
interface CommentData extends Data {}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* HTML document type.
|
|
238
|
+
*/
|
|
239
|
+
interface Doctype extends Node$1 {
|
|
240
|
+
/**
|
|
241
|
+
* Node type of HTML document types in hast.
|
|
242
|
+
*/
|
|
243
|
+
type: "doctype";
|
|
244
|
+
/**
|
|
245
|
+
* Data associated with the doctype.
|
|
246
|
+
*/
|
|
247
|
+
data?: DoctypeData | undefined;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Info associated with hast doctypes by the ecosystem.
|
|
252
|
+
*/
|
|
253
|
+
interface DoctypeData extends Data {}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* HTML element.
|
|
257
|
+
*/
|
|
258
|
+
interface Element extends Parent {
|
|
259
|
+
/**
|
|
260
|
+
* Node type of elements.
|
|
261
|
+
*/
|
|
262
|
+
type: "element";
|
|
263
|
+
/**
|
|
264
|
+
* Tag name (such as `'body'`) of the element.
|
|
265
|
+
*/
|
|
266
|
+
tagName: string;
|
|
267
|
+
/**
|
|
268
|
+
* Info associated with the element.
|
|
269
|
+
*/
|
|
270
|
+
properties: Properties;
|
|
271
|
+
/**
|
|
272
|
+
* Children of element.
|
|
273
|
+
*/
|
|
274
|
+
children: ElementContent[];
|
|
275
|
+
/**
|
|
276
|
+
* When the `tagName` field is `'template'`, a `content` field can be
|
|
277
|
+
* present.
|
|
278
|
+
*/
|
|
279
|
+
content?: Root | undefined;
|
|
280
|
+
/**
|
|
281
|
+
* Data associated with the element.
|
|
282
|
+
*/
|
|
283
|
+
data?: ElementData | undefined;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Info associated with hast elements by the ecosystem.
|
|
288
|
+
*/
|
|
289
|
+
interface ElementData extends Data {}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Document fragment or a whole document.
|
|
293
|
+
*
|
|
294
|
+
* Should be used as the root of a tree and must not be used as a child.
|
|
295
|
+
*
|
|
296
|
+
* Can also be used as the value for the content field on a `'template'` element.
|
|
297
|
+
*/
|
|
298
|
+
interface Root extends Parent {
|
|
299
|
+
/**
|
|
300
|
+
* Node type of hast root.
|
|
301
|
+
*/
|
|
302
|
+
type: "root";
|
|
303
|
+
/**
|
|
304
|
+
* Children of root.
|
|
305
|
+
*/
|
|
306
|
+
children: RootContent[];
|
|
307
|
+
/**
|
|
308
|
+
* Data associated with the hast root.
|
|
309
|
+
*/
|
|
310
|
+
data?: RootData | undefined;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Info associated with hast root nodes by the ecosystem.
|
|
315
|
+
*/
|
|
316
|
+
interface RootData extends Data {}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* HTML character data (plain text).
|
|
320
|
+
*/
|
|
321
|
+
interface Text extends Literal {
|
|
322
|
+
/**
|
|
323
|
+
* Node type of HTML character data (plain text) in hast.
|
|
324
|
+
*/
|
|
325
|
+
type: "text";
|
|
326
|
+
/**
|
|
327
|
+
* Data associated with the text.
|
|
328
|
+
*/
|
|
329
|
+
data?: TextData | undefined;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Info associated with hast texts by the ecosystem.
|
|
334
|
+
*/
|
|
335
|
+
interface TextData extends Data {}
|
|
336
|
+
|
|
3
337
|
/**
|
|
4
338
|
* @deprecated Use `import('shiki/wasm')` instead.
|
|
5
339
|
*/
|
|
6
340
|
declare const getWasmInlined: WebAssemblyInstantiator;
|
|
7
341
|
|
|
8
|
-
export { getWasmInlined as g };
|
|
342
|
+
export { type Root as R, getWasmInlined as g };
|
package/dist/types.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shiki",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.2",
|
|
5
5
|
"description": "A beautiful Syntax Highlighter.",
|
|
6
6
|
"author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -119,17 +119,17 @@
|
|
|
119
119
|
"dependencies": {
|
|
120
120
|
"@shikijs/vscode-textmate": "^10.0.1",
|
|
121
121
|
"@types/hast": "^3.0.4",
|
|
122
|
-
"@shikijs/core": "2.3.
|
|
123
|
-
"@shikijs/engine-
|
|
124
|
-
"@shikijs/engine-
|
|
125
|
-
"@shikijs/
|
|
126
|
-
"@shikijs/
|
|
127
|
-
"@shikijs/
|
|
122
|
+
"@shikijs/core": "2.3.2",
|
|
123
|
+
"@shikijs/engine-javascript": "2.3.2",
|
|
124
|
+
"@shikijs/engine-oniguruma": "2.3.2",
|
|
125
|
+
"@shikijs/themes": "2.3.2",
|
|
126
|
+
"@shikijs/types": "2.3.2",
|
|
127
|
+
"@shikijs/langs": "2.3.2"
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
130
|
"rollup-plugin-copy": "^3.5.0",
|
|
131
|
-
"tm-grammars": "^1.22.
|
|
132
|
-
"tm-themes": "^1.9.
|
|
131
|
+
"tm-grammars": "^1.22.13",
|
|
132
|
+
"tm-themes": "^1.9.12",
|
|
133
133
|
"vscode-oniguruma": "1.7.0"
|
|
134
134
|
},
|
|
135
135
|
"scripts": {
|