Skip to content

Commit a30b2bd

Browse files
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
1 parent 8c4dfe5 commit a30b2bd

23 files changed

+29
-23
lines changed

packages/core/src/lib/base_protocol.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
getPeersForProtocol,
66
selectConnection,
77
selectPeerForProtocol,
8-
} from "@waku/utils";
8+
} from "@waku/utils/libp2p";
99

1010
/**
1111
* A class with predefined helpers, to be used as a base to implement Waku

packages/core/src/lib/store/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
ProtocolCreateOptions,
1111
} from "@waku/interfaces";
1212
import { proto_store as proto } from "@waku/proto";
13-
import { concat, utf8ToBytes } from "@waku/utils";
13+
import { concat, utf8ToBytes } from "@waku/utils/bytes";
1414
import debug from "debug";
1515
import all from "it-all";
1616
import * as lp from "it-length-prefixed";

packages/dns-discovery/src/dns_over_https.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bytesToUtf8 } from "@waku/utils";
1+
import { bytesToUtf8 } from "@waku/utils/bytes";
22
import debug from "debug";
33
import { Endpoint, query, toEndpoint } from "dns-query";
44

packages/dns-discovery/src/enrtree.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ENR } from "@waku/enr";
22
import { keccak256, verifySignature } from "@waku/enr";
3-
import { utf8ToBytes } from "@waku/utils";
3+
import { utf8ToBytes } from "@waku/utils/bytes";
44
import base32 from "hi-base32";
55
import { fromString } from "uint8arrays/from-string";
66

packages/enr/src/creator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { PeerId } from "@libp2p/interface-peer-id";
22
import type { ENRKey, ENRValue } from "@waku/interfaces";
3-
import { utf8ToBytes } from "@waku/utils";
3+
import { utf8ToBytes } from "@waku/utils/bytes";
44

55
import { compressPublicKey } from "./crypto.js";
66
import { ENR } from "./enr.js";

packages/enr/src/crypto.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as secp from "@noble/secp256k1";
2-
import { concat } from "@waku/utils";
2+
import { concat } from "@waku/utils/bytes";
33
import sha3 from "js-sha3";
44

55
/**

packages/enr/src/decoder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as RLP from "@ethersproject/rlp";
22
import type { ENRKey, ENRValue } from "@waku/interfaces";
3-
import { bytesToHex, bytesToUtf8, hexToBytes } from "@waku/utils";
3+
import { bytesToHex, bytesToUtf8, hexToBytes } from "@waku/utils/bytes";
44
import { log } from "debug";
55
import { fromString } from "uint8arrays/from-string";
66

packages/enr/src/encoder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as RLP from "@ethersproject/rlp";
22
import type { ENRKey, ENRValue } from "@waku/interfaces";
3-
import { hexToBytes, utf8ToBytes } from "@waku/utils";
3+
import { hexToBytes, utf8ToBytes } from "@waku/utils/bytes";
44
import { toString } from "uint8arrays/to-string";
55

66
import { ERR_NO_SIGNATURE, MAX_RECORD_SIZE } from "./constants.js";

packages/enr/src/enr.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
33
import { multiaddr } from "@multiformats/multiaddr";
44
import * as secp from "@noble/secp256k1";
55
import type { Waku2 } from "@waku/interfaces";
6-
import { bytesToHex, hexToBytes, utf8ToBytes } from "@waku/utils";
6+
import { bytesToHex, hexToBytes, utf8ToBytes } from "@waku/utils/bytes";
77
import { assert, expect } from "chai";
88
import { equals } from "uint8arrays/equals";
99

packages/enr/src/raw_enr.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
convertToString,
55
} from "@multiformats/multiaddr/convert";
66
import type { ENRKey, ENRValue, SequenceNumber, Waku2 } from "@waku/interfaces";
7-
import { bytesToUtf8 } from "@waku/utils";
7+
import { bytesToUtf8 } from "@waku/utils/bytes";
88

99
import { ERR_INVALID_ID } from "./constants.js";
1010
import { decodeMultiaddrs, encodeMultiaddrs } from "./multiaddrs_codec.js";

packages/enr/src/v4.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as secp from "@noble/secp256k1";
22
import type { NodeId } from "@waku/interfaces";
3-
import { bytesToHex } from "@waku/utils";
3+
import { bytesToHex } from "@waku/utils/bytes";
44

55
import { keccak256 } from "./crypto.js";
66
export async function sign(

packages/message-encryption/src/crypto/ecies.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as secp from "@noble/secp256k1";
2-
import { concat, hexToBytes } from "@waku/utils";
2+
import { concat, hexToBytes } from "@waku/utils/bytes";
33

44
import { getSubtle, randomBytes, sha256 } from "./index.js";
55
/**

packages/message-encryption/src/crypto/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import nodeCrypto from "crypto";
22

33
import * as secp from "@noble/secp256k1";
4-
import { concat } from "@waku/utils";
4+
import { concat } from "@waku/utils/bytes";
55
import sha3 from "js-sha3";
66

77
import { Asymmetric, Symmetric } from "../constants.js";

packages/message-encryption/src/waku_payload.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as secp from "@noble/secp256k1";
2-
import { concat, hexToBytes } from "@waku/utils";
2+
import { concat, hexToBytes } from "@waku/utils/bytes";
33

44
import { Symmetric } from "./constants.js";
55
import * as ecies from "./crypto/ecies.js";

packages/tests/src/nwaku.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { PeerId } from "@libp2p/interface-peer-id";
44
import { peerIdFromString } from "@libp2p/peer-id";
55
import { Multiaddr, multiaddr } from "@multiformats/multiaddr";
66
import { DefaultPubSubTopic } from "@waku/core";
7-
import { bytesToHex, hexToBytes } from "@waku/utils";
7+
import { bytesToHex, hexToBytes } from "@waku/utils/bytes";
88
import appRoot from "app-root-path";
99
import debug from "debug";
1010
import portfinder from "portfinder";

packages/tests/tests/ephemeral.node.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
createDecoder as symDecoder,
1919
createEncoder as symEncoder,
2020
} from "@waku/message-encryption/symmetric";
21-
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
21+
import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
2222
import { expect } from "chai";
2323
import debug from "debug";
2424

packages/tests/tests/filter.node.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { createLightNode } from "@waku/create";
99
import type { LightNode } from "@waku/interfaces";
1010
import { Protocols } from "@waku/interfaces";
11-
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
11+
import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
1212
import { expect } from "chai";
1313
import debug from "debug";
1414

packages/tests/tests/light_push.node.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createEncoder, waitForRemotePeer } from "@waku/core";
22
import { createLightNode } from "@waku/create";
33
import type { LightNode } from "@waku/interfaces";
44
import { Protocols } from "@waku/interfaces";
5-
import { utf8ToBytes } from "@waku/utils";
5+
import { utf8ToBytes } from "@waku/utils/bytes";
66
import { expect } from "chai";
77
import debug from "debug";
88

packages/tests/tests/relay.node.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
createEncoder as createSymEncoder,
2121
generateSymmetricKey,
2222
} from "@waku/message-encryption/symmetric";
23-
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
23+
import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
2424
import { expect } from "chai";
2525
import debug from "debug";
2626

packages/tests/tests/store.node.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
createEncoder as createSymEncoder,
2121
generateSymmetricKey,
2222
} from "@waku/message-encryption/symmetric";
23-
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
23+
import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
2424
import { expect } from "chai";
2525
import debug from "debug";
2626

packages/tests/tests/waku.node.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
createEncoder,
1414
generateSymmetricKey,
1515
} from "@waku/message-encryption/symmetric";
16-
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
16+
import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
1717
import { expect } from "chai";
1818

1919
import {

packages/utils/package.json

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
".": {
99
"types": "./dist/index.d.ts",
1010
"import": "./dist/index.js"
11+
},
12+
"./libp2p": {
13+
"types": "./dist/libp2p/index.d.ts",
14+
"import": "./dist/libp2p/index.js"
15+
},
16+
"./bytes": {
17+
"types": "./dist/bytes/index.d.ts",
18+
"import": "./dist/bytes/index.js"
1119
}
1220
},
1321
"type": "module",

packages/utils/src/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export * from "./bytes/index.js";
2-
export * from "./libp2p/index.js";
31
export * from "./common/index.js";

0 commit comments

Comments
 (0)