Skip to content

Commit

Permalink
Use hono from jsr
Browse files Browse the repository at this point in the history
Signed-off-by: m4rc3l05 <[email protected]>
  • Loading branch information
M4RC3L05 committed May 27, 2024
1 parent 160b895 commit 1374d52
Show file tree
Hide file tree
Showing 61 changed files with 88 additions and 90 deletions.
4 changes: 2 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"compilerOptions": {
"jsx": "precompile",
"jsxImportSource": "hono/jsx"
"jsxImportSource": "@hono/hono/jsx"
},
"lint": {
"rules": {
Expand All @@ -22,6 +22,7 @@
"imports": {
"#src/": "./src/",
"@db/sqlite": "jsr:@db/[email protected]",
"@hono/hono": "jsr:@hono/[email protected]",
"@m4rc3l05/cron": "jsr:@m4rc3l05/[email protected]",
"@m4rc3l05/feed-normalizer": "jsr:@m4rc3l05/[email protected]",
"@m4rc3l05/process-lifecycle": "jsr:@m4rc3l05/[email protected]",
Expand All @@ -40,7 +41,6 @@
"config": "npm:[email protected]",
"deno-dom": "https://deno.land/x/[email protected]/deno-dom-native.ts",
"fast-xml-parser": "npm:[email protected]",
"hono": "npm:[email protected]",
"lodash-es": "npm:[email protected]"
}
}
12 changes: 5 additions & 7 deletions deno.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"specifiers": {
"jsr:@db/[email protected]": "jsr:@db/[email protected]",
"jsr:@denosaurs/plug@1": "jsr:@denosaurs/[email protected]",
"jsr:@hono/[email protected]": "jsr:@hono/[email protected]",
"jsr:@m4rc3l05/[email protected]": "jsr:@m4rc3l05/[email protected]",
"jsr:@m4rc3l05/[email protected]": "jsr:@m4rc3l05/[email protected]",
"jsr:@m4rc3l05/[email protected]": "jsr:@m4rc3l05/[email protected]",
Expand Down Expand Up @@ -39,7 +40,6 @@
"npm:[email protected]": "npm:[email protected]",
"npm:[email protected]": "npm:[email protected]",
"npm:[email protected]": "npm:[email protected]",
"npm:[email protected]": "npm:[email protected]",
"npm:[email protected]": "npm:[email protected]",
"npm:[email protected]": "npm:[email protected]"
},
Expand All @@ -60,6 +60,9 @@
"jsr:@std/path@^0.221.0"
]
},
"@hono/[email protected]": {
"integrity": "3a720bde9692549ecef9117b2069b318e9e976a8af7588d9d8f3051b81d95b8d"
},
"@m4rc3l05/[email protected]": {
"integrity": "297bd4ea6b7c27d3b4afb8f726e8319e1e79ab887c0ef8612047e7a9e9081a9a",
"dependencies": [
Expand Down Expand Up @@ -137,7 +140,6 @@
"@std/[email protected]": {
"integrity": "0aff885d21d829c050b8a08b1d71b54aed5841aecf227f8d77e99ec529a11e8e",
"dependencies": [
"jsr:@std/assert@^0.224.0",
"jsr:@std/bytes@^0.224.0"
]
},
Expand Down Expand Up @@ -247,10 +249,6 @@
"strnum": "[email protected]"
}
},
"[email protected]": {
"integrity": "sha512-Hle1uNqJJKkebFkFEEWr3UAElJP922Xy0STfl8c+1PH1q+l6WrmhwAJFS6YH8ZWJY4z46qJtssbyVwwPm3dP5w==",
"dependencies": {}
},
"[email protected]": {
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
"dependencies": {}
Expand Down Expand Up @@ -338,6 +336,7 @@
"workspace": {
"dependencies": [
"jsr:@db/[email protected]",
"jsr:@hono/[email protected]",
"jsr:@m4rc3l05/[email protected]",
"jsr:@m4rc3l05/[email protected]",
"jsr:@m4rc3l05/[email protected]",
Expand All @@ -355,7 +354,6 @@
"npm:@vinejs/[email protected]",
"npm:[email protected]",
"npm:[email protected]",
"npm:[email protected]",
"npm:[email protected]"
]
}
Expand Down
10 changes: 5 additions & 5 deletions src/apps/api/app.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import config from "config";
import { type ContextVariableMap, Hono } from "hono";
import { basicAuth } from "hono/basic-auth";
import { cors } from "hono/cors";
import { HTTPException } from "hono/http-exception";
import { type ContextVariableMap, Hono } from "@hono/hono";
import { basicAuth } from "@hono/hono/basic-auth";
import { cors } from "@hono/hono/cors";
import { HTTPException } from "@hono/hono/http-exception";
import { errorMappers } from "#src/errors/mod.ts";
import { errorMapper, serviceRegister } from "#src/middlewares/mod.ts";
import { router } from "#src/apps/api/routes/mod.ts";
import type { CustomDatabase } from "#src/database/mod.ts";
import type { FeedService } from "#src/services/mod.ts";

declare module "hono" {
declare module "@hono/hono" {
interface ContextVariableMap {
database: CustomDatabase;
feedService: FeedService;
Expand Down
4 changes: 2 additions & 2 deletions src/apps/api/routes/categories/create.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import type { Hono } from "@hono/hono";
import { HTTPException } from "@hono/hono/http-exception";
import type { CategoriesTable } from "#src/database/types/mod.ts";
import vine from "@vinejs/vine";

Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/categories/delete.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import vine from "@vinejs/vine";
import { makeLogger } from "#src/common/logger/mod.ts";

Expand Down
4 changes: 2 additions & 2 deletions src/apps/api/routes/categories/get.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import type { Hono } from "@hono/hono";
import { HTTPException } from "@hono/hono/http-exception";
import vine from "@vinejs/vine";
import type { CategoriesTable } from "#src/database/types/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/categories/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hono } from "hono";
import { Hono } from "@hono/hono";
import { create } from "#src/apps/api/routes/categories/create.ts";
import { del } from "#src/apps/api/routes/categories/delete.ts";
import { get } from "#src/apps/api/routes/categories/get.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/categories/search.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import type { CategoriesTable } from "#src/database/types/mod.ts";

export const search = (router: Hono) => {
Expand Down
4 changes: 2 additions & 2 deletions src/apps/api/routes/categories/update.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import type { Hono } from "@hono/hono";
import { HTTPException } from "@hono/hono/http-exception";
import vine from "@vinejs/vine";
import type { CategoriesTable } from "#src/database/types/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/feed-items/bookmark.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import vine from "@vinejs/vine";
import { makeLogger } from "#src/common/logger/mod.ts";

Expand Down
4 changes: 2 additions & 2 deletions src/apps/api/routes/feed-items/extract-content.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import { Readability } from "@mozilla/readability";
import type { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import type { Hono } from "@hono/hono";
import { HTTPException } from "@hono/hono/http-exception";
import { DOMParser, type Element } from "deno-dom";
import vine from "@vinejs/vine";
import { makeLogger } from "#src/common/logger/mod.ts";
Expand Down
4 changes: 2 additions & 2 deletions src/apps/api/routes/feed-items/get.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import type { Hono } from "@hono/hono";
import { HTTPException } from "@hono/hono/http-exception";
import vine from "@vinejs/vine";
import type { FeedItemsTable } from "#src/database/types/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/feed-items/mark-as-read.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import vine from "@vinejs/vine";
import { makeLogger } from "#src/common/logger/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/feed-items/mark-as-unread.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import vine from "@vinejs/vine";
import { makeLogger } from "#src/common/logger/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/feed-items/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hono } from "hono";
import { Hono } from "@hono/hono";
import { bookmark } from "#src/apps/api/routes/feed-items/bookmark.ts";
import { extractContent } from "#src/apps/api/routes/feed-items/extract-content.ts";
import { get } from "#src/apps/api/routes/feed-items/get.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/feed-items/search.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import vine from "@vinejs/vine";
import type { FeedItemsTable } from "#src/database/types/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/feed-items/unbookmark.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import vine from "@vinejs/vine";
import { makeLogger } from "#src/common/logger/mod.ts";

Expand Down
4 changes: 2 additions & 2 deletions src/apps/api/routes/feeds/create.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import type { Hono } from "@hono/hono";
import { HTTPException } from "@hono/hono/http-exception";
import vine from "@vinejs/vine";
import { formatError, makeLogger } from "#src/common/logger/mod.ts";
import type { FeedsTable } from "#src/database/types/mod.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/feeds/delete.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import vine from "@vinejs/vine";
import { makeLogger } from "#src/common/logger/mod.ts";

Expand Down
4 changes: 2 additions & 2 deletions src/apps/api/routes/feeds/get.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import type { Hono } from "@hono/hono";
import { HTTPException } from "@hono/hono/http-exception";
import vine from "@vinejs/vine";
import type { FeedsTable } from "#src/database/types/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/feeds/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hono } from "hono";
import { Hono } from "@hono/hono";
import { create } from "#src/apps/api/routes/feeds/create.ts";
import { del } from "#src/apps/api/routes/feeds/delete.ts";
import { get } from "#src/apps/api/routes/feeds/get.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/feeds/search.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import type { FeedsTable } from "#src/database/types/mod.ts";

export const search = (router: Hono) => {
Expand Down
4 changes: 2 additions & 2 deletions src/apps/api/routes/feeds/update.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import type { Hono } from "@hono/hono";
import { HTTPException } from "@hono/hono/http-exception";
import vine from "@vinejs/vine";
import { mapKeys } from "@std/collections";
import { toSnakeCase } from "@std/text";
Expand Down
4 changes: 2 additions & 2 deletions src/apps/api/routes/feeds/validate-url.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import type { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import type { Hono } from "@hono/hono";
import { HTTPException } from "@hono/hono/http-exception";
import vine from "@vinejs/vine";
import { makeLogger } from "#src/common/logger/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hono } from "hono";
import { Hono } from "@hono/hono";
import { categoriesRoutes } from "#src/apps/api/routes/categories/mod.ts";
import { feedItemsRoutes } from "#src/apps/api/routes/feed-items/mod.ts";
import { feedsRoutes } from "#src/apps/api/routes/feeds/mod.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/opml/export.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import { escape } from "@std/html";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";

export const exportFeeds = (router: Hono) => {
router.get("/export", (c) => {
Expand Down
4 changes: 2 additions & 2 deletions src/apps/api/routes/opml/import.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { sql } from "@m4rc3l05/sqlite-tag";
import { unescape } from "@std/html";
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import * as _ from "lodash-es";
import { HTTPException } from "hono/http-exception";
import { HTTPException } from "@hono/hono/http-exception";
import { makeLogger } from "#src/common/logger/mod.ts";
import { xmlParser } from "#src/common/utils/xml-utils.ts";
import type { FeedsTable } from "#src/database/types/mod.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/routes/opml/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hono } from "hono";
import { Hono } from "@hono/hono";
import { exportFeeds } from "#src/apps/api/routes/opml/export.ts";
import { importFeeds } from "#src/apps/api/routes/opml/import.ts";

Expand Down
14 changes: 7 additions & 7 deletions src/apps/web/app.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import config from "config";
import { type ContextVariableMap, Hono } from "hono";
import { serveStatic } from "hono/deno";
import { basicAuth } from "hono/basic-auth";
import { jsxRenderer } from "hono/jsx-renderer";
import { HTTPException } from "hono/http-exception";
import { secureHeaders } from "hono/secure-headers";
import { type ContextVariableMap, Hono } from "@hono/hono";
import { serveStatic } from "@hono/hono/deno";
import { basicAuth } from "@hono/hono/basic-auth";
import { jsxRenderer } from "@hono/hono/jsx-renderer";
import { HTTPException } from "@hono/hono/http-exception";
import { secureHeaders } from "@hono/hono/secure-headers";
import { makeLogger } from "#src/common/logger/mod.ts";
import { serviceRegister } from "#src/middlewares/mod.ts";
import { router } from "#src/apps/web/routes/mod.ts";
Expand All @@ -18,7 +18,7 @@ import { MainLayout } from "#src/apps/web/views/common/layouts/main.tsx";

const log = makeLogger("web");

declare module "hono" {
declare module "@hono/hono" {
interface ContextVariableMap {
services: {
api: {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/categories/create.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import { CategoriesCreatePage } from "#src/apps/web/views/categories/pages/create.tsx";

export const create = (router: Hono) => {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/categories/delete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";

export const del = (router: Hono) => {
router.post(
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/categories/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hono } from "hono";
import { Hono } from "@hono/hono";
import { create } from "#src/apps/web/routes/categories/create.tsx";
import { del } from "#src/apps/web/routes/categories/delete.ts";
import { update } from "#src/apps/web/routes/categories/update.tsx";
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/categories/update.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import { CategoriesEditPage } from "#src/apps/web/views/categories/pages/edit.tsx";

export const update = (router: Hono) => {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/feed-items/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import { FeedItemsIndexPage } from "#src/apps/web/views/feed-items/pages/index.tsx";

export const index = (router: Hono) => {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/feed-items/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hono } from "hono";
import { Hono } from "@hono/hono";
import { index } from "#src/apps/web/routes/feed-items/index.tsx";
import { readability } from "#src/apps/web/routes/feed-items/readability.tsx";
import { show } from "#src/apps/web/routes/feed-items/show.tsx";
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/feed-items/readability.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import { FeedItemsReadabilityPage } from "#src/apps/web/views/feed-items/pages/readability.tsx";

export const readability = (router: Hono) => {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/feed-items/show.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import { FeedItemsShowPage } from "#src/apps/web/views/feed-items/pages/show.tsx";

export const show = (router: Hono) => {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/feed-items/update.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import { decodeBase64Url } from "@std/encoding/base64url";

export const update = (router: Hono) => {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/feeds/create.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";
import { FeedsCreatePage } from "#src/apps/web/views/feeds/pages/create.tsx";

export const create = (router: Hono) => {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/feeds/delete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Hono } from "hono";
import type { Hono } from "@hono/hono";

export const del = (router: Hono) => {
router.post(
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/routes/feeds/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hono } from "hono";
import { Hono } from "@hono/hono";
import { create } from "#src/apps/web/routes/feeds/create.tsx";
import { del } from "#src/apps/web/routes/feeds/delete.ts";
import { update } from "#src/apps/web/routes/feeds/update.tsx";
Expand Down

0 comments on commit 1374d52

Please sign in to comment.