diff --git a/.changeset/angry-rabbits-refuse.md b/.changeset/angry-rabbits-refuse.md new file mode 100644 index 000000000..58c94eae8 --- /dev/null +++ b/.changeset/angry-rabbits-refuse.md @@ -0,0 +1,5 @@ +--- +"@ckb-lumos/base": minor +--- + +**BREAKING CHANGE**: remove unused `isDeepEqual` function to reduce the package size diff --git a/packages/base/package.json b/packages/base/package.json index 154755da1..6d2aff77f 100644 --- a/packages/base/package.json +++ b/packages/base/package.json @@ -50,11 +50,11 @@ "@types/blake2b": "^2.1.0", "@types/lodash.isequal": "^4.5.5", "blake2b": "^2.1.3", - "js-xxhash": "^1.0.4", - "lodash.isequal": "^4.5.0" + "js-xxhash": "^1.0.4" }, "devDependencies": { - "jsbi": "^4.1.0" + "jsbi": "^4.1.0", + "lodash.isequal": "^4.5.0" }, "publishConfig": { "access": "public" diff --git a/packages/base/src/utils.ts b/packages/base/src/utils.ts index 7c269e4a2..b952803b0 100644 --- a/packages/base/src/utils.ts +++ b/packages/base/src/utils.ts @@ -1,5 +1,4 @@ import blake2b, { Blake2b } from "blake2b"; -import isEqual from "lodash.isequal"; import { xxHash32 } from "js-xxhash"; import { bytes, number, BytesLike } from "@ckb-lumos/codec"; import { BI, BIish } from "@ckb-lumos/bi"; @@ -149,10 +148,6 @@ function assertHexadecimal(debugPath: string, str: string): void { } } -// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types -function isDeepEqual(a: any, b: any): boolean { - return isEqual(a, b); -} // Buffer.from('TYPE_ID') const TYPE_ID_CODE_HASH = "0x00000000000000000000000000000000000000000000000000545950455f4944"; @@ -272,6 +267,5 @@ export { hashCode, assertHexString, assertHexadecimal, - isDeepEqual, generateTypeIdScript, }; diff --git a/packages/base/tests/since.test.js b/packages/base/tests/since.test.js index bfff204a9..33a6e6e25 100644 --- a/packages/base/tests/since.test.js +++ b/packages/base/tests/since.test.js @@ -1,7 +1,8 @@ const test = require("ava"); +const isEqual = require("lodash.isequal"); const { BI } = require("@ckb-lumos/bi"); -const { since, utils } = require("../src"); +const { since } = require("../src"); const { parseSinceCompatible, @@ -91,7 +92,7 @@ test.before(() => { test("parsedSince", (t) => { fixtrues.forEach((v) => { const parsed = parseSinceCompatible(v.since); - t.true(utils.isDeepEqual(parsed, v.parsed)); + t.true(isEqual(parsed, v.parsed)); }); }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3e989cd0d..098b65758 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -143,13 +143,13 @@ importers: js-xxhash: specifier: ^1.0.4 version: 1.0.4 - lodash.isequal: - specifier: ^4.5.0 - version: 4.5.0 devDependencies: jsbi: specifier: ^4.1.0 version: 4.3.0 + lodash.isequal: + specifier: ^4.5.0 + version: 4.5.0 packages/bi: dependencies: @@ -11493,7 +11493,7 @@ packages: /lodash.isequal@4.5.0: resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} - dev: false + dev: true /lodash.memoize@4.1.2: resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==}