From 3fb31b316b8f4d699d087e1b465e908688be3872 Mon Sep 17 00:00:00 2001 From: Jonas Gloning <34194370+jonasgloning@users.noreply.github.com> Date: Sat, 9 Mar 2024 09:45:22 +0100 Subject: [PATCH] fix: remove need for `unsafe-eval` As we are still using `commonjs` in our `tsconfig.json` this commit uses `#paths` to overwrite the import path for the types only. The types are the same now, but could theoretically drift in the future. --- lib/dataconnection/StreamConnection/Cbor.ts | 2 +- tsconfig.json | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/dataconnection/StreamConnection/Cbor.ts b/lib/dataconnection/StreamConnection/Cbor.ts index 523fdf0a2..c0b93f0c1 100644 --- a/lib/dataconnection/StreamConnection/Cbor.ts +++ b/lib/dataconnection/StreamConnection/Cbor.ts @@ -1,5 +1,5 @@ import type { Peer } from "../../peer.js"; -import { Decoder, Encoder } from "cbor-x"; +import { Decoder, Encoder } from "cbor-x/index-no-eval"; import { StreamConnection } from "./StreamConnection.js"; const NullValue = Symbol.for(null); diff --git a/tsconfig.json b/tsconfig.json index 7fabb216b..8d0d774ce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,10 @@ "skipLibCheck": true, "isolatedModules": true, "resolveJsonModule": true, - "lib": ["es2020", "dom"] + "lib": ["es2020", "dom"], + "paths": { + "cbor-x/index-no-eval": ["./node_modules/cbor-x"] + } }, "exclude": ["node_modules", "dist", "e2e"] }