From a75de86d68ace375843143acdf32da7d11010ad6 Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Tue, 2 Jul 2024 17:17:21 +0200 Subject: [PATCH] refactor: :recycle: replace http imports by jsr/npm imports --- components/Markdown.tsx | 2 +- deno.json | 9 ++++----- islands/AiChatBox.tsx | 8 ++++---- islands/BlogCardList.tsx | 2 +- routes/imports/markdown_css.ts | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/components/Markdown.tsx b/components/Markdown.tsx index a57e55a..0375ac4 100644 --- a/components/Markdown.tsx +++ b/components/Markdown.tsx @@ -1,5 +1,5 @@ import { SignalLike } from '$fresh/src/types.ts' -import { render, RenderOptions } from 'gfm' +import { render, RenderOptions } from '@deno/gfm' export type MarkdownTheme = 'light' | 'dark' | 'auto' export function Markdown( diff --git a/deno.json b/deno.json index b63bf19..1d4427a 100644 --- a/deno.json +++ b/deno.json @@ -36,10 +36,11 @@ ":src/": "./src/", "@cohabit/cohamail/": "./packages/@cohabit__cohamail@0.2.1/", "@cohabit/ressources_manager/": "./packages/@cohabit__ressources_manager@0.1.3/", + "@deno/gfm": "jsr:@deno/gfm@^0.8.2", "@jotsr/delayed": "jsr:@jotsr/delayed@^2.1.1", "@jotsr/smart-css-bundler": "jsr:@jotsr/smart-css-bundler@^0.3.0", - "@preact/signals": "https://esm.sh/*@preact/signals@1.2.2", - "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1", + "@preact/signals": "npm:@preact/signals@^1.2.3", + "@preact/signals-core": "npm:@preact/signals-core@^1.6.1", "@simplewebauthn/browser": "npm:@simplewebauthn/browser@^10.0.0", "@simplewebauthn/server": "npm:@simplewebauthn/server@^10.0.0", "@simplewebauthn/types": "npm:@simplewebauthn/types@^10.0.0", @@ -49,9 +50,7 @@ "@std/json": "jsr:@std/json@^0.224.1", "@std/streams": "jsr:@std/streams@^0.224.5", "@univoq/": "https://deno.land/x/univoq@0.2.0/", - "gfm": "https://deno.land/x/gfm@0.6.0/mod.ts", - "preact": "https://esm.sh/preact@10.19.6", - "preact/": "https://esm.sh/preact@10.19.6/", + "preact": "npm:preact@^10.22.1", "univoq": "https://deno.land/x/univoq@0.2.0/mod.ts", "web-push": "npm:web-push@^3.6.7" }, diff --git a/islands/AiChatBox.tsx b/islands/AiChatBox.tsx index 0cff435..24bb157 100644 --- a/islands/AiChatBox.tsx +++ b/islands/AiChatBox.tsx @@ -1,8 +1,8 @@ -import { Signal, signal, useSignal } from '@preact/signals' -import { useEffect, useRef } from 'preact/hooks' -import { JSX } from 'preact' import { JsonParseStream } from '$std/json/mod.ts' -import { CSS, render as renderMd } from 'gfm' +import { CSS, render as renderMd } from '@deno/gfm' +import { Signal, signal, useSignal } from '@preact/signals' +import { JSX } from 'preact' +import { useEffect, useRef } from 'preact/hooks' const systemHistory = signal([{ role: 'system', diff --git a/islands/BlogCardList.tsx b/islands/BlogCardList.tsx index d64ee56..a316e13 100644 --- a/islands/BlogCardList.tsx +++ b/islands/BlogCardList.tsx @@ -78,7 +78,7 @@ function updateFromList( index: number, ): Promise { const { promise, resolve } = Promise.withResolvers() - list.subscribe((value) => { + list.subscribe((value: JSX.Element[]) => { const selected = value.at(index) if (selected) { resolve(selected) diff --git a/routes/imports/markdown_css.ts b/routes/imports/markdown_css.ts index 660a34d..6e7af77 100644 --- a/routes/imports/markdown_css.ts +++ b/routes/imports/markdown_css.ts @@ -1,5 +1,5 @@ import { Handlers } from '$fresh/server.ts' -import { CSS, KATEX_CSS } from 'gfm' +import { CSS, KATEX_CSS } from '@deno/gfm' export const handler: Handlers = { GET() {