rregex 1.6.0 → 1.7.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 +15 -13
- package/lib/browser.js +114 -97
- package/lib/commonjs.d.ts +2 -2
- package/lib/commonjs.js +86 -78
- package/lib/module.d.ts +2 -2
- package/lib/module.js +89 -77
- package/lib/rregex.wasm +0 -0
- package/lib/rregex.wasm.d.ts +7 -7
- package/lib/types.d.ts +15 -13
- package/package.json +1 -1
package/lib/browser.d.ts
CHANGED
|
@@ -503,6 +503,10 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
503
503
|
|
|
504
504
|
export interface InitOutput {
|
|
505
505
|
readonly memory: WebAssembly.Memory;
|
|
506
|
+
readonly __wbg_rregexset_free: (a: number) => void;
|
|
507
|
+
readonly rregexset_new: (a: number, b: number) => void;
|
|
508
|
+
readonly rregexset_isMatch: (a: number, b: number, c: number) => number;
|
|
509
|
+
readonly rregexset_matches: (a: number, b: number, c: number) => number;
|
|
506
510
|
readonly escape: (a: number, b: number, c: number) => void;
|
|
507
511
|
readonly __wbg_rregex_free: (a: number) => void;
|
|
508
512
|
readonly rregex_new: (a: number, b: number, c: number) => void;
|
|
@@ -520,25 +524,23 @@ export interface InitOutput {
|
|
|
520
524
|
readonly rregex_shortestMatchAt: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
521
525
|
readonly rregex_syntax: (a: number) => number;
|
|
522
526
|
readonly rregex_toString: (a: number, b: number) => void;
|
|
523
|
-
readonly
|
|
524
|
-
readonly
|
|
525
|
-
readonly rregexset_isMatch: (a: number, b: number, c: number) => number;
|
|
526
|
-
readonly rregexset_matches: (a: number, b: number, c: number) => number;
|
|
527
|
-
readonly __wbindgen_malloc: (a: number) => number;
|
|
528
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
527
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
528
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
529
529
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
530
|
-
readonly __wbindgen_free: (a: number, b: number) => void;
|
|
530
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
531
531
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
532
532
|
}
|
|
533
533
|
|
|
534
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
534
535
|
/**
|
|
535
|
-
*
|
|
536
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
537
|
+
* a precompiled `WebAssembly.Module`.
|
|
536
538
|
*
|
|
537
|
-
* @param {
|
|
539
|
+
* @param {SyncInitInput} module
|
|
538
540
|
*
|
|
539
541
|
* @returns {InitOutput}
|
|
540
542
|
*/
|
|
541
|
-
export function initSync(
|
|
543
|
+
export function initSync(module: SyncInitInput): InitOutput;
|
|
542
544
|
|
|
543
545
|
/**
|
|
544
546
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
@@ -548,7 +550,7 @@ export function initSync(bytes: BufferSource): InitOutput;
|
|
|
548
550
|
*
|
|
549
551
|
* @returns {Promise<InitOutput>}
|
|
550
552
|
*/
|
|
551
|
-
export default function
|
|
553
|
+
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
552
554
|
|
|
553
555
|
export const metadata: {
|
|
554
556
|
"name": "rregex",
|
|
@@ -558,6 +560,6 @@ export const metadata: {
|
|
|
558
560
|
],
|
|
559
561
|
"homepage": "https://2fd.github.io/rregex",
|
|
560
562
|
"repository": "https://github.com/2fd/rregex",
|
|
561
|
-
"regex": "1.
|
|
562
|
-
"regex-syntax": "0.6.
|
|
563
|
+
"regex": "1.7.3",
|
|
564
|
+
"regex-syntax": "0.6.29"
|
|
563
565
|
}
|
package/lib/browser.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
1
|
let wasm;
|
|
3
2
|
|
|
4
|
-
const heap = new Array(
|
|
3
|
+
const heap = new Array(128).fill(undefined);
|
|
5
4
|
|
|
6
5
|
heap.push(undefined, null, true, false);
|
|
7
6
|
|
|
@@ -10,7 +9,7 @@ function getObject(idx) { return heap[idx]; }
|
|
|
10
9
|
let heap_next = heap.length;
|
|
11
10
|
|
|
12
11
|
function dropObject(idx) {
|
|
13
|
-
if (idx <
|
|
12
|
+
if (idx < 132) return;
|
|
14
13
|
heap[idx] = heap_next;
|
|
15
14
|
heap_next = idx;
|
|
16
15
|
}
|
|
@@ -21,19 +20,21 @@ function takeObject(idx) {
|
|
|
21
20
|
return ret;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
23
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
24
|
+
|
|
25
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
let cachedUint8Memory0 = null;
|
|
27
28
|
|
|
28
|
-
let cachedUint8Memory0;
|
|
29
29
|
function getUint8Memory0() {
|
|
30
|
-
if (cachedUint8Memory0.byteLength === 0) {
|
|
30
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
31
31
|
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
32
32
|
}
|
|
33
33
|
return cachedUint8Memory0;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function getStringFromWasm0(ptr, len) {
|
|
37
|
+
ptr = ptr >>> 0;
|
|
37
38
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
38
39
|
}
|
|
39
40
|
|
|
@@ -48,7 +49,7 @@ function addHeapObject(obj) {
|
|
|
48
49
|
|
|
49
50
|
let WASM_VECTOR_LEN = 0;
|
|
50
51
|
|
|
51
|
-
const cachedTextEncoder = new TextEncoder('utf-8');
|
|
52
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
52
53
|
|
|
53
54
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
54
55
|
? function (arg, view) {
|
|
@@ -67,14 +68,14 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
67
68
|
|
|
68
69
|
if (realloc === undefined) {
|
|
69
70
|
const buf = cachedTextEncoder.encode(arg);
|
|
70
|
-
const ptr = malloc(buf.length);
|
|
71
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
71
72
|
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
72
73
|
WASM_VECTOR_LEN = buf.length;
|
|
73
74
|
return ptr;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
let len = arg.length;
|
|
77
|
-
let ptr = malloc(len);
|
|
78
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
78
79
|
|
|
79
80
|
const mem = getUint8Memory0();
|
|
80
81
|
|
|
@@ -90,7 +91,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
90
91
|
if (offset !== 0) {
|
|
91
92
|
arg = arg.slice(offset);
|
|
92
93
|
}
|
|
93
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
94
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
94
95
|
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
95
96
|
const ret = encodeString(arg, view);
|
|
96
97
|
|
|
@@ -105,9 +106,10 @@ function isLikeNone(x) {
|
|
|
105
106
|
return x === undefined || x === null;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
let cachedInt32Memory0;
|
|
109
|
+
let cachedInt32Memory0 = null;
|
|
110
|
+
|
|
109
111
|
function getInt32Memory0() {
|
|
110
|
-
if (cachedInt32Memory0.byteLength === 0) {
|
|
112
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
111
113
|
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
112
114
|
}
|
|
113
115
|
return cachedInt32Memory0;
|
|
@@ -177,11 +179,21 @@ function debugString(val) {
|
|
|
177
179
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
178
180
|
return className;
|
|
179
181
|
}
|
|
182
|
+
|
|
183
|
+
let stack_pointer = 128;
|
|
184
|
+
|
|
185
|
+
function addBorrowedObject(obj) {
|
|
186
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
187
|
+
heap[--stack_pointer] = obj;
|
|
188
|
+
return stack_pointer;
|
|
189
|
+
}
|
|
180
190
|
/**
|
|
181
191
|
* @param {string} text
|
|
182
192
|
* @returns {string}
|
|
183
193
|
*/
|
|
184
194
|
export function escape(text) {
|
|
195
|
+
let deferred2_0;
|
|
196
|
+
let deferred2_1;
|
|
185
197
|
try {
|
|
186
198
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
187
199
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -189,21 +201,15 @@ export function escape(text) {
|
|
|
189
201
|
wasm.escape(retptr, ptr0, len0);
|
|
190
202
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
191
203
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
204
|
+
deferred2_0 = r0;
|
|
205
|
+
deferred2_1 = r1;
|
|
192
206
|
return getStringFromWasm0(r0, r1);
|
|
193
207
|
} finally {
|
|
194
208
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
195
|
-
wasm.__wbindgen_free(
|
|
209
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
196
210
|
}
|
|
197
211
|
}
|
|
198
212
|
|
|
199
|
-
let stack_pointer = 32;
|
|
200
|
-
|
|
201
|
-
function addBorrowedObject(obj) {
|
|
202
|
-
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
203
|
-
heap[--stack_pointer] = obj;
|
|
204
|
-
return stack_pointer;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
213
|
function handleError(f, args) {
|
|
208
214
|
try {
|
|
209
215
|
return f.apply(this, args);
|
|
@@ -217,16 +223,9 @@ function handleError(f, args) {
|
|
|
217
223
|
*/
|
|
218
224
|
export class RRegex {
|
|
219
225
|
|
|
220
|
-
static __wrap(ptr) {
|
|
221
|
-
const obj = Object.create(RRegex.prototype);
|
|
222
|
-
obj.ptr = ptr;
|
|
223
|
-
|
|
224
|
-
return obj;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
226
|
__destroy_into_raw() {
|
|
228
|
-
const ptr = this.
|
|
229
|
-
this.
|
|
227
|
+
const ptr = this.__wbg_ptr;
|
|
228
|
+
this.__wbg_ptr = 0;
|
|
230
229
|
|
|
231
230
|
return ptr;
|
|
232
231
|
}
|
|
@@ -252,7 +251,8 @@ export class RRegex {
|
|
|
252
251
|
if (r2) {
|
|
253
252
|
throw takeObject(r1);
|
|
254
253
|
}
|
|
255
|
-
|
|
254
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
255
|
+
return this;
|
|
256
256
|
} finally {
|
|
257
257
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
258
258
|
}
|
|
@@ -267,7 +267,7 @@ export class RRegex {
|
|
|
267
267
|
isMatch(text) {
|
|
268
268
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
269
269
|
const len0 = WASM_VECTOR_LEN;
|
|
270
|
-
const ret = wasm.rregex_isMatch(this.
|
|
270
|
+
const ret = wasm.rregex_isMatch(this.__wbg_ptr, ptr0, len0);
|
|
271
271
|
return ret !== 0;
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
@@ -281,7 +281,7 @@ export class RRegex {
|
|
|
281
281
|
isMatchAt(text, start) {
|
|
282
282
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
283
283
|
const len0 = WASM_VECTOR_LEN;
|
|
284
|
-
const ret = wasm.rregex_isMatchAt(this.
|
|
284
|
+
const ret = wasm.rregex_isMatchAt(this.__wbg_ptr, ptr0, len0, start);
|
|
285
285
|
return ret !== 0;
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
@@ -294,7 +294,7 @@ export class RRegex {
|
|
|
294
294
|
find(text) {
|
|
295
295
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
296
296
|
const len0 = WASM_VECTOR_LEN;
|
|
297
|
-
const ret = wasm.rregex_find(this.
|
|
297
|
+
const ret = wasm.rregex_find(this.__wbg_ptr, ptr0, len0);
|
|
298
298
|
return takeObject(ret);
|
|
299
299
|
}
|
|
300
300
|
/**
|
|
@@ -308,7 +308,7 @@ export class RRegex {
|
|
|
308
308
|
findAt(text, start) {
|
|
309
309
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
310
310
|
const len0 = WASM_VECTOR_LEN;
|
|
311
|
-
const ret = wasm.rregex_findAt(this.
|
|
311
|
+
const ret = wasm.rregex_findAt(this.__wbg_ptr, ptr0, len0, start);
|
|
312
312
|
return takeObject(ret);
|
|
313
313
|
}
|
|
314
314
|
/**
|
|
@@ -320,7 +320,7 @@ export class RRegex {
|
|
|
320
320
|
findAll(text) {
|
|
321
321
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
322
322
|
const len0 = WASM_VECTOR_LEN;
|
|
323
|
-
const ret = wasm.rregex_findAll(this.
|
|
323
|
+
const ret = wasm.rregex_findAll(this.__wbg_ptr, ptr0, len0);
|
|
324
324
|
return takeObject(ret);
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
@@ -333,19 +333,23 @@ export class RRegex {
|
|
|
333
333
|
* @returns {string}
|
|
334
334
|
*/
|
|
335
335
|
replace(text, rep) {
|
|
336
|
+
let deferred3_0;
|
|
337
|
+
let deferred3_1;
|
|
336
338
|
try {
|
|
337
339
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
338
340
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
339
341
|
const len0 = WASM_VECTOR_LEN;
|
|
340
342
|
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
341
343
|
const len1 = WASM_VECTOR_LEN;
|
|
342
|
-
wasm.rregex_replace(retptr, this.
|
|
344
|
+
wasm.rregex_replace(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
343
345
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
344
346
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
347
|
+
deferred3_0 = r0;
|
|
348
|
+
deferred3_1 = r1;
|
|
345
349
|
return getStringFromWasm0(r0, r1);
|
|
346
350
|
} finally {
|
|
347
351
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
348
|
-
wasm.__wbindgen_free(
|
|
352
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
349
353
|
}
|
|
350
354
|
}
|
|
351
355
|
/**
|
|
@@ -358,19 +362,23 @@ export class RRegex {
|
|
|
358
362
|
* @returns {string}
|
|
359
363
|
*/
|
|
360
364
|
replacen(text, limit, rep) {
|
|
365
|
+
let deferred3_0;
|
|
366
|
+
let deferred3_1;
|
|
361
367
|
try {
|
|
362
368
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
363
369
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
364
370
|
const len0 = WASM_VECTOR_LEN;
|
|
365
371
|
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
366
372
|
const len1 = WASM_VECTOR_LEN;
|
|
367
|
-
wasm.rregex_replacen(retptr, this.
|
|
373
|
+
wasm.rregex_replacen(retptr, this.__wbg_ptr, ptr0, len0, limit, ptr1, len1);
|
|
368
374
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
369
375
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
376
|
+
deferred3_0 = r0;
|
|
377
|
+
deferred3_1 = r1;
|
|
370
378
|
return getStringFromWasm0(r0, r1);
|
|
371
379
|
} finally {
|
|
372
380
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
373
|
-
wasm.__wbindgen_free(
|
|
381
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
374
382
|
}
|
|
375
383
|
}
|
|
376
384
|
/**
|
|
@@ -382,19 +390,23 @@ export class RRegex {
|
|
|
382
390
|
* @returns {string}
|
|
383
391
|
*/
|
|
384
392
|
replaceAll(text, rep) {
|
|
393
|
+
let deferred3_0;
|
|
394
|
+
let deferred3_1;
|
|
385
395
|
try {
|
|
386
396
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
387
397
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
388
398
|
const len0 = WASM_VECTOR_LEN;
|
|
389
399
|
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
390
400
|
const len1 = WASM_VECTOR_LEN;
|
|
391
|
-
wasm.rregex_replaceAll(retptr, this.
|
|
401
|
+
wasm.rregex_replaceAll(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
392
402
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
393
403
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
404
|
+
deferred3_0 = r0;
|
|
405
|
+
deferred3_1 = r1;
|
|
394
406
|
return getStringFromWasm0(r0, r1);
|
|
395
407
|
} finally {
|
|
396
408
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
397
|
-
wasm.__wbindgen_free(
|
|
409
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
398
410
|
}
|
|
399
411
|
}
|
|
400
412
|
/**
|
|
@@ -407,7 +419,7 @@ export class RRegex {
|
|
|
407
419
|
split(text) {
|
|
408
420
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
409
421
|
const len0 = WASM_VECTOR_LEN;
|
|
410
|
-
const ret = wasm.rregex_split(this.
|
|
422
|
+
const ret = wasm.rregex_split(this.__wbg_ptr, ptr0, len0);
|
|
411
423
|
return takeObject(ret);
|
|
412
424
|
}
|
|
413
425
|
/**
|
|
@@ -421,7 +433,7 @@ export class RRegex {
|
|
|
421
433
|
splitn(text, limit) {
|
|
422
434
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
423
435
|
const len0 = WASM_VECTOR_LEN;
|
|
424
|
-
const ret = wasm.rregex_splitn(this.
|
|
436
|
+
const ret = wasm.rregex_splitn(this.__wbg_ptr, ptr0, len0, limit);
|
|
425
437
|
return takeObject(ret);
|
|
426
438
|
}
|
|
427
439
|
/**
|
|
@@ -436,7 +448,7 @@ export class RRegex {
|
|
|
436
448
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
437
449
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
438
450
|
const len0 = WASM_VECTOR_LEN;
|
|
439
|
-
wasm.rregex_shortestMatch(retptr, this.
|
|
451
|
+
wasm.rregex_shortestMatch(retptr, this.__wbg_ptr, ptr0, len0);
|
|
440
452
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
441
453
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
442
454
|
return r0 === 0 ? undefined : r1 >>> 0;
|
|
@@ -457,7 +469,7 @@ export class RRegex {
|
|
|
457
469
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
458
470
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
459
471
|
const len0 = WASM_VECTOR_LEN;
|
|
460
|
-
wasm.rregex_shortestMatchAt(retptr, this.
|
|
472
|
+
wasm.rregex_shortestMatchAt(retptr, this.__wbg_ptr, ptr0, len0, limit);
|
|
461
473
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
462
474
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
463
475
|
return r0 === 0 ? undefined : r1 >>> 0;
|
|
@@ -470,7 +482,7 @@ export class RRegex {
|
|
|
470
482
|
* @returns {any}
|
|
471
483
|
*/
|
|
472
484
|
syntax() {
|
|
473
|
-
const ret = wasm.rregex_syntax(this.
|
|
485
|
+
const ret = wasm.rregex_syntax(this.__wbg_ptr);
|
|
474
486
|
return takeObject(ret);
|
|
475
487
|
}
|
|
476
488
|
/**
|
|
@@ -478,15 +490,19 @@ export class RRegex {
|
|
|
478
490
|
* @returns {string}
|
|
479
491
|
*/
|
|
480
492
|
toString() {
|
|
493
|
+
let deferred1_0;
|
|
494
|
+
let deferred1_1;
|
|
481
495
|
try {
|
|
482
496
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
483
|
-
wasm.rregex_toString(retptr, this.
|
|
497
|
+
wasm.rregex_toString(retptr, this.__wbg_ptr);
|
|
484
498
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
485
499
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
500
|
+
deferred1_0 = r0;
|
|
501
|
+
deferred1_1 = r1;
|
|
486
502
|
return getStringFromWasm0(r0, r1);
|
|
487
503
|
} finally {
|
|
488
504
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
489
|
-
wasm.__wbindgen_free(
|
|
505
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
490
506
|
}
|
|
491
507
|
}
|
|
492
508
|
}
|
|
@@ -497,16 +513,9 @@ export class RRegex {
|
|
|
497
513
|
*/
|
|
498
514
|
export class RRegexSet {
|
|
499
515
|
|
|
500
|
-
static __wrap(ptr) {
|
|
501
|
-
const obj = Object.create(RRegexSet.prototype);
|
|
502
|
-
obj.ptr = ptr;
|
|
503
|
-
|
|
504
|
-
return obj;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
516
|
__destroy_into_raw() {
|
|
508
|
-
const ptr = this.
|
|
509
|
-
this.
|
|
517
|
+
const ptr = this.__wbg_ptr;
|
|
518
|
+
this.__wbg_ptr = 0;
|
|
510
519
|
|
|
511
520
|
return ptr;
|
|
512
521
|
}
|
|
@@ -529,7 +538,8 @@ export class RRegexSet {
|
|
|
529
538
|
if (r2) {
|
|
530
539
|
throw takeObject(r1);
|
|
531
540
|
}
|
|
532
|
-
|
|
541
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
542
|
+
return this;
|
|
533
543
|
} finally {
|
|
534
544
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
535
545
|
heap[stack_pointer++] = undefined;
|
|
@@ -545,7 +555,7 @@ export class RRegexSet {
|
|
|
545
555
|
isMatch(text) {
|
|
546
556
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
547
557
|
const len0 = WASM_VECTOR_LEN;
|
|
548
|
-
const ret = wasm.rregexset_isMatch(this.
|
|
558
|
+
const ret = wasm.rregexset_isMatch(this.__wbg_ptr, ptr0, len0);
|
|
549
559
|
return ret !== 0;
|
|
550
560
|
}
|
|
551
561
|
/**
|
|
@@ -558,12 +568,12 @@ export class RRegexSet {
|
|
|
558
568
|
matches(text) {
|
|
559
569
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
560
570
|
const len0 = WASM_VECTOR_LEN;
|
|
561
|
-
const ret = wasm.rregexset_matches(this.
|
|
571
|
+
const ret = wasm.rregexset_matches(this.__wbg_ptr, ptr0, len0);
|
|
562
572
|
return takeObject(ret);
|
|
563
573
|
}
|
|
564
574
|
}
|
|
565
575
|
|
|
566
|
-
async function
|
|
576
|
+
async function __wbg_load(module, imports) {
|
|
567
577
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
568
578
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
569
579
|
try {
|
|
@@ -594,7 +604,7 @@ async function load(module, imports) {
|
|
|
594
604
|
}
|
|
595
605
|
}
|
|
596
606
|
|
|
597
|
-
function
|
|
607
|
+
function __wbg_get_imports() {
|
|
598
608
|
const imports = {};
|
|
599
609
|
imports.wbg = {};
|
|
600
610
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
@@ -615,45 +625,45 @@ function getImports() {
|
|
|
615
625
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
616
626
|
const obj = getObject(arg1);
|
|
617
627
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
618
|
-
var
|
|
619
|
-
var
|
|
620
|
-
getInt32Memory0()[arg0 / 4 + 1] =
|
|
621
|
-
getInt32Memory0()[arg0 / 4 + 0] =
|
|
628
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
629
|
+
var len1 = WASM_VECTOR_LEN;
|
|
630
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
631
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
622
632
|
};
|
|
623
|
-
imports.wbg.
|
|
633
|
+
imports.wbg.__wbg_get_f01601b5a68d10e3 = function(arg0, arg1) {
|
|
624
634
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
625
635
|
return addHeapObject(ret);
|
|
626
636
|
};
|
|
627
|
-
imports.wbg.
|
|
637
|
+
imports.wbg.__wbg_length_1009b1af0c481d7b = function(arg0) {
|
|
628
638
|
const ret = getObject(arg0).length;
|
|
629
639
|
return ret;
|
|
630
640
|
};
|
|
631
|
-
imports.wbg.
|
|
641
|
+
imports.wbg.__wbg_new_ffc6d4d085022169 = function() {
|
|
632
642
|
const ret = new Array();
|
|
633
643
|
return addHeapObject(ret);
|
|
634
644
|
};
|
|
635
|
-
imports.wbg.
|
|
645
|
+
imports.wbg.__wbg_new_9fb8d994e1c0aaac = function() {
|
|
636
646
|
const ret = new Object();
|
|
637
647
|
return addHeapObject(ret);
|
|
638
648
|
};
|
|
639
|
-
imports.wbg.
|
|
649
|
+
imports.wbg.__wbg_push_901f3914205d44de = function(arg0, arg1) {
|
|
640
650
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
641
651
|
return ret;
|
|
642
652
|
};
|
|
643
|
-
imports.wbg.
|
|
653
|
+
imports.wbg.__wbg_new_a64e3f2afc2cf2f8 = function(arg0, arg1) {
|
|
644
654
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
645
655
|
return addHeapObject(ret);
|
|
646
656
|
};
|
|
647
|
-
imports.wbg.
|
|
657
|
+
imports.wbg.__wbg_set_759f75cd92b612d2 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
648
658
|
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
649
659
|
return ret;
|
|
650
660
|
}, arguments) };
|
|
651
661
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
652
662
|
const ret = debugString(getObject(arg1));
|
|
653
|
-
const
|
|
654
|
-
const
|
|
655
|
-
getInt32Memory0()[arg0 / 4 + 1] =
|
|
656
|
-
getInt32Memory0()[arg0 / 4 + 0] =
|
|
663
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
664
|
+
const len1 = WASM_VECTOR_LEN;
|
|
665
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
666
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
657
667
|
};
|
|
658
668
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
659
669
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
@@ -662,50 +672,57 @@ function getImports() {
|
|
|
662
672
|
return imports;
|
|
663
673
|
}
|
|
664
674
|
|
|
665
|
-
function
|
|
675
|
+
function __wbg_init_memory(imports, maybe_memory) {
|
|
666
676
|
|
|
667
677
|
}
|
|
668
678
|
|
|
669
|
-
function
|
|
679
|
+
function __wbg_finalize_init(instance, module) {
|
|
670
680
|
wasm = instance.exports;
|
|
671
|
-
|
|
672
|
-
cachedInt32Memory0 =
|
|
673
|
-
cachedUint8Memory0 =
|
|
681
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
682
|
+
cachedInt32Memory0 = null;
|
|
683
|
+
cachedUint8Memory0 = null;
|
|
674
684
|
|
|
675
685
|
|
|
676
686
|
return wasm;
|
|
677
687
|
}
|
|
678
688
|
|
|
679
|
-
function initSync(
|
|
680
|
-
|
|
689
|
+
function initSync(module) {
|
|
690
|
+
if (wasm !== undefined) return wasm;
|
|
691
|
+
|
|
692
|
+
const imports = __wbg_get_imports();
|
|
681
693
|
|
|
682
|
-
|
|
694
|
+
__wbg_init_memory(imports);
|
|
695
|
+
|
|
696
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
697
|
+
module = new WebAssembly.Module(module);
|
|
698
|
+
}
|
|
683
699
|
|
|
684
|
-
const module = new WebAssembly.Module(bytes);
|
|
685
700
|
const instance = new WebAssembly.Instance(module, imports);
|
|
686
701
|
|
|
687
|
-
return
|
|
702
|
+
return __wbg_finalize_init(instance, module);
|
|
688
703
|
}
|
|
689
704
|
|
|
690
|
-
async function
|
|
705
|
+
async function __wbg_init(input) {
|
|
706
|
+
if (wasm !== undefined) return wasm;
|
|
707
|
+
|
|
691
708
|
if (typeof input === 'undefined') {
|
|
692
709
|
input = new URL('rregex.wasm', import.meta.url);
|
|
693
710
|
}
|
|
694
|
-
const imports =
|
|
711
|
+
const imports = __wbg_get_imports();
|
|
695
712
|
|
|
696
713
|
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
697
714
|
input = fetch(input);
|
|
698
715
|
}
|
|
699
716
|
|
|
700
|
-
|
|
717
|
+
__wbg_init_memory(imports);
|
|
701
718
|
|
|
702
|
-
const { instance, module } = await
|
|
719
|
+
const { instance, module } = await __wbg_load(await input, imports);
|
|
703
720
|
|
|
704
|
-
return
|
|
721
|
+
return __wbg_finalize_init(instance, module);
|
|
705
722
|
}
|
|
706
723
|
|
|
707
724
|
export { initSync }
|
|
708
|
-
export default
|
|
725
|
+
export default __wbg_init;
|
|
709
726
|
|
|
710
727
|
export const metadata = {
|
|
711
728
|
"name": "rregex",
|
|
@@ -715,6 +732,6 @@ export const metadata = {
|
|
|
715
732
|
],
|
|
716
733
|
"homepage": "https://2fd.github.io/rregex",
|
|
717
734
|
"repository": "https://github.com/2fd/rregex",
|
|
718
|
-
"regex": "1.
|
|
719
|
-
"regex-syntax": "0.6.
|
|
735
|
+
"regex": "1.7.3",
|
|
736
|
+
"regex-syntax": "0.6.29"
|
|
720
737
|
}
|
package/lib/commonjs.d.ts
CHANGED