Skip to content

Commit e3ef0dd

Browse files
Switch to re2-wasm (#467)
re2 uses a native module that has a normal dependency on node-gyp, which bloats the installed size of a service and requires special care when packaging. re2-wasm has no dependencies, and while it is not officially supported, it is used by grpc-node's grpc-js-xds package.
1 parent 1634755 commit e3ef0dd

File tree

3 files changed

+722
-923
lines changed

3 files changed

+722
-923
lines changed

smithy-typescript-ssdk-libs/server-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@aws-sdk/smithy-client": "3.38.0",
2424
"@aws-sdk/types": "3.38.0",
2525
"tslib": "^1.8.0",
26-
"re2": "^1.16.0"
26+
"re2-wasm": "^1.0.2"
2727
},
2828
"devDependencies": {
2929
"@types/jest": "^26.0.22",

smithy-typescript-ssdk-libs/server-common/src/validation/validators.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
import RE2 from "re2";
16+
import { RE2 } from "re2-wasm";
1717

1818
import {
1919
EnumValidationFailure,
@@ -271,7 +271,7 @@ export class PatternValidator implements SingleConstraintValidator<string, Patte
271271
return null;
272272
}
273273

274-
if (!input.match(this.pattern)) {
274+
if (!this.pattern.match(input)) {
275275
return {
276276
constraintType: "pattern",
277277
constraintValues: this.inputPattern,

0 commit comments

Comments
 (0)