From 5a82d4ff2a05d51283ae57368bdb1fd7bcf805f0 Mon Sep 17 00:00:00 2001 From: Zixuan Liu Date: Fri, 13 May 2022 23:20:51 +0800 Subject: [PATCH] fix: enable esModuleInterop support Signed-off-by: Zixuan Liu --- src/persist/helper.ts | 2 +- src/util/builtinOperators.ts | 4 ++-- tsconfig.json | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/persist/helper.ts b/src/persist/helper.ts index bc659f8c..403c3bd4 100644 --- a/src/persist/helper.ts +++ b/src/persist/helper.ts @@ -1,5 +1,5 @@ import { Model } from '../model'; -import * as parse from 'csv-parse/lib/sync'; +import parse from 'csv-parse/lib/sync'; export class Helper { public static loadPolicyLine(line: string, model: Model): void { diff --git a/src/util/builtinOperators.ts b/src/util/builtinOperators.ts index cd1df513..7f90b9c3 100644 --- a/src/util/builtinOperators.ts +++ b/src/util/builtinOperators.ts @@ -14,7 +14,7 @@ import * as rbac from '../rbac'; import { ip } from './ip'; -import * as picomatch from 'picomatch'; +import { isMatch } from 'picomatch'; // regexMatch determines whether key1 matches the pattern of key2 in regular expression. function regexMatch(key1: string, key2: string): boolean { @@ -305,7 +305,7 @@ function ipMatchFunc(...args: any[]): boolean { * ``` */ function globMatch(string: string, pattern: string): boolean { - return picomatch(pattern)(string); + return isMatch(string, pattern); } // generateGFunction is the factory method of the g(_, _) function. diff --git a/tsconfig.json b/tsconfig.json index ee1a6848..358d51cc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,8 @@ "strictPropertyInitialization": false, "declaration": true, "downlevelIteration": true, - "allowSyntheticDefaultImports": true + "allowSyntheticDefaultImports": true, + "esModuleInterop": true }, "include": ["src/**/*"] }