From 7a766dce2bab541c21419b5787cfbf0cbfd6a7ae Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Fri, 19 Apr 2024 18:15:52 +1000 Subject: [PATCH] chore: update to std 0.223 --- application.ts | 74 +++++++++++++++++++++++++++++++++++--- deps.ts | 26 +++++++------- examples/closeServer.ts | 2 +- examples/cookieServer.ts | 2 +- examples/countingServer.ts | 2 +- examples/httpsServer.ts | 2 +- examples/proxyServer.ts | 2 +- examples/routingServer.ts | 2 +- examples/server.ts | 2 +- examples/sseServer.ts | 2 +- examples/staticServer.ts | 2 +- mod.test.ts | 2 +- request.ts | 2 +- test_deps.ts | 12 +++---- 14 files changed, 99 insertions(+), 35 deletions(-) diff --git a/application.ts b/application.ts index 3cde59c..e4c3057 100644 --- a/application.ts +++ b/application.ts @@ -59,20 +59,84 @@ export interface ListenOptionsBase { signal?: AbortSignal; } +interface TlsCertifiedKeyPem { + /** The format of this key material, which must be PEM. */ + keyFormat?: "pem"; + /** Private key in `PEM` format. RSA, EC, and PKCS8-format keys are supported. */ + key: string; + /** Certificate chain in `PEM` format. */ + cert: string; +} + +interface TlsCertifiedKeyFromFile { + /** Path to a file containing a PEM formatted CA certificate. Requires + * `--allow-read`. + * + * @tags allow-read + * @deprecated This will be removed in Deno 2.0. See the + * {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide} + * for migration instructions. + */ + certFile: string; + /** Path to a file containing a private key file. Requires `--allow-read`. + * + * @tags allow-read + * @deprecated This will be removed in Deno 2.0. See the + * {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide} + * for migration instructions. + */ + keyFile: string; +} + +interface TlsCertifiedKeyConnectTls { + /** + * Certificate chain in `PEM` format. + * + * @deprecated This will be removed in Deno 2.0. See the + * {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide} + * for migration instructions. + */ + certChain: string; + /** + * Private key in `PEM` format. RSA, EC, and PKCS8-format keys are supported. + * + * @deprecated This will be removed in Deno 2.0. See the + * {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide} + * for migration instructions. + */ + privateKey: string; +} + +type TlsCertifiedKeyOptions = + | TlsCertifiedKeyPem + | TlsCertifiedKeyFromFile + | TlsCertifiedKeyConnectTls; + /** Interface options when listening on TLS. */ -export interface ListenOptionsTls extends Deno.ListenTlsOptions { +export type ListenOptionsTls = { + /** The port to listen on. */ + port: number; + /** A literal IP address or host name that can be resolved to an IP address. + * + * __Note about `0.0.0.0`__ While listening `0.0.0.0` works on all platforms, + * the browsers on Windows don't work with the address `0.0.0.0`. + * You should show the message like `server running on localhost:8080` instead of + * `server running on 0.0.0.0:8080` if your program supports Windows. + * + * @default {"0.0.0.0"} */ + hostname?: string; + + transport?: "tcp"; + /** Application-Layer Protocol Negotiation (ALPN) protocols to announce to * the client. If not specified, no ALPN extension will be included in the * TLS handshake. - * - * **NOTE** this is part of the native HTTP server in Deno 1.9 or later, - * which requires the `--unstable` flag to be available. */ alpnProtocols?: string[]; secure: true; /** An optional abort signal which can be used to close the listener. */ signal?: AbortSignal; -} +} & TlsCertifiedKeyOptions; interface HandleMethod { /** Handle an individual server request, returning the server response. This diff --git a/deps.ts b/deps.ts index 6a07474..a15aa95 100644 --- a/deps.ts +++ b/deps.ts @@ -4,28 +4,28 @@ // jsr dependencies -export { assert } from "jsr:@std/assert@0.222/assert"; -export { concat } from "jsr:@std/bytes@0.222/concat"; -export { copy as copyBytes } from "jsr:@std/bytes@0.222/copy"; -export { timingSafeEqual } from "jsr:@std/crypto@0.222/timing-safe-equal"; -export { KeyStack } from "jsr:@std/crypto@0.222/unstable-keystack"; +export { assert } from "jsr:@std/assert@0.223/assert"; +export { concat } from "jsr:@std/bytes@0.223/concat"; +export { copy as copyBytes } from "jsr:@std/bytes@0.223/copy"; +export { timingSafeEqual } from "jsr:@std/crypto@0.223/timing-safe-equal"; +export { KeyStack } from "jsr:@std/crypto@0.223/unstable-keystack"; export { calculate, type ETagOptions, type FileInfo, ifMatch, ifNoneMatch, -} from "jsr:@std/http@0.222/etag"; +} from "jsr:@std/http@0.223/etag"; export { accepts, acceptsEncodings, acceptsLanguages, -} from "jsr:@std/http@0.222/negotiation"; -export { UserAgent } from "jsr:@std/http@0.222/user-agent"; -export { LimitedReader } from "jsr:@std/io@0.222/limited-reader"; -export { readAll } from "jsr:@std/io@0.222/read-all"; -export { contentType } from "jsr:@std/media-types@0.222/content-type"; -export { typeByExtension } from "jsr:@std/media-types@0.222/type-by-extension"; +} from "jsr:@std/http@0.223/negotiation"; +export { UserAgent } from "jsr:@std/http@0.223/user-agent"; +export { LimitedReader } from "jsr:@std/io@0.223/limited-reader"; +export { readAll } from "jsr:@std/io@0.223/read-all"; +export { contentType } from "jsr:@std/media-types@0.223/content-type"; +export { typeByExtension } from "jsr:@std/media-types@0.223/type-by-extension"; export { basename, extname, @@ -34,7 +34,7 @@ export { normalize, parse, SEPARATOR, -} from "jsr:@std/path@0.222/"; +} from "jsr:@std/path@0.223/"; // 3rd party dependencies diff --git a/examples/closeServer.ts b/examples/closeServer.ts index 54056fd..fb7c26a 100644 --- a/examples/closeServer.ts +++ b/examples/closeServer.ts @@ -3,7 +3,7 @@ */ // Importing some console colors -import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.222/colors"; +import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.223/colors"; import { Application, type Context, Router, Status } from "../mod.ts"; diff --git a/examples/cookieServer.ts b/examples/cookieServer.ts index e50846e..862c9d2 100644 --- a/examples/cookieServer.ts +++ b/examples/cookieServer.ts @@ -3,7 +3,7 @@ */ // Importing some console colors -import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.222/colors"; +import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.223/colors"; import { Application } from "../mod.ts"; diff --git a/examples/countingServer.ts b/examples/countingServer.ts index fd7afb6..8ed80f3 100644 --- a/examples/countingServer.ts +++ b/examples/countingServer.ts @@ -2,7 +2,7 @@ * `MiddlewareObject` can be ideal for when a middleware needs to encapsulate * large amounts of logic or its own state. */ -import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.222/colors"; +import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.223/colors"; import { Application, diff --git a/examples/httpsServer.ts b/examples/httpsServer.ts index 83dacdb..cce581b 100644 --- a/examples/httpsServer.ts +++ b/examples/httpsServer.ts @@ -8,7 +8,7 @@ */ // Importing some console colors -import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.222/colors"; +import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.223/colors"; import { Application } from "../mod.ts"; diff --git a/examples/proxyServer.ts b/examples/proxyServer.ts index b26ed6a..ddbab32 100644 --- a/examples/proxyServer.ts +++ b/examples/proxyServer.ts @@ -2,7 +2,7 @@ * This is an example proxy server. */ -import { bold, cyan, green, red, yellow } from "jsr:@std/fmt@0.222/colors"; +import { bold, cyan, green, red, yellow } from "jsr:@std/fmt@0.223/colors"; import { Application, HttpError, proxy, Status } from "../mod.ts"; diff --git a/examples/routingServer.ts b/examples/routingServer.ts index 12dbd5e..afac56a 100644 --- a/examples/routingServer.ts +++ b/examples/routingServer.ts @@ -3,7 +3,7 @@ */ // Importing some console colors -import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.222/colors"; +import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.223/colors"; import { Application, diff --git a/examples/server.ts b/examples/server.ts index 79f22f0..f6fb223 100644 --- a/examples/server.ts +++ b/examples/server.ts @@ -4,7 +4,7 @@ */ // Importing some console colors -import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.222/colors"; +import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.223/colors"; import { Application } from "../mod.ts"; diff --git a/examples/sseServer.ts b/examples/sseServer.ts index b3e8869..d840193 100644 --- a/examples/sseServer.ts +++ b/examples/sseServer.ts @@ -3,7 +3,7 @@ */ // Importing some console colors -import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.222/colors"; +import { bold, cyan, green, yellow } from "jsr:@std/fmt@0.223/colors"; import { Application, diff --git a/examples/staticServer.ts b/examples/staticServer.ts index 4cf56bd..94e1c7d 100644 --- a/examples/staticServer.ts +++ b/examples/staticServer.ts @@ -3,7 +3,7 @@ * $CWD/examples/static path. */ -import { bold, cyan, green, red, yellow } from "jsr:@std/fmt@0.222/colors"; +import { bold, cyan, green, red, yellow } from "jsr:@std/fmt@0.223/colors"; import { Application, HttpError, Status } from "../mod.ts"; diff --git a/mod.test.ts b/mod.test.ts index 783389a..f7b08f6 100644 --- a/mod.test.ts +++ b/mod.test.ts @@ -11,7 +11,7 @@ Deno.test({ assertEquals(typeof mod.Application, "function"); assertEquals(typeof mod.Context, "function"); assertEquals(typeof mod.etag, "object"); - assertEquals(typeof mod.etag.calculate, "function"); + assertEquals(typeof mod.etag.getEntity, "function"); assertEquals(typeof mod.etag.factory, "function"); assertEquals(typeof mod.helpers, "object"); assertEquals(typeof mod.helpers.getQuery, "function"); diff --git a/request.ts b/request.ts index 812beda..2fca284 100644 --- a/request.ts +++ b/request.ts @@ -163,7 +163,7 @@ export class Request { /** An object representing the requesting user agent. If the `User-Agent` * header isn't defined in the request, all the properties will be undefined. * - * See [std/http/user_agent#UserAgent](https://deno.land/std@0.222.2/http/user_agent.ts?s=UserAgent) + * See [std/http/user_agent#UserAgent](https://deno.land/std@0.223/http/user_agent.ts?s=UserAgent) * for more information. */ get userAgent(): UserAgent { diff --git a/test_deps.ts b/test_deps.ts index 5fb4a9d..6999d81 100644 --- a/test_deps.ts +++ b/test_deps.ts @@ -1,8 +1,8 @@ // Copyright 2018-2024 the oak authors. All rights reserved. MIT license. -export { assertEquals } from "jsr:@std/assert@0.222/assert-equals"; -export { assertInstanceOf } from "jsr:@std/assert@0.222/assert-instance-of"; -export { assertRejects } from "jsr:@std/assert@0.222/assert-rejects"; -export { assertStrictEquals } from "jsr:@std/assert@0.222/assert-strict-equals"; -export { assertThrows } from "jsr:@std/assert@0.222/assert-throws"; -export { unreachable } from "jsr:@std/assert@0.222/unreachable"; +export { assertEquals } from "jsr:@std/assert@0.223/assert-equals"; +export { assertInstanceOf } from "jsr:@std/assert@0.223/assert-instance-of"; +export { assertRejects } from "jsr:@std/assert@0.223/assert-rejects"; +export { assertStrictEquals } from "jsr:@std/assert@0.223/assert-strict-equals"; +export { assertThrows } from "jsr:@std/assert@0.223/assert-throws"; +export { unreachable } from "jsr:@std/assert@0.223/unreachable";