diff --git a/components/BenchmarkChart.tsx b/components/BenchmarkChart.tsx index 1999d231a..0d933e195 100644 --- a/components/BenchmarkChart.tsx +++ b/components/BenchmarkChart.tsx @@ -2,7 +2,7 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { Fragment, h } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; import { Column, formatLogScale, logScale } from "@/util/benchmark_utils.ts"; diff --git a/components/CodeBlock.tsx b/components/CodeBlock.tsx index e03c81c0c..a28411f96 100644 --- a/components/CodeBlock.tsx +++ b/components/CodeBlock.tsx @@ -1,7 +1,8 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. /** @jsx h */ -import { h } from "$fresh/runtime.ts"; +import { h } from "preact"; + import { tw } from "@twind"; import { Prism } from "@/util/prism_utils.ts"; import { escape as htmlEscape } from "$he"; diff --git a/components/DirectoryView.tsx b/components/DirectoryView.tsx index 0cb134fcd..67686ee09 100644 --- a/components/DirectoryView.tsx +++ b/components/DirectoryView.tsx @@ -1,5 +1,7 @@ +// Copyright 2022 the Deno authors. All rights reserved. MIT license. + /** @jsx h */ -import { h } from "$fresh/runtime.ts"; +import { h } from "preact"; import { tw } from "@twind"; import { DirListing, Entry, isReadme } from "@/util/registry_utils.ts"; import * as Icons from "@/components/Icons.tsx"; diff --git a/components/ErrorMessage.tsx b/components/ErrorMessage.tsx index ce938ce9a..9ce35a0a3 100644 --- a/components/ErrorMessage.tsx +++ b/components/ErrorMessage.tsx @@ -1,7 +1,7 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. /** @jsx h */ -import { ComponentChildren, h } from "$fresh/runtime.ts"; +import { ComponentChildren, h } from "preact"; import { tw } from "@twind"; import * as Icons from "./Icons.tsx"; diff --git a/components/Footer.tsx b/components/Footer.tsx index 2726070df..af263a048 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -1,7 +1,7 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. /** @jsx h */ -import { ComponentChildren, h } from "$fresh/runtime.ts"; +import { ComponentChildren, h } from "preact"; import { tw } from "@twind"; import * as Icons from "./Icons.tsx"; diff --git a/components/Header.tsx b/components/Header.tsx index 8b7a4675a..684aaa83d 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -1,7 +1,8 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. /** @jsx h */ -import { h } from "$fresh/runtime.ts"; +import { h } from "preact"; + import { tw } from "@twind"; import * as Icons from "./Icons.tsx"; diff --git a/components/HelloBar.tsx b/components/HelloBar.tsx index c7f9eddbc..ffcfc8185 100644 --- a/components/HelloBar.tsx +++ b/components/HelloBar.tsx @@ -1,7 +1,7 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. /** @jsx h */ -import { ComponentChildren, h } from "$fresh/runtime.ts"; +import { ComponentChildren, h } from "preact"; import { tw } from "@twind"; export function HelloBar(props: { diff --git a/components/HeroBackground.tsx b/components/HeroBackground.tsx index 5ebf1076c..159ed8942 100644 --- a/components/HeroBackground.tsx +++ b/components/HeroBackground.tsx @@ -1,7 +1,7 @@ // Copyright Deno Land Inc. All Rights Reserved. Proprietary and confidential. /** @jsx h */ -import { h } from "$fresh/runtime.ts"; +import { h } from "preact"; import { tw } from "@twind"; export function Background() { diff --git a/components/Icons.tsx b/components/Icons.tsx index 06244ff62..b4747ef4f 100644 --- a/components/Icons.tsx +++ b/components/Icons.tsx @@ -1,5 +1,5 @@ /** @jsx h */ -import { h } from "$fresh/runtime.ts"; +import { h } from "preact"; import { tw } from "@twind"; export function GitHub(props: { class?: string }) { diff --git a/components/InlineCode.tsx b/components/InlineCode.tsx index ca5021db6..0d3de228c 100644 --- a/components/InlineCode.tsx +++ b/components/InlineCode.tsx @@ -1,7 +1,7 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. /** @jsx h */ -import { ComponentChildren, h } from "$fresh/runtime.ts"; +import { ComponentChildren, h } from "preact"; import { tw } from "@twind"; export function InlineCode( diff --git a/components/Markdown.tsx b/components/Markdown.tsx index 259dc0ee7..15398d7d8 100644 --- a/components/Markdown.tsx +++ b/components/Markdown.tsx @@ -1,7 +1,7 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. /** @jsx h */ -import { h } from "$fresh/runtime.ts"; +import { h } from "preact"; import { tw } from "@twind"; import { render } from "$gfm"; diff --git a/components/Pagination.tsx b/components/Pagination.tsx index 8613aaf8a..a66946dab 100644 --- a/components/Pagination.tsx +++ b/components/Pagination.tsx @@ -2,7 +2,7 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { ComponentProps, Fragment, h } from "$fresh/runtime.ts"; +import { ComponentProps, Fragment, h } from "preact"; import { tw } from "@twind"; import { PaginationProps } from "@/util/pagination_utils.ts"; import { SearchResult } from "@/util/registry_utils.ts"; diff --git a/deno.json b/deno.json index 334c8a430..9ed56eb51 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "tasks": { - "dev": "deno run --watch --no-check --allow-read --allow-write --allow-run --allow-env --allow-net main.ts" + "start": "deno run -A --watch=routes/,static/ dev.ts" }, "compilerOptions": { "types": [ diff --git a/dev.ts b/dev.ts new file mode 100755 index 000000000..2d85d6c18 --- /dev/null +++ b/dev.ts @@ -0,0 +1,5 @@ +#!/usr/bin/env -S deno run -A --watch=static/,routes/ + +import dev from "$fresh/dev.ts"; + +await dev(import.meta.url, "./main.ts"); diff --git a/fresh.gen.ts b/fresh.gen.ts index 63faee5e9..f2f41d805 100644 --- a/fresh.gen.ts +++ b/fresh.gen.ts @@ -1,51 +1,49 @@ -// DO NOT EDIT. This file is generated by `fresh`. +// DO NOT EDIT. This file is generated by fresh. // This file SHOULD be checked into source version control. -// To update this file, run `fresh manifest`. +// This file is automatically updated during development when running `dev.ts`. import * as $0 from "./routes/_404.tsx"; import * as $1 from "./routes/_app.tsx"; -import * as $2 from "./routes/_render.ts"; -import * as $3 from "./routes/add_module.tsx"; -import * as $4 from "./routes/artwork.tsx"; -import * as $5 from "./routes/benchmarks.tsx"; -import * as $6 from "./routes/completions/config.ts"; -import * as $7 from "./routes/completions/v1.ts"; -import * as $8 from "./routes/gfm.css.ts"; -import * as $9 from "./routes/index.tsx"; -import * as $10 from "./routes/install.ts"; -import * as $11 from "./routes/legacy_redirects/posts.ts"; -import * as $12 from "./routes/legacy_redirects/v1.ts"; -import * as $13 from "./routes/manual.tsx"; -import * as $14 from "./routes/showcase.tsx"; -import * as $15 from "./routes/status.tsx"; -import * as $16 from "./routes/std.tsx"; -import * as $17 from "./routes/translations.tsx"; -import * as $18 from "./routes/x/index.tsx"; -import * as $19 from "./routes/x/module.tsx"; +import * as $2 from "./routes/add_module.tsx"; +import * as $3 from "./routes/artwork.tsx"; +import * as $4 from "./routes/benchmarks.tsx"; +import * as $5 from "./routes/completions/config.ts"; +import * as $6 from "./routes/completions/v1.ts"; +import * as $7 from "./routes/gfm.css.ts"; +import * as $8 from "./routes/index.tsx"; +import * as $9 from "./routes/install.ts"; +import * as $10 from "./routes/legacy_redirects/posts.ts"; +import * as $11 from "./routes/legacy_redirects/v1.ts"; +import * as $12 from "./routes/manual.tsx"; +import * as $13 from "./routes/showcase.tsx"; +import * as $14 from "./routes/status.tsx"; +import * as $15 from "./routes/std.tsx"; +import * as $16 from "./routes/translations.tsx"; +import * as $17 from "./routes/x/index.tsx"; +import * as $18 from "./routes/x/module.tsx"; import * as $$0 from "./islands/VersionSelect.tsx"; const manifest = { routes: { "./routes/_404.tsx": $0, "./routes/_app.tsx": $1, - "./routes/_render.ts": $2, - "./routes/add_module.tsx": $3, - "./routes/artwork.tsx": $4, - "./routes/benchmarks.tsx": $5, - "./routes/completions/config.ts": $6, - "./routes/completions/v1.ts": $7, - "./routes/gfm.css.ts": $8, - "./routes/index.tsx": $9, - "./routes/install.ts": $10, - "./routes/legacy_redirects/posts.ts": $11, - "./routes/legacy_redirects/v1.ts": $12, - "./routes/manual.tsx": $13, - "./routes/showcase.tsx": $14, - "./routes/status.tsx": $15, - "./routes/std.tsx": $16, - "./routes/translations.tsx": $17, - "./routes/x/index.tsx": $18, - "./routes/x/module.tsx": $19, + "./routes/add_module.tsx": $2, + "./routes/artwork.tsx": $3, + "./routes/benchmarks.tsx": $4, + "./routes/completions/config.ts": $5, + "./routes/completions/v1.ts": $6, + "./routes/gfm.css.ts": $7, + "./routes/index.tsx": $8, + "./routes/install.ts": $9, + "./routes/legacy_redirects/posts.ts": $10, + "./routes/legacy_redirects/v1.ts": $11, + "./routes/manual.tsx": $12, + "./routes/showcase.tsx": $13, + "./routes/status.tsx": $14, + "./routes/std.tsx": $15, + "./routes/translations.tsx": $16, + "./routes/x/index.tsx": $17, + "./routes/x/module.tsx": $18, }, islands: { "./islands/VersionSelect.tsx": $$0, diff --git a/import_map.json b/import_map.json index d640bbb2f..b915b6d08 100644 --- a/import_map.json +++ b/import_map.json @@ -3,9 +3,12 @@ "@/": "./", "@twind": "./util/twind.ts", - "$fresh/": "https://raw.githubusercontent.com/lucacasonato/fresh/4bb07f4bcebfc205692e53bb61a1e2447d589c8e/", - "twind": "https://esm.sh/twind@0.16.16", - "twind/": "https://esm.sh/twind@0.16.16/", + "$fresh/": "https://deno.land/x/fresh@1.0.0-rc.2/", + "preact": "https://esm.sh/preact@10.8.1", + "preact/": "https://esm.sh/preact@10.8.1/", + "preact-render-to-string": "https://esm.sh/preact-render-to-string@5.1.20?deps=preact@10.8.1", + "twind": "https://esm.sh/twind@0.16.17", + "twind/": "https://esm.sh/twind@0.16.17/", "$prism": "https://esm.sh/prismjs@1.27.0", "$prism/": "https://esm.sh/prismjs@1.27.0/", "$twas": "https://esm.sh/twas@2.1.2", @@ -20,6 +23,7 @@ "$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts", "$ga": "https://deno.land/x/g_a@0.1.2/mod.ts", "$oak_commons": "https://deno.land/x/oak_commons@0.1.1/negotiation.ts", - "$doc_components/": "https://deno.land/x/deno_doc_components@0.1.1/" + "$doc_components/": "https://deno.land/x/deno_doc_components@0.1.1/", + "$deno_doc/": "https://deno.land/x/deno_doc@v0.34.0/lib/" } } diff --git a/islands/VersionSelect.tsx b/islands/VersionSelect.tsx index 10fb11b1c..da3f8439d 100644 --- a/islands/VersionSelect.tsx +++ b/islands/VersionSelect.tsx @@ -1,5 +1,8 @@ +// Copyright 2022 the Deno authors. All rights reserved. MIT license. + /** @jsx h */ -import { h, IS_BROWSER } from "$fresh/runtime.ts"; +import { h } from "preact"; +import { IS_BROWSER } from "$fresh/runtime.ts"; import { tw } from "@twind"; export default function VersionSelect({ versions, selectedVersion }: { diff --git a/main.ts b/main.ts index 63b87cc8a..1f7092906 100644 --- a/main.ts +++ b/main.ts @@ -9,13 +9,14 @@ /// import { ServerContext } from "$fresh/server.ts"; -import { Fragment, h } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; import { serve } from "$std/http/server.ts"; import { router } from "$router"; import { withLog } from "./util/ga_utils.ts"; import { setup } from "$doc_components/services.ts"; import manifest from "./fresh.gen.ts"; +import options from "./options.ts"; import { routes as completionsV2Routes } from "./completions_v2.ts"; @@ -44,7 +45,7 @@ await setup({ runtime: { Fragment, h }, }); -const ctx = await ServerContext.fromManifest(manifest); +const ctx = await ServerContext.fromManifest(manifest, options); const innerHandler = withLog(ctx.handler()); const handler = router(completionsV2Routes, innerHandler); diff --git a/options.ts b/options.ts new file mode 100644 index 000000000..4dd9e9474 --- /dev/null +++ b/options.ts @@ -0,0 +1,22 @@ +import { + FreshOptions, + InnerRenderFunction, + RenderContext, +} from "$fresh/server.ts"; +import { config, setup } from "@twind"; +import { virtualSheet } from "twind/sheets"; + +const sheet = virtualSheet(); +sheet.reset(); +setup({ ...config, sheet }); + +function render(ctx: RenderContext, render: InnerRenderFunction) { + const snapshot = ctx.state.get("twind") as unknown[] | null; + sheet.reset(snapshot || undefined); + render(); + ctx.styles.splice(0, ctx.styles.length, ...(sheet).target); + const newSnapshot = sheet.reset(); + ctx.state.set("twind", newSnapshot); +} + +export default { render } as FreshOptions; diff --git a/routes/_404.tsx b/routes/_404.tsx index 6c02422f6..9d98e2971 100644 --- a/routes/_404.tsx +++ b/routes/_404.tsx @@ -1,7 +1,8 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. /** @jsx h */ -import { h, Head } from "$fresh/runtime.ts"; +import { h } from "preact"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; import { Header } from "@/components/Header.tsx"; import { Footer } from "@/components/Footer.tsx"; diff --git a/routes/_app.tsx b/routes/_app.tsx index b181de0c0..bcd0577c1 100644 --- a/routes/_app.tsx +++ b/routes/_app.tsx @@ -2,7 +2,9 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { AppProps, h, Head } from "$fresh/runtime.ts"; +import { h } from "preact"; +import { AppProps } from "$fresh/server.ts"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; export default function App({ Component }: AppProps) { diff --git a/routes/_render.ts b/routes/_render.ts deleted file mode 100644 index 9adec404a..000000000 --- a/routes/_render.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2022 the Deno authors. All rights reserved. MIT license. - -import { config, setup } from "@twind"; -import { RenderContext, RenderFn } from "$fresh/server.ts"; -import { virtualSheet } from "twind/sheets"; - -const sheet = virtualSheet(); -sheet.reset(); -setup({ sheet, ...config }); - -export function render(ctx: RenderContext, render: RenderFn) { - const snapshot = ctx.state.get("twindSnapshot") as unknown[] | null; - sheet.reset(snapshot || undefined); - render(); - ctx.styles.splice(0, ctx.styles.length, ...(sheet).target); - const newSnapshot = sheet.reset(); - ctx.state.set("twindSnapshot", newSnapshot); -} diff --git a/routes/add_module.tsx b/routes/add_module.tsx index f83205fd3..98733c1ad 100644 --- a/routes/add_module.tsx +++ b/routes/add_module.tsx @@ -2,7 +2,8 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { ComponentChildren, Fragment, h, Head } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; import { CDN_ENDPOINT } from "@/util/registry_utils.ts"; import { Header } from "@/components/Header.tsx"; diff --git a/routes/artwork.tsx b/routes/artwork.tsx index 0cd2f1f55..d444a1b17 100644 --- a/routes/artwork.tsx +++ b/routes/artwork.tsx @@ -2,7 +2,8 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { Fragment, h, Head } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; import { Footer } from "@/components/Footer.tsx"; import { Header } from "@/components/Header.tsx"; diff --git a/routes/benchmarks.tsx b/routes/benchmarks.tsx index c07a059f7..c77a8180e 100644 --- a/routes/benchmarks.tsx +++ b/routes/benchmarks.tsx @@ -2,7 +2,9 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { Fragment, h, Head, PageProps } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; +import { PageProps } from "$fresh/server.ts"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; import { Handlers } from "$fresh/server.ts"; import { Header } from "@/components/Header.tsx"; diff --git a/routes/completions/config.ts b/routes/completions/config.ts index 40ba61c86..3014d8e1a 100644 --- a/routes/completions/config.ts +++ b/routes/completions/config.ts @@ -1,6 +1,6 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. -import { RouteConfig } from "$fresh/runtime.ts"; +import { RouteConfig } from "$fresh/server.ts"; import { accepts } from "$oak_commons"; interface RegistryDefVariable { diff --git a/routes/completions/v1.ts b/routes/completions/v1.ts index 00614392d..f1bf75891 100644 --- a/routes/completions/v1.ts +++ b/routes/completions/v1.ts @@ -1,6 +1,6 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. -import { RouteConfig } from "$fresh/runtime.ts"; +import { RouteConfig } from "$fresh/server.ts"; export function handler(_req: Request) { return new Response( diff --git a/routes/index.tsx b/routes/index.tsx index ce54671fa..dd2947712 100644 --- a/routes/index.tsx +++ b/routes/index.tsx @@ -2,7 +2,8 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { Fragment, h, Head } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; import { CodeBlock } from "@/components/CodeBlock.tsx"; import { Footer } from "@/components/Footer.tsx"; @@ -10,7 +11,6 @@ import { InlineCode } from "@/components/InlineCode.tsx"; import { Header } from "@/components/Header.tsx"; import { HelloBar } from "@/components/HelloBar.tsx"; import { Background } from "@/components/HeroBackground.tsx"; -import * as Icons from "@/components/Icons.tsx"; import versions from "@/versions.json" assert { type: "json" }; diff --git a/routes/install.ts b/routes/install.ts index 80afdbc69..1a8584a3c 100644 --- a/routes/install.ts +++ b/routes/install.ts @@ -1,6 +1,6 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. -import { RouteConfig } from "$fresh/runtime.ts"; +import { RouteConfig } from "$fresh/server.ts"; export function handler(req: Request) { return Response.redirect( diff --git a/routes/legacy_redirects/posts.ts b/routes/legacy_redirects/posts.ts index bda1c3c96..318998493 100644 --- a/routes/legacy_redirects/posts.ts +++ b/routes/legacy_redirects/posts.ts @@ -1,7 +1,6 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. -import { RouteConfig } from "$fresh/runtime.ts"; -import { Handlers } from "$fresh/server.ts"; +import { Handlers, RouteConfig } from "$fresh/server.ts"; export const handler: Handlers = { GET(_, { params }) { diff --git a/routes/legacy_redirects/v1.ts b/routes/legacy_redirects/v1.ts index a4869fa96..c56f56f54 100644 --- a/routes/legacy_redirects/v1.ts +++ b/routes/legacy_redirects/v1.ts @@ -1,7 +1,6 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. -import { RouteConfig } from "$fresh/runtime.ts"; -import { Handlers } from "$fresh/server.ts"; +import { Handlers, RouteConfig } from "$fresh/server.ts"; export const handler: Handlers = { GET() { diff --git a/routes/manual.tsx b/routes/manual.tsx index 0cb043a37..b4d98751c 100644 --- a/routes/manual.tsx +++ b/routes/manual.tsx @@ -1,8 +1,9 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. /** @jsx h */ -/** @jsxFrag Fragment */ -import { h, Head, PageProps, RouteConfig } from "$fresh/runtime.ts"; +import { h } from "preact"; +import { PageProps, RouteConfig } from "$fresh/server.ts"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; import { Handlers } from "$fresh/server.ts"; import { Markdown } from "@/components/Markdown.tsx"; diff --git a/routes/showcase.tsx b/routes/showcase.tsx index 03760b49f..f4dcb18e8 100644 --- a/routes/showcase.tsx +++ b/routes/showcase.tsx @@ -2,7 +2,8 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { Fragment, h, Head } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; import { Footer } from "@/components/Footer.tsx"; import { Header } from "@/components/Header.tsx"; diff --git a/routes/status.tsx b/routes/status.tsx index e10f5da55..e2fa6853c 100644 --- a/routes/status.tsx +++ b/routes/status.tsx @@ -2,9 +2,10 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { Fragment, h, Head, PageProps, RouteConfig } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; +import { Head } from "$fresh/runtime.ts"; +import { Handlers, PageProps, RouteConfig } from "$fresh/server.ts"; import { tw } from "@twind"; -import { Handlers } from "$fresh/server.ts"; import { Header } from "@/components/Header.tsx"; import { Footer } from "@/components/Footer.tsx"; import { Build, getBuild } from "@/util/registry_utils.ts"; diff --git a/routes/std.tsx b/routes/std.tsx index 041a2fb93..01b299abc 100644 --- a/routes/std.tsx +++ b/routes/std.tsx @@ -1,7 +1,8 @@ // Copyright 2022 the Deno authors. All rights reserved. MIT license. /** @jsx h */ -import { h, PageProps, RouteConfig } from "$fresh/runtime.ts"; +import { h } from "preact"; +import { PageProps, RouteConfig } from "$fresh/server.ts"; import { Handlers } from "$fresh/server.ts"; import Registry, { handler as xHandler } from "./x/module.tsx"; diff --git a/routes/translations.tsx b/routes/translations.tsx index 278a07aff..575286b45 100644 --- a/routes/translations.tsx +++ b/routes/translations.tsx @@ -2,7 +2,8 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { Fragment, h, Head } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; import { Footer } from "@/components/Footer.tsx"; import { Header } from "@/components/Header.tsx"; diff --git a/routes/x/index.tsx b/routes/x/index.tsx index 63730f4ff..b53086109 100644 --- a/routes/x/index.tsx +++ b/routes/x/index.tsx @@ -2,7 +2,9 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { Fragment, h, Head, PageProps } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; +import { PageProps } from "$fresh/server.ts"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; import { Handlers } from "$fresh/server.ts"; import twas from "$twas"; diff --git a/routes/x/module.tsx b/routes/x/module.tsx index f30cc8e22..21d14eabf 100644 --- a/routes/x/module.tsx +++ b/routes/x/module.tsx @@ -2,7 +2,9 @@ /** @jsx h */ /** @jsxFrag Fragment */ -import { Fragment, h, Head, PageProps, RouteConfig } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; +import { PageProps, RouteConfig } from "$fresh/server.ts"; +import { Head } from "$fresh/runtime.ts"; import { tw } from "@twind"; import { Handlers } from "$fresh/server.ts"; import twas from "$twas"; diff --git a/tests/handler_test.ts b/tests/handler_test.ts index bbf409768..e48f11cc1 100644 --- a/tests/handler_test.ts +++ b/tests/handler_test.ts @@ -7,10 +7,11 @@ import { } from "$std/testing/asserts.ts"; import { extractAltLineNumberReference } from "@/util/registry_utils.ts"; import { ServerContext } from "$fresh/server.ts"; -import { Fragment, h } from "$fresh/runtime.ts"; +import { Fragment, h } from "preact"; import { setup } from "$doc_components/services.ts"; -import manifest from "../fresh.gen.ts"; +import manifest from "@/fresh.gen.ts"; +import options from "@/options.ts"; const docland = "https://doc.deno.land/"; await setup({ @@ -31,8 +32,10 @@ await setup({ runtime: { Fragment, h }, }); -const handleRequest = async (req: Request) => - (await ServerContext.fromManifest(manifest)).handler()(req, { +const serverCtx = await ServerContext.fromManifest(manifest, options); +const handler = serverCtx.handler(); +const handleRequest = (req: Request) => + handler(req, { localAddr: { transport: "tcp", hostname: "127.0.0.1", diff --git a/tests/registry_config_test.ts b/tests/registry_config_test.ts index 466cf8867..8142d3230 100644 --- a/tests/registry_config_test.ts +++ b/tests/registry_config_test.ts @@ -2,9 +2,14 @@ import { assertEquals } from "$std/testing/asserts.ts"; import { ServerContext } from "$fresh/server.ts"; -import manifest from "../fresh.gen.ts"; -const handleRequest = async (req: Request) => - (await ServerContext.fromManifest(manifest)).handler()(req, { + +import manifest from "@/fresh.gen.ts"; +import options from "@/options.ts"; + +const serverCtx = await ServerContext.fromManifest(manifest, options); +const handler = serverCtx.handler(); +const handleRequest = (req: Request) => + handler(req, { localAddr: { transport: "tcp", hostname: "127.0.0.1", diff --git a/tests/suggestions_test.ts b/tests/suggestions_test.ts index 092d224db..0f9df04a3 100644 --- a/tests/suggestions_test.ts +++ b/tests/suggestions_test.ts @@ -8,14 +8,15 @@ import { } from "$std/testing/asserts.ts"; import { ServerContext } from "$fresh/server.ts"; import { router } from "$router"; -import manifest from "../fresh.gen.ts"; -import { routes as completionsV2Routes } from "../completions_v2.ts"; -const handleRequest = async (req: Request) => - router( - completionsV2Routes, - (await ServerContext.fromManifest(manifest)).handler(), - )(req, { +import manifest from "@/fresh.gen.ts"; +import options from "@/options.ts"; +import { routes as completionsV2Routes } from "@/completions_v2.ts"; + +const serverCtx = await ServerContext.fromManifest(manifest, options); +const handler = router(completionsV2Routes, serverCtx.handler()); +const handleRequest = (req: Request) => + handler(req, { localAddr: { transport: "tcp", hostname: "127.0.0.1", diff --git a/util/doc.ts b/util/doc.ts index 4ca20b3c9..b89d0cbb5 100644 --- a/util/doc.ts +++ b/util/doc.ts @@ -1,5 +1,5 @@ import type { ModuleIndexWithDoc } from "$doc_components/module_index.tsx"; -import type { DocNode } from "https://deno.land/x/deno_doc@v0.34.0/lib/types.d.ts"; +import type { DocNode } from "$deno_doc/types.d.ts"; import { getIndex } from "$doc_components/doc.ts"; import { fileTypeFromURL } from "./registry_utils.ts"; export type { DocNode }; diff --git a/util/ga_utils.ts b/util/ga_utils.ts index c651da830..0eb553799 100644 --- a/util/ga_utils.ts +++ b/util/ga_utils.ts @@ -1,6 +1,6 @@ /* Copyright 2020 the Deno authors. All rights reserved. MIT license. */ +import type { ConnInfo } from "$std/http/server.ts"; import { accepts } from "$oak_commons"; -import type { ConnInfo } from "https://deno.land/std@0.112.0/http/server.ts"; import { createReporter, Reporter } from "$ga"; import type { Event } from "$ga4"; import { diff --git a/util/twind.ts b/util/twind.ts index c9079b5bd..6bfbe6cbe 100644 --- a/util/twind.ts +++ b/util/twind.ts @@ -1,8 +1,7 @@ import { IS_BROWSER } from "$fresh/runtime.ts"; -import { apply, Configuration, setup, tw } from "twind"; +import { apply, Configuration, setup } from "twind"; +export * from "twind"; export { css } from "twind/css"; - -export { apply, setup, tw }; export const config: Configuration = { darkMode: "class", mode: "silent",