From e3acaf925d6978098ec035c752e64a7c11e83fd5 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Mon, 25 Jan 2021 14:44:58 -0800 Subject: [PATCH] Remove JSBI No longer needed as most browsers have BigInt support now. --- build/build.ts | 4 +- lib/common/bigint-jsbi.ts | 108 -------------------------------------- npm-shrinkwrap.json | 3 +- package.json | 1 - 4 files changed, 3 insertions(+), 113 deletions(-) delete mode 100644 lib/common/bigint-jsbi.ts diff --git a/build/build.ts b/build/build.ts index 8f59cec..73f29c8 100644 --- a/build/build.ts +++ b/build/build.ts @@ -293,11 +293,9 @@ async function generateFrontendJs(externals: string[]): Promise { const p = path.resolve(path.dirname(importer), importee); if (p === path.resolve(INPUT_DIR, "package.json")) return path.resolve(OUTPUT_DIR, "package.json"); - } else if (importee.endsWith("/bigint")) { - return this.resolve(importee + "-jsbi", importer); } else if (importee === "espresso-iisojs") { return this.resolve( - "espresso-iisojs/dist/espresso-iisojs-jsbi.mjs", + "espresso-iisojs/dist/espresso-iisojs.mjs", importer ); } diff --git a/lib/common/bigint-jsbi.ts b/lib/common/bigint-jsbi.ts deleted file mode 100644 index defc9d7..0000000 --- a/lib/common/bigint-jsbi.ts +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright 2013-2020 GenieACS Inc. - * - * This file is part of GenieACS. - * - * GenieACS is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * GenieACS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with GenieACS. If not, see . - */ - -import JSBI from "jsbi"; - -export function and(a: JSBI, b: JSBI): JSBI { - return JSBI.bitwiseAnd(a, b); -} - -export function or(a: JSBI, b: JSBI): JSBI { - return JSBI.bitwiseOr(a, b); -} - -export function xor(a: JSBI, b: JSBI): JSBI { - return JSBI.bitwiseXor(a, b); -} - -export function not(a: JSBI): JSBI { - return JSBI.bitwiseNot(a); -} - -export function lshift(a: JSBI, b: JSBI): JSBI { - return JSBI.leftShift(a, b); -} - -export function rshift(a: JSBI, b: JSBI): JSBI { - return JSBI.signedRightShift(a, b); -} - -export function add(a: JSBI, b: JSBI): JSBI { - return JSBI.add(a, b); -} - -export function sub(a: JSBI, b: JSBI): JSBI { - return JSBI.subtract(a, b); -} - -export function mul(a: JSBI, b: JSBI): JSBI { - return JSBI.multiply(a, b); -} - -export function div(a: JSBI, b: JSBI): JSBI { - return JSBI.divide(a, b); -} - -export function exp(a: JSBI, b: JSBI): JSBI { - return JSBI.exponentiate(a, b); -} - -export function rem(a: JSBI, b: JSBI): JSBI { - return JSBI.remainder(a, b); -} - -export function toNumber(a: JSBI): number { - return JSBI.toNumber(a); -} - -export function eq(a: JSBI, b: JSBI): boolean { - return JSBI.equal(a, b); -} - -export function ne(a: JSBI, b: JSBI): boolean { - return JSBI.notEqual(a, b); -} - -export function lt(a: JSBI, b: JSBI): boolean { - return JSBI.lessThan(a, b); -} - -export function lte(a: JSBI, b: JSBI): boolean { - return JSBI.lessThanOrEqual(a, b); -} - -export function gt(a: JSBI, b: JSBI): boolean { - return JSBI.greaterThan(a, b); -} - -export function gte(a: JSBI, b: JSBI): boolean { - return JSBI.greaterThanOrEqual(a, b); -} - -export function asUintN(a: number, b: JSBI): JSBI { - return JSBI.asUintN(a, b); -} - -export function asIntN(a: number, b: JSBI): JSBI { - return JSBI.asIntN(a, b); -} - -const _BigInt = JSBI.BigInt; -type _bigint = JSBI; -export { _BigInt as BigInt, _bigint as bigint }; diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index c03d456..e41ea11 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -3303,7 +3303,8 @@ "jsbi": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-3.1.4.tgz", - "integrity": "sha512-52QRRFSsi9impURE8ZUbzAMCLjPm4THO7H2fcuIvaaeFTbSysvkodbQQXIVsNgq/ypDbq6dJiuGKL0vZ/i9hUg==" + "integrity": "sha512-52QRRFSsi9impURE8ZUbzAMCLjPm4THO7H2fcuIvaaeFTbSysvkodbQQXIVsNgq/ypDbq6dJiuGKL0vZ/i9hUg==", + "optional": true }, "json-buffer": { "version": "3.0.0", diff --git a/package.json b/package.json index b8a5228..16b8bf3 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,6 @@ "eslint": "^7.12.1", "eslint-config-prettier": "^6.14.0", "esm": "^3.2.25", - "jsbi": "^3.1.4", "mithril": "^2.0.4", "postcss": "^8.1.4", "postcss-import": "^13.0.0",