Tweaks and upgrade karma/webpack
This commit is contained in:
parent
8e8447d2f9
commit
7c2e883527
|
@ -4,17 +4,26 @@ const webpackConfig = require("./webpack.config.cjs");
|
|||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: "",
|
||||
frameworks: ["mocha", "chai"],
|
||||
files: ["test/unit-web/run-web-implementation.test.ts", "test/unit/index-named-exports.test.ts"],
|
||||
frameworks: [
|
||||
"webpack",
|
||||
"mocha",
|
||||
//"chai",
|
||||
],
|
||||
files: [
|
||||
"test/unit-web/run-web-implementation.test.ts",
|
||||
"test/unit/index-named-exports.test.ts",
|
||||
],
|
||||
exclude: [],
|
||||
preprocessors: {
|
||||
"test/**/*.ts": ["webpack"],
|
||||
},
|
||||
webpack: {
|
||||
mode: "production",
|
||||
node: webpackConfig.node,
|
||||
module: webpackConfig.module,
|
||||
resolve: webpackConfig.resolve,
|
||||
experiments: webpackConfig.experiments,
|
||||
optimization: webpackConfig.optimization,
|
||||
stats: {warnings:false},
|
||||
},
|
||||
reporters: ["spec"],
|
||||
|
||||
|
|
19
package.json
19
package.json
|
@ -33,8 +33,8 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"module": "./browser",
|
||||
"browser": "./browser",
|
||||
"module": "./lib/index.js",
|
||||
"browser": "./lib/herumi.js",
|
||||
"homepage": "https://github.com/chainsafe/bls",
|
||||
"author": "ChainSafe Systems",
|
||||
"license": "Apache-2.0",
|
||||
|
@ -83,26 +83,27 @@
|
|||
"@types/randombytes": "^2.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.31.1",
|
||||
"@typescript-eslint/parser": "^4.31.1",
|
||||
"buffer": "^6.0.3",
|
||||
"chai": "^4.3.6",
|
||||
"eslint": "^7.14.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"karma": "^4.4.1",
|
||||
"karma": "^6.3.18",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-chrome-launcher": "^3.1.0",
|
||||
"karma-cli": "^2.0.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"karma-spec-reporter": "^0.0.32",
|
||||
"karma-webpack": "^4.0.2",
|
||||
"karma-webpack": "^5.0.0",
|
||||
"mocha": "^9.2.2",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^2.1.2",
|
||||
"resolve-typescript-plugin": "^1.1.5",
|
||||
"ts-loader": "^8.3.0",
|
||||
"resolve-typescript-plugin": "^1.2.0",
|
||||
"ts-loader": "^9.2.8",
|
||||
"ts-node": "^10.7.0",
|
||||
"typescript": "^4.6.3",
|
||||
"webpack": "^4.30.0",
|
||||
"webpack-cli": "^3.3.2"
|
||||
"webpack": "^5.72.0",
|
||||
"webpack-cli": "^4.9.2"
|
||||
},
|
||||
"resolutions": {
|
||||
"mocha": "^9.2.2",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {SecretKey} from "./secretKey.js";
|
||||
import {PublicKey} from "./publicKey.js";
|
||||
import {Signature} from "./signature.js";
|
||||
import {IBls} from "../interface.js";
|
||||
import {IBls} from "../types.js";
|
||||
import {functionalInterfaceFactory} from "../functional.js";
|
||||
export * from "../constants.js";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as blst from "@chainsafe/blst";
|
||||
import {EmptyAggregateError} from "../errors.js";
|
||||
import {bytesToHex, hexToBytes} from "../helpers/index.js";
|
||||
import {PointFormat, PublicKey as IPublicKey} from "../interface.js";
|
||||
import {PointFormat, PublicKey as IPublicKey} from "../types.js";
|
||||
|
||||
export class PublicKey extends blst.PublicKey implements IPublicKey {
|
||||
constructor(value: ConstructorParameters<typeof blst.PublicKey>[0]) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as blst from "@chainsafe/blst";
|
||||
import {bytesToHex, hexToBytes, isZeroUint8Array, randomBytes} from "../helpers/index.js";
|
||||
import {SECRET_KEY_LENGTH} from "../constants.js";
|
||||
import {SecretKey as ISecretKey} from "../interface.js";
|
||||
import {SecretKey as ISecretKey} from "../types.js";
|
||||
import {PublicKey} from "./publicKey.js";
|
||||
import {Signature} from "./signature.js";
|
||||
import {ZeroSecretKeyError} from "../errors.js";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as blst from "@chainsafe/blst";
|
||||
import {bytesToHex, hexToBytes} from "../helpers/index.js";
|
||||
import {PointFormat, Signature as ISignature} from "../interface.js";
|
||||
import {PointFormat, Signature as ISignature} from "../types.js";
|
||||
import {PublicKey} from "./publicKey.js";
|
||||
import {EmptyAggregateError, ZeroSignatureError} from "../errors.js";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {IBls} from "./interface.js";
|
||||
import {IBls} from "./types.js";
|
||||
import {validateBytes} from "./helpers/index.js";
|
||||
import {NotInitializedError} from "./errors.js";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type {IBls, Implementation} from "./interface.js";
|
||||
import type {IBls, Implementation} from "./types.js";
|
||||
|
||||
// Thanks https://github.com/iliakan/detect-node/blob/master/index.esm.js
|
||||
const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
|
||||
|
|
|
@ -2,7 +2,7 @@ import {SecretKey} from "./secretKey.js";
|
|||
import {PublicKey} from "./publicKey.js";
|
||||
import {Signature} from "./signature.js";
|
||||
import {init, destroy} from "./context.js";
|
||||
import {IBls} from "../interface.js";
|
||||
import {IBls} from "../types.js";
|
||||
import {functionalInterfaceFactory} from "../functional.js";
|
||||
|
||||
await init();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type {PublicKeyType} from "bls-eth-wasm";
|
||||
import {getContext} from "./context.js";
|
||||
import {bytesToHex, hexToBytes, isZeroUint8Array} from "../helpers/index.js";
|
||||
import {PointFormat, PublicKey as IPublicKey} from "../interface.js";
|
||||
import {PointFormat, PublicKey as IPublicKey} from "../types.js";
|
||||
import {EmptyAggregateError, InvalidLengthError, ZeroPublicKeyError} from "../errors.js";
|
||||
import {PUBLIC_KEY_LENGTH_COMPRESSED, PUBLIC_KEY_LENGTH_UNCOMPRESSED} from "../constants.js";
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import {getContext} from "./context.js";
|
|||
import {PublicKey} from "./publicKey.js";
|
||||
import {Signature} from "./signature.js";
|
||||
import {bytesToHex, hexToBytes} from "../helpers/index.js";
|
||||
import {SecretKey as ISecretKey} from "../interface.js";
|
||||
import {SecretKey as ISecretKey} from "../types.js";
|
||||
import {InvalidLengthError, ZeroSecretKeyError} from "../errors.js";
|
||||
|
||||
export class SecretKey implements ISecretKey {
|
||||
|
@ -35,7 +35,7 @@ export class SecretKey implements ISecretKey {
|
|||
}
|
||||
|
||||
static fromKeygen(entropy?: Uint8Array): SecretKey {
|
||||
const sk = generateRandomSecretKey(entropy && Buffer.from(entropy));
|
||||
const sk = generateRandomSecretKey(entropy);
|
||||
return this.fromBytes(sk);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import type {SignatureType} from "bls-eth-wasm";
|
|||
import {getContext} from "./context.js";
|
||||
import {PublicKey} from "./publicKey.js";
|
||||
import {bytesToHex, concatUint8Arrays, hexToBytes, isZeroUint8Array} from "../helpers/index.js";
|
||||
import {PointFormat, Signature as ISignature, CoordType} from "../interface.js";
|
||||
import {PointFormat, Signature as ISignature, CoordType} from "../types.js";
|
||||
import {EmptyAggregateError, InvalidLengthError, InvalidOrderError} from "../errors.js";
|
||||
import {SIGNATURE_LENGTH_COMPRESSED, SIGNATURE_LENGTH_UNCOMPRESSED} from "../constants.js";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type {IBls} from "./interface.js";
|
||||
import type {IBls} from "./types.js";
|
||||
import {getImplementation} from "./getImplementation.js";
|
||||
|
||||
// Thanks https://github.com/iliakan/detect-node/blob/master/index.esm.js
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
export interface IBls {
|
||||
implementation: Implementation;
|
||||
SecretKey: typeof SecretKey;
|
||||
PublicKey: typeof PublicKey;
|
||||
Signature: typeof Signature;
|
||||
|
||||
sign(secretKey: Uint8Array, message: Uint8Array): Uint8Array;
|
||||
aggregatePublicKeys(publicKeys: Uint8Array[]): Uint8Array;
|
||||
aggregateSignatures(signatures: Uint8Array[]): Uint8Array;
|
||||
verify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
|
||||
verifyAggregate(publicKeys: Uint8Array[], message: Uint8Array, signature: Uint8Array): boolean;
|
||||
verifyMultiple(publicKeys: Uint8Array[], messages: Uint8Array[], signature: Uint8Array): boolean;
|
||||
verifyMultipleSignatures(sets: {publicKey: Uint8Array; message: Uint8Array; signature: Uint8Array}[]): boolean;
|
||||
secretKeyToPublicKey(secretKey: Uint8Array): Uint8Array;
|
||||
}
|
||||
|
||||
export declare class SecretKey {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private constructor(...value: any);
|
||||
static fromBytes(bytes: Uint8Array): SecretKey;
|
||||
static fromHex(hex: string): SecretKey;
|
||||
static fromKeygen(entropy?: Uint8Array): SecretKey;
|
||||
sign(message: Uint8Array): Signature;
|
||||
toPublicKey(): PublicKey;
|
||||
toBytes(): Uint8Array;
|
||||
toHex(): string;
|
||||
}
|
||||
|
||||
export declare class PublicKey {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private constructor(...value: any);
|
||||
/** @param type Only for impl `blst-native`. Defaults to `CoordType.jacobian` */
|
||||
static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): PublicKey;
|
||||
static fromHex(hex: string): PublicKey;
|
||||
static aggregate(publicKeys: PublicKey[]): PublicKey;
|
||||
/** @param format Defaults to `PointFormat.compressed` */
|
||||
toBytes(format?: PointFormat): Uint8Array;
|
||||
toHex(format?: PointFormat): string;
|
||||
}
|
||||
|
||||
export declare class Signature {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private constructor(...value: any);
|
||||
/** @param type Only for impl `blst-native`. Defaults to `CoordType.affine`
|
||||
* @param validate When using `herumi` implementation, signature validation is always on regardless of this flag. */
|
||||
static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): Signature;
|
||||
static fromHex(hex: string): Signature;
|
||||
static aggregate(signatures: Signature[]): Signature;
|
||||
static verifyMultipleSignatures(sets: {publicKey: PublicKey; message: Uint8Array; signature: Signature}[]): boolean;
|
||||
verify(publicKey: PublicKey, message: Uint8Array): boolean;
|
||||
verifyAggregate(publicKeys: PublicKey[], message: Uint8Array): boolean;
|
||||
verifyMultiple(publicKeys: PublicKey[], messages: Uint8Array[]): boolean;
|
||||
/** @param format Defaults to `PointFormat.compressed` */
|
||||
toBytes(format?: PointFormat): Uint8Array;
|
||||
toHex(format?: PointFormat): string;
|
||||
}
|
||||
|
||||
export type Implementation = "herumi" | "blst-native";
|
||||
|
||||
export enum PointFormat {
|
||||
compressed = "compressed",
|
||||
uncompressed = "uncompressed",
|
||||
}
|
||||
|
||||
export enum CoordType {
|
||||
affine,
|
||||
jacobian,
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import type {IBls, Implementation} from "./interface.js";
|
||||
import type {IBls, Implementation} from "./types.js";
|
||||
import {getImplementation} from "./getImplementation.js";
|
||||
|
||||
// TODO: Use a Proxy for example to throw an error if it's not initialized yet
|
||||
|
|
69
src/types.ts
69
src/types.ts
|
@ -1 +1,68 @@
|
|||
export * from "./interface.js";
|
||||
export interface IBls {
|
||||
implementation: Implementation;
|
||||
SecretKey: typeof SecretKey;
|
||||
PublicKey: typeof PublicKey;
|
||||
Signature: typeof Signature;
|
||||
|
||||
sign(secretKey: Uint8Array, message: Uint8Array): Uint8Array;
|
||||
aggregatePublicKeys(publicKeys: Uint8Array[]): Uint8Array;
|
||||
aggregateSignatures(signatures: Uint8Array[]): Uint8Array;
|
||||
verify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
|
||||
verifyAggregate(publicKeys: Uint8Array[], message: Uint8Array, signature: Uint8Array): boolean;
|
||||
verifyMultiple(publicKeys: Uint8Array[], messages: Uint8Array[], signature: Uint8Array): boolean;
|
||||
verifyMultipleSignatures(sets: {publicKey: Uint8Array; message: Uint8Array; signature: Uint8Array}[]): boolean;
|
||||
secretKeyToPublicKey(secretKey: Uint8Array): Uint8Array;
|
||||
}
|
||||
|
||||
export declare class SecretKey {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private constructor(...value: any);
|
||||
static fromBytes(bytes: Uint8Array): SecretKey;
|
||||
static fromHex(hex: string): SecretKey;
|
||||
static fromKeygen(entropy?: Uint8Array): SecretKey;
|
||||
sign(message: Uint8Array): Signature;
|
||||
toPublicKey(): PublicKey;
|
||||
toBytes(): Uint8Array;
|
||||
toHex(): string;
|
||||
}
|
||||
|
||||
export declare class PublicKey {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private constructor(...value: any);
|
||||
/** @param type Only for impl `blst-native`. Defaults to `CoordType.jacobian` */
|
||||
static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): PublicKey;
|
||||
static fromHex(hex: string): PublicKey;
|
||||
static aggregate(publicKeys: PublicKey[]): PublicKey;
|
||||
/** @param format Defaults to `PointFormat.compressed` */
|
||||
toBytes(format?: PointFormat): Uint8Array;
|
||||
toHex(format?: PointFormat): string;
|
||||
}
|
||||
|
||||
export declare class Signature {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private constructor(...value: any);
|
||||
/** @param type Only for impl `blst-native`. Defaults to `CoordType.affine`
|
||||
* @param validate When using `herumi` implementation, signature validation is always on regardless of this flag. */
|
||||
static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): Signature;
|
||||
static fromHex(hex: string): Signature;
|
||||
static aggregate(signatures: Signature[]): Signature;
|
||||
static verifyMultipleSignatures(sets: {publicKey: PublicKey; message: Uint8Array; signature: Signature}[]): boolean;
|
||||
verify(publicKey: PublicKey, message: Uint8Array): boolean;
|
||||
verifyAggregate(publicKeys: PublicKey[], message: Uint8Array): boolean;
|
||||
verifyMultiple(publicKeys: PublicKey[], messages: Uint8Array[]): boolean;
|
||||
/** @param format Defaults to `PointFormat.compressed` */
|
||||
toBytes(format?: PointFormat): Uint8Array;
|
||||
toHex(format?: PointFormat): string;
|
||||
}
|
||||
|
||||
export type Implementation = "herumi" | "blst-native";
|
||||
|
||||
export enum PointFormat {
|
||||
compressed = "compressed",
|
||||
uncompressed = "uncompressed",
|
||||
}
|
||||
|
||||
export enum CoordType {
|
||||
affine,
|
||||
jacobian,
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import blst from "../src/blst-native/index.js";
|
||||
import herumi from "../src/herumi/index.js";
|
||||
import {IBls} from "../src/interface.js";
|
||||
import {IBls} from "../src/types.js";
|
||||
|
||||
export type Implementation = "blst" | "herumi";
|
||||
|
||||
|
@ -19,7 +19,6 @@ export async function runForAllImplementations(
|
|||
): Promise<void> {
|
||||
for (const implementation of ["blst", "herumi"] as Implementation[]) {
|
||||
const bls = getBls(implementation);
|
||||
await bls.init();
|
||||
callback(bls, implementation);
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +26,6 @@ export async function runForAllImplementations(
|
|||
export function describeForAllImplementations(callback: (bls: IBls) => void): void {
|
||||
runForAllImplementations((bls, implementation) => {
|
||||
describe(implementation, function () {
|
||||
before(async () => {
|
||||
await bls.init();
|
||||
});
|
||||
|
||||
try {
|
||||
callback(bls);
|
||||
} catch (e) {
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
import herumi from "../../src/herumi/index.js";
|
||||
import {runSecretKeyTests} from "../unit/secretKey.test";
|
||||
import {runPublicKeyTests} from "../unit/publicKey.test";
|
||||
import {runIndexTests} from "../unit/index.test";
|
||||
import {runSecretKeyTests} from "../unit/secretKey.test.js";
|
||||
import {runPublicKeyTests} from "../unit/publicKey.test.js";
|
||||
import {runIndexTests} from "../unit/index.test.js";
|
||||
|
||||
// This file is intended to be compiled and run by Karma
|
||||
// Do not import the node.bindings or it will break with:
|
||||
// Error: BLST bindings loader should only run in a NodeJS context: process.platform
|
||||
describe("herumi", () => {
|
||||
before(async () => {
|
||||
// For consistency with describeForAllImplementations
|
||||
// eslint-disable-next-line import/no-named-as-default-member
|
||||
await herumi.init();
|
||||
});
|
||||
|
||||
runSecretKeyTests(herumi);
|
||||
runPublicKeyTests(herumi);
|
||||
runIndexTests(herumi);
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import {expect} from "chai";
|
||||
import {init, bls} from "../../src/index.js";
|
||||
import bls from "../../src/index.js";
|
||||
import type {SecretKey, PublicKey, Signature} from "../../src/types.js";
|
||||
|
||||
describe("types named exports", () => {
|
||||
it("Classes and methods should be defined", async () => {
|
||||
await init("herumi");
|
||||
|
||||
/**
|
||||
* Sample helper to test argument typing
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {expect} from "chai";
|
||||
import {IBls, PointFormat} from "../../src/interface.js";
|
||||
import {getN, randomMessage, hexToBytesNode} from "../util.js";
|
||||
import {Buffer} from "buffer";
|
||||
import {IBls, PointFormat} from "../../src/types.js";
|
||||
import {getN, randomMessage} from "../util.js";
|
||||
import {hexToBytes} from "../../src/helpers/index.js";
|
||||
import {maliciousVerifyMultipleSignaturesData} from "../data/malicious-signature-test-data.js";
|
||||
|
||||
|
@ -178,13 +179,13 @@ export function runIndexTests(bls: IBls): void {
|
|||
"0x0a1a1c26055a329817a5759d877a2795f9499b97d6056edde0eea39512f24e8bc874b4471f0501127abb1ea0d9f68ac111392125a1c3750363c2c97d9650fb78696e6428db8ff9efaf0471cbfd20324916ab545746db83756d335e92f9e8c8b8";
|
||||
|
||||
it("Should serialize comp pubkey", () => {
|
||||
const sk = bls.SecretKey.fromBytes(hexToBytesNode(skHex));
|
||||
const sk = bls.SecretKey.fromBytes(hexToBytes(skHex));
|
||||
const pkHexComp = sk.toPublicKey().toHex(PointFormat.compressed);
|
||||
expect(pkHexComp).to.equal(pkHexCompExpected, "Wrong pkHexComp");
|
||||
});
|
||||
|
||||
it("Should serialize uncomp pubkey", () => {
|
||||
const sk = bls.SecretKey.fromBytes(hexToBytesNode(skHex));
|
||||
const sk = bls.SecretKey.fromBytes(hexToBytes(skHex));
|
||||
const pkHexUncomp = sk.toPublicKey().toHex(PointFormat.uncompressed);
|
||||
expect(pkHexUncomp).to.equal(pkHexUncompExpected, "Wrong pkHexUncomp");
|
||||
});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {spawn, Pool, Worker, Thread} from "@chainsafe/threads";
|
||||
import {Implementation, PointFormat} from "../../../../src/index.js";
|
||||
import {PublicKey, Signature} from "../../../../src/types.js";
|
||||
import {Implementation, PointFormat, PublicKey, Signature} from "../../../../src/types.js";
|
||||
import {WorkerApi} from "./worker.js";
|
||||
|
||||
type ThreadType = {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {expect} from "chai";
|
||||
import {IBls} from "../../../../src/index.js";
|
||||
import {IBls} from "../../../../src/types.js";
|
||||
import type {PublicKey, Signature} from "../../../../src/types.js";
|
||||
import {BlsMultiThreadNaive} from "./index.js";
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {expose} from "@chainsafe/threads/worker";
|
||||
import {bls, init, CoordType, Implementation} from "../../../../src/index.js";
|
||||
import {CoordType, Implementation} from "../../../../src/types.js";
|
||||
import bls, {init} from "../../../../src/switchable.js";
|
||||
|
||||
export type WorkerApi = typeof workerApi;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {expect} from "chai";
|
||||
import {IBls} from "../../src/interface.js";
|
||||
import {IBls} from "../../src/types.js";
|
||||
|
||||
export function runPublicKeyTests(bls: IBls): void {
|
||||
describe("PublicKey", () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {expect} from "chai";
|
||||
import {IBls} from "../../src/interface.js";
|
||||
import {IBls} from "../../src/types.js";
|
||||
|
||||
export function runSecretKeyTests(bls: IBls): void {
|
||||
describe("SecretKey", () => {
|
||||
|
|
|
@ -3,22 +3,27 @@ const ResolveTypeScriptPlugin = require("resolve-typescript-plugin");
|
|||
module.exports = {
|
||||
entry: "./src/index.ts",
|
||||
mode: "production",
|
||||
node: {
|
||||
fs: "empty",
|
||||
},
|
||||
output: {
|
||||
filename: "dist/bundle.js",
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"],
|
||||
plugins: [new ResolveTypeScriptPlugin()]
|
||||
},
|
||||
module: {
|
||||
rules: [{test: /\.(ts|js)$/, use: {loader: "ts-loader", options: {transpileOnly: true}}}],
|
||||
rules: [{test: /\.(ts)$/, use: {loader: "ts-loader", options: {transpileOnly: true}}}],
|
||||
},
|
||||
optimization: {
|
||||
// Disable minification for better debugging on Karma tests
|
||||
minimize: false,
|
||||
//splitChunks: false, runtimeChunk: false,
|
||||
},
|
||||
devtool: "source-map",
|
||||
resolve: {
|
||||
plugins: [new ResolveTypeScriptPlugin()],
|
||||
fallback: {
|
||||
crypto: false,
|
||||
fs: false,
|
||||
path: false,
|
||||
},
|
||||
},
|
||||
experiments: {
|
||||
topLevelAwait: true,
|
||||
},
|
||||
};
|
||||
|
|
Reference in New Issue