Skip to content

Commit 159d5af

Browse files
committed
fix: don't return
1 parent f9d7872 commit 159d5af

File tree

6 files changed

+18
-13
lines changed

6 files changed

+18
-13
lines changed

build.ts

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1-
import type { BuildConfig } from "bun";
21
import dts from "bun-plugin-dts";
32
import { build } from "esbuild";
43

5-
const defaultBuildConfig: BuildConfig = {
6-
entrypoints: ["./src/index.ts"],
7-
outdir: "./dist",
8-
};
9-
104
// Build ESM version
11-
await Bun.build({
12-
...defaultBuildConfig,
5+
await build({
6+
entryPoints: ["./src/index.ts"],
7+
outfile: "./dist/index.js",
138
format: "esm",
14-
naming: "[dir]/[name].js",
9+
platform: "node",
10+
bundle: true,
11+
external: ["node:crypto"], // Mark node built-ins as external
1512
});
1613

17-
// Build CJS version using esbuild
14+
// Build CJS version
1815
await build({
1916
entryPoints: ["./src/index.ts"],
2017
outfile: "./dist/index.cjs",
2118
format: "cjs",
2219
platform: "node",
2320
bundle: true,
21+
external: ["node:crypto"],
2422
});
2523

2624
// Build type declarations
2725
await Bun.build({
28-
...defaultBuildConfig,
26+
entrypoints: ["./src/index.ts"],
27+
outdir: "./dist",
2928
plugins: [dts()],
3029
});

bun.lockb

0 Bytes
Binary file not shown.

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from "./srp";
2+
export * from "./utils";

src/srp/srpClient.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class SrpClient {
2626
private badState = false;
2727

2828
constructor(group: SrpGroup, v: BigInteger, k?: BigInteger) {
29-
return this.newSrp(group, v, k);
29+
this.newSrp(group, v, k);
3030
}
3131

3232
private newSrp(group: SrpGroup, xORv: BigInteger, k?: BigInteger) {
@@ -39,7 +39,6 @@ export class SrpClient {
3939
}
4040
this.generateMySecret();
4141
this.makeA();
42-
return this;
4342
}
4443

4544
private makeLittleK(): BigInteger {

src/utils/bigint.ts

+4
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ export const maxInt = (n1: number, ...nums: number[]): number => {
2424
}
2525
return max;
2626
};
27+
28+
export const uint8ArrayToBigInt = (arr: Uint8Array): BigInteger => {
29+
return new BigInteger([...arr]);
30+
};

src/utils/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { uint8ArrayToBigInt } from "./bigint";
2+
export { uint8ArrayToBigInt };

0 commit comments

Comments
 (0)