From 4a8f447c8d15748d6ee3cd532355b354a5795137 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Fri, 3 Mar 2023 01:09:36 +0000 Subject: [PATCH] package.json, tsconfig: remove common.js support. Pure ESM now --- package.json | 28 +++------------------------- tsconfig.esm.json | 20 -------------------- tsconfig.json | 6 +++--- 3 files changed, 6 insertions(+), 48 deletions(-) delete mode 100644 tsconfig.esm.json diff --git a/package.json b/package.json index 7850b87..eeb0c88 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "Minimal, auditable JS implementation of elliptic curve cryptography", "files": [ "abstract", - "esm", "src", "*.js", "*.js.map", @@ -13,7 +12,8 @@ ], "scripts": { "bench": "cd benchmark; node secp256k1.js; node curves.js; node ecdh.js; node stark.js; node bls.js", - "build": "tsc && tsc -p tsconfig.esm.json", + "build": "tsc", + "build:clean": "rm *.{js,d.ts,js.map} esm/*.{js,js.map} 2> /dev/null", "build:release": "rollup -c rollup.config.js", "lint": "prettier --check 'src/**/*.{js,ts}' 'test/*.js'", "format": "prettier --write 'src/**/*.{js,ts}' 'test/*.js'", @@ -40,120 +40,98 @@ "typescript": "4.7.3" }, "main": "index.js", + "type": "module", "exports": { ".": { "types": "./index.d.ts", - "import": "./esm/index.js", "default": "./index.js" }, "./abstract/edwards": { "types": "./abstract/edwards.d.ts", - "import": "./esm/abstract/edwards.js", "default": "./abstract/edwards.js" }, "./abstract/modular": { "types": "./abstract/modular.d.ts", - "import": "./esm/abstract/modular.js", "default": "./abstract/modular.js" }, "./abstract/montgomery": { "types": "./abstract/montgomery.d.ts", - "import": "./esm/abstract/montgomery.js", "default": "./abstract/montgomery.js" }, "./abstract/weierstrass": { "types": "./abstract/weierstrass.d.ts", - "import": "./esm/abstract/weierstrass.js", "default": "./abstract/weierstrass.js" }, "./abstract/bls": { "types": "./abstract/bls.d.ts", - "import": "./esm/abstract/bls.js", "default": "./abstract/bls.js" }, "./abstract/hash-to-curve": { "types": "./abstract/hash-to-curve.d.ts", - "import": "./esm/abstract/hash-to-curve.js", "default": "./abstract/hash-to-curve.js" }, "./abstract/curve": { "types": "./abstract/curve.d.ts", - "import": "./esm/abstract/curve.js", "default": "./abstract/curve.js" }, "./abstract/utils": { "types": "./abstract/utils.d.ts", - "import": "./esm/abstract/utils.js", "default": "./abstract/utils.js" }, "./abstract/poseidon": { "types": "./abstract/poseidon.d.ts", - "import": "./esm/abstract/poseidon.js", "default": "./abstract/poseidon.js" }, "./_shortw_utils": { "types": "./_shortw_utils.d.ts", - "import": "./esm/_shortw_utils.js", "default": "./_shortw_utils.js" }, "./bls12-381": { "types": "./bls12-381.d.ts", - "import": "./esm/bls12-381.js", "default": "./bls12-381.js" }, "./bn": { "types": "./bn.d.ts", - "import": "./esm/bn.js", "default": "./bn.js" }, "./ed25519": { "types": "./ed25519.d.ts", - "import": "./esm/ed25519.js", "default": "./ed25519.js" }, "./ed448": { "types": "./ed448.d.ts", - "import": "./esm/ed448.js", "default": "./ed448.js" }, "./index": { "types": "./index.d.ts", - "import": "./esm/index.js", "default": "./index.js" }, "./jubjub": { "types": "./jubjub.d.ts", - "import": "./esm/jubjub.js", "default": "./jubjub.js" }, "./p256": { "types": "./p256.d.ts", - "import": "./esm/p256.js", "default": "./p256.js" }, "./p384": { "types": "./p384.d.ts", - "import": "./esm/p384.js", "default": "./p384.js" }, "./p521": { "types": "./p521.d.ts", - "import": "./esm/p521.js", "default": "./p521.js" }, "./pasta": { "types": "./pasta.d.ts", - "import": "./esm/pasta.js", "default": "./pasta.js" }, "./secp256k1": { "types": "./secp256k1.d.ts", - "import": "./esm/secp256k1.js", "default": "./secp256k1.js" }, "./stark": { "types": "./stark.d.ts", - "import": "./esm/stark.js", "default": "./stark.js" } }, diff --git a/tsconfig.esm.json b/tsconfig.esm.json deleted file mode 100644 index 51b7e07..0000000 --- a/tsconfig.esm.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "outDir": "esm", - "target": "es2020", - "module": "es6", - "moduleResolution": "node16", - "noUnusedLocals": true, - "sourceMap": true, - "baseUrl": ".", - "paths": { - "@noble/hashes/crypto": [ "src/crypto" ] - }, - }, - "include": ["src"], - "exclude": [ - "node_modules", - "lib", - ], -} diff --git a/tsconfig.json b/tsconfig.json index 720577e..26be7a0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,12 +3,12 @@ "strict": true, "declaration": true, "declarationMap": true, + "sourceMap": true, "outDir": ".", "target": "es2020", "lib": ["es2020"], // Set explicitly to remove DOM - "sourceMap": true, - "module": "commonjs", - "moduleResolution": "node", + "module": "es6", + "moduleResolution": "node16", "noUnusedLocals": true, "baseUrl": ".", },