rregex 1.3.0 → 1.5.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/lib/browser.d.ts +13 -4
- package/lib/browser.js +142 -98
- package/lib/commonjs.d.ts +2 -2
- package/lib/commonjs.js +105 -87
- package/lib/module.d.ts +2 -2
- package/lib/module.js +102 -84
- package/lib/rregex.wasm +0 -0
- package/lib/rregex.wasm.d.ts +2 -2
- package/lib/types.d.ts +13 -4
- package/package.json +11 -1
package/lib/commonjs.js
CHANGED
|
@@ -27,12 +27,12 @@ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true
|
|
|
27
27
|
|
|
28
28
|
cachedTextDecoder.decode();
|
|
29
29
|
|
|
30
|
-
let
|
|
30
|
+
let cachedUint8Memory0;
|
|
31
31
|
function getUint8Memory0() {
|
|
32
|
-
if (
|
|
33
|
-
|
|
32
|
+
if (cachedUint8Memory0.byteLength === 0) {
|
|
33
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return cachedUint8Memory0;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function getStringFromWasm0(ptr, len) {
|
|
@@ -107,12 +107,12 @@ function isLikeNone(x) {
|
|
|
107
107
|
return x === undefined || x === null;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
let
|
|
110
|
+
let cachedInt32Memory0;
|
|
111
111
|
function getInt32Memory0() {
|
|
112
|
-
if (
|
|
113
|
-
|
|
112
|
+
if (cachedInt32Memory0.byteLength === 0) {
|
|
113
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
114
114
|
}
|
|
115
|
-
return
|
|
115
|
+
return cachedInt32Memory0;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
function debugString(val) {
|
|
@@ -186,8 +186,8 @@ function debugString(val) {
|
|
|
186
186
|
module.exports.escape = function(text) {
|
|
187
187
|
try {
|
|
188
188
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
190
|
+
const len0 = WASM_VECTOR_LEN;
|
|
191
191
|
wasm.escape(retptr, ptr0, len0);
|
|
192
192
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
193
193
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
@@ -243,10 +243,21 @@ class RRegex {
|
|
|
243
243
|
* @param {string} re
|
|
244
244
|
*/
|
|
245
245
|
constructor(re) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
try {
|
|
247
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
248
|
+
const ptr0 = passStringToWasm0(re, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
249
|
+
const len0 = WASM_VECTOR_LEN;
|
|
250
|
+
wasm.rregex_new(retptr, ptr0, len0);
|
|
251
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
252
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
253
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
254
|
+
if (r2) {
|
|
255
|
+
throw takeObject(r1);
|
|
256
|
+
}
|
|
257
|
+
return RRegex.__wrap(r0);
|
|
258
|
+
} finally {
|
|
259
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
260
|
+
}
|
|
250
261
|
}
|
|
251
262
|
/**
|
|
252
263
|
* Returns true if and only if there is a match for the regex in the string given.
|
|
@@ -256,9 +267,9 @@ class RRegex {
|
|
|
256
267
|
* @returns {boolean}
|
|
257
268
|
*/
|
|
258
269
|
isMatch(text) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
270
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
271
|
+
const len0 = WASM_VECTOR_LEN;
|
|
272
|
+
const ret = wasm.rregex_isMatch(this.ptr, ptr0, len0);
|
|
262
273
|
return ret !== 0;
|
|
263
274
|
}
|
|
264
275
|
/**
|
|
@@ -270,9 +281,9 @@ class RRegex {
|
|
|
270
281
|
* @returns {boolean}
|
|
271
282
|
*/
|
|
272
283
|
isMatchAt(text, start) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
284
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
285
|
+
const len0 = WASM_VECTOR_LEN;
|
|
286
|
+
const ret = wasm.rregex_isMatchAt(this.ptr, ptr0, len0, start);
|
|
276
287
|
return ret !== 0;
|
|
277
288
|
}
|
|
278
289
|
/**
|
|
@@ -283,9 +294,9 @@ class RRegex {
|
|
|
283
294
|
* @returns {any}
|
|
284
295
|
*/
|
|
285
296
|
find(text) {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
297
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
298
|
+
const len0 = WASM_VECTOR_LEN;
|
|
299
|
+
const ret = wasm.rregex_find(this.ptr, ptr0, len0);
|
|
289
300
|
return takeObject(ret);
|
|
290
301
|
}
|
|
291
302
|
/**
|
|
@@ -297,9 +308,9 @@ class RRegex {
|
|
|
297
308
|
* @returns {any}
|
|
298
309
|
*/
|
|
299
310
|
findAt(text, start) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
311
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
312
|
+
const len0 = WASM_VECTOR_LEN;
|
|
313
|
+
const ret = wasm.rregex_findAt(this.ptr, ptr0, len0, start);
|
|
303
314
|
return takeObject(ret);
|
|
304
315
|
}
|
|
305
316
|
/**
|
|
@@ -309,9 +320,9 @@ class RRegex {
|
|
|
309
320
|
* @returns {any}
|
|
310
321
|
*/
|
|
311
322
|
findAll(text) {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
323
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
324
|
+
const len0 = WASM_VECTOR_LEN;
|
|
325
|
+
const ret = wasm.rregex_findAll(this.ptr, ptr0, len0);
|
|
315
326
|
return takeObject(ret);
|
|
316
327
|
}
|
|
317
328
|
/**
|
|
@@ -326,10 +337,10 @@ class RRegex {
|
|
|
326
337
|
replace(text, rep) {
|
|
327
338
|
try {
|
|
328
339
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
340
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
341
|
+
const len0 = WASM_VECTOR_LEN;
|
|
342
|
+
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
343
|
+
const len1 = WASM_VECTOR_LEN;
|
|
333
344
|
wasm.rregex_replace(retptr, this.ptr, ptr0, len0, ptr1, len1);
|
|
334
345
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
335
346
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
@@ -351,10 +362,10 @@ class RRegex {
|
|
|
351
362
|
replacen(text, limit, rep) {
|
|
352
363
|
try {
|
|
353
364
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
365
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
366
|
+
const len0 = WASM_VECTOR_LEN;
|
|
367
|
+
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
368
|
+
const len1 = WASM_VECTOR_LEN;
|
|
358
369
|
wasm.rregex_replacen(retptr, this.ptr, ptr0, len0, limit, ptr1, len1);
|
|
359
370
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
360
371
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
@@ -375,10 +386,10 @@ class RRegex {
|
|
|
375
386
|
replaceAll(text, rep) {
|
|
376
387
|
try {
|
|
377
388
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
389
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
390
|
+
const len0 = WASM_VECTOR_LEN;
|
|
391
|
+
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
392
|
+
const len1 = WASM_VECTOR_LEN;
|
|
382
393
|
wasm.rregex_replaceAll(retptr, this.ptr, ptr0, len0, ptr1, len1);
|
|
383
394
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
384
395
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
@@ -396,9 +407,9 @@ class RRegex {
|
|
|
396
407
|
* @returns {any}
|
|
397
408
|
*/
|
|
398
409
|
split(text) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
410
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
411
|
+
const len0 = WASM_VECTOR_LEN;
|
|
412
|
+
const ret = wasm.rregex_split(this.ptr, ptr0, len0);
|
|
402
413
|
return takeObject(ret);
|
|
403
414
|
}
|
|
404
415
|
/**
|
|
@@ -410,9 +421,9 @@ class RRegex {
|
|
|
410
421
|
* @returns {any}
|
|
411
422
|
*/
|
|
412
423
|
splitn(text, limit) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
424
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
425
|
+
const len0 = WASM_VECTOR_LEN;
|
|
426
|
+
const ret = wasm.rregex_splitn(this.ptr, ptr0, len0, limit);
|
|
416
427
|
return takeObject(ret);
|
|
417
428
|
}
|
|
418
429
|
/**
|
|
@@ -425,8 +436,8 @@ class RRegex {
|
|
|
425
436
|
shortestMatch(text) {
|
|
426
437
|
try {
|
|
427
438
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
428
|
-
|
|
429
|
-
|
|
439
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
440
|
+
const len0 = WASM_VECTOR_LEN;
|
|
430
441
|
wasm.rregex_shortestMatch(retptr, this.ptr, ptr0, len0);
|
|
431
442
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
432
443
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
@@ -446,8 +457,8 @@ class RRegex {
|
|
|
446
457
|
shortestMatchAt(text, limit) {
|
|
447
458
|
try {
|
|
448
459
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
449
|
-
|
|
450
|
-
|
|
460
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
461
|
+
const len0 = WASM_VECTOR_LEN;
|
|
451
462
|
wasm.rregex_shortestMatchAt(retptr, this.ptr, ptr0, len0, limit);
|
|
452
463
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
453
464
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
@@ -461,7 +472,7 @@ class RRegex {
|
|
|
461
472
|
* @returns {any}
|
|
462
473
|
*/
|
|
463
474
|
syntax() {
|
|
464
|
-
|
|
475
|
+
const ret = wasm.rregex_syntax(this.ptr);
|
|
465
476
|
return takeObject(ret);
|
|
466
477
|
}
|
|
467
478
|
/**
|
|
@@ -513,9 +524,17 @@ class RRegexSet {
|
|
|
513
524
|
*/
|
|
514
525
|
constructor(list) {
|
|
515
526
|
try {
|
|
516
|
-
|
|
517
|
-
|
|
527
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
528
|
+
wasm.rregexset_new(retptr, addBorrowedObject(list));
|
|
529
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
530
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
531
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
532
|
+
if (r2) {
|
|
533
|
+
throw takeObject(r1);
|
|
534
|
+
}
|
|
535
|
+
return RRegexSet.__wrap(r0);
|
|
518
536
|
} finally {
|
|
537
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
519
538
|
heap[stack_pointer++] = undefined;
|
|
520
539
|
}
|
|
521
540
|
}
|
|
@@ -527,9 +546,9 @@ class RRegexSet {
|
|
|
527
546
|
* @returns {boolean}
|
|
528
547
|
*/
|
|
529
548
|
isMatch(text) {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
549
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
550
|
+
const len0 = WASM_VECTOR_LEN;
|
|
551
|
+
const ret = wasm.rregexset_isMatch(this.ptr, ptr0, len0);
|
|
533
552
|
return ret !== 0;
|
|
534
553
|
}
|
|
535
554
|
/**
|
|
@@ -540,9 +559,9 @@ class RRegexSet {
|
|
|
540
559
|
* @returns {any}
|
|
541
560
|
*/
|
|
542
561
|
matches(text) {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
562
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
563
|
+
const len0 = WASM_VECTOR_LEN;
|
|
564
|
+
const ret = wasm.rregexset_matches(this.ptr, ptr0, len0);
|
|
546
565
|
return takeObject(ret);
|
|
547
566
|
}
|
|
548
567
|
}
|
|
@@ -553,68 +572,68 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
553
572
|
};
|
|
554
573
|
|
|
555
574
|
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
556
|
-
|
|
575
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
557
576
|
return addHeapObject(ret);
|
|
558
577
|
};
|
|
559
578
|
|
|
560
579
|
module.exports.__wbindgen_number_new = function(arg0) {
|
|
561
|
-
|
|
580
|
+
const ret = arg0;
|
|
562
581
|
return addHeapObject(ret);
|
|
563
582
|
};
|
|
564
583
|
|
|
565
584
|
module.exports.__wbindgen_is_string = function(arg0) {
|
|
566
|
-
|
|
585
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
567
586
|
return ret;
|
|
568
587
|
};
|
|
569
588
|
|
|
570
589
|
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
571
590
|
const obj = getObject(arg1);
|
|
572
|
-
|
|
591
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
573
592
|
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
574
593
|
var len0 = WASM_VECTOR_LEN;
|
|
575
594
|
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
576
595
|
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
577
596
|
};
|
|
578
597
|
|
|
579
|
-
module.exports.
|
|
580
|
-
|
|
598
|
+
module.exports.__wbg_get_f0f4f1608ebf633e = function(arg0, arg1) {
|
|
599
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
581
600
|
return addHeapObject(ret);
|
|
582
601
|
};
|
|
583
602
|
|
|
584
|
-
module.exports.
|
|
585
|
-
|
|
603
|
+
module.exports.__wbg_length_93debb0e2e184ab6 = function(arg0) {
|
|
604
|
+
const ret = getObject(arg0).length;
|
|
586
605
|
return ret;
|
|
587
606
|
};
|
|
588
607
|
|
|
589
|
-
module.exports.
|
|
590
|
-
|
|
608
|
+
module.exports.__wbg_new_2ab697f1555e0dbc = function() {
|
|
609
|
+
const ret = new Array();
|
|
591
610
|
return addHeapObject(ret);
|
|
592
611
|
};
|
|
593
612
|
|
|
594
|
-
module.exports.
|
|
595
|
-
|
|
613
|
+
module.exports.__wbg_new_306ce8d57919e6ae = function() {
|
|
614
|
+
const ret = new Object();
|
|
596
615
|
return addHeapObject(ret);
|
|
597
616
|
};
|
|
598
617
|
|
|
599
|
-
module.exports.
|
|
600
|
-
|
|
618
|
+
module.exports.__wbg_push_811c8b08bf4ff9d5 = function(arg0, arg1) {
|
|
619
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
601
620
|
return ret;
|
|
602
621
|
};
|
|
603
622
|
|
|
604
|
-
module.exports.
|
|
605
|
-
|
|
623
|
+
module.exports.__wbg_new_651776e932b7e9c7 = function(arg0, arg1) {
|
|
624
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
606
625
|
return addHeapObject(ret);
|
|
607
626
|
};
|
|
608
627
|
|
|
609
|
-
module.exports.
|
|
610
|
-
|
|
628
|
+
module.exports.__wbg_set_b12cd0ab82903c2f = function() { return handleError(function (arg0, arg1, arg2) {
|
|
629
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
611
630
|
return ret;
|
|
612
631
|
}, arguments) };
|
|
613
632
|
|
|
614
633
|
module.exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
634
|
+
const ret = debugString(getObject(arg1));
|
|
635
|
+
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
636
|
+
const len0 = WASM_VECTOR_LEN;
|
|
618
637
|
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
619
638
|
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
620
639
|
};
|
|
@@ -623,10 +642,6 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
623
642
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
624
643
|
};
|
|
625
644
|
|
|
626
|
-
module.exports.__wbindgen_rethrow = function(arg0) {
|
|
627
|
-
throw takeObject(arg0);
|
|
628
|
-
};
|
|
629
|
-
|
|
630
645
|
const path = require('path').join(__dirname, 'rregex.wasm');
|
|
631
646
|
const bytes = require('fs').readFileSync(path);
|
|
632
647
|
|
|
@@ -635,6 +650,9 @@ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
|
635
650
|
wasm = wasmInstance.exports;
|
|
636
651
|
module.exports.__wasm = wasm;
|
|
637
652
|
|
|
653
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
654
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
655
|
+
|
|
638
656
|
|
|
639
657
|
module.exports.metadata = {
|
|
640
658
|
"name": "rregex",
|
|
@@ -644,6 +662,6 @@ module.exports.metadata = {
|
|
|
644
662
|
],
|
|
645
663
|
"homepage": "https://2fd.github.io/rregex",
|
|
646
664
|
"repository": "https://github.com/2fd/rregex",
|
|
647
|
-
"regex": "1.
|
|
648
|
-
"regex-syntax": "0.6.
|
|
665
|
+
"regex": "1.5.6",
|
|
666
|
+
"regex-syntax": "0.6.26"
|
|
649
667
|
}
|
package/lib/module.d.ts
CHANGED