From 6f10632ac09e820a8fd1617c1a680c233efb451e Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Fri, 2 Jun 2023 15:16:56 +0000 Subject: [PATCH] Add build directory that allows to test tree-shaking --- build/README.md | 7 +++++++ build/input.js | 11 +++++++++++ build/package.json | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 build/README.md create mode 100644 build/input.js create mode 100644 build/package.json diff --git a/build/README.md b/build/README.md new file mode 100644 index 0000000..2c30e68 --- /dev/null +++ b/build/README.md @@ -0,0 +1,7 @@ +# build + +The directory is used to build a single file `noble-curves.js` which contains everything. + +The output file uses iife wrapper and can be used in browsers as-is. + +Don't use it unless you can't use NPM/ESM, which support tree shaking. diff --git a/build/input.js b/build/input.js new file mode 100644 index 0000000..c08fbee --- /dev/null +++ b/build/input.js @@ -0,0 +1,11 @@ +import { bytesToHex, concatBytes, hexToBytes } from '@noble/curves/abstract/utils'; + +export { secp256k1 } from '@noble/curves/secp256k1'; +export { ed25519, x25519 } from '@noble/curves/ed25519'; +export { ed448, x448 } from '@noble/curves/ed448'; +export { p256 } from '@noble/curves/p256'; +export { p384 } from '@noble/curves/p384'; +export { p521 } from '@noble/curves/p521'; +export { bls12_381 } from '@noble/curves/bls12-381'; + +export const utils = { bytesToHex, concatBytes, hexToBytes }; diff --git a/build/package.json b/build/package.json new file mode 100644 index 0000000..13bb4a7 --- /dev/null +++ b/build/package.json @@ -0,0 +1,18 @@ +{ + "name": "build", + "private": true, + "version": "1.0.0", + "description": "Used to build a single file", + "main": "input.js", + "keywords": [], + "type": "module", + "author": "", + "license": "MIT", + "devDependencies": { + "@noble/curves": "..", + "esbuild": "0.17.19" + }, + "scripts": { + "build": "npx esbuild --bundle input.js --outfile=noble-curves.js --global-name=nobleCurves" + } +}