Skip to content

Commit

Permalink
Merge pull request #4 from kawanet/0.10.6
Browse files Browse the repository at this point in the history
0.10.6 TS7016 / TS2365
  • Loading branch information
kawanet committed Aug 20, 2023
2 parents a021225 + d47976a commit 7543e5a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 14, 16, 18, 19 ]
node-version: [ 16, 18, 20 ]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ALL=\

all: $(ALL)

# ES5 - CommonJS for browsers
dist/sha256-uint8array.min.js: build/bundle.js
@mkdir -p dist
node_modules/.bin/terser -c -m --mangle-props "regex=/^_/" --ecma 5 -o $@ $<
Expand All @@ -18,12 +19,15 @@ build/bundle.js: build/es5/sha256-uint8array.js
echo '})(SHA256)' >> $@
perl -i -pe 's#^("use strict"|Object.defineProperty|exports.*= void 0)#// $$&#' $@

# ES5 - CommonJS
build/es5/%.js: lib/%.ts
node_modules/.bin/tsc -p tsconfig-es5.json

# ES2021 - ES Module
build/esm/%.js:
node_modules/.bin/tsc -p tsconfig-esm.json

# ES2021 - ES Module
dist/%.mjs: build/esm/%.js
cp $^ $@

Expand All @@ -33,11 +37,12 @@ build/test.js: all
node_modules/.bin/browserify -o $@ test/*.js \
-t [ browserify-sed 's#(require\("(?:../)+)("\))#$$1browser/import$$2#' ]

# ES2021 - CommonJS
lib/%.js: lib/%.ts
node_modules/.bin/tsc -p tsconfig.json

clean:
/bin/rm -fr build dist/*.js lib/*.js test/*.js
/bin/rm -fr $(ALL) build/ lib/*.js test/*.js

sizes:
wc -c dist/sha256-uint8array.min.js
Expand Down
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sha256-uint8array",
"description": "Fast SHA-256 digest hash based on Uint8Array, pure JavaScript.",
"version": "0.10.5",
"version": "0.10.6",
"author": "Yusuke Kawasaki <u-suke@kawa.net>",
"bugs": {
"url": "https://github.com/kawanet/sha256-uint8array/issues"
Expand All @@ -19,15 +19,20 @@
"crypto-js": "^4.1.1",
"hash.js": "^1.1.7",
"jshashes": "^1.0.8",
"jssha": "^3.3.0",
"jssha": "^3.3.1",
"mocha": "^10.2.0",
"sha.js": "^2.4.11",
"terser": "^5.16.4",
"typescript": "^4.9.5"
"terser": "^5.19.2",
"typescript": "^5.1.6"
},
"exports": {
"require": "./lib/sha256-uint8array.js",
"import": "./dist/sha256-uint8array.mjs"
".": {
"require": "./lib/sha256-uint8array.js",
"import": {
"default": "./dist/sha256-uint8array.mjs",
"types": "./types/sha256-uint8array.d.ts"
}
}
},
"files": [
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion test/99.benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const TITLE = __filename.split("/").pop()!!;

const isBrowser = ("undefined" !== typeof window);
const isLegacy = ("function" !== typeof TextEncoder);
const REPEAT = process.env.REPEAT || (isBrowser ? (isLegacy ? 1000 : 10000) : 10000);
const REPEAT = +(process.env.REPEAT || (isBrowser ? (isLegacy ? 1000 : 10000) : 10000));
const SLEEP = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
const stringToArray = (str: string) => [].map.call(unescape(encodeURIComponent(str)), (c: string) => c.charCodeAt(0))

Expand Down
2 changes: 1 addition & 1 deletion tsconfig-esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"removeComments": false,
"skipLibCheck": true,
"strictNullChecks": true,
"target": "ES2020"
"target": "ES2021"
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"removeComments": false,
"skipLibCheck": true,
"strictNullChecks": true,
"target": "ES2020"
"target": "ES2021"
}
}

0 comments on commit 7543e5a

Please sign in to comment.