re2 1.17.7 → 1.18.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.
@@ -0,0 +1,6 @@
1
+ FROM node:19-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 19 on Alpine Linux'
2
+ description: 'Create a binary artifact for Node 19 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,15 +1,15 @@
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++ python3 make" && \
4
+ INSTALL_PKGS="devtoolset-8 python3 make" && \
5
5
  yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
6
6
  rpm -V $INSTALL_PKGS && \
7
7
  yum -y clean all --enablerepo='*'
8
8
  # && \
9
- # source scl_source enable devtoolset-7 && \
9
+ # source scl_source enable devtoolset-8 && \
10
10
  # source scl_source enable python3
11
11
 
12
- ENV PATH=/opt/rh/devtoolset-7/root/usr/bin:$PATH
12
+ ENV PATH=/opt/rh/devtoolset-8/root/usr/bin:$PATH
13
13
 
14
14
  COPY entrypoint.sh /entrypoint.sh
15
15
  ENTRYPOINT ["/entrypoint.sh"]
@@ -2,7 +2,7 @@
2
2
 
3
3
  NVM_DIR=$HOME/.nvm
4
4
 
5
- curl -sS -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
5
+ curl -sS -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
6
6
  [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
7
7
 
8
8
  nvm install --no-progress $1
@@ -0,0 +1,6 @@
1
+ FROM node:19-buster
2
+
3
+ RUN apt install python3 make gcc g++
4
+
5
+ COPY entrypoint.sh /entrypoint.sh
6
+ ENTRYPOINT ["/entrypoint.sh"]
@@ -0,0 +1,12 @@
1
+ name: 'Create a binary artifact for Node == 19 on Linux'
2
+ description: 'Create a binary artifact for Node == 19 on Linux using node:19-buster'
3
+ inputs:
4
+ node-version:
5
+ description: 'Node.js version'
6
+ required: false
7
+ default: '19'
8
+ runs:
9
+ using: 'docker'
10
+ image: 'Dockerfile'
11
+ args:
12
+ - ${{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
@@ -31,7 +31,7 @@ jobs:
31
31
  strategy:
32
32
  matrix:
33
33
  os: [macOS-latest, windows-latest]
34
- node-version: [14, 16, 18]
34
+ node-version: [14, 16, 18, 19]
35
35
  exclude:
36
36
  - os: windows-latest
37
37
  node-version: 14
@@ -44,18 +44,6 @@ jobs:
44
44
  uses: actions/setup-node@v3
45
45
  with:
46
46
  node-version: ${{matrix.node-version}}
47
- - name: Get NPM cache directory
48
- id: npm-cache
49
- run: |
50
- echo "::set-output name=dir::$(npm config get cache)"
51
- - name: Cache node modules
52
- uses: actions/cache@v3
53
- with:
54
- path: ${{steps.npm-cache.outputs.dir}}
55
- key: ${{runner.os}}-node-${{hashFiles('**/package-lock.json')}}
56
- restore-keys: |
57
- ${{runner.os}}-node-
58
- ${{runner.os}}-
59
47
  - name: Install the package and run tests
60
48
  env:
61
49
  DEVELOPMENT_SKIP_GETTING_ASSET: true
@@ -82,18 +70,6 @@ jobs:
82
70
  - uses: actions/checkout@v3
83
71
  with:
84
72
  submodules: true
85
- - name: Get NPM cache directory
86
- id: npm-cache
87
- run: |
88
- echo "::set-output name=dir::$(npm config get cache)"
89
- - name: Cache node modules
90
- uses: actions/cache@v3
91
- with:
92
- path: ${{steps.npm-cache.outputs.dir}}
93
- key: Linux-node-${{hashFiles('**/package-lock.json')}}
94
- restore-keys: |
95
- Linux-node-
96
- Linux-
97
73
  - name: Install, test, and create artifact
98
74
  uses: ./.github/actions/linux-node-12/
99
75
  env:
@@ -111,23 +87,26 @@ jobs:
111
87
  - uses: actions/checkout@v3
112
88
  with:
113
89
  submodules: true
114
- - name: Get NPM cache directory
115
- id: npm-cache
116
- run: |
117
- echo "::set-output name=dir::$(npm config get cache)"
118
- - name: Cache node modules
119
- uses: actions/cache@v3
120
- with:
121
- path: ${{steps.npm-cache.outputs.dir}}
122
- key: Linux-node-${{hashFiles('**/package-lock.json')}}
123
- restore-keys: |
124
- Linux-node-
125
- Linux-
126
90
  - name: Install, test, and create artifact
127
91
  uses: ./.github/actions/linux-node-18/
128
92
  env:
129
93
  GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
130
94
 
95
+ build-linux-node-19:
96
+ name: Node.js 19 on Debian Buster
97
+ needs: create-release
98
+ runs-on: ubuntu-latest
99
+ continue-on-error: true
100
+
101
+ steps:
102
+ - uses: actions/checkout@v3
103
+ with:
104
+ submodules: true
105
+ - name: Install, test, and create artifact
106
+ uses: ./.github/actions/linux-node-19/
107
+ env:
108
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
109
+
131
110
  build-linux-alpine-node-14:
132
111
  name: Node.js 14 on Alpine Linux
133
112
  needs: create-release
@@ -138,18 +117,6 @@ jobs:
138
117
  - uses: actions/checkout@v3
139
118
  with:
140
119
  submodules: true
141
- - name: Get NPM cache directory
142
- id: npm-cache
143
- run: |
144
- echo "::set-output name=dir::$(npm config get cache)"
145
- - name: Cache node modules
146
- uses: actions/cache@v3
147
- with:
148
- path: ${{steps.npm-cache.outputs.dir}}
149
- key: Linux-Alpine-node-${{hashFiles('**/package-lock.json')}}
150
- restore-keys: |
151
- Linux-Alpine-node-
152
- Linux-Alpine-
153
120
  - name: Install, test, and create artifact
154
121
  uses: ./.github/actions/linux-alpine-node-14/
155
122
  env:
@@ -165,18 +132,6 @@ jobs:
165
132
  - uses: actions/checkout@v3
166
133
  with:
167
134
  submodules: true
168
- - name: Get NPM cache directory
169
- id: npm-cache
170
- run: |
171
- echo "::set-output name=dir::$(npm config get cache)"
172
- - name: Cache node modules
173
- uses: actions/cache@v3
174
- with:
175
- path: ${{steps.npm-cache.outputs.dir}}
176
- key: Linux-Alpine-node-${{hashFiles('**/package-lock.json')}}
177
- restore-keys: |
178
- Linux-Alpine-node-
179
- Linux-Alpine-
180
135
  - name: Install, test, and create artifact
181
136
  uses: ./.github/actions/linux-alpine-node-16/
182
137
  env:
@@ -192,19 +147,22 @@ jobs:
192
147
  - uses: actions/checkout@v3
193
148
  with:
194
149
  submodules: true
195
- - name: Get NPM cache directory
196
- id: npm-cache
197
- run: |
198
- echo "::set-output name=dir::$(npm config get cache)"
199
- - name: Cache node modules
200
- uses: actions/cache@v3
201
- with:
202
- path: ${{steps.npm-cache.outputs.dir}}
203
- key: Linux-Alpine-node-${{hashFiles('**/package-lock.json')}}
204
- restore-keys: |
205
- Linux-Alpine-node-
206
- Linux-Alpine-
207
150
  - name: Install, test, and create artifact
208
151
  uses: ./.github/actions/linux-alpine-node-18/
209
152
  env:
210
153
  GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
154
+
155
+ build-linux-alpine-node-19:
156
+ name: Node.js 19 on Alpine Linux
157
+ needs: create-release
158
+ runs-on: ubuntu-latest
159
+ continue-on-error: true
160
+
161
+ steps:
162
+ - uses: actions/checkout@v3
163
+ with:
164
+ submodules: true
165
+ - name: Install, test, and create artifact
166
+ uses: ./.github/actions/linux-alpine-node-19/
167
+ env:
168
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -14,7 +14,7 @@ jobs:
14
14
  strategy:
15
15
  matrix:
16
16
  os: [ubuntu-latest, macOS-latest, windows-latest]
17
- node-version: [14, 16, 18]
17
+ node-version: [14, 16, 18, 19]
18
18
  exclude:
19
19
  - os: windows-latest
20
20
  node-version: 14
@@ -27,17 +27,6 @@ jobs:
27
27
  uses: actions/setup-node@v3
28
28
  with:
29
29
  node-version: ${{matrix.node-version}}
30
- - name: Get NPM cache directory
31
- id: npm-cache
32
- run: echo "::set-output name=dir::$(npm config get cache)"
33
- - name: Cache node modules
34
- uses: actions/cache@v3
35
- with:
36
- path: ${{steps.npm-cache.outputs.dir}}
37
- key: ${{runner.os}}-node-${{hashFiles('**/package-lock.json')}}
38
- restore-keys: |
39
- ${{runner.os}}-node-
40
- ${{runner.os}}-
41
30
  - name: Install the package and run tests
42
31
  env:
43
32
  DEVELOPMENT_SKIP_GETTING_ASSET: true
@@ -45,3 +34,4 @@ jobs:
45
34
  npm i
46
35
  npm run build --if-present
47
36
  npm test
37
+ npm run ts-test
package/README.md CHANGED
@@ -352,6 +352,8 @@ console.log('re2_res : ' + re2_res); // prints: re2_res : abc,a,b,c
352
352
 
353
353
  ## Release history
354
354
 
355
+ - 1.18.0 *Modified TS bindings, added a type test (thx, [Kenichi Kamiya](https://github.com/kachick) and [Jamie Magee](https://github.com/JamieMagee)).*
356
+ - 1.17.8 *Updated deps, added Node 19 as a pre-compilation target.*
355
357
  - 1.17.7 *Added support for a cross-platform fetching of a pre-compiled version by updating [install-artifact-from-github](https://github.com/uhop/install-artifact-from-github).*
356
358
  - 1.17.6 *Implemented `dotAll`. Thx [Michael Kriese](https://github.com/viceice).*
357
359
  - 1.17.5 *Updated deps, updated test/build targets, implemented `matchAll()` (thx, [ThePendulum](https://github.com/ThePendulum) and [David Sichau](https://github.com/DavidSichau)).*
package/binding.gyp CHANGED
@@ -39,7 +39,7 @@
39
39
  "vendor/util/strutil.cc"
40
40
  ],
41
41
  "cflags": [
42
- "-std=c++14",
42
+ "-std=c++2a",
43
43
  "-Wall",
44
44
  "-Wextra",
45
45
  "-Wno-sign-compare",
@@ -59,10 +59,10 @@
59
59
  ],
60
60
  "xcode_settings": {
61
61
  "MACOSX_DEPLOYMENT_TARGET": "10.7",
62
- "CLANG_CXX_LANGUAGE_STANDARD": "c++11",
62
+ "CLANG_CXX_LANGUAGE_STANDARD": "c++2a",
63
63
  "CLANG_CXX_LIBRARY": "libc++",
64
64
  "OTHER_CFLAGS": [
65
- "-std=c++14",
65
+ "-std=c++2a",
66
66
  "-Wall",
67
67
  "-Wextra",
68
68
  "-Wno-sign-compare",
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "re2",
3
- "version": "1.17.7",
3
+ "version": "1.18.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",
7
+ "type": "commonjs",
7
8
  "main": "re2.js",
8
9
  "types": "re2.d.ts",
9
10
  "directories": {
@@ -11,14 +12,17 @@
11
12
  },
12
13
  "dependencies": {
13
14
  "install-artifact-from-github": "^1.3.1",
14
- "nan": "^2.16.0",
15
- "node-gyp": "^9.0.0"
15
+ "nan": "^2.17.0",
16
+ "node-gyp": "^9.3.0"
16
17
  },
17
18
  "devDependencies": {
18
- "heya-unit": "^0.3.0"
19
+ "@types/node": "^18.11.12",
20
+ "heya-unit": "^0.3.0",
21
+ "typescript": "^4.9.4"
19
22
  },
20
23
  "scripts": {
21
24
  "test": "node tests/tests.js",
25
+ "ts-test": "tsc",
22
26
  "save-to-github": "save-to-github-cache --artifact build/Release/re2.node",
23
27
  "install": "install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR --skip-path-var RE2_DOWNLOAD_SKIP_PATH --skip-ver-var RE2_DOWNLOAD_SKIP_VER || npm run rebuild",
24
28
  "verify-build": "node scripts/verify-build.js",
package/re2.d.ts CHANGED
@@ -1,21 +1,31 @@
1
1
  declare module 're2' {
2
2
 
3
- interface RE2MatchArray<K> extends Array<K> {
4
- index?: number;
5
- input?: K;
3
+ interface RE2BufferExecArray {
4
+ index: number;
5
+ input: Buffer;
6
+ 0: Buffer;
7
+ groups?: {
8
+ [key: string]: Buffer
9
+ }
6
10
  }
7
11
 
8
- interface RE2ExecArray<K> extends Array<K> {
9
- index: number;
10
- input: K;
12
+ interface RE2BufferMatchArray {
13
+ index?: number;
14
+ input?: Buffer;
15
+ 0: Buffer;
16
+ groups?: {
17
+ [key: string]: Buffer
18
+ }
11
19
  }
12
20
 
13
21
  interface RE2 extends RegExp {
14
- exec<K extends String | Buffer>(str: K): RE2ExecArray<K> | null;
22
+ exec(str: string): RegExpExecArray | null;
23
+ exec(str: Buffer): RE2BufferExecArray | null;
15
24
 
16
- test(str: string | Buffer): boolean;
25
+ match(str: string): RegExpMatchArray | null;
26
+ match(str: Buffer): RE2BufferMatchArray | null;
17
27
 
18
- match<K extends String | Buffer>(str: K): RE2MatchArray<K> | null;
28
+ test(str: string | Buffer): boolean;
19
29
 
20
30
  replace<K extends String | Buffer>(str: K, replaceValue: string | Buffer): K;
21
31
  replace<K extends String | Buffer>(str: K, replacer: (substring: string, ...args: any[]) => string | Buffer): K;
@@ -26,10 +36,10 @@ declare module 're2' {
26
36
  }
27
37
 
28
38
  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;
39
+ new(pattern: Buffer | RegExp | RE2 | string): RE2;
40
+ new(pattern: Buffer | string, flags?: string | Buffer): RE2;
41
+ (pattern: Buffer | RegExp | RE2 | string): RE2;
42
+ (pattern: Buffer | string, flags?: string | Buffer): RE2;
33
43
  readonly prototype: RE2;
34
44
 
35
45
  unicodeWarningLevel: 'nothing' | 'warnOnce' | 'warn' | 'throw';
package/re2.js CHANGED
@@ -19,7 +19,7 @@ if (typeof Symbol != 'undefined') {
19
19
  (RE2.prototype[Symbol.split] = function (str, limit) {
20
20
  return this.split(str, limit);
21
21
  });
22
- Symbol.matchAll &&
22
+ Symbol.matchAll &&
23
23
  (RE2.prototype[Symbol.matchAll] = function* (str) {
24
24
  if (!this.global) {
25
25
  throw TypeError('String.prototype.matchAll called with a non-global RE2 argument');
@@ -0,0 +1,28 @@
1
+ import RE2 from 're2';
2
+
3
+ function assertType<T>(_val: T) {}
4
+
5
+ function test_execTypes() {
6
+ const re = new RE2('quick\\s(brown).+?(?<verb>jumps)', 'ig');
7
+ const result = re.exec('The Quick Brown Fox Jumps Over The Lazy Dog')
8
+ if (!(result && result.groups)) {
9
+ throw 'Unexpected Result'
10
+ }
11
+ assertType<number>(result.index)
12
+ assertType<string>(result.input)
13
+ assertType<string | undefined>(result.groups['verb'])
14
+ }
15
+
16
+ function test_matchTypes() {
17
+ const re = new RE2('quick\\s(brown).+?(?<verb>jumps)', 'ig');
18
+ const result = re.match('The Quick Brown Fox Jumps Over The Lazy Dog')
19
+ if (!(result && result.index && result.input && result.groups)) {
20
+ throw 'Unexpected Result'
21
+ }
22
+ assertType<number>(result.index)
23
+ assertType<string>(result.input)
24
+ assertType<string | undefined>(result.groups['verb'])
25
+ }
26
+
27
+ test_execTypes()
28
+ test_matchTypes()
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "noEmit": true,
4
+ "declaration": true,
5
+ "esModuleInterop": true,
6
+ "strict": true,
7
+ "allowUnusedLabels": false,
8
+ "allowUnreachableCode": false,
9
+ "exactOptionalPropertyTypes": true,
10
+ "noFallthroughCasesInSwitch": true,
11
+ "noImplicitOverride": true,
12
+ "noImplicitReturns": true,
13
+ "noPropertyAccessFromIndexSignature": true,
14
+ "noUncheckedIndexedAccess": true,
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+
18
+ },
19
+ "include": ["**/*.ts"]
20
+ }