@veracity/ai 0.0.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/ChatCompletionSSE.d.ts +35 -0
- package/dist/ChatCompletionSSE.d.ts.map +1 -0
- package/dist/Markdown.d.ts +2 -0
- package/dist/Markdown.d.ts.map +1 -0
- package/dist/SmoothChatCompletionSSE.d.ts +23 -0
- package/dist/SmoothChatCompletionSSE.d.ts.map +1 -0
- package/dist/components/AIChat/index.d.ts +26 -0
- package/dist/components/AIChat/index.d.ts.map +1 -0
- package/dist/components/AIChatBubble.d.ts +7 -0
- package/dist/components/AIChatBubble.d.ts.map +1 -0
- package/dist/components/AIChatMessage.d.ts +22 -0
- package/dist/components/AIChatMessage.d.ts.map +1 -0
- package/dist/components/AIChatToolCall.d.ts +26 -0
- package/dist/components/AIChatToolCall.d.ts.map +1 -0
- package/dist/components/AIChatToolCallGroup.d.ts +20 -0
- package/dist/components/AIChatToolCallGroup.d.ts.map +1 -0
- package/dist/components/Avatar.d.ts +23 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/HighlightCode/index.d.ts +11 -0
- package/dist/components/HighlightCode/index.d.ts.map +1 -0
- package/dist/components/VeracityAvatar.d.ts +3 -0
- package/dist/components/VeracityAvatar.d.ts.map +1 -0
- package/dist/components/VeracityLogoSquare.d.ts +3 -0
- package/dist/components/VeracityLogoSquare.d.ts.map +1 -0
- package/dist/components/icons/Check.d.ts +3 -0
- package/dist/components/icons/Check.d.ts.map +1 -0
- package/dist/components/icons/ExclamationCircle.d.ts +3 -0
- package/dist/components/icons/ExclamationCircle.d.ts.map +1 -0
- package/dist/components/icons/IconProps.d.ts +12 -0
- package/dist/components/icons/IconProps.d.ts.map +1 -0
- package/dist/components/icons/InfoCircle.d.ts +3 -0
- package/dist/components/icons/InfoCircle.d.ts.map +1 -0
- package/dist/components/icons/QuestionCircle.d.ts +3 -0
- package/dist/components/icons/QuestionCircle.d.ts.map +1 -0
- package/dist/components/icons/Spinner.d.ts +13 -0
- package/dist/components/icons/Spinner.d.ts.map +1 -0
- package/dist/core-Diwflo5W.js +1077 -0
- package/dist/csharp-Cigc7XMa.js +371 -0
- package/dist/css-B-yPI1XM.js +719 -0
- package/dist/dtos.d.ts +18 -0
- package/dist/dtos.d.ts.map +1 -0
- package/dist/enums.d.ts +30 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/javascript-CDslspYb.js +654 -0
- package/dist/python-CzH_tl5q.js +397 -0
- package/dist/typescript-Bx5cZccb.js +728 -0
- package/dist/utils/CancellationToken.d.ts +16 -0
- package/dist/utils/CancellationToken.d.ts.map +1 -0
- package/dist/utils/OperationCancelledError.d.ts +5 -0
- package/dist/utils/OperationCancelledError.d.ts.map +1 -0
- package/dist/utils/createSVGElement.d.ts +2 -0
- package/dist/utils/createSVGElement.d.ts.map +1 -0
- package/dist/veracity-ai.es.js +4173 -0
- package/dist/veracity-ai.umd.js +5 -0
- package/package.json +36 -0
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
const T = "[A-Za-z$_][0-9A-Za-z$_]*", L = [
|
|
2
|
+
"as",
|
|
3
|
+
// for exports
|
|
4
|
+
"in",
|
|
5
|
+
"of",
|
|
6
|
+
"if",
|
|
7
|
+
"for",
|
|
8
|
+
"while",
|
|
9
|
+
"finally",
|
|
10
|
+
"var",
|
|
11
|
+
"new",
|
|
12
|
+
"function",
|
|
13
|
+
"do",
|
|
14
|
+
"return",
|
|
15
|
+
"void",
|
|
16
|
+
"else",
|
|
17
|
+
"break",
|
|
18
|
+
"catch",
|
|
19
|
+
"instanceof",
|
|
20
|
+
"with",
|
|
21
|
+
"throw",
|
|
22
|
+
"case",
|
|
23
|
+
"default",
|
|
24
|
+
"try",
|
|
25
|
+
"switch",
|
|
26
|
+
"continue",
|
|
27
|
+
"typeof",
|
|
28
|
+
"delete",
|
|
29
|
+
"let",
|
|
30
|
+
"yield",
|
|
31
|
+
"const",
|
|
32
|
+
"class",
|
|
33
|
+
// JS handles these with a special rule
|
|
34
|
+
// "get",
|
|
35
|
+
// "set",
|
|
36
|
+
"debugger",
|
|
37
|
+
"async",
|
|
38
|
+
"await",
|
|
39
|
+
"static",
|
|
40
|
+
"import",
|
|
41
|
+
"from",
|
|
42
|
+
"export",
|
|
43
|
+
"extends"
|
|
44
|
+
], x = [
|
|
45
|
+
"true",
|
|
46
|
+
"false",
|
|
47
|
+
"null",
|
|
48
|
+
"undefined",
|
|
49
|
+
"NaN",
|
|
50
|
+
"Infinity"
|
|
51
|
+
], D = [
|
|
52
|
+
// Fundamental objects
|
|
53
|
+
"Object",
|
|
54
|
+
"Function",
|
|
55
|
+
"Boolean",
|
|
56
|
+
"Symbol",
|
|
57
|
+
// numbers and dates
|
|
58
|
+
"Math",
|
|
59
|
+
"Date",
|
|
60
|
+
"Number",
|
|
61
|
+
"BigInt",
|
|
62
|
+
// text
|
|
63
|
+
"String",
|
|
64
|
+
"RegExp",
|
|
65
|
+
// Indexed collections
|
|
66
|
+
"Array",
|
|
67
|
+
"Float32Array",
|
|
68
|
+
"Float64Array",
|
|
69
|
+
"Int8Array",
|
|
70
|
+
"Uint8Array",
|
|
71
|
+
"Uint8ClampedArray",
|
|
72
|
+
"Int16Array",
|
|
73
|
+
"Int32Array",
|
|
74
|
+
"Uint16Array",
|
|
75
|
+
"Uint32Array",
|
|
76
|
+
"BigInt64Array",
|
|
77
|
+
"BigUint64Array",
|
|
78
|
+
// Keyed collections
|
|
79
|
+
"Set",
|
|
80
|
+
"Map",
|
|
81
|
+
"WeakSet",
|
|
82
|
+
"WeakMap",
|
|
83
|
+
// Structured data
|
|
84
|
+
"ArrayBuffer",
|
|
85
|
+
"SharedArrayBuffer",
|
|
86
|
+
"Atomics",
|
|
87
|
+
"DataView",
|
|
88
|
+
"JSON",
|
|
89
|
+
// Control abstraction objects
|
|
90
|
+
"Promise",
|
|
91
|
+
"Generator",
|
|
92
|
+
"GeneratorFunction",
|
|
93
|
+
"AsyncFunction",
|
|
94
|
+
// Reflection
|
|
95
|
+
"Reflect",
|
|
96
|
+
"Proxy",
|
|
97
|
+
// Internationalization
|
|
98
|
+
"Intl",
|
|
99
|
+
// WebAssembly
|
|
100
|
+
"WebAssembly"
|
|
101
|
+
], k = [
|
|
102
|
+
"Error",
|
|
103
|
+
"EvalError",
|
|
104
|
+
"InternalError",
|
|
105
|
+
"RangeError",
|
|
106
|
+
"ReferenceError",
|
|
107
|
+
"SyntaxError",
|
|
108
|
+
"TypeError",
|
|
109
|
+
"URIError"
|
|
110
|
+
], B = [
|
|
111
|
+
"setInterval",
|
|
112
|
+
"setTimeout",
|
|
113
|
+
"clearInterval",
|
|
114
|
+
"clearTimeout",
|
|
115
|
+
"require",
|
|
116
|
+
"exports",
|
|
117
|
+
"eval",
|
|
118
|
+
"isFinite",
|
|
119
|
+
"isNaN",
|
|
120
|
+
"parseFloat",
|
|
121
|
+
"parseInt",
|
|
122
|
+
"decodeURI",
|
|
123
|
+
"decodeURIComponent",
|
|
124
|
+
"encodeURI",
|
|
125
|
+
"encodeURIComponent",
|
|
126
|
+
"escape",
|
|
127
|
+
"unescape"
|
|
128
|
+
], h = [
|
|
129
|
+
"arguments",
|
|
130
|
+
"this",
|
|
131
|
+
"super",
|
|
132
|
+
"console",
|
|
133
|
+
"window",
|
|
134
|
+
"document",
|
|
135
|
+
"localStorage",
|
|
136
|
+
"sessionStorage",
|
|
137
|
+
"module",
|
|
138
|
+
"global"
|
|
139
|
+
// Node.js
|
|
140
|
+
], U = [].concat(
|
|
141
|
+
B,
|
|
142
|
+
D,
|
|
143
|
+
k
|
|
144
|
+
);
|
|
145
|
+
function W(e) {
|
|
146
|
+
const n = e.regex, f = (s, { after: i }) => {
|
|
147
|
+
const b = "</" + s[0].slice(1);
|
|
148
|
+
return s.input.indexOf(b, i) !== -1;
|
|
149
|
+
}, t = T, u = {
|
|
150
|
+
begin: "<>",
|
|
151
|
+
end: "</>"
|
|
152
|
+
}, R = /<[A-Za-z0-9\\._:-]+\s*\/>/, r = {
|
|
153
|
+
begin: /<[A-Za-z0-9\\._:-]+/,
|
|
154
|
+
end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
|
|
155
|
+
/**
|
|
156
|
+
* @param {RegExpMatchArray} match
|
|
157
|
+
* @param {CallbackResponse} response
|
|
158
|
+
*/
|
|
159
|
+
isTrulyOpeningTag: (s, i) => {
|
|
160
|
+
const b = s[0].length + s.index, m = s.input[b];
|
|
161
|
+
if (
|
|
162
|
+
// HTML should not include another raw `<` inside a tag
|
|
163
|
+
// nested type?
|
|
164
|
+
// `<Array<Array<number>>`, etc.
|
|
165
|
+
m === "<" || // the , gives away that this is not HTML
|
|
166
|
+
// `<T, A extends keyof T, V>`
|
|
167
|
+
m === ","
|
|
168
|
+
) {
|
|
169
|
+
i.ignoreMatch();
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
m === ">" && (f(s, { after: b }) || i.ignoreMatch());
|
|
173
|
+
let I;
|
|
174
|
+
const w = s.input.substring(b);
|
|
175
|
+
if (I = w.match(/^\s*=/)) {
|
|
176
|
+
i.ignoreMatch();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if ((I = w.match(/^\s+extends\s+/)) && I.index === 0) {
|
|
180
|
+
i.ignoreMatch();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}, c = {
|
|
185
|
+
$pattern: T,
|
|
186
|
+
keyword: L,
|
|
187
|
+
literal: x,
|
|
188
|
+
built_in: U,
|
|
189
|
+
"variable.language": h
|
|
190
|
+
}, g = "[0-9](_?[0-9])*", o = `\\.(${g})`, l = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", A = {
|
|
191
|
+
className: "number",
|
|
192
|
+
variants: [
|
|
193
|
+
// DecimalLiteral
|
|
194
|
+
{ begin: `(\\b(${l})((${o})|\\.)?|(${o}))[eE][+-]?(${g})\\b` },
|
|
195
|
+
{ begin: `\\b(${l})\\b((${o})\\b|\\.)?|(${o})\\b` },
|
|
196
|
+
// DecimalBigIntegerLiteral
|
|
197
|
+
{ begin: "\\b(0|[1-9](_?[0-9])*)n\\b" },
|
|
198
|
+
// NonDecimalIntegerLiteral
|
|
199
|
+
{ begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
|
|
200
|
+
{ begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
|
|
201
|
+
{ begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
|
|
202
|
+
// LegacyOctalIntegerLiteral (does not include underscore separators)
|
|
203
|
+
// https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
|
|
204
|
+
{ begin: "\\b0[0-7]+n?\\b" }
|
|
205
|
+
],
|
|
206
|
+
relevance: 0
|
|
207
|
+
}, a = {
|
|
208
|
+
className: "subst",
|
|
209
|
+
begin: "\\$\\{",
|
|
210
|
+
end: "\\}",
|
|
211
|
+
keywords: c,
|
|
212
|
+
contains: []
|
|
213
|
+
// defined later
|
|
214
|
+
}, _ = {
|
|
215
|
+
begin: "html`",
|
|
216
|
+
end: "",
|
|
217
|
+
starts: {
|
|
218
|
+
end: "`",
|
|
219
|
+
returnEnd: !1,
|
|
220
|
+
contains: [
|
|
221
|
+
e.BACKSLASH_ESCAPE,
|
|
222
|
+
a
|
|
223
|
+
],
|
|
224
|
+
subLanguage: "xml"
|
|
225
|
+
}
|
|
226
|
+
}, S = {
|
|
227
|
+
begin: "css`",
|
|
228
|
+
end: "",
|
|
229
|
+
starts: {
|
|
230
|
+
end: "`",
|
|
231
|
+
returnEnd: !1,
|
|
232
|
+
contains: [
|
|
233
|
+
e.BACKSLASH_ESCAPE,
|
|
234
|
+
a
|
|
235
|
+
],
|
|
236
|
+
subLanguage: "css"
|
|
237
|
+
}
|
|
238
|
+
}, E = {
|
|
239
|
+
begin: "gql`",
|
|
240
|
+
end: "",
|
|
241
|
+
starts: {
|
|
242
|
+
end: "`",
|
|
243
|
+
returnEnd: !1,
|
|
244
|
+
contains: [
|
|
245
|
+
e.BACKSLASH_ESCAPE,
|
|
246
|
+
a
|
|
247
|
+
],
|
|
248
|
+
subLanguage: "graphql"
|
|
249
|
+
}
|
|
250
|
+
}, N = {
|
|
251
|
+
className: "string",
|
|
252
|
+
begin: "`",
|
|
253
|
+
end: "`",
|
|
254
|
+
contains: [
|
|
255
|
+
e.BACKSLASH_ESCAPE,
|
|
256
|
+
a
|
|
257
|
+
]
|
|
258
|
+
}, y = {
|
|
259
|
+
className: "comment",
|
|
260
|
+
variants: [
|
|
261
|
+
e.COMMENT(
|
|
262
|
+
/\/\*\*(?!\/)/,
|
|
263
|
+
"\\*/",
|
|
264
|
+
{
|
|
265
|
+
relevance: 0,
|
|
266
|
+
contains: [
|
|
267
|
+
{
|
|
268
|
+
begin: "(?=@[A-Za-z]+)",
|
|
269
|
+
relevance: 0,
|
|
270
|
+
contains: [
|
|
271
|
+
{
|
|
272
|
+
className: "doctag",
|
|
273
|
+
begin: "@[A-Za-z]+"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
className: "type",
|
|
277
|
+
begin: "\\{",
|
|
278
|
+
end: "\\}",
|
|
279
|
+
excludeEnd: !0,
|
|
280
|
+
excludeBegin: !0,
|
|
281
|
+
relevance: 0
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
className: "variable",
|
|
285
|
+
begin: t + "(?=\\s*(-)|$)",
|
|
286
|
+
endsParent: !0,
|
|
287
|
+
relevance: 0
|
|
288
|
+
},
|
|
289
|
+
// eat spaces (not newlines) so we can find
|
|
290
|
+
// types or variables
|
|
291
|
+
{
|
|
292
|
+
begin: /(?=[^\n])\s/,
|
|
293
|
+
relevance: 0
|
|
294
|
+
}
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
e.C_BLOCK_COMMENT_MODE,
|
|
301
|
+
e.C_LINE_COMMENT_MODE
|
|
302
|
+
]
|
|
303
|
+
}, C = [
|
|
304
|
+
e.APOS_STRING_MODE,
|
|
305
|
+
e.QUOTE_STRING_MODE,
|
|
306
|
+
_,
|
|
307
|
+
S,
|
|
308
|
+
E,
|
|
309
|
+
N,
|
|
310
|
+
// Skip numbers when they are part of a variable name
|
|
311
|
+
{ match: /\$\d+/ },
|
|
312
|
+
A
|
|
313
|
+
// This is intentional:
|
|
314
|
+
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
315
|
+
// hljs.REGEXP_MODE
|
|
316
|
+
];
|
|
317
|
+
a.contains = C.concat({
|
|
318
|
+
// we need to pair up {} inside our subst to prevent
|
|
319
|
+
// it from ending too early by matching another }
|
|
320
|
+
begin: /\{/,
|
|
321
|
+
end: /\}/,
|
|
322
|
+
keywords: c,
|
|
323
|
+
contains: [
|
|
324
|
+
"self"
|
|
325
|
+
].concat(C)
|
|
326
|
+
});
|
|
327
|
+
const O = [].concat(y, a.contains), p = O.concat([
|
|
328
|
+
// eat recursive parens in sub expressions
|
|
329
|
+
{
|
|
330
|
+
begin: /\(/,
|
|
331
|
+
end: /\)/,
|
|
332
|
+
keywords: c,
|
|
333
|
+
contains: ["self"].concat(O)
|
|
334
|
+
}
|
|
335
|
+
]), d = {
|
|
336
|
+
className: "params",
|
|
337
|
+
begin: /\(/,
|
|
338
|
+
end: /\)/,
|
|
339
|
+
excludeBegin: !0,
|
|
340
|
+
excludeEnd: !0,
|
|
341
|
+
keywords: c,
|
|
342
|
+
contains: p
|
|
343
|
+
}, P = {
|
|
344
|
+
variants: [
|
|
345
|
+
// class Car extends vehicle
|
|
346
|
+
{
|
|
347
|
+
match: [
|
|
348
|
+
/class/,
|
|
349
|
+
/\s+/,
|
|
350
|
+
t,
|
|
351
|
+
/\s+/,
|
|
352
|
+
/extends/,
|
|
353
|
+
/\s+/,
|
|
354
|
+
n.concat(t, "(", n.concat(/\./, t), ")*")
|
|
355
|
+
],
|
|
356
|
+
scope: {
|
|
357
|
+
1: "keyword",
|
|
358
|
+
3: "title.class",
|
|
359
|
+
5: "keyword",
|
|
360
|
+
7: "title.class.inherited"
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
// class Car
|
|
364
|
+
{
|
|
365
|
+
match: [
|
|
366
|
+
/class/,
|
|
367
|
+
/\s+/,
|
|
368
|
+
t
|
|
369
|
+
],
|
|
370
|
+
scope: {
|
|
371
|
+
1: "keyword",
|
|
372
|
+
3: "title.class"
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
]
|
|
376
|
+
}, M = {
|
|
377
|
+
relevance: 0,
|
|
378
|
+
match: n.either(
|
|
379
|
+
// Hard coded exceptions
|
|
380
|
+
/\bJSON/,
|
|
381
|
+
// Float32Array, OutT
|
|
382
|
+
/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,
|
|
383
|
+
// CSSFactory, CSSFactoryT
|
|
384
|
+
/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,
|
|
385
|
+
// FPs, FPsT
|
|
386
|
+
/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/
|
|
387
|
+
// P
|
|
388
|
+
// single letters are not highlighted
|
|
389
|
+
// BLAH
|
|
390
|
+
// this will be flagged as a UPPER_CASE_CONSTANT instead
|
|
391
|
+
),
|
|
392
|
+
className: "title.class",
|
|
393
|
+
keywords: {
|
|
394
|
+
_: [
|
|
395
|
+
// se we still get relevance credit for JS library classes
|
|
396
|
+
...D,
|
|
397
|
+
...k
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
}, $ = {
|
|
401
|
+
label: "use_strict",
|
|
402
|
+
className: "meta",
|
|
403
|
+
relevance: 10,
|
|
404
|
+
begin: /^\s*['"]use (strict|asm)['"]/
|
|
405
|
+
}, F = {
|
|
406
|
+
variants: [
|
|
407
|
+
{
|
|
408
|
+
match: [
|
|
409
|
+
/function/,
|
|
410
|
+
/\s+/,
|
|
411
|
+
t,
|
|
412
|
+
/(?=\s*\()/
|
|
413
|
+
]
|
|
414
|
+
},
|
|
415
|
+
// anonymous function
|
|
416
|
+
{
|
|
417
|
+
match: [
|
|
418
|
+
/function/,
|
|
419
|
+
/\s*(?=\()/
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
],
|
|
423
|
+
className: {
|
|
424
|
+
1: "keyword",
|
|
425
|
+
3: "title.function"
|
|
426
|
+
},
|
|
427
|
+
label: "func.def",
|
|
428
|
+
contains: [d],
|
|
429
|
+
illegal: /%/
|
|
430
|
+
}, Z = {
|
|
431
|
+
relevance: 0,
|
|
432
|
+
match: /\b[A-Z][A-Z_0-9]+\b/,
|
|
433
|
+
className: "variable.constant"
|
|
434
|
+
};
|
|
435
|
+
function z(s) {
|
|
436
|
+
return n.concat("(?!", s.join("|"), ")");
|
|
437
|
+
}
|
|
438
|
+
const G = {
|
|
439
|
+
match: n.concat(
|
|
440
|
+
/\b/,
|
|
441
|
+
z([
|
|
442
|
+
...B,
|
|
443
|
+
"super",
|
|
444
|
+
"import"
|
|
445
|
+
]),
|
|
446
|
+
t,
|
|
447
|
+
n.lookahead(/\(/)
|
|
448
|
+
),
|
|
449
|
+
className: "title.function",
|
|
450
|
+
relevance: 0
|
|
451
|
+
}, K = {
|
|
452
|
+
begin: n.concat(/\./, n.lookahead(
|
|
453
|
+
n.concat(t, /(?![0-9A-Za-z$_(])/)
|
|
454
|
+
)),
|
|
455
|
+
end: t,
|
|
456
|
+
excludeBegin: !0,
|
|
457
|
+
keywords: "prototype",
|
|
458
|
+
className: "property",
|
|
459
|
+
relevance: 0
|
|
460
|
+
}, H = {
|
|
461
|
+
match: [
|
|
462
|
+
/get|set/,
|
|
463
|
+
/\s+/,
|
|
464
|
+
t,
|
|
465
|
+
/(?=\()/
|
|
466
|
+
],
|
|
467
|
+
className: {
|
|
468
|
+
1: "keyword",
|
|
469
|
+
3: "title.function"
|
|
470
|
+
},
|
|
471
|
+
contains: [
|
|
472
|
+
{
|
|
473
|
+
// eat to avoid empty params
|
|
474
|
+
begin: /\(\)/
|
|
475
|
+
},
|
|
476
|
+
d
|
|
477
|
+
]
|
|
478
|
+
}, v = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + e.UNDERSCORE_IDENT_RE + ")\\s*=>", Y = {
|
|
479
|
+
match: [
|
|
480
|
+
/const|var|let/,
|
|
481
|
+
/\s+/,
|
|
482
|
+
t,
|
|
483
|
+
/\s*/,
|
|
484
|
+
/=\s*/,
|
|
485
|
+
/(async\s*)?/,
|
|
486
|
+
// async is optional
|
|
487
|
+
n.lookahead(v)
|
|
488
|
+
],
|
|
489
|
+
keywords: "async",
|
|
490
|
+
className: {
|
|
491
|
+
1: "keyword",
|
|
492
|
+
3: "title.function"
|
|
493
|
+
},
|
|
494
|
+
contains: [
|
|
495
|
+
d
|
|
496
|
+
]
|
|
497
|
+
};
|
|
498
|
+
return {
|
|
499
|
+
name: "JavaScript",
|
|
500
|
+
aliases: ["js", "jsx", "mjs", "cjs"],
|
|
501
|
+
keywords: c,
|
|
502
|
+
// this will be extended by TypeScript
|
|
503
|
+
exports: { PARAMS_CONTAINS: p, CLASS_REFERENCE: M },
|
|
504
|
+
illegal: /#(?![$_A-z])/,
|
|
505
|
+
contains: [
|
|
506
|
+
e.SHEBANG({
|
|
507
|
+
label: "shebang",
|
|
508
|
+
binary: "node",
|
|
509
|
+
relevance: 5
|
|
510
|
+
}),
|
|
511
|
+
$,
|
|
512
|
+
e.APOS_STRING_MODE,
|
|
513
|
+
e.QUOTE_STRING_MODE,
|
|
514
|
+
_,
|
|
515
|
+
S,
|
|
516
|
+
E,
|
|
517
|
+
N,
|
|
518
|
+
y,
|
|
519
|
+
// Skip numbers when they are part of a variable name
|
|
520
|
+
{ match: /\$\d+/ },
|
|
521
|
+
A,
|
|
522
|
+
M,
|
|
523
|
+
{
|
|
524
|
+
className: "attr",
|
|
525
|
+
begin: t + n.lookahead(":"),
|
|
526
|
+
relevance: 0
|
|
527
|
+
},
|
|
528
|
+
Y,
|
|
529
|
+
{
|
|
530
|
+
// "value" container
|
|
531
|
+
begin: "(" + e.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
|
|
532
|
+
keywords: "return throw case",
|
|
533
|
+
relevance: 0,
|
|
534
|
+
contains: [
|
|
535
|
+
y,
|
|
536
|
+
e.REGEXP_MODE,
|
|
537
|
+
{
|
|
538
|
+
className: "function",
|
|
539
|
+
// we have to count the parens to make sure we actually have the
|
|
540
|
+
// correct bounding ( ) before the =>. There could be any number of
|
|
541
|
+
// sub-expressions inside also surrounded by parens.
|
|
542
|
+
begin: v,
|
|
543
|
+
returnBegin: !0,
|
|
544
|
+
end: "\\s*=>",
|
|
545
|
+
contains: [
|
|
546
|
+
{
|
|
547
|
+
className: "params",
|
|
548
|
+
variants: [
|
|
549
|
+
{
|
|
550
|
+
begin: e.UNDERSCORE_IDENT_RE,
|
|
551
|
+
relevance: 0
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
className: null,
|
|
555
|
+
begin: /\(\s*\)/,
|
|
556
|
+
skip: !0
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
begin: /\(/,
|
|
560
|
+
end: /\)/,
|
|
561
|
+
excludeBegin: !0,
|
|
562
|
+
excludeEnd: !0,
|
|
563
|
+
keywords: c,
|
|
564
|
+
contains: p
|
|
565
|
+
}
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
]
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
// could be a comma delimited list of params to a function call
|
|
572
|
+
begin: /,/,
|
|
573
|
+
relevance: 0
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
match: /\s+/,
|
|
577
|
+
relevance: 0
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
// JSX
|
|
581
|
+
variants: [
|
|
582
|
+
{ begin: u.begin, end: u.end },
|
|
583
|
+
{ match: R },
|
|
584
|
+
{
|
|
585
|
+
begin: r.begin,
|
|
586
|
+
// we carefully check the opening tag to see if it truly
|
|
587
|
+
// is a tag and not a false positive
|
|
588
|
+
"on:begin": r.isTrulyOpeningTag,
|
|
589
|
+
end: r.end
|
|
590
|
+
}
|
|
591
|
+
],
|
|
592
|
+
subLanguage: "xml",
|
|
593
|
+
contains: [
|
|
594
|
+
{
|
|
595
|
+
begin: r.begin,
|
|
596
|
+
end: r.end,
|
|
597
|
+
skip: !0,
|
|
598
|
+
contains: ["self"]
|
|
599
|
+
}
|
|
600
|
+
]
|
|
601
|
+
}
|
|
602
|
+
]
|
|
603
|
+
},
|
|
604
|
+
F,
|
|
605
|
+
{
|
|
606
|
+
// prevent this from getting swallowed up by function
|
|
607
|
+
// since they appear "function like"
|
|
608
|
+
beginKeywords: "while if switch catch for"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
// we have to count the parens to make sure we actually have the correct
|
|
612
|
+
// bounding ( ). There could be any number of sub-expressions inside
|
|
613
|
+
// also surrounded by parens.
|
|
614
|
+
begin: "\\b(?!function)" + e.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
|
|
615
|
+
// end parens
|
|
616
|
+
returnBegin: !0,
|
|
617
|
+
label: "func.def",
|
|
618
|
+
contains: [
|
|
619
|
+
d,
|
|
620
|
+
e.inherit(e.TITLE_MODE, { begin: t, className: "title.function" })
|
|
621
|
+
]
|
|
622
|
+
},
|
|
623
|
+
// catch ... so it won't trigger the property rule below
|
|
624
|
+
{
|
|
625
|
+
match: /\.\.\./,
|
|
626
|
+
relevance: 0
|
|
627
|
+
},
|
|
628
|
+
K,
|
|
629
|
+
// hack: prevents detection of keywords in some circumstances
|
|
630
|
+
// .keyword()
|
|
631
|
+
// $keyword = x
|
|
632
|
+
{
|
|
633
|
+
match: "\\$" + t,
|
|
634
|
+
relevance: 0
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
match: [/\bconstructor(?=\s*\()/],
|
|
638
|
+
className: { 1: "title.function" },
|
|
639
|
+
contains: [d]
|
|
640
|
+
},
|
|
641
|
+
G,
|
|
642
|
+
Z,
|
|
643
|
+
P,
|
|
644
|
+
H,
|
|
645
|
+
{
|
|
646
|
+
match: /\$[(.]/
|
|
647
|
+
// relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
|
|
648
|
+
}
|
|
649
|
+
]
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
function X(e) {
|
|
653
|
+
const n = W(e), f = T, t = [
|
|
654
|
+
"any",
|
|
655
|
+
"void",
|
|
656
|
+
"number",
|
|
657
|
+
"boolean",
|
|
658
|
+
"string",
|
|
659
|
+
"object",
|
|
660
|
+
"never",
|
|
661
|
+
"symbol",
|
|
662
|
+
"bigint",
|
|
663
|
+
"unknown"
|
|
664
|
+
], u = {
|
|
665
|
+
beginKeywords: "namespace",
|
|
666
|
+
end: /\{/,
|
|
667
|
+
excludeEnd: !0,
|
|
668
|
+
contains: [n.exports.CLASS_REFERENCE]
|
|
669
|
+
}, R = {
|
|
670
|
+
beginKeywords: "interface",
|
|
671
|
+
end: /\{/,
|
|
672
|
+
excludeEnd: !0,
|
|
673
|
+
keywords: {
|
|
674
|
+
keyword: "interface extends",
|
|
675
|
+
built_in: t
|
|
676
|
+
},
|
|
677
|
+
contains: [n.exports.CLASS_REFERENCE]
|
|
678
|
+
}, r = {
|
|
679
|
+
className: "meta",
|
|
680
|
+
relevance: 10,
|
|
681
|
+
begin: /^\s*['"]use strict['"]/
|
|
682
|
+
}, c = [
|
|
683
|
+
"type",
|
|
684
|
+
"namespace",
|
|
685
|
+
"interface",
|
|
686
|
+
"public",
|
|
687
|
+
"private",
|
|
688
|
+
"protected",
|
|
689
|
+
"implements",
|
|
690
|
+
"declare",
|
|
691
|
+
"abstract",
|
|
692
|
+
"readonly",
|
|
693
|
+
"enum",
|
|
694
|
+
"override"
|
|
695
|
+
], g = {
|
|
696
|
+
$pattern: T,
|
|
697
|
+
keyword: L.concat(c),
|
|
698
|
+
literal: x,
|
|
699
|
+
built_in: U.concat(t),
|
|
700
|
+
"variable.language": h
|
|
701
|
+
}, o = {
|
|
702
|
+
className: "meta",
|
|
703
|
+
begin: "@" + f
|
|
704
|
+
}, l = (a, _, S) => {
|
|
705
|
+
const E = a.contains.findIndex((N) => N.label === _);
|
|
706
|
+
if (E === -1)
|
|
707
|
+
throw new Error("can not find mode to replace");
|
|
708
|
+
a.contains.splice(E, 1, S);
|
|
709
|
+
};
|
|
710
|
+
Object.assign(n.keywords, g), n.exports.PARAMS_CONTAINS.push(o), n.contains = n.contains.concat([
|
|
711
|
+
o,
|
|
712
|
+
u,
|
|
713
|
+
R
|
|
714
|
+
]), l(n, "shebang", e.SHEBANG()), l(n, "use_strict", r);
|
|
715
|
+
const A = n.contains.find((a) => a.label === "func.def");
|
|
716
|
+
return A.relevance = 0, Object.assign(n, {
|
|
717
|
+
name: "TypeScript",
|
|
718
|
+
aliases: [
|
|
719
|
+
"ts",
|
|
720
|
+
"tsx",
|
|
721
|
+
"mts",
|
|
722
|
+
"cts"
|
|
723
|
+
]
|
|
724
|
+
}), n;
|
|
725
|
+
}
|
|
726
|
+
export {
|
|
727
|
+
X as default
|
|
728
|
+
};
|