rregex 1.10.4 → 1.10.6
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/README.md +34 -2
- package/jsr.json +16 -0
- package/lib/{module.d.ts → bundler.d.ts} +1 -13
- package/lib/bundler.mjs +16 -0
- package/lib/{commonjs.js → commonjs.cjs} +0 -12
- package/lib/commonjs.d.ts +1 -13
- package/lib/{browser.d.ts → esm.d.ts} +1 -70
- package/lib/esm.mjs +1210 -0
- package/lib/rregex.wasm +0 -0
- package/lib/standalone.d.ts +1300 -0
- package/lib/standalone.js +1283 -0
- package/lib/types.d.ts +1 -1
- package/package.json +46 -20
- /package/lib/{module.js → bundler_bg.mjs} +0 -0
- /package/lib/{browser.js → web.js} +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# rregex
|
|
2
2
|
|
|
3
|
-
A WebAssembly build of [Rust Regex](https://docs.rs/regex/latest/regex/) for Javascript
|
|
3
|
+
A dependency-free WebAssembly build of [Rust Regex](https://docs.rs/regex/latest/regex/) for Javascript
|
|
4
|
+
|
|
5
|
+
  
|
|
6
|
+

|
|
4
7
|
|
|
5
8
|
> Note: this project is not intended to be used in production jet
|
|
6
9
|
|
|
7
10
|
- [Why Rust Regex](#why-rust-regex)
|
|
8
11
|
- [Install](#install)
|
|
12
|
+
- [Supported Runtimes](#supported-runtimes)
|
|
9
13
|
- [API](https://tsdocs.dev/docs/rregex/latest)
|
|
10
14
|
- [`RRegex`](https://tsdocs.dev/docs/rregex/latest/classes/RRegex.html)
|
|
11
15
|
- [`RRegexSet`](https://tsdocs.dev/docs/rregex/latest/classes/RRegexSet.html)
|
|
@@ -23,9 +27,37 @@ Rust has a powerful Regex library with a lot of features that don't exists en th
|
|
|
23
27
|
## Install
|
|
24
28
|
|
|
25
29
|
```bash
|
|
26
|
-
|
|
30
|
+
# NPM
|
|
31
|
+
npm install rregex
|
|
32
|
+
|
|
33
|
+
# Yarn
|
|
34
|
+
yarn add rregex
|
|
35
|
+
|
|
36
|
+
# PNPM
|
|
37
|
+
pnpm add rregex
|
|
38
|
+
|
|
39
|
+
# Deno
|
|
40
|
+
deno add @rregex/rregex
|
|
41
|
+
|
|
42
|
+
# JSR
|
|
43
|
+
npx jsr add @rregex/rregex
|
|
27
44
|
```
|
|
28
45
|
|
|
46
|
+
## Supported Runtimes
|
|
47
|
+
|
|
48
|
+
This package includes builds for multiple runtimes
|
|
49
|
+
|
|
50
|
+
| Runtime | File |
|
|
51
|
+
| ------------------ | ----------------------------------------------- |
|
|
52
|
+
| Node.js (esm) | [`lib/esm.mjs` (default)](./test/node.test.mjs) |
|
|
53
|
+
| Node.js (commonjs) | [`lib/commonjs.cjs`](./test/node.test.cjs) |
|
|
54
|
+
| Deno | [`lib/esm.mjs`](./test/deno.test.mjs) |
|
|
55
|
+
| Bun | [`lib/esm.mjs`](./test/bun.test.mjs) |
|
|
56
|
+
| Cloudflare Workers | TODO |
|
|
57
|
+
| Browser | TODO |
|
|
58
|
+
| Standalone | TODO |
|
|
59
|
+
| Typescript | `lib/types.d.ts` |
|
|
60
|
+
|
|
29
61
|
## Known Issues
|
|
30
62
|
|
|
31
63
|
If you call `splitn(text, limit)` and the expected result length is equal to `limit - 1` the result will include an extra item `""`, this behavior does not happen if `limit` es greater. **`fixed at >=1.3`**
|
package/jsr.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rregex/rregex",
|
|
3
|
+
"version": "0.0.0-development",
|
|
4
|
+
"exports": "./lib/esm.mjs",
|
|
5
|
+
"publish": {
|
|
6
|
+
"include": [
|
|
7
|
+
"LICENSE",
|
|
8
|
+
"README.md",
|
|
9
|
+
"jsr.json",
|
|
10
|
+
"lib/rregex.wasm",
|
|
11
|
+
"lib/rregex.wasm.d.ts",
|
|
12
|
+
"lib/esm.mjs",
|
|
13
|
+
"lib/esm.d.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -498,7 +498,7 @@ export type LookWordUnicodeNegateVariant = {
|
|
|
498
498
|
'@type': 'enum'
|
|
499
499
|
'@name': 'regex_syntax::hir:Look'
|
|
500
500
|
'@variant': 'WordUnicodeNegate'
|
|
501
|
-
|
|
501
|
+
}
|
|
502
502
|
|
|
503
503
|
/**
|
|
504
504
|
* Match the start of an ASCII-only word boundary. That is, this matches a
|
|
@@ -1249,15 +1249,3 @@ export class RRegexSet {
|
|
|
1249
1249
|
*/
|
|
1250
1250
|
matches(text: string): number[];
|
|
1251
1251
|
}
|
|
1252
|
-
|
|
1253
|
-
export const metadata: {
|
|
1254
|
-
"name": "rregex",
|
|
1255
|
-
"description": "Rust Regex binding for Javascript",
|
|
1256
|
-
"authors": [
|
|
1257
|
-
"Fede Ramirez <i@2fd.me>"
|
|
1258
|
-
],
|
|
1259
|
-
"homepage": "http://rregex.dev",
|
|
1260
|
-
"repository": "https://github.com/2fd/rregex",
|
|
1261
|
-
"regex": "1.10.4",
|
|
1262
|
-
"regex-syntax": "0.8.3"
|
|
1263
|
-
}
|
package/lib/bundler.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as wasm from "./rregex.wasm";
|
|
2
|
+
import { __wbg_set_wasm } from "./bundler_bg.mjs";
|
|
3
|
+
__wbg_set_wasm(wasm);
|
|
4
|
+
export * from "./bundler_bg.mjs";
|
|
5
|
+
|
|
6
|
+
export const metadata = {
|
|
7
|
+
"name": "rregex",
|
|
8
|
+
"description": "Rust Regex binding for Javascript",
|
|
9
|
+
"authors": [
|
|
10
|
+
"Fede Ramirez <i@2fd.me>"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "http://rregex.dev",
|
|
13
|
+
"repository": "https://github.com/2fd/rregex",
|
|
14
|
+
"regex": "1.10.4",
|
|
15
|
+
"regex-syntax": "0.8.3"
|
|
16
|
+
}
|
|
@@ -1216,15 +1216,3 @@ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
|
1216
1216
|
wasm = wasmInstance.exports;
|
|
1217
1217
|
module.exports.__wasm = wasm;
|
|
1218
1218
|
|
|
1219
|
-
|
|
1220
|
-
module.exports.metadata = {
|
|
1221
|
-
"name": "rregex",
|
|
1222
|
-
"description": "Rust Regex binding for Javascript",
|
|
1223
|
-
"authors": [
|
|
1224
|
-
"Fede Ramirez <i@2fd.me>"
|
|
1225
|
-
],
|
|
1226
|
-
"homepage": "http://rregex.dev",
|
|
1227
|
-
"repository": "https://github.com/2fd/rregex",
|
|
1228
|
-
"regex": "1.10.4",
|
|
1229
|
-
"regex-syntax": "0.8.3"
|
|
1230
|
-
}
|
package/lib/commonjs.d.ts
CHANGED
|
@@ -498,7 +498,7 @@ export type LookWordUnicodeNegateVariant = {
|
|
|
498
498
|
'@type': 'enum'
|
|
499
499
|
'@name': 'regex_syntax::hir:Look'
|
|
500
500
|
'@variant': 'WordUnicodeNegate'
|
|
501
|
-
|
|
501
|
+
}
|
|
502
502
|
|
|
503
503
|
/**
|
|
504
504
|
* Match the start of an ASCII-only word boundary. That is, this matches a
|
|
@@ -1249,15 +1249,3 @@ export class RRegexSet {
|
|
|
1249
1249
|
*/
|
|
1250
1250
|
matches(text: string): number[];
|
|
1251
1251
|
}
|
|
1252
|
-
|
|
1253
|
-
export const metadata: {
|
|
1254
|
-
"name": "rregex",
|
|
1255
|
-
"description": "Rust Regex binding for Javascript",
|
|
1256
|
-
"authors": [
|
|
1257
|
-
"Fede Ramirez <i@2fd.me>"
|
|
1258
|
-
],
|
|
1259
|
-
"homepage": "http://rregex.dev",
|
|
1260
|
-
"repository": "https://github.com/2fd/rregex",
|
|
1261
|
-
"regex": "1.10.4",
|
|
1262
|
-
"regex-syntax": "0.8.3"
|
|
1263
|
-
}
|
|
@@ -498,7 +498,7 @@ export type LookWordUnicodeNegateVariant = {
|
|
|
498
498
|
'@type': 'enum'
|
|
499
499
|
'@name': 'regex_syntax::hir:Look'
|
|
500
500
|
'@variant': 'WordUnicodeNegate'
|
|
501
|
-
|
|
501
|
+
}
|
|
502
502
|
|
|
503
503
|
/**
|
|
504
504
|
* Match the start of an ASCII-only word boundary. That is, this matches a
|
|
@@ -1249,72 +1249,3 @@ export class RRegexSet {
|
|
|
1249
1249
|
*/
|
|
1250
1250
|
matches(text: string): number[];
|
|
1251
1251
|
}
|
|
1252
|
-
|
|
1253
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
1254
|
-
|
|
1255
|
-
export interface InitOutput {
|
|
1256
|
-
readonly memory: WebAssembly.Memory;
|
|
1257
|
-
readonly __wbg_rregex_free: (a: number) => void;
|
|
1258
|
-
readonly rregex_new: (a: number, b: number, c: number) => void;
|
|
1259
|
-
readonly rregex_isMatch: (a: number, b: number, c: number) => number;
|
|
1260
|
-
readonly rregex_isMatchAt: (a: number, b: number, c: number, d: number) => number;
|
|
1261
|
-
readonly rregex_find: (a: number, b: number, c: number, d: number) => void;
|
|
1262
|
-
readonly rregex_findAt: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1263
|
-
readonly rregex_findAll: (a: number, b: number, c: number, d: number) => void;
|
|
1264
|
-
readonly rregex_captureNames: (a: number, b: number) => void;
|
|
1265
|
-
readonly rregex_captures: (a: number, b: number, c: number, d: number) => void;
|
|
1266
|
-
readonly rregex_capturesAll: (a: number, b: number, c: number, d: number) => void;
|
|
1267
|
-
readonly rregex_capturesLength: (a: number) => number;
|
|
1268
|
-
readonly rregex_replace: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1269
|
-
readonly rregex_replacen: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1270
|
-
readonly rregex_replaceAll: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1271
|
-
readonly rregex_split: (a: number, b: number, c: number, d: number) => void;
|
|
1272
|
-
readonly rregex_splitn: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1273
|
-
readonly rregex_shortestMatch: (a: number, b: number, c: number, d: number) => void;
|
|
1274
|
-
readonly rregex_shortestMatchAt: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1275
|
-
readonly rregex_syntax: (a: number, b: number) => void;
|
|
1276
|
-
readonly rregex_toString: (a: number, b: number) => void;
|
|
1277
|
-
readonly __wbg_rregexset_free: (a: number) => void;
|
|
1278
|
-
readonly rregexset_new: (a: number, b: number) => void;
|
|
1279
|
-
readonly rregexset_isMatch: (a: number, b: number, c: number) => number;
|
|
1280
|
-
readonly rregexset_matches: (a: number, b: number, c: number, d: number) => void;
|
|
1281
|
-
readonly escape: (a: number, b: number, c: number) => void;
|
|
1282
|
-
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
1283
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
1284
|
-
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
1285
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
1286
|
-
readonly __wbindgen_exn_store: (a: number) => void;
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
1290
|
-
/**
|
|
1291
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
1292
|
-
* a precompiled `WebAssembly.Module`.
|
|
1293
|
-
*
|
|
1294
|
-
* @param {SyncInitInput} module
|
|
1295
|
-
*
|
|
1296
|
-
* @returns {InitOutput}
|
|
1297
|
-
*/
|
|
1298
|
-
export function initSync(module: SyncInitInput): InitOutput;
|
|
1299
|
-
|
|
1300
|
-
/**
|
|
1301
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
1302
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
1303
|
-
*
|
|
1304
|
-
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
1305
|
-
*
|
|
1306
|
-
* @returns {Promise<InitOutput>}
|
|
1307
|
-
*/
|
|
1308
|
-
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
1309
|
-
|
|
1310
|
-
export const metadata: {
|
|
1311
|
-
"name": "rregex",
|
|
1312
|
-
"description": "Rust Regex binding for Javascript",
|
|
1313
|
-
"authors": [
|
|
1314
|
-
"Fede Ramirez <i@2fd.me>"
|
|
1315
|
-
],
|
|
1316
|
-
"homepage": "http://rregex.dev",
|
|
1317
|
-
"repository": "https://github.com/2fd/rregex",
|
|
1318
|
-
"regex": "1.10.4",
|
|
1319
|
-
"regex-syntax": "0.8.3"
|
|
1320
|
-
}
|