Skip to content

Commit

Permalink
feat: use rollup and remove Buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Nesopie committed Aug 18, 2024
1 parent 5187ba2 commit 3793ddf
Show file tree
Hide file tree
Showing 90 changed files with 43,977 additions and 20,794 deletions.
693 changes: 669 additions & 24 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 17 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
"version": "3.1.0",
"description": "Bitcoin BIP39: Mnemonic code for generating deterministic keys",
"type": "module",
"main": "src/cjs/index.cjs",
"module": "src/esm/index.js",
"types": "src/cjs/index.d.ts",
"exports": {
".": {
"types": "./src/index.d.ts",
"import": "./src/index.js"
"types": "./src/cjs/index.d.ts",
"import": "./src/esm/index.js",
"require": "./src/cjs/index.cjs"
},
"./wordlists": {
"import": "./src/wordlists"
Expand Down Expand Up @@ -43,7 +47,7 @@
}
},
"scripts": {
"build": "npm run clean && tsc -p tsconfig.json",
"build": "rollup -c rollup.config.ts --configPlugin typescript",
"clean": "rm -rf src",
"coverage": "nyc --branches 85 --functions 100 --check-coverage npm run unit",
"format": "npm run prettier -- --write",
Expand Down Expand Up @@ -72,16 +76,23 @@
"src"
],
"dependencies": {
"@noble/hashes": "^1.2.0"
"@noble/hashes": "^1.2.0",
"uint8array-tools": "^0.0.8"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@types/node": "11.11.6",
"node-fetch": "2.6.9",
"nyc": "^15.0.0",
"prettier": "1.16.4",
"proxyquire": "^1.7.10",
"rollup": "^4.9.6",
"tape": "^5.3.0",
"tslint": "^6.1.0",
"typescript": "3.3.4000"
}
"typescript": "5.0.4"
},
"sideEffects": false
}
42 changes: 42 additions & 0 deletions rollup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import commonjs from '@rollup/plugin-commonjs'
import nodeResolve from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import terser from '@rollup/plugin-terser';


const treeshake = {
moduleSideEffects : false,
propertyReadSideEffects : false,
tryCatchDeoptimization : false
}

const onwarn = (warning) => {
if (
warning.code === 'INVALID_ANNOTATION' &&
warning.message.includes('@__PURE__')
) {
return
}
throw new Error(warning)
}

export default {
plugins: [ typescript(), nodeResolve(), commonjs() ],
input: 'ts_src/index.ts',
onwarn,
output: [
{
file: 'src/cjs/index.cjs',
format: 'cjs',
sourcemap: true,
},
{
file: 'src/esm/index.js',
format: 'es',
sourcemap: true,
minifyInternalExports: false
}
],
strictDeprecations: true,
treeshake
}
Loading

0 comments on commit 3793ddf

Please sign in to comment.