re2 1.20.1 → 1.20.3

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.
@@ -1,5 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
+ set -e
4
+
3
5
  npm config set unsafe-perm true
4
6
  export USERNAME=`whoami`
5
7
  export DEVELOPMENT_SKIP_GETTING_ASSET=true
@@ -1,6 +1,8 @@
1
1
  #!/bin/sh
2
2
 
3
- npm config set unsafe-perm true
3
+ set -e
4
+
5
+ #npm config set unsafe-perm true
4
6
  export USERNAME=`whoami`
5
7
  export DEVELOPMENT_SKIP_GETTING_ASSET=true
6
8
  npm i
@@ -1,6 +1,8 @@
1
1
  #!/bin/sh
2
2
 
3
- npm config set unsafe-perm true
3
+ set -e
4
+
5
+ #npm config set unsafe-perm true
4
6
  export USERNAME=`whoami`
5
7
  export DEVELOPMENT_SKIP_GETTING_ASSET=true
6
8
  npm i
@@ -1,5 +1,7 @@
1
1
  #!/bin/bash -l
2
2
 
3
+ set -e
4
+
3
5
  NVM_DIR=$HOME/.nvm
4
6
 
5
7
  curl -sS -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
@@ -1,6 +1,8 @@
1
1
  #!/bin/sh
2
2
 
3
- npm config set unsafe-perm true
3
+ set -e
4
+
5
+ #npm config set unsafe-perm true
4
6
  export USERNAME=`whoami`
5
7
  export DEVELOPMENT_SKIP_GETTING_ASSET=true
6
8
  npm i
@@ -1,6 +1,8 @@
1
1
  #!/bin/sh
2
2
 
3
- npm config set unsafe-perm true
3
+ set -e
4
+
5
+ #npm config set unsafe-perm true
4
6
  export USERNAME=`whoami`
5
7
  export DEVELOPMENT_SKIP_GETTING_ASSET=true
6
8
  npm i
package/README.md CHANGED
@@ -353,6 +353,8 @@ console.log('re2_res : ' + re2_res); // prints: re2_res : abc,a,b,c
353
353
 
354
354
  ## Release history
355
355
 
356
+ - 1.20.3 *Fix: subsequent numbers are incorporated into group if they would form a legal group reference. Thx, [Oleksii Vasyliev](https://github.com/le0pard).*
357
+ - 1.20.2 *Fix: added a missing C++ file, which caused a bug on Alpine Linux. Thx, [rbitanga-manticore](https://github.com/rbitanga-manticore).*
356
358
  - 1.20.1 *Fix: files included in the npm package to build the C++ code.*
357
359
  - 1.20.0 *Updated RE2. New version uses `abseil-cpp` and required the adaptation work. Thx, [Stefano Rivera](https://github.com/stefanor).*
358
360
  - 1.19.2 *Bugfix: infinite loop in matchAll() with empty matches. Thx, [ziyunfei](https://github.com/ziyunfei).*
package/binding.gyp CHANGED
@@ -47,6 +47,7 @@
47
47
  "vendor/abseil-cpp/absl/base/internal/throw_delegate.cc",
48
48
  "vendor/abseil-cpp/absl/base/internal/unscaledcycleclock.cc",
49
49
  "vendor/abseil-cpp/absl/container/internal/raw_hash_set.cc",
50
+ "vendor/abseil-cpp/absl/debugging/internal/address_is_readable.cc",
50
51
  "vendor/abseil-cpp/absl/debugging/stacktrace.cc",
51
52
  "vendor/abseil-cpp/absl/debugging/symbolize.cc",
52
53
  "vendor/abseil-cpp/absl/flags/commandlineflag.cc",
package/lib/replace.cc CHANGED
@@ -142,6 +142,12 @@ inline std::string replace(const char *data, size_t size, const std::vector<re2:
142
142
  result += (std::string)groups[index2];
143
143
  continue;
144
144
  }
145
+ else if (index && index < groups.size())
146
+ {
147
+ result += (std::string)groups[index];
148
+ result += ch;
149
+ continue;
150
+ }
145
151
  result += '$';
146
152
  result += '0' + index;
147
153
  result += ch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "re2",
3
- "version": "1.20.1",
3
+ "version": "1.20.3",
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",
@@ -16,7 +16,7 @@
16
16
  "node-gyp": "^9.4.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@types/node": "^20.4.5",
19
+ "@types/node": "^20.5.3",
20
20
  "heya-unit": "^0.3.0",
21
21
  "typescript": "^5.1.6"
22
22
  },
@@ -334,5 +334,47 @@ unit.add(module, [
334
334
  var re = new RE2(/b(?<a>1)? & (?<b>2)?y/);
335
335
  var result = re.replace('ab & yz', replacer);
336
336
  eval(t.TEST("result === 'az'"));
337
+ },
338
+ function test_replaceGroupSimple(t) {
339
+ 'use strict';
340
+
341
+ var re = new RE2(/(2)/);
342
+
343
+ var result = re.replace('123', '$0');
344
+ eval(t.TEST("result === '1$03'"));
345
+ result = re.replace('123', '$1');
346
+ eval(t.TEST("result === '123'"));
347
+ result = re.replace('123', '$2');
348
+ eval(t.TEST("result === '1$23'"));
349
+
350
+ result = re.replace('123', '$00');
351
+ eval(t.TEST("result === '1$003'"));
352
+ result = re.replace('123', '$01');
353
+ eval(t.TEST("result === '123'"));
354
+ result = re.replace('123', '$02');
355
+ eval(t.TEST("result === '1$023'"));
356
+ },
357
+ function test_replaceGroupCases(t) {
358
+ 'use strict';
359
+
360
+ var re = new RE2(/(test)/g);
361
+ var result = re.replace('123', '$1$20');
362
+ eval(t.TEST("result === '123'"));
363
+
364
+ re = new RE2(/(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)/g);
365
+ result = re.replace('abcdefghijklmnopqrstuvwxyz123', '$10$20');
366
+ eval(t.TEST("result === 'jb0wo0123'"));
367
+
368
+ re = new RE2(/(.)(.)(.)(.)(.)/g);
369
+ result = re.replace('abcdefghijklmnopqrstuvwxyz123', '$10$20');
370
+ eval(t.TEST("result === 'a0b0f0g0k0l0p0q0u0v0z123'"));
371
+
372
+ re = new RE2(/(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)/g);
373
+ result = re.replace('abcdefghijklmnopqrstuvwxyz123', '$10$20');
374
+ eval(t.TEST("result === 'jtvwxyz123'"));
375
+
376
+ re = new RE2(/abcd/g);
377
+ result = re.replace('abcd123', '$1$2');
378
+ eval(t.TEST("result === '$1$2123'"));
337
379
  }
338
380
  ]);