chore!: add exports map to @waku/utils (#1201)

* add exports map

* merge: master

* export  subdir with default export path

* import according to the export path
This commit is contained in:
Danish Arora 2023-03-14 10:10:38 +05:30 committed by GitHub
parent 8c4dfe566c
commit a30b2bd747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 29 additions and 23 deletions

View File

@ -5,7 +5,7 @@ import {
getPeersForProtocol,
selectConnection,
selectPeerForProtocol,
} from "@waku/utils";
} from "@waku/utils/libp2p";
/**
* A class with predefined helpers, to be used as a base to implement Waku

View File

@ -10,7 +10,7 @@ import {
ProtocolCreateOptions,
} from "@waku/interfaces";
import { proto_store as proto } from "@waku/proto";
import { concat, utf8ToBytes } from "@waku/utils";
import { concat, utf8ToBytes } from "@waku/utils/bytes";
import debug from "debug";
import all from "it-all";
import * as lp from "it-length-prefixed";

View File

@ -1,4 +1,4 @@
import { bytesToUtf8 } from "@waku/utils";
import { bytesToUtf8 } from "@waku/utils/bytes";
import debug from "debug";
import { Endpoint, query, toEndpoint } from "dns-query";

View File

@ -1,6 +1,6 @@
import { ENR } from "@waku/enr";
import { keccak256, verifySignature } from "@waku/enr";
import { utf8ToBytes } from "@waku/utils";
import { utf8ToBytes } from "@waku/utils/bytes";
import base32 from "hi-base32";
import { fromString } from "uint8arrays/from-string";

View File

@ -1,6 +1,6 @@
import { PeerId } from "@libp2p/interface-peer-id";
import type { ENRKey, ENRValue } from "@waku/interfaces";
import { utf8ToBytes } from "@waku/utils";
import { utf8ToBytes } from "@waku/utils/bytes";
import { compressPublicKey } from "./crypto.js";
import { ENR } from "./enr.js";

View File

@ -1,5 +1,5 @@
import * as secp from "@noble/secp256k1";
import { concat } from "@waku/utils";
import { concat } from "@waku/utils/bytes";
import sha3 from "js-sha3";
/**

View File

@ -1,6 +1,6 @@
import * as RLP from "@ethersproject/rlp";
import type { ENRKey, ENRValue } from "@waku/interfaces";
import { bytesToHex, bytesToUtf8, hexToBytes } from "@waku/utils";
import { bytesToHex, bytesToUtf8, hexToBytes } from "@waku/utils/bytes";
import { log } from "debug";
import { fromString } from "uint8arrays/from-string";

View File

@ -1,6 +1,6 @@
import * as RLP from "@ethersproject/rlp";
import type { ENRKey, ENRValue } from "@waku/interfaces";
import { hexToBytes, utf8ToBytes } from "@waku/utils";
import { hexToBytes, utf8ToBytes } from "@waku/utils/bytes";
import { toString } from "uint8arrays/to-string";
import { ERR_NO_SIGNATURE, MAX_RECORD_SIZE } from "./constants.js";

View File

@ -3,7 +3,7 @@ import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
import { multiaddr } from "@multiformats/multiaddr";
import * as secp from "@noble/secp256k1";
import type { Waku2 } from "@waku/interfaces";
import { bytesToHex, hexToBytes, utf8ToBytes } from "@waku/utils";
import { bytesToHex, hexToBytes, utf8ToBytes } from "@waku/utils/bytes";
import { assert, expect } from "chai";
import { equals } from "uint8arrays/equals";

View File

@ -4,7 +4,7 @@ import {
convertToString,
} from "@multiformats/multiaddr/convert";
import type { ENRKey, ENRValue, SequenceNumber, Waku2 } from "@waku/interfaces";
import { bytesToUtf8 } from "@waku/utils";
import { bytesToUtf8 } from "@waku/utils/bytes";
import { ERR_INVALID_ID } from "./constants.js";
import { decodeMultiaddrs, encodeMultiaddrs } from "./multiaddrs_codec.js";

View File

@ -1,6 +1,6 @@
import * as secp from "@noble/secp256k1";
import type { NodeId } from "@waku/interfaces";
import { bytesToHex } from "@waku/utils";
import { bytesToHex } from "@waku/utils/bytes";
import { keccak256 } from "./crypto.js";
export async function sign(

View File

@ -1,5 +1,5 @@
import * as secp from "@noble/secp256k1";
import { concat, hexToBytes } from "@waku/utils";
import { concat, hexToBytes } from "@waku/utils/bytes";
import { getSubtle, randomBytes, sha256 } from "./index.js";
/**

View File

@ -1,7 +1,7 @@
import nodeCrypto from "crypto";
import * as secp from "@noble/secp256k1";
import { concat } from "@waku/utils";
import { concat } from "@waku/utils/bytes";
import sha3 from "js-sha3";
import { Asymmetric, Symmetric } from "../constants.js";

View File

@ -1,5 +1,5 @@
import * as secp from "@noble/secp256k1";
import { concat, hexToBytes } from "@waku/utils";
import { concat, hexToBytes } from "@waku/utils/bytes";
import { Symmetric } from "./constants.js";
import * as ecies from "./crypto/ecies.js";

View File

@ -4,7 +4,7 @@ import type { PeerId } from "@libp2p/interface-peer-id";
import { peerIdFromString } from "@libp2p/peer-id";
import { Multiaddr, multiaddr } from "@multiformats/multiaddr";
import { DefaultPubSubTopic } from "@waku/core";
import { bytesToHex, hexToBytes } from "@waku/utils";
import { bytesToHex, hexToBytes } from "@waku/utils/bytes";
import appRoot from "app-root-path";
import debug from "debug";
import portfinder from "portfinder";

View File

@ -18,7 +18,7 @@ import {
createDecoder as symDecoder,
createEncoder as symEncoder,
} from "@waku/message-encryption/symmetric";
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
import { expect } from "chai";
import debug from "debug";

View File

@ -8,7 +8,7 @@ import {
import { createLightNode } from "@waku/create";
import type { LightNode } from "@waku/interfaces";
import { Protocols } from "@waku/interfaces";
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
import { expect } from "chai";
import debug from "debug";

View File

@ -2,7 +2,7 @@ import { createEncoder, waitForRemotePeer } from "@waku/core";
import { createLightNode } from "@waku/create";
import type { LightNode } from "@waku/interfaces";
import { Protocols } from "@waku/interfaces";
import { utf8ToBytes } from "@waku/utils";
import { utf8ToBytes } from "@waku/utils/bytes";
import { expect } from "chai";
import debug from "debug";

View File

@ -20,7 +20,7 @@ import {
createEncoder as createSymEncoder,
generateSymmetricKey,
} from "@waku/message-encryption/symmetric";
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
import { expect } from "chai";
import debug from "debug";

View File

@ -20,7 +20,7 @@ import {
createEncoder as createSymEncoder,
generateSymmetricKey,
} from "@waku/message-encryption/symmetric";
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
import { expect } from "chai";
import debug from "debug";

View File

@ -13,7 +13,7 @@ import {
createEncoder,
generateSymmetricKey,
} from "@waku/message-encryption/symmetric";
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
import { expect } from "chai";
import {

View File

@ -8,6 +8,14 @@
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./libp2p": {
"types": "./dist/libp2p/index.d.ts",
"import": "./dist/libp2p/index.js"
},
"./bytes": {
"types": "./dist/bytes/index.d.ts",
"import": "./dist/bytes/index.js"
}
},
"type": "module",

View File

@ -1,3 +1 @@
export * from "./bytes/index.js";
export * from "./libp2p/index.js";
export * from "./common/index.js";