From 9e6efcee3a36431a4223ad9a4e1fbd420d270b29 Mon Sep 17 00:00:00 2001
From: MajorTanya <github@majortanya.eu>
Date: Tue, 2 Apr 2024 20:58:19 +0200
Subject: [PATCH] Upgrade to itty-router v5

Increased hnkrocks-chapter-router version to 2.10.1
---
 package-lock.json                 | 12 ++++++------
 package.json                      |  4 ++--
 src/handlers/handleChapters.ts    |  2 +-
 src/handlers/handleDirectPages.ts |  2 +-
 src/handlers/handleExtraPages.ts  |  2 +-
 src/handlers/handleFandub.ts      |  2 +-
 src/handlers/handleOEmbed.ts      |  2 +-
 src/handlers/handleOtherWorks.ts  |  2 +-
 src/index.ts                      |  5 +----
 9 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index e0f2e34..20e7322 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,14 +1,14 @@
 {
   "name": "hnkrocks-chapter-router",
-  "version": "2.10.0",
+  "version": "2.10.1",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "hnkrocks-chapter-router",
-      "version": "2.10.0",
+      "version": "2.10.1",
       "dependencies": {
-        "itty-router": "^4.2.2",
+        "itty-router": "^5.0.5",
         "reflare": "^1.1.5"
       },
       "devDependencies": {
@@ -1252,9 +1252,9 @@
       }
     },
     "node_modules/itty-router": {
-      "version": "4.2.2",
-      "resolved": "https://registry.npmjs.org/itty-router/-/itty-router-4.2.2.tgz",
-      "integrity": "sha512-KegPW0l9SNPadProoFT07AB84uOqLUwzlXQ7HsqkS31WUrxkjdhcemRpTDUuetbMJ89uBtWeQSVoiEmUAu31uw=="
+      "version": "5.0.5",
+      "resolved": "https://registry.npmjs.org/itty-router/-/itty-router-5.0.5.tgz",
+      "integrity": "sha512-SAidiHsush/fMnOjZdL4eilvwTiSc/ALbiqlc2RcYkW9SD924rzA/IBZJ1WxtGkFOHS9bhYAmtoBpcRiLuRMFg=="
     },
     "node_modules/longest-streak": {
       "version": "2.0.4",
diff --git a/package.json b/package.json
index 48cc6a9..55f843f 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,8 @@
 {
   "name": "hnkrocks-chapter-router",
-  "version": "2.10.0",
+  "version": "2.10.1",
   "dependencies": {
-    "itty-router": "^4.2.2",
+    "itty-router": "^5.0.5",
     "reflare": "^1.1.5"
   },
   "devDependencies": {
diff --git a/src/handlers/handleChapters.ts b/src/handlers/handleChapters.ts
index 359e236..7a9b26e 100644
--- a/src/handlers/handleChapters.ts
+++ b/src/handlers/handleChapters.ts
@@ -1,4 +1,4 @@
-import type { IRequestStrict } from 'itty-router/Router';
+import type { IRequestStrict } from 'itty-router/types/IRequestStrict';
 import { HNK_TITLE_URL, ZERO_DECIMAL_PATTERN } from '../constants';
 import type { Env } from '../types';
 
diff --git a/src/handlers/handleDirectPages.ts b/src/handlers/handleDirectPages.ts
index dcc5bc6..e4f6491 100644
--- a/src/handlers/handleDirectPages.ts
+++ b/src/handlers/handleDirectPages.ts
@@ -1,4 +1,4 @@
-import type { IRequestStrict } from 'itty-router/Router';
+import type { IRequestStrict } from 'itty-router/types/IRequestStrict';
 import { OEMBED_PAGE_DIRECT } from '../constants';
 import { redirectToHnKTitlePage } from './handleChapters';
 import type { Env } from '../types';
diff --git a/src/handlers/handleExtraPages.ts b/src/handlers/handleExtraPages.ts
index 26659ae..ba285e4 100644
--- a/src/handlers/handleExtraPages.ts
+++ b/src/handlers/handleExtraPages.ts
@@ -1,4 +1,4 @@
-import type { IRequestStrict } from 'itty-router/Router';
+import type { IRequestStrict } from 'itty-router/types/IRequestStrict';
 import useReflare from 'reflare';
 
 export const handleExtraPages = async (request: IRequestStrict): Promise<Response> => {
diff --git a/src/handlers/handleFandub.ts b/src/handlers/handleFandub.ts
index 7727382..c27b551 100644
--- a/src/handlers/handleFandub.ts
+++ b/src/handlers/handleFandub.ts
@@ -1,4 +1,4 @@
-import type { IRequestStrict } from 'itty-router/Router';
+import type { IRequestStrict } from 'itty-router/types/IRequestStrict';
 import { FANDUB_EP_01, FANDUB_EP_02, FANDUB_PLAYLIST } from '../constants';
 
 export const redirectToFandubPlaylist = () => Response.redirect(FANDUB_PLAYLIST);
diff --git a/src/handlers/handleOEmbed.ts b/src/handlers/handleOEmbed.ts
index 8c1931d..7a79a71 100644
--- a/src/handlers/handleOEmbed.ts
+++ b/src/handlers/handleOEmbed.ts
@@ -1,4 +1,4 @@
-import type { IRequestStrict } from 'itty-router/Router';
+import type { IRequestStrict } from 'itty-router/types/IRequestStrict';
 import { DEFAULT_JSON_HEADERS, OEMBED_BASE_RESPONSE, OEMBED_PAGE_DIRECT } from '../constants';
 
 type OEmbedProvider = { provider_name: string; provider_url: string } | Record<string, never>;
diff --git a/src/handlers/handleOtherWorks.ts b/src/handlers/handleOtherWorks.ts
index ab87583..8918897 100644
--- a/src/handlers/handleOtherWorks.ts
+++ b/src/handlers/handleOtherWorks.ts
@@ -1,4 +1,4 @@
-import type { IRequestStrict } from 'itty-router/Router';
+import type { IRequestStrict } from 'itty-router/types/IRequestStrict';
 import {
     HNK_FREEDOM_URL,
     HNK_LOREBOOK_URL,
diff --git a/src/index.ts b/src/index.ts
index c1251fd..7f7fada 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -23,7 +23,6 @@ import { handleExtraPages } from './handlers/handleExtraPages';
 import { handleFandubEpisodeNo, redirectToFandubPlaylist } from './handlers/handleFandub';
 import { handleOEmbed } from './handlers/handleOEmbed';
 import { handleOtherWorks } from './handlers/handleOtherWorks';
-import type { Env } from './types';
 
 const router = Router();
 
@@ -62,7 +61,5 @@ router.all('*', redirectToHnKTitlePage);
 
 // noinspection JSUnusedGlobalSymbols
 export default {
-    async fetch(request: Request, env: Env, _ctx: ExecutionContext): Promise<Response> {
-        return router.handle(request, env);
-    }
+    fetch: router.fetch
 };