diff --git a/.babelrc b/.babelrc index ff3059c..af2f565 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,3 @@ { - "presets": ["@babel/preset-env"] + "presets": [["@babel/preset-env", { "modules": "cjs" }]] } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 75efc66..e6c6c72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "rustbn-wasm", - "version": "0.2.0", + "version": "0.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "rustbn-wasm", - "version": "0.2.0", + "version": "0.3.0", "license": "(MIT OR Apache-2.0)", "dependencies": { - "@scure/base": "^1.1.1" + "@scure/base": "^1.1.5" }, "devDependencies": { "@babel/cli": "^7.23.9", @@ -2629,15 +2629,12 @@ ] }, "node_modules/@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", + "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==", + "funding": { + "url": "https://paulmillr.com/funding/" + } }, "node_modules/@sinclair/typebox": { "version": "0.27.8", @@ -10525,9 +10522,9 @@ "optional": true }, "@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==" + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", + "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==" }, "@sinclair/typebox": { "version": "0.27.8", diff --git a/package.json b/package.json index 7955050..e55cea8 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,9 @@ }, "license": "(MIT OR Apache-2.0)", "scripts": { - "build:node": "babel dist/esm -d dist/cjs", + "build:node": "babel dist/esm --out-dir dist/cjs", "build:esm": "tsc", - "build": "rm -rf dist && scripts/ts-build.sh", + "build": "rm -rf dist && npm run build:esm && npm run build:node && cp dist/esm/*.map dist/cjs && cp dist/esm/*.d.ts dist/cjs", "prepare": "npm run build", "test": "vitest run test/*", "wasm2b64": "node scripts/wasmToB64.js" diff --git a/scripts/ts-build.sh b/scripts/ts-build.sh index 87127cf..922aa74 100755 --- a/scripts/ts-build.sh +++ b/scripts/ts-build.sh @@ -46,9 +46,11 @@ EOT echo "> npm run build:node" printf "${BLUE}[Node build] Working... " - npm run build:node cp dist/esm/*.map dist/cjs cp dist/esm/*.d.ts dist/cjs + + npm run build:node + green "DONE" echo "\n"; diff --git a/src.ts/rustbn.d.ts b/src.ts/rustbn.d.ts deleted file mode 100644 index bc7d0d6..0000000 --- a/src.ts/rustbn.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * @param {string} input_hex - * @returns {string} - */ -export function ec_mul(input_hex: string): string -/** - * @param {string} input_str - * @returns {string} - */ -export function ec_add(input_str: string): string -/** - * @param {string} input_str - * @returns {string} - */ -export function ec_pairing(input_str: string): string diff --git a/src.ts/rustbn_bg.wasm.d.ts b/src.ts/rustbn_bg.wasm.d.ts deleted file mode 100644 index f1ca45e..0000000 --- a/src.ts/rustbn_bg.wasm.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export const memory: WebAssembly.Memory -export function ec_mul(a: number, b: number, c: number): void -export function ec_add(a: number, b: number, c: number): void -export function ec_pairing(a: number, b: number, c: number): void -export function __wbindgen_add_to_stack_pointer(a: number): number -export function __wbindgen_malloc(a: number, b: number): number -export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number -export function __wbindgen_free(a: number, b: number, c: number): void