From 738b2b67c6369381a34a2fe01a978249205c5802 Mon Sep 17 00:00:00 2001 From: Tony Lau <38905739+lht102@users.noreply.github.com> Date: Sun, 20 Oct 2024 09:16:20 +0800 Subject: [PATCH] feat: use `import { Buffer } from 'buffer/'` to be compatible with Bun (#486) * fix: import buffer module with trailing slash * fix: remove unnecessary import for buffer module --- src/persist/fileSystem.ts | 1 - src/util/ip.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/persist/fileSystem.ts b/src/persist/fileSystem.ts index 6d433ab7..736184bb 100644 --- a/src/persist/fileSystem.ts +++ b/src/persist/fileSystem.ts @@ -1,4 +1,3 @@ -import { Buffer } from 'buffer'; export interface FileSystem { readFileSync(path: string, encoding?: string): Buffer | string; writeFileSync(path: string, text: string, encoding?: string): void; diff --git a/src/util/ip.ts b/src/util/ip.ts index 3f0975ca..855055d7 100644 --- a/src/util/ip.ts +++ b/src/util/ip.ts @@ -26,7 +26,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -import { Buffer } from 'buffer'; +import { Buffer } from 'buffer/'; const ipv4Regex = /^(\d{1,3}\.){3,3}\d{1,3}$/; const ipv6Regex = /^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;