feat: upgrade fresh

This commit is contained in:
max_richter 2025-01-05 14:59:05 +01:00
parent d0e7af971e
commit 1937ef55bb
8 changed files with 40 additions and 22 deletions

View File

@ -1,6 +1,6 @@
import { ComponentChildren } from "preact"; import { ComponentChildren } from "preact";
import { resources } from "@lib/resources.ts"; import { resources } from "@lib/resources.ts";
import { CSS, KATEX_CSS } from "https://deno.land/x/gfm@0.2.5/mod.ts"; import { CSS, KATEX_CSS } from "gfm";
import { Head } from "$fresh/runtime.ts"; import { Head } from "$fresh/runtime.ts";
import Search, { RedirectSearchHandler } from "@islands/Search.tsx"; import Search, { RedirectSearchHandler } from "@islands/Search.tsx";
import { KMenu } from "@islands/KMenu.tsx"; import { KMenu } from "@islands/KMenu.tsx";

View File

@ -1,6 +1,6 @@
{ {
"lock": false, "lock": false,
"nodeModulesDir": true, "nodeModulesDir": "auto",
"tasks": { "tasks": {
"check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx", "check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
"start": "deno run -A --watch=static/,routes/ dev.ts", "start": "deno run -A --watch=static/,routes/ dev.ts",
@ -8,30 +8,50 @@
"preview": "deno run -A main.ts", "preview": "deno run -A main.ts",
"update": "deno run -A -r https://fresh.deno.dev/update ." "update": "deno run -A -r https://fresh.deno.dev/update ."
}, },
"lint": { "rules": { "tags": ["fresh", "recommended"] } }, "lint": {
"rules": {
"tags": [
"fresh",
"recommended"
]
}
},
"imports": { "imports": {
"$fresh/": "https://deno.land/x/fresh@1.6.8/", "$fresh/": "https://deno.land/x/fresh@1.7.3/",
"@components": "./components", "@components": "./components",
"@components/": "./components/", "@components/": "./components/",
"@denosaurs/emoji": "jsr:@denosaurs/emoji@^0.3.1",
"@islands": "./islands", "@islands": "./islands",
"@islands/": "./islands/", "@islands/": "./islands/",
"@lib": "./lib", "@lib": "./lib",
"@lib/": "./lib/", "@lib/": "./lib/",
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2", "@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1", "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
"@std/dotenv": "jsr:@std/dotenv@^0.224.0", "@std/dotenv": "jsr:@std/dotenv@^0.225.3",
"@std/http": "jsr:@std/http@^0.224.5", "@std/http": "jsr:@std/http@^1.0.12",
"@std/yaml": "jsr:@std/yaml@^0.224.1", "@std/yaml": "jsr:@std/yaml@^1.0.5",
"preact": "https://esm.sh/preact@10.19.6", "preact": "https://esm.sh/preact@10.22.0",
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.2", "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.2",
"preact/": "https://esm.sh/preact@10.19.6/", "preact/": "https://esm.sh/preact@10.22.0/",
"tailwindcss": "npm:tailwindcss@3.3.5", "gfm": "jsr:@deno/gfm",
"tailwindcss/": "npm:/tailwindcss@3.3.5/", "tailwindcss": "npm:tailwindcss@^3.4.17",
"tailwindcss/plugin": "npm:/tailwindcss@3.3.5/plugin.js", "tailwindcss/": "npm:/tailwindcss@^3.4.17/",
"tailwindcss/plugin": "npm:/tailwindcss@^3.4.17/plugin.js",
"camelcase-css": "npm:camelcase-css",
"typesense": "https://raw.githubusercontent.com/bradenmacdonald/typesense-deno/main/mod.ts", "typesense": "https://raw.githubusercontent.com/bradenmacdonald/typesense-deno/main/mod.ts",
"yaml": "https://deno.land/std@0.197.0/yaml/mod.ts", "yaml": "https://deno.land/std@0.197.0/yaml/mod.ts",
"zod": "https://deno.land/x/zod@v3.21.4/mod.ts" "zod": "https://deno.land/x/zod@v3.21.4/mod.ts"
}, },
"compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" }, "scopes": {
"exclude": ["**/_fresh/*"] "https://deno.land/x/emoji/": {
"https://deno.land/x/my-library@1.0.0/mod.ts": "./patched/mod.ts"
}
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"exclude": [
"**/_fresh/*"
]
} }

View File

@ -58,7 +58,7 @@ import * as $KMenu_commands_create_series from "./islands/KMenu/commands/create_
import * as $KMenu_types from "./islands/KMenu/types.ts"; import * as $KMenu_types from "./islands/KMenu/types.ts";
import * as $Recommendations from "./islands/Recommendations.tsx"; import * as $Recommendations from "./islands/Recommendations.tsx";
import * as $Search from "./islands/Search.tsx"; import * as $Search from "./islands/Search.tsx";
import { type Manifest } from "$fresh/server.ts"; import type { Manifest } from "$fresh/server.ts";
const manifest = { const manifest = {
routes: { routes: {

View File

@ -1,5 +1,5 @@
import { unified } from "https://esm.sh/unified@10.1.2"; import { unified } from "https://esm.sh/unified@10.1.2";
import { render } from "https://deno.land/x/gfm@0.2.5/mod.ts"; import { render } from "gfm";
import "https://esm.sh/prismjs@1.29.0/components/prism-typescript?no-check"; import "https://esm.sh/prismjs@1.29.0/components/prism-typescript?no-check";
import "https://esm.sh/prismjs@1.29.0/components/prism-bash?no-check"; import "https://esm.sh/prismjs@1.29.0/components/prism-bash?no-check";
import "https://esm.sh/prismjs@1.29.0/components/prism-rust?no-check"; import "https://esm.sh/prismjs@1.29.0/components/prism-rust?no-check";

View File

@ -3,7 +3,7 @@ import { useEffect, useRef } from "preact/hooks";
export function useEventListener<T extends Event>( export function useEventListener<T extends Event>(
eventName: string, eventName: string,
handler: (event: T) => void, handler: (event: T) => void,
element: Window | HTMLElement = window, element: Window | HTMLElement = globalThis,
) { ) {
// Create a ref that stores handler // Create a ref that stores handler
const savedHandler = useRef<(event: Event) => void>(); const savedHandler = useRef<(event: Event) => void>();

View File

@ -1,6 +1,6 @@
import { PageProps } from "$fresh/server.ts"; import { PageProps } from "$fresh/server.ts";
import { resources } from "@lib/resources.ts"; import { resources } from "@lib/resources.ts";
import { CSS, KATEX_CSS } from "https://deno.land/x/gfm@0.2.5/mod.ts"; import { CSS, KATEX_CSS } from "gfm";
import { Head } from "$fresh/runtime.ts"; import { Head } from "$fresh/runtime.ts";
import { Emoji } from "@components/Emoji.tsx"; import { Emoji } from "@components/Emoji.tsx";

View File

@ -5,7 +5,7 @@ import { AccessDeniedError, BadRequestError } from "@lib/errors.ts";
import { createStreamResponse, isValidUrl } from "@lib/helpers.ts"; import { createStreamResponse, isValidUrl } from "@lib/helpers.ts";
import * as openai from "@lib/openai.ts"; import * as openai from "@lib/openai.ts";
import tds from "https://cdn.skypack.dev/turndown@7.1.1"; import tds from "https://cdn.skypack.dev/turndown@7.2.0";
import { Article, createArticle } from "@lib/resource/articles.ts"; import { Article, createArticle } from "@lib/resource/articles.ts";
import { getYoutubeVideoDetails } from "@lib/youtube.ts"; import { getYoutubeVideoDetails } from "@lib/youtube.ts";
import { extractYoutubeId, isYoutubeLink } from "@lib/string.ts"; import { extractYoutubeId, isYoutubeLink } from "@lib/string.ts";
@ -21,8 +21,6 @@ async function processCreateArticle(
streamResponse: ReturnType<typeof createStreamResponse>; streamResponse: ReturnType<typeof createStreamResponse>;
}, },
) { ) {
log.info("create article from url", { url: fetchUrl }); log.info("create article from url", { url: fetchUrl });
streamResponse.enqueue("downloading article"); streamResponse.enqueue("downloading article");

View File

@ -4,7 +4,7 @@ import {
initialize, initialize,
MagickFormat, MagickFormat,
MagickGeometry, MagickGeometry,
} from "https://deno.land/x/imagemagick_deno@0.0.25/mod.ts"; } from "https://deno.land/x/imagemagick_deno@0.0.31/mod.ts";
import { parseMediaType } from "https://deno.land/std@0.224.0/media_types/parse_media_type.ts"; import { parseMediaType } from "https://deno.land/std@0.224.0/media_types/parse_media_type.ts";
import * as cache from "@lib/cache/image.ts"; import * as cache from "@lib/cache/image.ts";