From 92ac044e37ae7f75a3c4a23c12266ffdfcd82521 Mon Sep 17 00:00:00 2001 From: sebr Date: Thu, 27 Apr 2023 11:17:54 +0100 Subject: [PATCH 1/2] Rename server.ts to Server.ts --- lib/{server.ts => Server.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/{server.ts => Server.ts} (100%) diff --git a/lib/server.ts b/lib/Server.ts similarity index 100% rename from lib/server.ts rename to lib/Server.ts From ca03d9a9053ea4a59a6360d6bd94d1b93a5c9a43 Mon Sep 17 00:00:00 2001 From: Sebastien Ringrose Date: Thu, 27 Apr 2023 11:18:50 +0100 Subject: [PATCH 2/2] fix: Server.ts capitalisation --- README.md | 3 ++- lib/handlers/ssr.ts | 2 +- lib/handlers/static.ts | 2 +- lib/middleware/cacher.ts | 2 +- lib/types.ts | 2 +- lib/utils/Cascade.ts | 2 +- lib/utils/Profiler.ts | 2 +- lib/utils/helpers.ts | 1 - mod.ts | 4 ++-- tests/handlers/sse_test.ts | 2 +- tests/handlers/ssr_test.ts | 2 +- tests/handlers/static_test.ts | 2 +- tests/handlers/ws_test.ts | 2 +- tests/middleware/authenticator_test.ts | 2 +- tests/middleware/cacher_test.ts | 2 +- tests/middleware/logger_test.ts | 2 +- tests/scripts/profile.ts | 2 +- tests/server_test.ts | 2 +- tests/utils/Cascade_test.ts | 2 +- tests/utils/Profiler_test.ts | 2 +- tests/{router_test.ts => utils/Router_test.ts} | 6 +++--- tests/utils/helpers_test.ts | 2 +- 22 files changed, 25 insertions(+), 25 deletions(-) rename tests/{router_test.ts => utils/Router_test.ts} (91%) diff --git a/README.md b/README.md index 1db505b9..cd663be6 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,8 @@

Getting started

```js -import * as Peko from "https://deno.land/x/peko/mod.ts"; // or "../server.ts" for super featherweight +import * as Peko from "https://deno.land/x/peko/mod.ts"; +// import from ".../peko/lib/Server.ts" for featherweight mode const server = new Peko.Server(); diff --git a/lib/handlers/ssr.ts b/lib/handlers/ssr.ts index 8945d265..2ec7a40f 100644 --- a/lib/handlers/ssr.ts +++ b/lib/handlers/ssr.ts @@ -1,4 +1,4 @@ -import { RequestContext } from "../server.ts" +import { RequestContext } from "../Server.ts" import { Handler, HandlerOptions } from "../types.ts" import { Crypto } from "../utils/Crypto.ts" import { mergeHeaders } from "../utils/helpers.ts" diff --git a/lib/handlers/static.ts b/lib/handlers/static.ts index 0d7683e7..297b99dd 100644 --- a/lib/handlers/static.ts +++ b/lib/handlers/static.ts @@ -1,6 +1,6 @@ import { contentType } from "https://deno.land/std@0.174.0/media_types/mod.ts"; import { fromFileUrl } from "https://deno.land/std@0.174.0/path/mod.ts" -import { RequestContext } from "../server.ts" +import { RequestContext } from "../Server.ts" import { Handler, HandlerOptions } from "../types.ts" import { Crypto } from "../utils/Crypto.ts" import { mergeHeaders } from "../utils/helpers.ts" diff --git a/lib/middleware/cacher.ts b/lib/middleware/cacher.ts index cc5f3df6..035d0831 100644 --- a/lib/middleware/cacher.ts +++ b/lib/middleware/cacher.ts @@ -1,4 +1,4 @@ -import type { RequestContext } from "../server.ts"; +import type { RequestContext } from "../Server.ts"; import { Middleware } from "../types.ts"; import { ResponseCache } from "../utils/ResponseCache.ts"; diff --git a/lib/types.ts b/lib/types.ts index 38d773b2..ba0e80b8 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -1,4 +1,4 @@ -import { RequestContext } from "./server.ts" +import { RequestContext } from "./Server.ts" export interface Route { path: `/${string}` diff --git a/lib/utils/Cascade.ts b/lib/utils/Cascade.ts index a66787f7..6c09fc14 100644 --- a/lib/utils/Cascade.ts +++ b/lib/utils/Cascade.ts @@ -1,4 +1,4 @@ -import { RequestContext } from "../server.ts" +import { RequestContext } from "../Server.ts" import { Middleware, Result, Next, Route } from "../types.ts" export type PromiseMiddleware = (ctx: RequestContext, next: Next) => Promise diff --git a/lib/utils/Profiler.ts b/lib/utils/Profiler.ts index 228d8701..c181f8d9 100644 --- a/lib/utils/Profiler.ts +++ b/lib/utils/Profiler.ts @@ -1,4 +1,4 @@ -import { Server } from "../server.ts" +import { Server } from "../Server.ts" import { Route } from "../types.ts" type ProfileConfig = { diff --git a/lib/utils/helpers.ts b/lib/utils/helpers.ts index ba80844f..68fcef49 100644 --- a/lib/utils/helpers.ts +++ b/lib/utils/helpers.ts @@ -1,4 +1,3 @@ -// import { Server } from "../server.ts" import { Middleware, Route } from "../types.ts" import { staticHandler } from "../handlers/static.ts" diff --git a/mod.ts b/mod.ts index 0e1b393b..0aa295ad 100644 --- a/mod.ts +++ b/mod.ts @@ -3,7 +3,7 @@ */ // Core classes, functions & types -export * from "./lib/server.ts" +export * from "./lib/Server.ts" export * from "./lib/types.ts" // Handlers @@ -23,5 +23,5 @@ export * from "./lib/utils/ResponseCache.ts" export * from "./lib/utils/Crypto.ts" export * from "./lib/utils/helpers.ts" -import { Server } from "./lib/server.ts" +import { Server } from "./lib/Server.ts" export default Server \ No newline at end of file diff --git a/tests/handlers/sse_test.ts b/tests/handlers/sse_test.ts index 90df5ba0..e985aa0c 100644 --- a/tests/handlers/sse_test.ts +++ b/tests/handlers/sse_test.ts @@ -1,5 +1,5 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server, RequestContext } from "../../lib/server.ts" +import { Server, RequestContext } from "../../lib/Server.ts" import { sseHandler } from "../../lib/handlers/sse.ts" Deno.test("HANDLER: Server-sent events", async (t) => { diff --git a/tests/handlers/ssr_test.ts b/tests/handlers/ssr_test.ts index 348b0364..ca355890 100644 --- a/tests/handlers/ssr_test.ts +++ b/tests/handlers/ssr_test.ts @@ -1,5 +1,5 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server, RequestContext } from "../../lib/server.ts" +import { Server, RequestContext } from "../../lib/Server.ts" import { ssrHandler } from "../../lib/handlers/ssr.ts" Deno.test("HANDLER: Server-side render", async (t) => { diff --git a/tests/handlers/static_test.ts b/tests/handlers/static_test.ts index 542ffcb5..c6106106 100644 --- a/tests/handlers/static_test.ts +++ b/tests/handlers/static_test.ts @@ -1,5 +1,5 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server, RequestContext } from "../../lib/server.ts" +import { Server, RequestContext } from "../../lib/Server.ts" import { staticHandler } from "../../lib/handlers/static.ts" Deno.test("HANDLER: Static", async (t) => { diff --git a/tests/handlers/ws_test.ts b/tests/handlers/ws_test.ts index 3429bc20..b5a63232 100644 --- a/tests/handlers/ws_test.ts +++ b/tests/handlers/ws_test.ts @@ -1,5 +1,5 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server } from "../../lib/server.ts" +import { Server } from "../../lib/Server.ts" import { wsHandler } from "../../lib/handlers/ws.ts" Deno.test("HANDLER: WebSocket", async (t) => { diff --git a/tests/middleware/authenticator_test.ts b/tests/middleware/authenticator_test.ts index 9ae59a52..4d6612a4 100644 --- a/tests/middleware/authenticator_test.ts +++ b/tests/middleware/authenticator_test.ts @@ -1,5 +1,5 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server, RequestContext } from "../../lib/server.ts" +import { Server, RequestContext } from "../../lib/Server.ts" import { authenticator } from "../../lib/middleware/authenticator.ts" import { Crypto } from "../../lib/utils/Crypto.ts" diff --git a/tests/middleware/cacher_test.ts b/tests/middleware/cacher_test.ts index ac557e1a..40cc6a82 100644 --- a/tests/middleware/cacher_test.ts +++ b/tests/middleware/cacher_test.ts @@ -1,5 +1,5 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server, RequestContext } from "../../lib/server.ts" +import { Server, RequestContext } from "../../lib/Server.ts" import { cacher } from "../../lib/middleware/cacher.ts" import { testHandler } from "../mocks/middleware.ts" import { ResponseCache } from "../../lib/utils/ResponseCache.ts" diff --git a/tests/middleware/logger_test.ts b/tests/middleware/logger_test.ts index 82161a13..57571009 100644 --- a/tests/middleware/logger_test.ts +++ b/tests/middleware/logger_test.ts @@ -1,5 +1,5 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server, RequestContext } from "../../lib/server.ts" +import { Server, RequestContext } from "../../lib/Server.ts" import { logger } from "../../lib/middleware/logger.ts" Deno.test("MIDDLEWARE: Logger", async (t) => { diff --git a/tests/scripts/profile.ts b/tests/scripts/profile.ts index e8b7870c..c25b14f6 100644 --- a/tests/scripts/profile.ts +++ b/tests/scripts/profile.ts @@ -1,4 +1,4 @@ -import { Server } from "../../lib/server.ts" +import { Server } from "../../lib/Server.ts" import { testMiddleware2, testMiddleware3, diff --git a/tests/server_test.ts b/tests/server_test.ts index 81fe9a04..82c0f04a 100644 --- a/tests/server_test.ts +++ b/tests/server_test.ts @@ -1,4 +1,4 @@ -import { Server } from "../lib/server.ts" +import { Server } from "../lib/Server.ts" import { testMiddleware2, testMiddleware3, diff --git a/tests/utils/Cascade_test.ts b/tests/utils/Cascade_test.ts index 48fb148d..d81bab3a 100644 --- a/tests/utils/Cascade_test.ts +++ b/tests/utils/Cascade_test.ts @@ -1,5 +1,5 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server, RequestContext } from "../../lib/server.ts" +import { Server, RequestContext } from "../../lib/Server.ts" import { Cascade } from "../../lib/utils/Cascade.ts" import { testMiddleware1, diff --git a/tests/utils/Profiler_test.ts b/tests/utils/Profiler_test.ts index fcc0f0db..788817e8 100644 --- a/tests/utils/Profiler_test.ts +++ b/tests/utils/Profiler_test.ts @@ -1,5 +1,5 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server } from "../../lib/server.ts" +import { Server } from "../../lib/Server.ts" import Profiler from "../../lib/utils/Profiler.ts" Deno.test("UTIL: Profiler", async (t) => { diff --git a/tests/router_test.ts b/tests/utils/Router_test.ts similarity index 91% rename from tests/router_test.ts rename to tests/utils/Router_test.ts index 4145d7c8..9be95656 100644 --- a/tests/router_test.ts +++ b/tests/utils/Router_test.ts @@ -1,10 +1,10 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server } from "../lib/server.ts" -import { Router } from "../lib/utils/Router.ts" +import { Server } from "../../lib/Server.ts" +import { Router } from "../../lib/utils/Router.ts" import { testMiddleware1, testHandler, -} from "./mocks/middleware.ts" +} from "../mocks/middleware.ts" Deno.test("SERVER", async (t) => { const router = new Router() diff --git a/tests/utils/helpers_test.ts b/tests/utils/helpers_test.ts index 727e7d0a..b3099804 100644 --- a/tests/utils/helpers_test.ts +++ b/tests/utils/helpers_test.ts @@ -1,5 +1,5 @@ import { assert } from "https://deno.land/std@0.174.0/testing/asserts.ts" -import { Server } from "../../lib/server.ts" +import { Server } from "../../lib/Server.ts" import { mergeHeaders, staticDir