From 02fa53039598e2efa6ce401a48d59af8e1362134 Mon Sep 17 00:00:00 2001 From: RSoraM Date: Wed, 11 Dec 2024 19:41:09 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20update=20build=20configura?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit unbuilt后执行tsc ✅ Closes: #1 --- build.config.ts | 1 + package.json | 3 ++- src/hash/keccak1600.ts | 5 +++-- tsconfig.json | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build.config.ts b/build.config.ts index 7a5f019..ed8f1e3 100644 --- a/build.config.ts +++ b/build.config.ts @@ -1,6 +1,7 @@ import { defineBuildConfig } from 'unbuild' export default defineBuildConfig({ + failOnWarn: false, entries: [ 'src/index', ], diff --git a/package.json b/package.json index 0da4536..afdbf32 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "require": "./dist/index.cjs" } }, - "main": "./dist/index.mjs", + "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "typesVersions": { @@ -57,6 +57,7 @@ ], "scripts": { "build": "unbuild", + "postbuild": "tsc", "dev": "unbuild --stub", "lint": "eslint .", "prepublishOnly": "nr build", diff --git a/src/hash/keccak1600.ts b/src/hash/keccak1600.ts index 75eac20..38397c3 100644 --- a/src/hash/keccak1600.ts +++ b/src/hash/keccak1600.ts @@ -4,14 +4,14 @@ import { KitError, rotateL64 } from '../core/utils' // * Constants -export const PERMUTATION: KeccakConfig = { +export const PERMUTATION: KeccakConfig = Object.freeze({ b: 1600, bByte: 200, w: 64, wByte: 8, l: 6, nr: 24, -} +}) /** * FIPS.202 3.2.2 @@ -222,6 +222,7 @@ export function Keccak_p_1600(nr?: number) { * @param {Uint8Array} S - 状态 */ return (S: Uint8Array) => { + nr = nr || PERMUTATION.nr if (S.byteLength !== PERMUTATION.bByte) { throw new KitError('Invalid state size') } diff --git a/tsconfig.json b/tsconfig.json index f00409a..3324aa4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,8 +10,10 @@ ], "strict": true, "strictNullChecks": true, + "outDir": "dist", "esModuleInterop": true, "skipDefaultLibCheck": true, "skipLibCheck": true - } + }, + "include": ["src/index.ts"] }