rregex 1.0.5 → 1.0.7

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.
@@ -0,0 +1,517 @@
1
+ declare namespace wasm_bindgen {
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export function escape(text: string): string;
5
+
6
+ export type Hir = {
7
+ '@type': 'struct'
8
+ '@name': 'regex_syntax::hir::Hir'
9
+ kind: HirKind
10
+ }
11
+
12
+
13
+
14
+ export type Literal =
15
+ | LiteralUnicodeVariant
16
+ | LiteralByteVariant
17
+
18
+ export type LiteralUnicodeVariant = {
19
+ '@type': 'struct'
20
+ '@name': 'regex_syntax::hir::Literal'
21
+ '@variant': 'Unicode'
22
+ '@values': [string]
23
+ }
24
+
25
+ export type LiteralByteVariant = {
26
+ '@type': 'struct'
27
+ '@name': 'regex_syntax::hir::Literal'
28
+ '@variant': 'Byte'
29
+ '@values': [number]
30
+ }
31
+
32
+
33
+
34
+ export type Class =
35
+ | ClassUnicodeVariant
36
+ | ClassByteVariant
37
+
38
+ export type ClassUnicodeVariant = {
39
+ '@type': 'struct'
40
+ '@name': 'regex_syntax::hir::Class'
41
+ '@variant': 'Unicode'
42
+ '@values': [ClassUnicode]
43
+ }
44
+
45
+ export type ClassByteVariant = {
46
+ '@type': 'struct'
47
+ '@name': 'regex_syntax::hir::Class'
48
+ '@variant': 'Bytes'
49
+ '@values': [ClassBytes]
50
+ }
51
+
52
+
53
+
54
+ export type ClassUnicode = {
55
+ '@type': 'struct'
56
+ '@name': 'regex_syntax::hir::ClassUnicode'
57
+ 'ranges': ClassUnicodeRange[]
58
+ }
59
+
60
+
61
+
62
+ export type ClassUnicodeRange = {
63
+ '@type': 'struct'
64
+ '@name': 'regex_syntax::hir::ClassUnicodeRange'
65
+ start: string
66
+ end: string
67
+ }
68
+
69
+
70
+
71
+ export type ClassBytes = {
72
+ '@type': 'struct'
73
+ '@name': 'regex_syntax::hir::ClassBytes'
74
+ ranges: ClassBytesRange[]
75
+ }
76
+
77
+
78
+
79
+ export type ClassBytesRange = {
80
+ '@type': 'struct'
81
+ '@name': 'regex_syntax::hir::ClassBytesRange'
82
+ start: number
83
+ end: number
84
+ }
85
+
86
+
87
+
88
+ export type Anchor =
89
+ | AnchorStartLineVariant
90
+ | AnchorEndLineVariant
91
+ | AnchorStartTextVariant
92
+ | AnchorEndTextVariant
93
+
94
+ export type AnchorStartLineVariant = {
95
+ '@type': 'struct'
96
+ '@name': 'regex_syntax::hir::Anchor'
97
+ '@variant': 'StartLine'
98
+ }
99
+
100
+ export type AnchorEndLineVariant = {
101
+ '@type': 'struct'
102
+ '@name': 'regex_syntax::hir::Anchor'
103
+ '@variant': 'EndLine'
104
+ }
105
+
106
+ export type AnchorStartTextVariant = {
107
+ '@type': 'struct'
108
+ '@name': 'regex_syntax::hir::Anchor'
109
+ '@variant': 'StartText'
110
+ }
111
+
112
+ export type AnchorEndTextVariant = {
113
+ '@type': 'struct'
114
+ '@name': 'regex_syntax::hir::Anchor'
115
+ '@variant': 'EndText'
116
+ }
117
+
118
+
119
+
120
+ export type WordBoundary =
121
+ | WordBoundaryAsciiVariant
122
+ | WordBoundaryAsciiNegateVariant
123
+ | WordBoundaryUnicodeVariant
124
+ | WordBoundaryUnicodeNegateVariant
125
+
126
+ export type WordBoundaryAsciiVariant = {
127
+ '@type': 'struct'
128
+ '@name': 'regex_syntax::hir::WordBoundary'
129
+ '@variant': 'Ascii'
130
+ }
131
+
132
+ export type WordBoundaryAsciiNegateVariant = {
133
+ '@type': 'struct'
134
+ '@name': 'regex_syntax::hir::WordBoundary'
135
+ '@variant': 'AsciiNegate'
136
+ }
137
+
138
+ export type WordBoundaryUnicodeVariant = {
139
+ '@type': 'struct'
140
+ '@name': 'regex_syntax::hir::WordBoundary'
141
+ '@variant': 'Unicode'
142
+ }
143
+
144
+ export type WordBoundaryUnicodeNegateVariant = {
145
+ '@type': 'struct'
146
+ '@name': 'regex_syntax::hir::WordBoundary'
147
+ '@variant': 'UnicodeNegate'
148
+ }
149
+
150
+
151
+
152
+ export type Repetition = {
153
+ '@type': 'struct'
154
+ '@name': 'regex_syntax::hir::Repetition'
155
+ greedy: boolean
156
+ kind: RepetitionKind
157
+ hir: Hir
158
+ }
159
+
160
+
161
+
162
+ export type RepetitionKind =
163
+ | RepetitionKindZeroOrOneVariant
164
+ | RepetitionKindZeroOrMoreVariant
165
+ | RepetitionKindOneOrMoreVariant
166
+ | RepetitionKindRangeVariant
167
+
168
+ export type RepetitionKindZeroOrOneVariant = {
169
+ '@type': 'struct'
170
+ '@name': 'regex_syntax::hir::Repetition'
171
+ '@variant': 'ZeroOrOne'
172
+ }
173
+
174
+ export type RepetitionKindZeroOrMoreVariant = {
175
+ '@type': 'struct'
176
+ '@name': 'regex_syntax::hir::Repetition'
177
+ '@variant': 'ZeroOrMore'
178
+ }
179
+
180
+ export type RepetitionKindOneOrMoreVariant = {
181
+ '@type': 'struct'
182
+ '@name': 'regex_syntax::hir::Repetition'
183
+ '@variant': 'OneOrMore'
184
+ }
185
+
186
+ export type RepetitionKindRangeVariant = {
187
+ '@type': 'struct'
188
+ '@name': 'regex_syntax::hir::Repetition'
189
+ '@variant': 'Range'
190
+ '@values': [RepetitionRange]
191
+ }
192
+
193
+
194
+
195
+ export type HirKind =
196
+ | HirKindEmptyVariant
197
+ | HirKindLiteralVariant
198
+ | HirKindClassVariant
199
+ | HirKindAnchorVariant
200
+ | HirKindWordBoundaryVariant
201
+ | HirKindRepetitionVariant
202
+ | HirKindGroupVariant
203
+ | HirKindConcatVariant
204
+ | HirKindAlternationVariant
205
+
206
+ export type HirKindEmptyVariant = {
207
+ '@type': 'struct'
208
+ '@name': 'regex_syntax::hir::HirKind'
209
+ '@variant': 'Empty'
210
+ }
211
+
212
+ export type HirKindLiteralVariant = {
213
+ '@type': 'struct'
214
+ '@name': 'regex_syntax::hir::HirKind'
215
+ '@variant': 'Literal'
216
+ '@values': [Literal]
217
+ }
218
+
219
+ export type HirKindClassVariant = {
220
+ '@type': 'struct'
221
+ '@name': 'regex_syntax::hir::HirKind'
222
+ '@variant': 'Class'
223
+ '@values': [Class]
224
+ }
225
+
226
+ export type HirKindAnchorVariant = {
227
+ '@type': 'struct'
228
+ '@name': 'regex_syntax::hir::HirKind'
229
+ '@variant': 'Anchor'
230
+ '@values': [Anchor]
231
+ }
232
+
233
+ export type HirKindWordBoundaryVariant = {
234
+ '@type': 'struct'
235
+ '@name': 'regex_syntax::hir::HirKind'
236
+ '@variant': 'WordBoundary'
237
+ '@values': [WordBoundary]
238
+ }
239
+
240
+ export type HirKindRepetitionVariant = {
241
+ '@type': 'struct'
242
+ '@name': 'regex_syntax::hir::HirKind'
243
+ '@variant': 'Repetition'
244
+ '@values': [Repetition]
245
+ }
246
+
247
+ export type HirKindGroupVariant = {
248
+ '@type': 'struct'
249
+ '@name': 'regex_syntax::hir::HirKind'
250
+ '@variant': 'Group'
251
+ '@values': [Group]
252
+ }
253
+
254
+ export type HirKindConcatVariant = {
255
+ '@type': 'struct'
256
+ '@name': 'regex_syntax::hir::HirKind'
257
+ '@variant': 'Concat'
258
+ '@values': [Hir[]]
259
+ }
260
+
261
+ export type HirKindAlternationVariant = {
262
+ '@type': 'struct'
263
+ '@name': 'regex_syntax::hir::HirKind'
264
+ '@variant': 'Alternation'
265
+ '@values': [Hir[]]
266
+ }
267
+
268
+
269
+
270
+ export type RepetitionRange =
271
+ | RepetitionRangeExactlyVariant
272
+ | RepetitionRangeAtLeastVariant
273
+ | RepetitionRangeBoundedVariant
274
+
275
+ export type RepetitionRangeExactlyVariant = {
276
+ '@type': 'struct'
277
+ '@name': 'regex_syntax::hir::RepetitionRange'
278
+ '@variant': 'Exactly'
279
+ '@values': [number]
280
+ }
281
+
282
+ export type RepetitionRangeAtLeastVariant = {
283
+ '@type': 'struct'
284
+ '@name': 'regex_syntax::hir::RepetitionRange'
285
+ '@variant': 'AtLeast'
286
+ '@values': [number]
287
+ }
288
+
289
+ export type RepetitionRangeBoundedVariant = {
290
+ '@type': 'struct'
291
+ '@name': 'regex_syntax::hir::RepetitionRange'
292
+ '@variant': 'Bounded'
293
+ '@values': [number, number]
294
+ }
295
+
296
+
297
+
298
+ export type Group = {
299
+ '@type': 'struct'
300
+ '@name': 'regex_syntax::hir::Group'
301
+ kind: GroupKind
302
+ hir: Hir
303
+ }
304
+
305
+
306
+
307
+ export type GroupKind =
308
+ | GroupKindCaptureIndexVariant
309
+ | GroupKindCaptureNameVariant
310
+ | GroupKindNonCapturingVariant
311
+
312
+ export type GroupKindCaptureIndexVariant = {
313
+ '@type': 'struct'
314
+ '@name': 'regex_syntax::hir::GroupKind'
315
+ '@variant': 'CaptureIndex'
316
+ index: number
317
+ }
318
+
319
+ export type GroupKindCaptureNameVariant = {
320
+ '@type': 'struct'
321
+ '@name': 'regex_syntax::hir::GroupKind'
322
+ '@variant': 'CaptureName'
323
+ index: number
324
+ name: string
325
+ }
326
+
327
+ export type GroupKindNonCapturingVariant = {
328
+ '@type': 'struct'
329
+ '@name': 'regex_syntax::hir::GroupKind'
330
+ '@variant': 'NonCapturing'
331
+ }
332
+
333
+
334
+
335
+ export type Match = {
336
+ start: number
337
+ end: number
338
+ value: string
339
+ }
340
+
341
+
342
+ /**
343
+ * A compiled regular expression for matching Unicode strings.
344
+ * @see https://docs.rs/regex/latest/regex/
345
+ */
346
+ export class RRegex {
347
+ free(): void;
348
+ /**
349
+ * Returns the same as is_match, but starts the search at the given offset.
350
+ * The significance of the starting point is that it takes the surrounding context into consideration. For example, the `\A` anchor can only match when `start == 0`.
351
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
352
+ */
353
+ isMatchAt(text: string, start: number): boolean;
354
+ /**
355
+ * Replaces all non-overlapping matches in `text` with the replacement provided. This is the same as calling `replacen` with `limit` set to `0`.
356
+ * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
357
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
358
+ */
359
+ replaceAll(text: string, rep: string): string;
360
+ /**
361
+ * Returns the end location of a match in the text given.
362
+ * This method may have the same performance characteristics as `is_match`, except it provides an end location for a match. In particular, the location returned may be shorter than the proper end of the leftmost-first match.
363
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
364
+ */
365
+ shortestMatch(text: string): number | undefined;
366
+ /**
367
+ * Returns the same as shortest_match, but starts the search at the given offset.
368
+ * The significance of the starting point is that it takes the surrounding context into consideration. For example, the \A anchor can only match when `start == 0`.
369
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
370
+ */
371
+ shortestMatchAt(text: string, limit: number): number | undefined;
372
+ /**
373
+ * Compiles a regular expression. Once compiled, it can be used repeatedly to search, split or replace text in a string.
374
+ * If an invalid expression is given, then an error is returned.
375
+ */
376
+ constructor(re: string);
377
+ /**
378
+ * Returns the start and end byte range of the leftmost-first match in `text`. If no match exists, then `undefined` is returned.
379
+ * Note that this should only be used if you want to discover the position of the match. Testing the existence of a match is faster if you use `is_match`.
380
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
381
+ */
382
+ find(text: string): Match | undefined;
383
+ /**
384
+ * Returns an iterator of substrings of `text` delimited by a match of the regular expression. Namely, each element of the iterator corresponds to text that isn’t matched by the regular expression.
385
+ * This method will not copy the text given.
386
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
387
+ */
388
+ split(text: string): string[];
389
+ /**
390
+ * Returns an iterator of at most `limit` substrings of `text` delimited by a match of the regular expression. (A limit of 0 will return no substrings.) Namely, each element of the iterator corresponds to text that isn’t matched by the regular expression. The remainder of the string that is not split will be the last element in the iterator.
391
+ * This method will not copy the text given.
392
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
393
+ */
394
+ splitn(text: string, limit: number): string[];
395
+ /**
396
+ * Return the Regex syntax object
397
+ */
398
+ syntax(): Hir;
399
+ /**
400
+ * Returns the same as find, but starts the search at the given offset.
401
+ * The significance of the starting point is that it takes the surrounding context into consideration. For example, the \A anchor can only match when `start == 0`.
402
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
403
+ */
404
+ findAt(text: string, start: number): Match | undefined;
405
+ /**
406
+ * Replaces the leftmost-first match with the replacement provided.
407
+ * The replacement can be a regular string (where `$N` and `$name` are expanded to match capture groups) or a function that takes the matches’ `Captures` and returns the replaced string.
408
+ * If no match is found, then a copy of the string is returned unchanged.
409
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
410
+ */
411
+ replace(text: string, rep: string): string;
412
+ /**
413
+ * Returns an array for each successive non-overlapping match in text, returning the start and end byte indices with respect to text.
414
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
415
+ */
416
+ findAll(text: string): Match[];
417
+ /**
418
+ * Returns true if and only if there is a match for the regex in the string given.
419
+ * It is recommended to use this method if all you need to do is test a match, since the underlying matching engine may be able to do less work.
420
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
421
+ */
422
+ isMatch(text: string): boolean;
423
+ /**
424
+ * Replaces at most `limit` non-overlapping matches in `text` with the replacement provided. If `limit` is 0, then all non-overlapping matches are replaced.
425
+ * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
426
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
427
+ */
428
+ replacen(text: string, limit: number, rep: string): string;
429
+ /**
430
+ * Returns a string representing the regular expression
431
+ */
432
+ toString(): string;
433
+ }
434
+ /**
435
+ * Match multiple (possibly overlapping) regular expressions in a single scan.
436
+ * A regex set corresponds to the union of two or more regular expressions. That is, a regex set will match text where at least one of its constituent regular expressions matches. A regex set as its formulated here provides a touch more power: it will also report which regular expressions in the set match. Indeed, this is the key difference between regex sets and a single `Regex` with many alternates, since only one alternate can match at a time.
437
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
438
+ */
439
+ export class RRegexSet {
440
+ free(): void;
441
+ /**
442
+ * Create a new regex set with the given regular expressions.
443
+ */
444
+ constructor(list: Array<any>);
445
+ /**
446
+ * Returns the set of regular expressions that match in the given text.
447
+ * The set returned contains the index of each regular expression that matches in the given text. The index is in correspondence with the order of regular expressions given to RegexSet’s constructor.
448
+ * the set can also be used to iterate over the matched indices.
449
+ */
450
+ matches(text: string): any;
451
+ /**
452
+ * Returns true if and only if one of the regexes in this set matches the text given.
453
+ * This method should be preferred if you only need to test whether any of the regexes in the set should match, but don’t care about which regexes matched. This is because the underlying matching engine will quit immediately after seeing the first match instead of continuing to find all matches.
454
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
455
+ */
456
+ isMatch(text: string): boolean;
457
+ }
458
+
459
+ }
460
+
461
+ declare type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
462
+
463
+ declare interface InitOutput {
464
+ readonly memory: WebAssembly.Memory;
465
+ readonly escape: (a: number, b: number) => [number, number];
466
+ readonly __wbg_rregex_free: (a: number, b: number) => void;
467
+ readonly rregex_find: (a: number, b: number, c: number) => any;
468
+ readonly rregex_findAll: (a: number, b: number, c: number) => any;
469
+ readonly rregex_findAt: (a: number, b: number, c: number, d: number) => any;
470
+ readonly rregex_isMatch: (a: number, b: number, c: number) => number;
471
+ readonly rregex_isMatchAt: (a: number, b: number, c: number, d: number) => number;
472
+ readonly rregex_new: (a: number, b: number) => [number, number, number];
473
+ readonly rregex_replace: (a: number, b: number, c: number, d: number, e: number) => [number, number];
474
+ readonly rregex_replaceAll: (a: number, b: number, c: number, d: number, e: number) => [number, number];
475
+ readonly rregex_replacen: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
476
+ readonly rregex_shortestMatch: (a: number, b: number, c: number) => number;
477
+ readonly rregex_shortestMatchAt: (a: number, b: number, c: number, d: number) => number;
478
+ readonly rregex_split: (a: number, b: number, c: number) => any;
479
+ readonly rregex_splitn: (a: number, b: number, c: number, d: number) => any;
480
+ readonly rregex_syntax: (a: number) => any;
481
+ readonly rregex_toString: (a: number) => [number, number];
482
+ readonly __wbg_rregexset_free: (a: number, b: number) => void;
483
+ readonly rregexset_isMatch: (a: number, b: number, c: number) => number;
484
+ readonly rregexset_matches: (a: number, b: number, c: number) => any;
485
+ readonly rregexset_new: (a: any) => [number, number, number];
486
+ readonly __wbindgen_exn_store: (a: number) => void;
487
+ readonly __externref_table_alloc: () => number;
488
+ readonly __wbindgen_export_2: WebAssembly.Table;
489
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
490
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
491
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
492
+ readonly __externref_table_dealloc: (a: number) => void;
493
+ readonly __wbindgen_start: () => void;
494
+ }
495
+
496
+ /**
497
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
498
+ * for everything else, calls `WebAssembly.instantiate` directly.
499
+ *
500
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
501
+ *
502
+ * @returns {Promise<InitOutput>}
503
+ */
504
+ declare function wasm_bindgen (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
505
+
506
+ /** Build metadata */
507
+ export const metadata: {
508
+ "name": "rregex",
509
+ "description": "Rust Regex binding for Javascript",
510
+ "authors": [
511
+ "Fede Ramirez <i@2fd.me>"
512
+ ],
513
+ "homepage": "http://rregex.dev",
514
+ "repository": "https://github.com/2fd/rregex",
515
+ "regex": "1.0.6",
516
+ "regex-syntax": "0.6.2"
517
+ }