From 574f3ee80f6a6a728d4f49019fb004c5ed77c0ec Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Tue, 6 Dec 2022 12:49:02 +1100 Subject: [PATCH] refactor: remove `waku_` from module names This is redundant with the context (waku package). --- packages/core/package.json | 12 ++++++------ packages/core/rollup.config.js | 5 ++--- packages/core/src/index.ts | 18 +++++++++--------- .../lib/{waku_filter => filter}/filter_rpc.ts | 0 .../src/lib/{waku_filter => filter}/index.ts | 0 .../{waku_light_push => light_push}/index.ts | 0 .../push_rpc.ts | 0 .../topic_only_message.ts | 0 .../version_0.spec.ts | 0 .../lib/{waku_message => message}/version_0.ts | 0 .../src/lib/{waku_relay => relay}/constants.ts | 0 .../src/lib/{waku_relay => relay}/index.ts | 2 +- .../lib/{waku_store => store}/history_rpc.ts | 0 .../src/lib/{waku_store => store}/index.ts | 0 packages/core/src/lib/wait_for_remote_peer.ts | 6 +++--- packages/core/src/lib/waku.ts | 15 ++++++--------- packages/message-encryption/src/ecies.ts | 5 +---- packages/message-encryption/src/index.ts | 2 +- packages/message-encryption/src/symmetric.ts | 5 +---- 19 files changed, 30 insertions(+), 40 deletions(-) rename packages/core/src/lib/{waku_filter => filter}/filter_rpc.ts (100%) rename packages/core/src/lib/{waku_filter => filter}/index.ts (100%) rename packages/core/src/lib/{waku_light_push => light_push}/index.ts (100%) rename packages/core/src/lib/{waku_light_push => light_push}/push_rpc.ts (100%) rename packages/core/src/lib/{waku_message => message}/topic_only_message.ts (100%) rename packages/core/src/lib/{waku_message => message}/version_0.spec.ts (100%) rename packages/core/src/lib/{waku_message => message}/version_0.ts (100%) rename packages/core/src/lib/{waku_relay => relay}/constants.ts (100%) rename packages/core/src/lib/{waku_relay => relay}/index.ts (98%) rename packages/core/src/lib/{waku_store => store}/history_rpc.ts (100%) rename packages/core/src/lib/{waku_store => store}/index.ts (100%) diff --git a/packages/core/package.json b/packages/core/package.json index e8322db6ec..7776c92ba6 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -13,13 +13,13 @@ "types": "./dist/lib/predefined_bootstrap_nodes.d.ts", "import": "./dist/lib/predefined_bootstrap_nodes.js" }, - "./lib/waku_message/version_0": { - "types": "./dist/lib/waku_message/version_0.d.ts", - "import": "./dist/lib/waku_message/version_0.js" + "./lib/message/version_0": { + "types": "./dist/lib/message/version_0.d.ts", + "import": "./dist/lib/message/version_0.js" }, - "./lib/waku_message/topic_only_message": { - "types": "./dist/lib/waku_message/topic_only_message.d.ts", - "import": "./dist/lib/waku_message/topic_only_message.js" + "./lib/message/topic_only_message": { + "types": "./dist/lib/message/topic_only_message.d.ts", + "import": "./dist/lib/message/topic_only_message.js" } }, "typesVersions": { diff --git a/packages/core/rollup.config.js b/packages/core/rollup.config.js index 1a9240bbe7..4896be37cb 100644 --- a/packages/core/rollup.config.js +++ b/packages/core/rollup.config.js @@ -6,9 +6,8 @@ export default { input: { index: "dist/index.js", "lib/predefined_bootstrap_nodes": "dist/lib/predefined_bootstrap_nodes.js", - "lib/waku_message/version_0": "dist/lib/waku_message/version_0.js", - "lib/waku_message/topic_only_message": - "dist/lib/waku_message/topic_only_message.js", + "lib/message/version_0": "dist/lib/message/version_0.js", + "lib/message/topic_only_message": "dist/lib/message/topic_only_message.js", }, output: { dir: "bundle", diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index da0e7012b7..427dac0d4e 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -5,30 +5,30 @@ export { createEncoder, createDecoder, DecodedMessage, -} from "./lib/waku_message/version_0.js"; +} from "./lib/message/version_0.js"; export * as waku from "./lib/waku.js"; export { WakuNode } from "./lib/waku.js"; -export * as waku_filter from "./lib/waku_filter/index.js"; -export { wakuFilter } from "./lib/waku_filter/index.js"; +export * as waku_filter from "./lib/filter/index.js"; +export { wakuFilter } from "./lib/filter/index.js"; -export * as waku_light_push from "./lib/waku_light_push/index.js"; +export * as waku_light_push from "./lib/light_push/index.js"; export { wakuLightPush, LightPushCodec, PushResponse, -} from "./lib/waku_light_push/index.js"; +} from "./lib/light_push/index.js"; -export * as waku_relay from "./lib/waku_relay/index.js"; -export { wakuRelay } from "./lib/waku_relay/index.js"; +export * as waku_relay from "./lib/relay/index.js"; +export { wakuRelay } from "./lib/relay/index.js"; -export * as waku_store from "./lib/waku_store/index.js"; +export * as waku_store from "./lib/store/index.js"; export { PageDirection, wakuStore, StoreCodec, createCursor, -} from "./lib/waku_store/index.js"; +} from "./lib/store/index.js"; export { waitForRemotePeer } from "./lib/wait_for_remote_peer.js"; diff --git a/packages/core/src/lib/waku_filter/filter_rpc.ts b/packages/core/src/lib/filter/filter_rpc.ts similarity index 100% rename from packages/core/src/lib/waku_filter/filter_rpc.ts rename to packages/core/src/lib/filter/filter_rpc.ts diff --git a/packages/core/src/lib/waku_filter/index.ts b/packages/core/src/lib/filter/index.ts similarity index 100% rename from packages/core/src/lib/waku_filter/index.ts rename to packages/core/src/lib/filter/index.ts diff --git a/packages/core/src/lib/waku_light_push/index.ts b/packages/core/src/lib/light_push/index.ts similarity index 100% rename from packages/core/src/lib/waku_light_push/index.ts rename to packages/core/src/lib/light_push/index.ts diff --git a/packages/core/src/lib/waku_light_push/push_rpc.ts b/packages/core/src/lib/light_push/push_rpc.ts similarity index 100% rename from packages/core/src/lib/waku_light_push/push_rpc.ts rename to packages/core/src/lib/light_push/push_rpc.ts diff --git a/packages/core/src/lib/waku_message/topic_only_message.ts b/packages/core/src/lib/message/topic_only_message.ts similarity index 100% rename from packages/core/src/lib/waku_message/topic_only_message.ts rename to packages/core/src/lib/message/topic_only_message.ts diff --git a/packages/core/src/lib/waku_message/version_0.spec.ts b/packages/core/src/lib/message/version_0.spec.ts similarity index 100% rename from packages/core/src/lib/waku_message/version_0.spec.ts rename to packages/core/src/lib/message/version_0.spec.ts diff --git a/packages/core/src/lib/waku_message/version_0.ts b/packages/core/src/lib/message/version_0.ts similarity index 100% rename from packages/core/src/lib/waku_message/version_0.ts rename to packages/core/src/lib/message/version_0.ts diff --git a/packages/core/src/lib/waku_relay/constants.ts b/packages/core/src/lib/relay/constants.ts similarity index 100% rename from packages/core/src/lib/waku_relay/constants.ts rename to packages/core/src/lib/relay/constants.ts diff --git a/packages/core/src/lib/waku_relay/index.ts b/packages/core/src/lib/relay/index.ts similarity index 98% rename from packages/core/src/lib/waku_relay/index.ts rename to packages/core/src/lib/relay/index.ts index 9492e09bec..96ea47a355 100644 --- a/packages/core/src/lib/waku_relay/index.ts +++ b/packages/core/src/lib/relay/index.ts @@ -18,8 +18,8 @@ import { IDecodedMessage } from "@waku/interfaces"; import debug from "debug"; import { DefaultPubSubTopic } from "../constants.js"; +import { TopicOnlyDecoder } from "../message/topic_only_message.js"; import { pushOrInitMapSet } from "../push_or_init_map.js"; -import { TopicOnlyDecoder } from "../waku_message/topic_only_message.js"; import * as constants from "./constants.js"; diff --git a/packages/core/src/lib/waku_store/history_rpc.ts b/packages/core/src/lib/store/history_rpc.ts similarity index 100% rename from packages/core/src/lib/waku_store/history_rpc.ts rename to packages/core/src/lib/store/history_rpc.ts diff --git a/packages/core/src/lib/waku_store/index.ts b/packages/core/src/lib/store/index.ts similarity index 100% rename from packages/core/src/lib/waku_store/index.ts rename to packages/core/src/lib/store/index.ts diff --git a/packages/core/src/lib/wait_for_remote_peer.ts b/packages/core/src/lib/wait_for_remote_peer.ts index 85c312c12e..4e15b5d7e5 100644 --- a/packages/core/src/lib/wait_for_remote_peer.ts +++ b/packages/core/src/lib/wait_for_remote_peer.ts @@ -5,9 +5,9 @@ import { PeerExchangeCodec } from "@waku/peer-exchange"; import debug from "debug"; import { pEvent } from "p-event"; -import { FilterCodec } from "./waku_filter/index.js"; -import { LightPushCodec } from "./waku_light_push/index.js"; -import { StoreCodec } from "./waku_store/index.js"; +import { FilterCodec } from "./filter/index.js"; +import { LightPushCodec } from "./light_push/index.js"; +import { StoreCodec } from "./store/index.js"; const log = debug("waku:wait-for-remote-peer"); diff --git a/packages/core/src/lib/waku.ts b/packages/core/src/lib/waku.ts index ba6969f3fe..94184f8cd4 100644 --- a/packages/core/src/lib/waku.ts +++ b/packages/core/src/lib/waku.ts @@ -16,15 +16,12 @@ import { PeerExchangeCodec } from "@waku/peer-exchange"; import debug from "debug"; import type { Libp2p } from "libp2p"; -import { FilterCodec, FilterComponents } from "./waku_filter/index.js"; -import { - LightPushCodec, - LightPushComponents, -} from "./waku_light_push/index.js"; -import { createEncoder } from "./waku_message/version_0.js"; -import * as relayConstants from "./waku_relay/constants.js"; -import { RelayCodecs, RelayPingContentTopic } from "./waku_relay/constants.js"; -import { StoreCodec, StoreComponents } from "./waku_store/index.js"; +import { FilterCodec, FilterComponents } from "./filter/index.js"; +import { LightPushCodec, LightPushComponents } from "./light_push/index.js"; +import { createEncoder } from "./message/version_0.js"; +import * as relayConstants from "./relay/constants.js"; +import { RelayCodecs, RelayPingContentTopic } from "./relay/constants.js"; +import { StoreCodec, StoreComponents } from "./store/index.js"; export const DefaultPingKeepAliveValueSecs = 0; export const DefaultRelayKeepAliveValueSecs = 5 * 60; diff --git a/packages/message-encryption/src/ecies.ts b/packages/message-encryption/src/ecies.ts index f55b7ca0f0..1d0ac45a8e 100644 --- a/packages/message-encryption/src/ecies.ts +++ b/packages/message-encryption/src/ecies.ts @@ -1,7 +1,4 @@ -import { - Decoder as DecoderV0, - proto, -} from "@waku/core/lib/waku_message/version_0"; +import { Decoder as DecoderV0, proto } from "@waku/core/lib/message/version_0"; import type { IDecoder, IEncoder, diff --git a/packages/message-encryption/src/index.ts b/packages/message-encryption/src/index.ts index 118e0ade9f..677f4197c8 100644 --- a/packages/message-encryption/src/index.ts +++ b/packages/message-encryption/src/index.ts @@ -1,7 +1,7 @@ import { DecodedMessage as DecodedMessageV0, proto, -} from "@waku/core/lib/waku_message/version_0"; +} from "@waku/core/lib/message/version_0"; import type { IDecodedMessage } from "@waku/interfaces"; import { diff --git a/packages/message-encryption/src/symmetric.ts b/packages/message-encryption/src/symmetric.ts index b177813a5e..e52d0a1273 100644 --- a/packages/message-encryption/src/symmetric.ts +++ b/packages/message-encryption/src/symmetric.ts @@ -1,7 +1,4 @@ -import { - Decoder as DecoderV0, - proto, -} from "@waku/core/lib/waku_message/version_0"; +import { Decoder as DecoderV0, proto } from "@waku/core/lib/message/version_0"; import type { IDecoder, IEncoder,