From 2abfca2c4011a610e443c39600470988fa723751 Mon Sep 17 00:00:00 2001 From: Hans Klunder Date: Wed, 6 Mar 2024 17:01:42 +0100 Subject: [PATCH] improve dependency handling --- bin/conformanceServer.ts | 2 +- bin/demoServer.ts | 2 +- bin/mqtt.ts | 2 +- client/client.ts | 2 +- client/deps.ts | 2 +- client/dev_deps.ts | 2 -- client/store/deps.ts | 2 +- deno/server.test.ts | 2 +- utils/dev_utils.ts => dev_utils/dummyConn.ts | 2 +- utils/dev_deps.ts => dev_utils/mod.ts | 2 ++ mqttConn/deps.ts | 29 -------------------- mqttConn/dev_deps.ts | 2 -- mqttConn/mqttConn.test.ts | 5 ++-- mqttConn/mqttConn.ts | 7 +++-- mqttPacket/connack.test.ts | 2 +- mqttPacket/connect.test.ts | 2 +- mqttPacket/decoder.test.ts | 2 +- mqttPacket/dev_deps.ts | 1 - mqttPacket/disconnect.test.ts | 2 +- mqttPacket/encoder.test.ts | 2 +- mqttPacket/length.test.ts | 2 +- mqttPacket/mod.ts | 3 ++ mqttPacket/pingreq.test.ts | 2 +- mqttPacket/pingres.test.ts | 2 +- mqttPacket/puback.test.ts | 2 +- mqttPacket/pubcomp.test.ts | 2 +- mqttPacket/publish.test.ts | 2 +- mqttPacket/pubrec.test.ts | 2 +- mqttPacket/pubrel.test.ts | 2 +- mqttPacket/suback.test.ts | 2 +- mqttPacket/subscribe.test.ts | 2 +- mqttPacket/unsuback.test.ts | 2 +- mqttPacket/unsubscribe.test.ts | 2 +- persistence/deps.ts | 2 +- persistence/memory/memoryPersistence.test.ts | 2 +- persistence/memory/memoryPersistence.ts | 2 +- server/deps.ts | 4 +-- server/test/dev_deps.ts | 2 -- server/test/handleConnect.test.ts | 4 +-- server/test/test-handlers.ts | 2 +- timer/timer.test.ts | 2 +- trie/trie.test.ts | 2 +- utils/{deps.ts => mod.ts} | 10 +++++-- utils/utils.ts | 2 +- 44 files changed, 55 insertions(+), 80 deletions(-) delete mode 100644 client/dev_deps.ts rename utils/dev_utils.ts => dev_utils/dummyConn.ts (98%) rename utils/dev_deps.ts => dev_utils/mod.ts (76%) delete mode 100644 mqttConn/deps.ts delete mode 100644 mqttConn/dev_deps.ts delete mode 100644 mqttPacket/dev_deps.ts delete mode 100644 server/test/dev_deps.ts rename utils/{deps.ts => mod.ts} (51%) diff --git a/bin/conformanceServer.ts b/bin/conformanceServer.ts index 6bc3137..351ae92 100644 --- a/bin/conformanceServer.ts +++ b/bin/conformanceServer.ts @@ -2,7 +2,7 @@ import { AuthenticationResult, Context, Topic } from "../server/mod.ts"; import { DenoServer } from "../deno/server.ts"; -import { logger, LogLevel } from "../utils/utils.ts"; +import { logger, LogLevel } from "../utils/mod.ts"; const utf8Decoder = new TextDecoder(); const userTable = new Map(); diff --git a/bin/demoServer.ts b/bin/demoServer.ts index 59d0d4f..40bee12 100644 --- a/bin/demoServer.ts +++ b/bin/demoServer.ts @@ -1,6 +1,6 @@ import { AuthenticationResult, Context, Topic } from "../server/mod.ts"; import { DenoServer } from "../deno/server.ts"; -import { logger, LogLevel } from "../utils/utils.ts"; +import { logger, LogLevel } from "../utils/mod.ts"; const utf8Decoder = new TextDecoder(); const userTable = new Map(); diff --git a/bin/mqtt.ts b/bin/mqtt.ts index b7c890c..3af2953 100644 --- a/bin/mqtt.ts +++ b/bin/mqtt.ts @@ -1,4 +1,4 @@ -import { parseArgs } from "../utils/deps.ts"; +import { parseArgs } from "../utils/mod.ts"; import { DenoClient as Client } from "../deno/client.ts"; import { DEFAULT_URL, logger } from "../client/mod.ts"; diff --git a/client/client.ts b/client/client.ts index 227bbca..e3c3184 100644 --- a/client/client.ts +++ b/client/client.ts @@ -51,7 +51,7 @@ const CLIENTID_PREFIX = "opifex"; // on first connect export class Client { protected clientIdPrefix = CLIENTID_PREFIX; protected numberOfRetries = DEFAULT_RETRIES; - protected url = new URL(DEFAULT_URL); + protected url: URL = new URL(DEFAULT_URL); protected keepAlive = DEFAULT_KEEPALIVE; protected autoReconnect = true; private caCerts?: string[]; diff --git a/client/deps.ts b/client/deps.ts index aa1428a..cb7a362 100644 --- a/client/deps.ts +++ b/client/deps.ts @@ -29,5 +29,5 @@ export { export { MqttConn } from "../mqttConn/mqttConn.ts"; export type { SockConn } from "../mqttConn/mqttConn.ts"; export { Timer } from "../timer/timer.ts"; -export { AsyncQueue, Deferred, logger } from "../utils/utils.ts"; +export { AsyncQueue, Deferred, logger } from "../utils/mod.ts"; export { MemoryStore } from "./store/memoryStore.ts"; diff --git a/client/dev_deps.ts b/client/dev_deps.ts deleted file mode 100644 index c067a35..0000000 --- a/client/dev_deps.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { assertEquals } from "../utils/dev_deps.ts"; -export { DummyConn } from "../utils/dev_utils.ts"; diff --git a/client/store/deps.ts b/client/store/deps.ts index d09f338..e183cbd 100644 --- a/client/store/deps.ts +++ b/client/store/deps.ts @@ -19,4 +19,4 @@ export type { UnsubscribePacket, } from "../../mqttPacket/mod.ts"; -export { assert } from "../../utils/deps.ts"; +export { assert } from "../../utils/mod.ts"; diff --git a/deno/server.test.ts b/deno/server.test.ts index a949324..40f429b 100644 --- a/deno/server.test.ts +++ b/deno/server.test.ts @@ -1,5 +1,5 @@ import { DenoServer } from "./server.ts"; -import { assertEquals } from "../utils/dev_deps.ts"; +import { assertEquals } from "../dev_utils/mod.ts"; Deno.test("testServer", () => { const server = new DenoServer({ port: 0 }, {}); diff --git a/utils/dev_utils.ts b/dev_utils/dummyConn.ts similarity index 98% rename from utils/dev_utils.ts rename to dev_utils/dummyConn.ts index 705e02d..f87aac6 100644 --- a/utils/dev_utils.ts +++ b/dev_utils/dummyConn.ts @@ -1,4 +1,4 @@ -import { AsyncQueue } from "./utils.ts"; +import { AsyncQueue } from "../utils/mod.ts"; import { SockConn } from "../mqttConn/mqttConn.ts"; class Uint8Writer implements WritableStreamDefaultWriter { diff --git a/utils/dev_deps.ts b/dev_utils/mod.ts similarity index 76% rename from utils/dev_deps.ts rename to dev_utils/mod.ts index 296bfba..1a8f3b8 100644 --- a/utils/dev_deps.ts +++ b/dev_utils/mod.ts @@ -4,3 +4,5 @@ export { assertThrows, } from "https://deno.land/std@0.215.0/assert/mod.ts"; export { readerFromIterable } from "https://deno.land/std@0.215.0/streams/mod.ts"; + +export { DummyConn, DummyQueueConn } from "./dummyConn.ts"; diff --git a/mqttConn/deps.ts b/mqttConn/deps.ts deleted file mode 100644 index 31d8aa1..0000000 --- a/mqttConn/deps.ts +++ /dev/null @@ -1,29 +0,0 @@ -export type { - AnyPacket, - ConnackPacket, - ConnectPacket, - DisconnectPacket, - PingreqPacket, - PingresPacket, - PubackPacket, - PubcompPacket, - PublishPacket, - PubrecPacket, - PubrelPacket, - SubackPacket, - SubscribePacket, - Subscription, - UnsubackPacket, - UnsubscribePacket, -} from "../mqttPacket/mod.ts"; - -export { - AuthenticationResult, - decodePayload, - encode, - PacketType, -} from "../mqttPacket/mod.ts"; - -export { getLengthDecoder } from "../mqttPacket/length.ts"; -export type { LengthDecoderResult } from "../mqttPacket/length.ts"; -export { assert, BufReader } from "../utils/deps.ts"; diff --git a/mqttConn/dev_deps.ts b/mqttConn/dev_deps.ts deleted file mode 100644 index c067a35..0000000 --- a/mqttConn/dev_deps.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { assertEquals } from "../utils/dev_deps.ts"; -export { DummyConn } from "../utils/dev_utils.ts"; diff --git a/mqttConn/mqttConn.test.ts b/mqttConn/mqttConn.test.ts index 3e7897d..61fd6dc 100644 --- a/mqttConn/mqttConn.test.ts +++ b/mqttConn/mqttConn.test.ts @@ -1,7 +1,6 @@ import { MqttConn, MqttConnError } from "./mqttConn.ts"; -import { AnyPacket, encode } from "./deps.ts"; -import { assertEquals, DummyConn } from "./dev_deps.ts"; -import { PacketType } from "../mqttPacket/types.ts"; +import { assertEquals, DummyConn } from "../dev_utils/mod.ts"; +import { PacketType, AnyPacket, encode } from "../mqttPacket/mod.ts"; const connectPacket: AnyPacket = { type: PacketType.connect, diff --git a/mqttConn/mqttConn.ts b/mqttConn/mqttConn.ts index d641d83..ab3de66 100644 --- a/mqttConn/mqttConn.ts +++ b/mqttConn/mqttConn.ts @@ -1,11 +1,12 @@ import { AnyPacket, - assert, decodePayload, encode, getLengthDecoder, LengthDecoderResult, -} from "./deps.ts"; +} from "../mqttPacket/mod.ts"; + +import { assert } from "../utils/mod.ts" export type SockConn = { readable: ReadableStream; @@ -49,7 +50,7 @@ async function readFull(conn: SockConn, buf: Uint8Array): Promise { } } -/** Read MQTT packet from given BufReader +/** Read MQTT packet * @throws `Error` if packet is invalid */ export async function readPacket( diff --git a/mqttPacket/connack.test.ts b/mqttPacket/connack.test.ts index 7faf9a8..5653f66 100644 --- a/mqttPacket/connack.test.ts +++ b/mqttPacket/connack.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Connack packet", () => { diff --git a/mqttPacket/connect.test.ts b/mqttPacket/connect.test.ts index 291c944..6fe06a3 100644 --- a/mqttPacket/connect.test.ts +++ b/mqttPacket/connect.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { ConnectPacket, decode, encode } from "./mod.ts"; Deno.test("encode Connect with ClientId", () => { diff --git a/mqttPacket/decoder.test.ts b/mqttPacket/decoder.test.ts index 97ae0ed..c9e01cf 100644 --- a/mqttPacket/decoder.test.ts +++ b/mqttPacket/decoder.test.ts @@ -1,4 +1,4 @@ -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { Decoder } from "./decoder.ts"; const utf8encoder = new TextEncoder(); diff --git a/mqttPacket/dev_deps.ts b/mqttPacket/dev_deps.ts deleted file mode 100644 index 2d85857..0000000 --- a/mqttPacket/dev_deps.ts +++ /dev/null @@ -1 +0,0 @@ -export { assertEquals, assertThrows } from "../utils/dev_deps.ts"; diff --git a/mqttPacket/disconnect.test.ts b/mqttPacket/disconnect.test.ts index 0e11280..68758d0 100644 --- a/mqttPacket/disconnect.test.ts +++ b/mqttPacket/disconnect.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Disconnect", () => { diff --git a/mqttPacket/encoder.test.ts b/mqttPacket/encoder.test.ts index 81b58d4..203e9c8 100644 --- a/mqttPacket/encoder.test.ts +++ b/mqttPacket/encoder.test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "./dev_deps.ts"; +import { assertEquals } from "../dev_utils/mod.ts"; import { Encoder } from "./encoder.ts"; const utf8Encoder = new TextEncoder(); diff --git a/mqttPacket/length.test.ts b/mqttPacket/length.test.ts index 8ef1c11..f2cdc5e 100644 --- a/mqttPacket/length.test.ts +++ b/mqttPacket/length.test.ts @@ -1,4 +1,4 @@ -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decodeLength as decode, encodeLength as encode } from "./length.ts"; Deno.test("encodeLength", function encodeLength() { diff --git a/mqttPacket/mod.ts b/mqttPacket/mod.ts index b0a1f02..03aaaf9 100644 --- a/mqttPacket/mod.ts +++ b/mqttPacket/mod.ts @@ -136,3 +136,6 @@ export function decode(buffer: Uint8Array): AnyPacket { const end = start + length; return decodePayload(buffer[0], buffer.subarray(start, end)); } + +export { getLengthDecoder } from "../mqttPacket/length.ts"; +export type { LengthDecoderResult } from "../mqttPacket/length.ts"; diff --git a/mqttPacket/pingreq.test.ts b/mqttPacket/pingreq.test.ts index 8aa34d8..45f4ffe 100644 --- a/mqttPacket/pingreq.test.ts +++ b/mqttPacket/pingreq.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Pingreq", () => { diff --git a/mqttPacket/pingres.test.ts b/mqttPacket/pingres.test.ts index ed1f4ef..a98a21f 100644 --- a/mqttPacket/pingres.test.ts +++ b/mqttPacket/pingres.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Pingres", () => { diff --git a/mqttPacket/puback.test.ts b/mqttPacket/puback.test.ts index b2b1486..25e8df0 100644 --- a/mqttPacket/puback.test.ts +++ b/mqttPacket/puback.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Puback", () => { diff --git a/mqttPacket/pubcomp.test.ts b/mqttPacket/pubcomp.test.ts index 41f1124..6848dfd 100644 --- a/mqttPacket/pubcomp.test.ts +++ b/mqttPacket/pubcomp.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Pubcomp", () => { diff --git a/mqttPacket/publish.test.ts b/mqttPacket/publish.test.ts index 21732b2..5d863b3 100644 --- a/mqttPacket/publish.test.ts +++ b/mqttPacket/publish.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; // const utf8Decoder = new TextDecoder(); diff --git a/mqttPacket/pubrec.test.ts b/mqttPacket/pubrec.test.ts index ff1675d..06061a9 100644 --- a/mqttPacket/pubrec.test.ts +++ b/mqttPacket/pubrec.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Pubrec", () => { diff --git a/mqttPacket/pubrel.test.ts b/mqttPacket/pubrel.test.ts index f4603c9..ad05122 100644 --- a/mqttPacket/pubrel.test.ts +++ b/mqttPacket/pubrel.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Pubrel", () => { diff --git a/mqttPacket/suback.test.ts b/mqttPacket/suback.test.ts index cee06a3..783602f 100644 --- a/mqttPacket/suback.test.ts +++ b/mqttPacket/suback.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals } from "./dev_deps.ts"; +import { assertEquals } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Suback", () => { diff --git a/mqttPacket/subscribe.test.ts b/mqttPacket/subscribe.test.ts index e7fae50..4faff7b 100644 --- a/mqttPacket/subscribe.test.ts +++ b/mqttPacket/subscribe.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Subscribe", () => { diff --git a/mqttPacket/unsuback.test.ts b/mqttPacket/unsuback.test.ts index f2ff95c..9fca5de 100644 --- a/mqttPacket/unsuback.test.ts +++ b/mqttPacket/unsuback.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Puback", () => { diff --git a/mqttPacket/unsubscribe.test.ts b/mqttPacket/unsubscribe.test.ts index e3432f8..d5b60b0 100644 --- a/mqttPacket/unsubscribe.test.ts +++ b/mqttPacket/unsubscribe.test.ts @@ -1,5 +1,5 @@ import { PacketType } from "./types.ts"; -import { assertEquals, assertThrows } from "./dev_deps.ts"; +import { assertEquals, assertThrows } from "../dev_utils/mod.ts"; import { decode, encode } from "./mod.ts"; Deno.test("encode Unsubscribe", () => { diff --git a/persistence/deps.ts b/persistence/deps.ts index 25ca739..270bf95 100644 --- a/persistence/deps.ts +++ b/persistence/deps.ts @@ -9,4 +9,4 @@ export type { } from "../mqttPacket/mod.ts"; export { PacketType } from "../mqttPacket/mod.ts"; export { Trie } from "../trie/trie.ts"; -export { logger } from "../utils/utils.ts"; +export { logger } from "../utils/mod.ts"; diff --git a/persistence/memory/memoryPersistence.test.ts b/persistence/memory/memoryPersistence.test.ts index ba9b5f2..e28c98e 100644 --- a/persistence/memory/memoryPersistence.test.ts +++ b/persistence/memory/memoryPersistence.test.ts @@ -4,7 +4,7 @@ import { } from "./memoryPersistence.ts"; import { PacketType, PublishPacket } from "../deps.ts"; -import { assertEquals } from "../../utils/dev_deps.ts"; +import { assertEquals } from "../../dev_utils/mod.ts"; const payloadAny = new TextEncoder().encode("any"); const qos = 1; diff --git a/persistence/memory/memoryPersistence.ts b/persistence/memory/memoryPersistence.ts index 84f0258..37faf3d 100644 --- a/persistence/memory/memoryPersistence.ts +++ b/persistence/memory/memoryPersistence.ts @@ -10,7 +10,7 @@ import { import { Client, Handler, IPersistence, RetainStore } from "../persistence.ts"; import { IStore, PacketStore, SubscriptionStore } from "../store.ts"; -import { assert } from "../../utils/deps.ts"; +import { assert } from "../../utils/mod.ts"; const maxPacketId = 0xffff; // const maxQueueLength = 0xffff; diff --git a/server/deps.ts b/server/deps.ts index 9cbc7ea..53877b6 100644 --- a/server/deps.ts +++ b/server/deps.ts @@ -27,6 +27,6 @@ export type { UnsubscribePacket, } from "../mqttPacket/mod.ts"; -export { AuthenticationResult, PacketType } from "../mqttConn/deps.ts"; +export { AuthenticationResult, PacketType } from "../mqttPacket/mod.ts"; export { Timer } from "../timer/timer.ts"; -export { logger } from "../utils/utils.ts"; +export { logger } from "../utils/mod.ts"; diff --git a/server/test/dev_deps.ts b/server/test/dev_deps.ts deleted file mode 100644 index e821c64..0000000 --- a/server/test/dev_deps.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { assertEquals } from "../../utils/dev_deps.ts"; -export { DummyConn, DummyQueueConn } from "../../utils/dev_utils.ts"; diff --git a/server/test/handleConnect.test.ts b/server/test/handleConnect.test.ts index 63daaef..1019a33 100644 --- a/server/test/handleConnect.test.ts +++ b/server/test/handleConnect.test.ts @@ -1,4 +1,4 @@ -import { assertEquals, DummyQueueConn } from "./dev_deps.ts"; +import { assertEquals, DummyQueueConn } from "../../dev_utils/mod.ts"; import { handlers } from "./test-handlers.ts"; import { AnyPacket, @@ -7,7 +7,7 @@ import { } from "../../mqttPacket/mod.ts"; import { MqttServer } from "../mod.ts"; import { MqttConn } from "../deps.ts"; -import { AsyncQueue, nextTick } from "../../utils/utils.ts"; +import { AsyncQueue, nextTick } from "../../utils/mod.ts"; const txtEncoder = new TextEncoder(); // logger.level(LogLevel.debug); diff --git a/server/test/test-handlers.ts b/server/test/test-handlers.ts index d2e83b7..1178945 100644 --- a/server/test/test-handlers.ts +++ b/server/test/test-handlers.ts @@ -1,5 +1,5 @@ import { AuthenticationResult, Context, Topic } from "../mod.ts"; -import { logger } from "../../utils/utils.ts"; +import { logger } from "../../utils/mod.ts"; const utf8Decoder = new TextDecoder(); const userTable = new Map(); diff --git a/timer/timer.test.ts b/timer/timer.test.ts index 134cf0c..05880ae 100644 --- a/timer/timer.test.ts +++ b/timer/timer.test.ts @@ -1,5 +1,5 @@ import { Timer } from "./timer.ts"; -import { assertEquals } from "../utils/dev_deps.ts"; +import { assertEquals } from "../dev_utils/mod.ts"; function delay(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/trie/trie.test.ts b/trie/trie.test.ts index 377094d..ccf0027 100644 --- a/trie/trie.test.ts +++ b/trie/trie.test.ts @@ -1,5 +1,5 @@ import { Trie } from "./trie.ts"; -import { assertArrayIncludes, assertEquals } from "../utils/dev_deps.ts"; +import { assertArrayIncludes, assertEquals } from "../dev_utils/mod.ts"; type Data = Array<[string, number]>; type Matches = Array<[string, number[]]>; diff --git a/utils/deps.ts b/utils/mod.ts similarity index 51% rename from utils/deps.ts rename to utils/mod.ts index 9a3e0f7..bb3f97b 100644 --- a/utils/deps.ts +++ b/utils/mod.ts @@ -1,4 +1,10 @@ -export { parse } from "https://deno.land/std@0.215.0/flags/mod.ts"; export { parseArgs } from "https://deno.land/std@0.215.0/cli/parse_args.ts"; export { assert } from "https://deno.land/std@0.215.0/assert/mod.ts"; -export { BufReader } from "https://deno.land/std@0.215.0/io/mod.ts"; +export { + AsyncQueue, + Deferred, + Logger, + logger, + LogLevel, + nextTick, +} from "./utils.ts"; diff --git a/utils/utils.ts b/utils/utils.ts index 82351fa..73538a2 100644 --- a/utils/utils.ts +++ b/utils/utils.ts @@ -85,7 +85,7 @@ export enum LogLevel { debug = 4, } -class Logger { +export class Logger { private defaultError = console.error; private defaultWarn = console.warn; private defaultInfo = console.info;