re2 1.15.7 → 1.17.0

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.
Files changed (60) hide show
  1. package/.github/actions/linux-alpine-node-12/Dockerfile +1 -1
  2. package/.github/actions/linux-alpine-node-12/entrypoint.sh +1 -1
  3. package/.github/actions/linux-alpine-node-14/Dockerfile +1 -1
  4. package/.github/actions/linux-alpine-node-14/entrypoint.sh +1 -1
  5. package/.github/actions/{linux-alpine-node-10 → linux-alpine-node-16}/Dockerfile +2 -2
  6. package/.github/actions/linux-alpine-node-16/action.yml +7 -0
  7. package/.github/actions/{linux-alpine-node-10 → linux-alpine-node-16}/entrypoint.sh +2 -1
  8. package/.github/actions/linux-alpine-node-17/Dockerfile +6 -0
  9. package/.github/actions/linux-alpine-node-17/action.yml +7 -0
  10. package/.github/actions/linux-alpine-node-17/entrypoint.sh +9 -0
  11. package/.github/actions/linux-node-12/Dockerfile +5 -4
  12. package/.github/actions/linux-node-12/entrypoint.sh +1 -1
  13. package/.github/dependabot.yml +1 -1
  14. package/.github/workflows/build.yml +31 -26
  15. package/.github/workflows/tests.yml +2 -2
  16. package/README.md +7 -35
  17. package/binding.gyp +2 -2
  18. package/package.json +4 -4
  19. package/re2.d.ts +39 -2
  20. package/tests/test_general.js +6 -0
  21. package/vendor/README +3 -1
  22. package/vendor/re2/bitstate.cc +3 -3
  23. package/vendor/re2/compile.cc +50 -34
  24. package/vendor/re2/dfa.cc +24 -21
  25. package/vendor/re2/fuzzing/re2_fuzzer.cc +96 -20
  26. package/vendor/re2/make_perl_groups.pl +1 -1
  27. package/vendor/re2/nfa.cc +5 -5
  28. package/vendor/re2/onepass.cc +2 -2
  29. package/vendor/re2/parse.cc +41 -22
  30. package/vendor/re2/perl_groups.cc +34 -34
  31. package/vendor/re2/prog.cc +188 -4
  32. package/vendor/re2/prog.h +45 -13
  33. package/vendor/re2/re2.cc +91 -129
  34. package/vendor/re2/re2.h +119 -135
  35. package/vendor/re2/regexp.cc +11 -5
  36. package/vendor/re2/regexp.h +7 -2
  37. package/vendor/re2/set.cc +3 -0
  38. package/vendor/re2/testing/backtrack.cc +3 -3
  39. package/vendor/re2/testing/charclass_test.cc +2 -2
  40. package/vendor/re2/testing/compile_test.cc +45 -21
  41. package/vendor/re2/testing/dfa_test.cc +4 -4
  42. package/vendor/re2/testing/exhaustive_tester.cc +2 -2
  43. package/vendor/re2/testing/parse_test.cc +1 -0
  44. package/vendor/re2/testing/re2_arg_test.cc +25 -0
  45. package/vendor/re2/testing/re2_test.cc +31 -16
  46. package/vendor/re2/testing/regexp_benchmark.cc +108 -121
  47. package/vendor/re2/testing/required_prefix_test.cc +78 -24
  48. package/vendor/re2/testing/search_test.cc +2 -0
  49. package/vendor/re2/testing/tester.cc +9 -9
  50. package/vendor/re2/tostring.cc +1 -1
  51. package/vendor/re2/unicode.py +1 -1
  52. package/vendor/re2/unicode_casefold.cc +25 -11
  53. package/vendor/re2/unicode_groups.cc +319 -151
  54. package/vendor/re2/walker-inl.h +3 -2
  55. package/vendor/util/mutex.h +2 -2
  56. package/vendor/util/pcre.h +3 -3
  57. package/.github/actions/linux-alpine-node-10/action.yml +0 -7
  58. package/.github/actions/linux-node-10/Dockerfile +0 -14
  59. package/.github/actions/linux-node-10/action.yml +0 -12
  60. package/.github/actions/linux-node-10/entrypoint.sh +0 -15
@@ -1,6 +1,6 @@
1
1
  FROM node:12-alpine3.9
2
2
 
3
- RUN apk add --no-cache python make gcc g++
3
+ RUN apk add --no-cache python3 make gcc g++
4
4
 
5
5
  COPY entrypoint.sh /entrypoint.sh
6
6
  ENTRYPOINT ["/entrypoint.sh"]
@@ -2,7 +2,7 @@
2
2
 
3
3
  npm config set unsafe-perm true
4
4
  export DEVELOPMENT_SKIP_GETTING_ASSET=true
5
- npm ci
5
+ npm i
6
6
  npm run build --if-present
7
7
  npm test
8
8
  npm run save-to-github
@@ -1,6 +1,6 @@
1
1
  FROM node:14-alpine
2
2
 
3
- RUN apk add --no-cache python make gcc g++
3
+ RUN apk add --no-cache python3 make gcc g++
4
4
 
5
5
  COPY entrypoint.sh /entrypoint.sh
6
6
  ENTRYPOINT ["/entrypoint.sh"]
@@ -2,7 +2,7 @@
2
2
 
3
3
  npm config set unsafe-perm true
4
4
  export DEVELOPMENT_SKIP_GETTING_ASSET=true
5
- npm ci
5
+ npm i
6
6
  npm run build --if-present
7
7
  npm test
8
8
  npm run save-to-github
@@ -1,6 +1,6 @@
1
- FROM node:10-alpine3.9
1
+ FROM node:16-alpine
2
2
 
3
- RUN apk add --no-cache python make gcc g++
3
+ RUN apk add --no-cache python3 make gcc g++
4
4
 
5
5
  COPY entrypoint.sh /entrypoint.sh
6
6
  ENTRYPOINT ["/entrypoint.sh"]
@@ -0,0 +1,7 @@
1
+ name: 'Create a binary artifact for Node 16 on Alpine Linux'
2
+ description: 'Create a binary artifact for Node 16 on Alpine Linux using musl'
3
+ runs:
4
+ using: 'docker'
5
+ image: 'Dockerfile'
6
+ args:
7
+ - ${{inputs.node-version}}
@@ -1,8 +1,9 @@
1
1
  #!/bin/sh
2
2
 
3
3
  npm config set unsafe-perm true
4
+ export USERNAME=`whoami`
4
5
  export DEVELOPMENT_SKIP_GETTING_ASSET=true
5
- npm ci
6
+ npm i
6
7
  npm run build --if-present
7
8
  npm test
8
9
  npm run save-to-github
@@ -0,0 +1,6 @@
1
+ FROM node:17-alpine
2
+
3
+ RUN apk add --no-cache python3 make gcc g++
4
+
5
+ COPY entrypoint.sh /entrypoint.sh
6
+ ENTRYPOINT ["/entrypoint.sh"]
@@ -0,0 +1,7 @@
1
+ name: 'Create a binary artifact for Node 17 on Alpine Linux'
2
+ description: 'Create a binary artifact for Node 17 on Alpine Linux using musl'
3
+ runs:
4
+ using: 'docker'
5
+ image: 'Dockerfile'
6
+ args:
7
+ - ${{inputs.node-version}}
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+
3
+ npm config set unsafe-perm true
4
+ export USERNAME=`whoami`
5
+ export DEVELOPMENT_SKIP_GETTING_ASSET=true
6
+ npm i
7
+ npm run build --if-present
8
+ npm test
9
+ npm run save-to-github
@@ -1,12 +1,13 @@
1
1
  FROM centos:centos7
2
2
 
3
3
  RUN yum install -y centos-release-scl && \
4
- INSTALL_PKGS="devtoolset-7-gcc devtoolset-7-gcc-c++ python27 make" && \
4
+ INSTALL_PKGS="devtoolset-7-gcc devtoolset-7-gcc-c++ python3 make" && \
5
5
  yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
6
6
  rpm -V $INSTALL_PKGS && \
7
- yum -y clean all --enablerepo='*' && \
8
- source scl_source enable devtoolset-7 && \
9
- source scl_source enable python27
7
+ yum -y clean all --enablerepo='*'
8
+ # && \
9
+ # source scl_source enable devtoolset-7 && \
10
+ # source scl_source enable python3
10
11
 
11
12
  ENV PATH=/opt/rh/devtoolset-7/root/usr/bin:$PATH
12
13
 
@@ -9,7 +9,7 @@ nvm install --no-progress $1
9
9
 
10
10
  npm config set unsafe-perm true
11
11
  export DEVELOPMENT_SKIP_GETTING_ASSET=true
12
- npm ci
12
+ npm i
13
13
  npm run build --if-present
14
14
  npm test
15
15
  npm run save-to-github
@@ -5,7 +5,7 @@
5
5
 
6
6
  version: 2
7
7
  updates:
8
- - package-ecosystem: "nvm" # See documentation for possible values
8
+ - package-ecosystem: "npm" # See documentation for possible values
9
9
  directory: "/" # Location of package manifests
10
10
  schedule:
11
11
  interval: "weekly"
@@ -31,7 +31,7 @@ jobs:
31
31
  strategy:
32
32
  matrix:
33
33
  os: [windows-latest, macOS-latest]
34
- node-version: [10, 12, 14]
34
+ node-version: [12, 14, 16, 17]
35
35
 
36
36
  steps:
37
37
  - uses: actions/checkout@v2
@@ -57,7 +57,7 @@ jobs:
57
57
  env:
58
58
  DEVELOPMENT_SKIP_GETTING_ASSET: true
59
59
  run: |
60
- npm ci
60
+ npm i
61
61
  npm run build --if-present
62
62
  npm test
63
63
  - name: Save to GitHub
@@ -65,10 +65,15 @@ jobs:
65
65
  GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
66
66
  run: npm run save-to-github
67
67
 
68
- build-linux-node-10:
69
- name: Node.js 10 on CentOS 6
68
+ build-linux-node:
69
+ name: Node.js ${{matrix.node-version}} on CentOS 7
70
70
  needs: create-release
71
71
  runs-on: ubuntu-latest
72
+ continue-on-error: true
73
+
74
+ strategy:
75
+ matrix:
76
+ node-version: [12, 14, 16, 17]
72
77
 
73
78
  steps:
74
79
  - uses: actions/checkout@v2
@@ -87,18 +92,17 @@ jobs:
87
92
  Linux-node-
88
93
  Linux-
89
94
  - name: Install, test, and create artifact
90
- uses: ./.github/actions/linux-node-10/
95
+ uses: ./.github/actions/linux-node-12/
91
96
  env:
92
97
  GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
98
+ with:
99
+ node-version: ${{matrix.node-version}}
93
100
 
94
- build-linux-node:
95
- name: Node.js ${{matrix.node-version}} on CentOS 7
101
+ build-linux-alpine-node-12:
102
+ name: Node.js 12 on Alpine Linux
96
103
  needs: create-release
97
104
  runs-on: ubuntu-latest
98
-
99
- strategy:
100
- matrix:
101
- node-version: [12, 14]
105
+ continue-on-error: true
102
106
 
103
107
  steps:
104
108
  - uses: actions/checkout@v2
@@ -112,21 +116,20 @@ jobs:
112
116
  uses: actions/cache@v2
113
117
  with:
114
118
  path: ${{steps.npm-cache.outputs.dir}}
115
- key: Linux-node-${{hashFiles('**/package-lock.json')}}
119
+ key: Linux-Alpine-node-${{hashFiles('**/package-lock.json')}}
116
120
  restore-keys: |
117
- Linux-node-
118
- Linux-
121
+ Linux-Alpine-node-
122
+ Linux-Alpine-
119
123
  - name: Install, test, and create artifact
120
- uses: ./.github/actions/linux-node-12/
124
+ uses: ./.github/actions/linux-alpine-node-12/
121
125
  env:
122
126
  GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
123
- with:
124
- node-version: ${{matrix.node-version}}
125
127
 
126
- build-linux-alpine-node-10:
127
- name: Node.js 10 on Alpine Linux
128
+ build-linux-alpine-node-14:
129
+ name: Node.js 14 on Alpine Linux
128
130
  needs: create-release
129
131
  runs-on: ubuntu-latest
132
+ continue-on-error: true
130
133
 
131
134
  steps:
132
135
  - uses: actions/checkout@v2
@@ -145,14 +148,15 @@ jobs:
145
148
  Linux-Alpine-node-
146
149
  Linux-Alpine-
147
150
  - name: Install, test, and create artifact
148
- uses: ./.github/actions/linux-alpine-node-10/
151
+ uses: ./.github/actions/linux-alpine-node-14/
149
152
  env:
150
153
  GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
151
154
 
152
- build-linux-alpine-node-12:
153
- name: Node.js 12 on Alpine Linux
155
+ build-linux-alpine-node-16:
156
+ name: Node.js 16 on Alpine Linux
154
157
  needs: create-release
155
158
  runs-on: ubuntu-latest
159
+ continue-on-error: true
156
160
 
157
161
  steps:
158
162
  - uses: actions/checkout@v2
@@ -171,14 +175,15 @@ jobs:
171
175
  Linux-Alpine-node-
172
176
  Linux-Alpine-
173
177
  - name: Install, test, and create artifact
174
- uses: ./.github/actions/linux-alpine-node-12/
178
+ uses: ./.github/actions/linux-alpine-node-16/
175
179
  env:
176
180
  GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
177
181
 
178
- build-linux-alpine-node-14:
179
- name: Node.js 14 on Alpine Linux
182
+ build-linux-alpine-node-17:
183
+ name: Node.js 17 on Alpine Linux
180
184
  needs: create-release
181
185
  runs-on: ubuntu-latest
186
+ continue-on-error: true
182
187
 
183
188
  steps:
184
189
  - uses: actions/checkout@v2
@@ -197,6 +202,6 @@ jobs:
197
202
  Linux-Alpine-node-
198
203
  Linux-Alpine-
199
204
  - name: Install, test, and create artifact
200
- uses: ./.github/actions/linux-alpine-node-14/
205
+ uses: ./.github/actions/linux-alpine-node-17/
201
206
  env:
202
207
  GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -14,7 +14,7 @@ jobs:
14
14
  strategy:
15
15
  matrix:
16
16
  os: [ubuntu-latest, windows-latest, macOS-latest]
17
- node-version: [10, 12, 14]
17
+ node-version: [12, 14, 16, 17]
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v2
@@ -39,6 +39,6 @@ jobs:
39
39
  env:
40
40
  DEVELOPMENT_SKIP_GETTING_ASSET: true
41
41
  run: |
42
- npm ci
42
+ npm i
43
43
  npm run build --if-present
44
44
  npm test
package/README.md CHANGED
@@ -211,7 +211,7 @@ For example, [yarn](https://yarnpkg.com/) is known to fail in some scenarios
211
211
 
212
212
  ### Precompiled artifacts
213
213
 
214
- When installing re2 the [install script](scripts/install-from-cache.js) attempts to download a prebuilt artifact for your system from the Github releases. The download location can be overridden by setting the `RE2_DOWNLOAD_MIRROR` environment variable as seen in the install script.
214
+ When installing re2 the [install script](https://github.com/uhop/install-artifact-from-github/blob/master/bin/install-from-cache.js) attempts to download a prebuilt artifact for your system from the Github releases. The download location can be overridden by setting the `RE2_DOWNLOAD_MIRROR` environment variable as seen in the install script.
215
215
 
216
216
  If all attempts to download the prebuilt artifact for your system fails the script attempts to built re2 locally on your machine using [node-gyp](https://github.com/nodejs/node-gyp).
217
217
 
@@ -343,6 +343,10 @@ console.log('re2_res : ' + re2_res); // prints: re2_res : abc,a,b,c
343
343
 
344
344
  ## Release history
345
345
 
346
+ - 1.17.0 *Updated GYP, added support for Node 17, updated deps.*
347
+ - 1.16.0 *Updated the compiler (thx, [Sergei Dyshel](https://github.com/sergei-dyshel)), updated GYP, removed support for Node 10, added support for Node 16, updated TS bindings (thx, [BannerBomb](https://github.com/BannerBomb)).*
348
+ - 1.15.9 *Updated deps.*
349
+ - 1.15.8 *Updated deps.*
346
350
  - 1.15.7 *Updated deps.*
347
351
  - 1.15.6 *Technical release: less dependencies for the build.*
348
352
  - 1.15.5 *Updated deps. Fixed a `node2nix`-related problem (thx [malte-v](https://github.com/malte-v)).*
@@ -351,40 +355,8 @@ console.log('re2_res : ' + re2_res); // prints: re2_res : abc,a,b,c
351
355
  - 1.15.2 *Added `linux-musl` target for precompiled images (thx [Uzlopak](https://github.com/Uzlopak)).*
352
356
  - 1.15.1 *Refreshed dependencies, updated the verification check on installation, general maintenance.*
353
357
  - 1.15.0 *Fix for multiline expressions (thx [Frederic Rudman](https://github.com/frudman)), `toString()` uses `source` now, updated deps.*
354
- - 1.14.0 *New delivery mechanism for binary artifacts (thx [Brandon Kobel](https://github.com/kobelb) for the idea and the research) + minor fix to eliminate warnings on Windows.*
355
- - 1.13.1 *Fix for Windows builds.*
356
- - 1.13.0 *Got rid of a single static variable to support multithreading.*
357
- - 1.12.1 *Updated re2 to the latest version.*
358
- - 1.12.0 *Updated the way `RE2` objects are constructed.*
359
- - 1.11.0 *Updated the way to initialize the extension (thx [BannerBomb](https://github.com/BannerBomb)).*
360
- - 1.10.5 *Bugfix for optional groups (thx [Josh Yudaken](https://github.com/qix)), the latest version of re2.*
361
- - 1.10.4 *Technical release: even better TypeScript types (thx [Louis Brann](https://github.com/louis-brann)).*
362
- - 1.10.3 *Technical release: missing reference to TS types (thx [Jamie Magee](https://github.com/JamieMagee)).*
363
- - 1.10.2 *Technical release: added TypeScript types (thx [Jamie Magee](https://github.com/JamieMagee)).*
364
- - 1.10.1 *Updated re2 to the latest version (thx [Jamie Magee](https://github.com/JamieMagee)), dropped Node 6.*
365
- - 1.10.0 *Added back support for Node 6 and Node 8. Now Node 6-12 is supported.*
366
- - 1.9.0 *Refreshed dependencies to support Node 12. Only versions 10-12 are supported now (`v8` restrictions). For older versions use `node-re2@1.8`.*
367
- - 1.8.4 *Refreshed dependencies, removed `unistd.h` to compile on Windows.*
368
- - 1.8.3 *Refreshed dependencies, removed suppression of some warnings.*
369
- - 1.8.2 *Bugfix to support the null prototype for groups. Thx [Exter-N](https://github.com/Exter-N).*
370
- - 1.8.1 *Bugfix for better source escaping.*
371
- - 1.8.0 *Clarified Unicode support, added `unicode` flag, added named groups — thx [Exter-N](https://github.com/Exter-N)! Bugfixes — thx [Barak Amar](https://github.com/nopcoder).*
372
- - 1.7.0 *Implemented `sticky` and `flags` + bug fixes + more tests. Thx [Exter-N](https://github.com/Exter-N).*
373
- - 1.6.2 *Bugfix for a prototype access. Thx [Exter-N](https://github.com/Exter-N).*
374
- - 1.6.1 *Returned support for node 4 LTS. Thx [Kannan Goundan](https://github.com/cakoose).*
375
- - 1.6.0 *Added well-known symbol-based methods of ES6. Refreshed NAN.*
376
- - 1.5.0 *Bugfixes, error checks, better docs. Thx [Jamie Davis](https://github.com/davisjam), and [omg](https://github.com/omg).*
377
- - 1.4.1 *Minor corrections in README.*
378
- - 1.4.0 *Use re2 as a git submodule. Thx [Ben James](https://github.com/benhjames).*
379
- - 1.3.3 *Refreshed dependencies.*
380
- - 1.3.2 *Updated references in README (re2 was moved to github).*
381
- - 1.3.1 *Refreshed dependencies, new Travis-CI config.*
382
- - 1.3.0 *Upgraded NAN to 1.6.3, now we support node.js 0.10.36, 0.12.0, and io.js 1.3.0. Thx [Reid Burke](https://github.com/reid)!*
383
- - 1.2.0 *Documented getUtfXLength() functions. Added support for `\c` and `\u` commands.*
384
- - 1.1.1 *Minor corrections in README.*
385
- - 1.1.0 *Buffer-based API is public. Unicode is fully supported.*
386
- - 1.0.0 *Implemented all `RegExp` methods, and all relevant `String` methods.*
387
- - 0.9.0 *The initial public release.*
358
+
359
+ The rest can be consulted in the project's wiki [Release history](https://github.com/uhop/node-re2/wiki/Release-history).
388
360
 
389
361
  ## License
390
362
 
package/binding.gyp CHANGED
@@ -39,7 +39,7 @@
39
39
  "vendor/util/strutil.cc"
40
40
  ],
41
41
  "cflags": [
42
- "-std=c++11",
42
+ "-std=c++14",
43
43
  "-Wall",
44
44
  "-Wextra",
45
45
  "-Wno-sign-compare",
@@ -62,7 +62,7 @@
62
62
  "CLANG_CXX_LANGUAGE_STANDARD": "c++11",
63
63
  "CLANG_CXX_LIBRARY": "libc++",
64
64
  "OTHER_CFLAGS": [
65
- "-std=c++11",
65
+ "-std=c++14",
66
66
  "-Wall",
67
67
  "-Wextra",
68
68
  "-Wno-sign-compare",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "re2",
3
- "version": "1.15.7",
3
+ "version": "1.17.0",
4
4
  "description": "Bindings for RE2: fast, safe alternative to backtracking regular expression engines.",
5
5
  "homepage": "https://github.com/uhop/node-re2",
6
6
  "bugs": "https://github.com/uhop/node-re2/issues",
@@ -10,9 +10,9 @@
10
10
  "test": "tests"
11
11
  },
12
12
  "dependencies": {
13
- "install-artifact-from-github": "^1.1.3",
14
- "nan": "^2.14.2",
15
- "node-gyp": "^7.1.1"
13
+ "install-artifact-from-github": "^1.2.0",
14
+ "nan": "^2.15.0",
15
+ "node-gyp": "^8.4.1"
16
16
  },
17
17
  "devDependencies": {
18
18
  "heya-unit": "^0.3.0"
package/re2.d.ts CHANGED
@@ -1,5 +1,42 @@
1
1
  declare module 're2' {
2
- class RE2 extends RegExp {}
2
+
3
+ interface RE2MatchArray<K> extends Array<K> {
4
+ index?: number;
5
+ input?: K;
6
+ }
7
+
8
+ interface RE2ExecArray<K> extends Array<K> {
9
+ index: number;
10
+ input: K;
11
+ }
12
+
13
+ interface RE2 extends RegExp {
14
+ exec<K extends String | Buffer>(str: K): RE2ExecArray<K> | null;
15
+
16
+ test(str: string | Buffer): boolean;
17
+
18
+ match<K extends String | Buffer>(str: K): RE2MatchArray<K> | null;
19
+
20
+ replace<K extends String | Buffer>(str: K, replaceValue: string | Buffer): K;
21
+ replace<K extends String | Buffer>(str: K, replacer: (substring: string, ...args: any[]) => string | Buffer): K;
22
+
23
+ search(str: string | Buffer): number;
24
+
25
+ split<K extends String | Buffer>(str: K, limit?: number): K[];
26
+ }
27
+
28
+ interface RE2Constructor extends RegExpConstructor {
29
+ new(pattern: Buffer | RegExp | string): RE2;
30
+ new(pattern: Buffer | string, flags?: string): RE2;
31
+ (pattern: Buffer | RegExp | string): RE2;
32
+ (pattern: Buffer | string, flags?: string): RE2;
33
+ readonly prototype: RE2;
34
+
35
+ unicodeWarningLevel: 'nothing' | 'warnOnce' | 'warn' | 'throw';
36
+ getUtf8Length(value: string): number;
37
+ getUtf16Length(value: Buffer): number;
38
+ }
39
+
40
+ var RE2: RE2Constructor;
3
41
  export = RE2;
4
42
  }
5
-
@@ -209,6 +209,12 @@ unit.add(module, [
209
209
  eval(t.TEST("s3.length === 1"));
210
210
  eval(t.TEST("RE2.getUtf8Length(s3) === 3"));
211
211
 
212
+ var s4 = "🤡";
213
+
214
+ eval(t.TEST("s4.length === 2"));
215
+ eval(t.TEST("RE2.getUtf8Length(s4) === 4"));
216
+ eval(t.TEST("RE2.getUtf16Length(Buffer.from(s4, 'utf8')) === s4.length"));
217
+
212
218
  var b3 = new Buffer([0xF0]);
213
219
 
214
220
  eval(t.TEST("b3.length === 1"));
package/vendor/README CHANGED
@@ -31,10 +31,12 @@ The Python wrapper is at https://github.com/google/re2/tree/abseil/python
31
31
  and on PyPI (https://pypi.org/project/google-re2/).
32
32
 
33
33
  A C wrapper is at https://github.com/marcomaggi/cre2/.
34
+ A D wrapper is at https://github.com/ShigekiKarita/re2d/ and on DUB (code.dlang.org).
34
35
  An Erlang wrapper is at https://github.com/dukesoferl/re2/ and on Hex (hex.pm).
35
36
  An Inferno wrapper is at https://github.com/powerman/inferno-re2/.
36
37
  A Node.js wrapper is at https://github.com/uhop/node-re2/ and on NPM (npmjs.com).
37
38
  An OCaml wrapper is at https://github.com/janestreet/re2/ and on OPAM (opam.ocaml.org).
38
39
  A Perl wrapper is at https://github.com/dgl/re-engine-RE2/ and on CPAN (cpan.org).
39
- An R wrapper is at https://github.com/qinwf/re2r/ and on CRAN (cran.r-project.org).
40
+ An R wrapper is at https://github.com/girishji/re2/ and on CRAN (cran.r-project.org).
40
41
  A Ruby wrapper is at https://github.com/mudge/re2/ and on RubyGems (rubygems.org).
42
+ A WebAssembly wrapper is at https://github.com/google/re2-wasm/ and on NPM (npmjs.com).
@@ -293,9 +293,9 @@ bool BitState::Search(const StringPiece& text, const StringPiece& context,
293
293
  context_ = context;
294
294
  if (context_.data() == NULL)
295
295
  context_ = text;
296
- if (prog_->anchor_start() && context_.begin() != text.begin())
296
+ if (prog_->anchor_start() && BeginPtr(context_) != BeginPtr(text))
297
297
  return false;
298
- if (prog_->anchor_end() && context_.end() != text.end())
298
+ if (prog_->anchor_end() && EndPtr(context_) != EndPtr(text))
299
299
  return false;
300
300
  anchored_ = anchored || prog_->anchor_start();
301
301
  longest_ = longest || prog_->anchor_end();
@@ -377,7 +377,7 @@ bool Prog::SearchBitState(const StringPiece& text,
377
377
  bool longest = kind != kFirstMatch;
378
378
  if (!b.Search(text, context, anchored, longest, match, nmatch))
379
379
  return false;
380
- if (kind == kFullMatch && match[0].end() != text.end())
380
+ if (kind == kFullMatch && EndPtr(match[0]) != EndPtr(text))
381
381
  return false;
382
382
  return true;
383
383
  }