chore: bump std to 208 and deal with deprecations (#2081)

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
Reed von Redwitz
2023-11-28 16:35:26 +00:00
committed by GitHub
co-authored by Marvin Hagemeister
parent 6a90fdbf1b
commit b902205feb
20 changed files with 137 additions and 131 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ export {
join,
relative,
toFileUrl,
} from "https://deno.land/std@0.205.0/path/mod.ts";
export { escape as regexpEscape } from "https://deno.land/std@0.205.0/regexp/escape.ts";
} from "https://deno.land/std@0.208.0/path/mod.ts";
export { escape as regexpEscape } from "https://deno.land/std@0.208.0/regexp/escape.ts";
export { denoPlugins } from "https://deno.land/x/esbuild_deno_loader@0.8.2/mod.ts";
export { assertEquals } from "https://deno.land/std@0.205.0/assert/mod.ts";
export { assertEquals } from "https://deno.land/std@0.208.0/assert/mod.ts";
+10 -10
View File
@@ -9,24 +9,24 @@ export {
resolve,
SEP,
toFileUrl,
} from "https://deno.land/std@0.205.0/path/mod.ts";
export { normalize } from "https://deno.land/std@0.205.0/path/posix/mod.ts";
export { DAY, WEEK } from "https://deno.land/std@0.205.0/datetime/constants.ts";
export * as colors from "https://deno.land/std@0.205.0/fmt/colors.ts";
} from "https://deno.land/std@0.208.0/path/mod.ts";
export { normalize } from "https://deno.land/std@0.208.0/path/posix/mod.ts";
export { DAY, WEEK } from "https://deno.land/std@0.208.0/datetime/constants.ts";
export * as colors from "https://deno.land/std@0.208.0/fmt/colors.ts";
export {
walk,
type WalkEntry,
WalkError,
} from "https://deno.land/std@0.205.0/fs/walk.ts";
export { parse } from "https://deno.land/std@0.205.0/flags/mod.ts";
} from "https://deno.land/std@0.208.0/fs/walk.ts";
export { parse } from "https://deno.land/std@0.208.0/flags/mod.ts";
export {
gte,
lt,
parse as semverParse,
} from "https://deno.land/std@0.205.0/semver/mod.ts";
export { emptyDir, existsSync } from "https://deno.land/std@0.205.0/fs/mod.ts";
export * as JSONC from "https://deno.land/std@0.205.0/jsonc/mod.ts";
export { assertEquals } from "https://deno.land/std@0.205.0/assert/mod.ts";
} from "https://deno.land/std@0.208.0/semver/mod.ts";
export { emptyDir, existsSync } from "https://deno.land/std@0.208.0/fs/mod.ts";
export * as JSONC from "https://deno.land/std@0.208.0/jsonc/mod.ts";
export { assertEquals } from "https://deno.land/std@0.208.0/assert/mod.ts";
// ts-morph
export { Node, Project } from "https://deno.land/x/ts_morph@20.0.0/mod.ts";
+1 -1
View File
@@ -2,7 +2,7 @@ export const RECOMMENDED_PREACT_VERSION = "10.19.2";
export const RECOMMENDED_PREACT_SIGNALS_VERSION = "1.2.1";
export const RECOMMENDED_PREACT_SIGNALS_CORE_VERSION = "1.5.0";
export const RECOMMENDED_TWIND_VERSION = "0.16.19";
export const RECOMMENDED_STD_VERSION = "0.205.0";
export const RECOMMENDED_STD_VERSION = "0.208.0";
export const RECOMMENDED_TAILIWIND_VERSION = "3.3.5";
export function freshImports(imports: Record<string, string>) {
+1 -2
View File
@@ -1,6 +1,5 @@
import { assertSnapshot } from "$std/testing/snapshot.ts";
import { createCodeFrame, getFirstUserFile } from "./code_frame.ts";
import { assertEquals, colors } from "./deps.ts";
import { assertEquals, assertSnapshot, colors } from "./deps.ts";
function testCodeFrame(text: string, line: number, column: number) {
const codeFrame = createCodeFrame(text, line, column);
+9 -9
View File
@@ -1,4 +1,4 @@
import { extname, Status, typeByExtension } from "./deps.ts";
import { contentType, extname, STATUS_CODE } from "./deps.ts";
import * as router from "./router.ts";
import { FreshConfig, Manifest, UnknownHandlerContext } from "./mod.ts";
import { ALIVE_URL, DEV_CLIENT_URL, JS_PREFIX } from "./constants.ts";
@@ -220,7 +220,7 @@ export class ServerContext {
const path = url.pathname.replace(/\/+$/, "");
const location = `${path}${url.search}`;
return new Response(null, {
status: Status.TemporaryRedirect,
status: STATUS_CODE.TemporaryRedirect,
headers: { location },
});
} else if (trailingSlashEnabled && !url.pathname.endsWith("/")) {
@@ -232,7 +232,7 @@ export class ServerContext {
if (!isFile && !isInternal) {
url.pathname += "/";
return Response.redirect(url, Status.PermanentRedirect);
return Response.redirect(url, STATUS_CODE.PermanentRedirect);
}
}
@@ -390,7 +390,7 @@ export class ServerContext {
) {
route.pattern += "/";
}
const createRender = genRender(route, Status.OK);
const createRender = genRender(route, STATUS_CODE.OK);
if (typeof route.handler === "function") {
routes[route.pattern] = {
baseRoute: route.baseRoute,
@@ -445,7 +445,7 @@ export class ServerContext {
const errorHandlerRender = genRender(
this.#extractResult.error,
Status.InternalServerError,
STATUS_CODE.InternalServerError,
);
const errorHandler: router.ErrorHandler<RouterState> = async (
req,
@@ -595,8 +595,8 @@ export class ServerContext {
: "public, max-age=604800, immutable",
};
const contentType = typeByExtension(extname(params.path));
if (contentType) headers["Content-Type"] = contentType;
const type = contentType(extname(params.path));
if (type) headers["Content-Type"] = type;
return new Response(contents, {
status: 200,
@@ -625,7 +625,7 @@ const createRenderNotFound = (
const notFound = extractResult.notFound;
if (!notFound.component) {
return sendResponse(["Not found.", undefined], {
status: Status.NotFound,
status: STATUS_CODE.NotFound,
isDev: dev,
statusText: undefined,
headers: undefined,
@@ -660,7 +660,7 @@ const createRenderNotFound = (
}
return sendResponse(resp, {
status: Status.NotFound,
status: STATUS_CODE.NotFound,
isDev: dev,
statusText: undefined,
headers: undefined,
+12 -11
View File
@@ -7,22 +7,23 @@ export {
isAbsolute,
join,
toFileUrl,
} from "https://deno.land/std@0.205.0/path/mod.ts";
export { walk } from "https://deno.land/std@0.205.0/fs/walk.ts";
export * as colors from "https://deno.land/std@0.205.0/fmt/colors.ts";
} from "https://deno.land/std@0.208.0/path/mod.ts";
export { walk } from "https://deno.land/std@0.208.0/fs/walk.ts";
export * as colors from "https://deno.land/std@0.208.0/fmt/colors.ts";
export {
type Handler as ServeHandler,
serve,
} from "https://deno.land/std@0.205.0/http/server.ts";
export { Status } from "https://deno.land/std@0.205.0/http/http_status.ts";
} from "https://deno.land/std@0.208.0/http/server.ts";
export { STATUS_CODE } from "https://deno.land/std@0.208.0/http/status.ts";
export {
typeByExtension,
} from "https://deno.land/std@0.205.0/media_types/mod.ts";
export { toHashString } from "https://deno.land/std@0.205.0/crypto/to_hash_string.ts";
export { escape } from "https://deno.land/std@0.205.0/regexp/escape.ts";
export * as JSONC from "https://deno.land/std@0.205.0/jsonc/mod.ts";
contentType,
} from "https://deno.land/std@0.208.0/media_types/content_type.ts";
export { toHashString } from "https://deno.land/std@0.208.0/crypto/to_hash_string.ts";
export { escape } from "https://deno.land/std@0.208.0/regexp/escape.ts";
export * as JSONC from "https://deno.land/std@0.208.0/jsonc/mod.ts";
export { renderToString } from "https://esm.sh/*preact-render-to-string@6.3.1";
export {
assertEquals,
assertThrows,
} from "https://deno.land/std@0.205.0/assert/mod.ts";
} from "https://deno.land/std@0.208.0/assert/mod.ts";
export { assertSnapshot } from "https://deno.land/std@0.208.0/testing/snapshot.ts";
+3 -3
View File
@@ -22,11 +22,11 @@ import * as router from "./router.ts";
import DefaultErrorHandler from "./default_error_page.tsx";
import {
basename,
contentType,
dirname,
extname,
join,
toFileUrl,
typeByExtension,
walk,
} from "./deps.ts";
import { BUILD_ID } from "./build_id.ts";
@@ -316,7 +316,7 @@ export async function extractRoutes(
const localUrl = toFileUrl(entry.path);
const path = localUrl.href.substring(staticDirUrl.href.length);
const stat = await Deno.stat(localUrl);
const contentType = typeByExtension(extname(path)) ??
const type = contentType(extname(path)) ??
"application/octet-stream";
const etag = await crypto.subtle.digest(
"SHA-1",
@@ -330,7 +330,7 @@ export async function extractRoutes(
localUrl,
path,
size: stat.size,
contentType,
contentType: type,
etag,
};
staticFiles.push(staticFile);
+1 -1
View File
@@ -1,6 +1,6 @@
import { ServerContext } from "./context.ts";
export type { FromManifestConfig, FromManifestOptions } from "./context.ts";
export { Status } from "./deps.ts";
export { STATUS_CODE } from "./deps.ts";
import {
ErrorHandler,
FreshConfig,