diff --git a/benchmarks/webapp/.gitignore b/benchmarks/webapp/.gitignore new file mode 100644 index 00000000..7255efa0 --- /dev/null +++ b/benchmarks/webapp/.gitignore @@ -0,0 +1 @@ +yarn.lock \ No newline at end of file diff --git a/benchmarks/webapp/hono/index.js b/benchmarks/webapp/hono.js similarity index 75% rename from benchmarks/webapp/hono/index.js rename to benchmarks/webapp/hono.js index d7cf2507..a717176e 100644 --- a/benchmarks/webapp/hono/index.js +++ b/benchmarks/webapp/hono.js @@ -1,8 +1,7 @@ -import { Hono } from '../../../dist' -import { RegExpRouter } from '../../../dist/router/reg-exp-router' +import { Hono } from '../../dist/hono' //import { Hono } from 'hono' -const hono = new Hono({ routerClass: RegExpRouter }) +const hono = new Hono() hono.get('/user', (c) => c.text('User')) hono.get('/user/comments', (c) => c.text('User Comments')) hono.get('/user/avatar', (c) => c.text('User Avatar')) @@ -13,7 +12,7 @@ hono.post('/event/:id/comments', (c) => c.text('POST Event Comments')) hono.post('/status', (c) => c.text('Status')) hono.get('/very/deeply/nested/route/hello/there', (c) => c.text('Very Deeply Nested Route')) hono.get('/user/lookup/username/:username', (c) => { - return c.text(`Hello ${c.req.param('username')}`) + return new Response(`Hello ${c.req.param('username')}`) }) hono.fire() diff --git a/benchmarks/webapp/hono/package.json b/benchmarks/webapp/hono/package.json deleted file mode 100644 index cc8d3552..00000000 --- a/benchmarks/webapp/hono/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "hono-example-for-benchmark", - "version": "0.0.1", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "miniflare": "miniflare --port 8787" - }, - "author": "Yusuke Wada (https://github.com/yusukebe)", - "license": "MIT", - "dependencies": { - "hono": "./hono-1.1.1.tgz" - } -} diff --git a/benchmarks/webapp/hono/wrangler.toml b/benchmarks/webapp/hono/wrangler.toml deleted file mode 100644 index 53bdb969..00000000 --- a/benchmarks/webapp/hono/wrangler.toml +++ /dev/null @@ -1,2 +0,0 @@ -name = "hono-example-for-benchmark" -compatibility_date = "2022-05-11" diff --git a/benchmarks/webapp/itty-router/index.js b/benchmarks/webapp/itty-router.js similarity index 85% rename from benchmarks/webapp/itty-router/index.js rename to benchmarks/webapp/itty-router.js index 8a373b89..48b56ee3 100644 --- a/benchmarks/webapp/itty-router/index.js +++ b/benchmarks/webapp/itty-router.js @@ -9,8 +9,10 @@ ittyRouter.get('/event/:id', () => new Response('Event')) ittyRouter.get('/event/:id/comments', () => new Response('Event Comments')) ittyRouter.post('/event/:id/comments', () => new Response('POST Event Comments')) ittyRouter.post('/status', () => new Response('Status')) -ittyRouter.get('/very/deeply/nested/route/hello/there', () => new Response('Very Deeply Nested Route')) -//ittyRouter.get('/static/*', () => new Response('Static')) +ittyRouter.get( + '/very/deeply/nested/route/hello/there', + () => new Response('Very Deeply Nested Route') +) ittyRouter.get('/user/lookup/username/:username', ({ params }) => { return new Response(`Hello ${params.username}`, { status: 200, diff --git a/benchmarks/webapp/itty-router/package.json b/benchmarks/webapp/itty-router/package.json deleted file mode 100644 index 728eb231..00000000 --- a/benchmarks/webapp/itty-router/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "itty-router-example-for-benchmark", - "version": "0.0.1", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "miniflare": "miniflare --port 8788" - }, - "author": "Yusuke Wada (https://github.com/yusukebe)", - "license": "MIT", - "dependencies": { - "itty-router": "^2.4.8" - } -} diff --git a/benchmarks/webapp/itty-router/wrangler.toml b/benchmarks/webapp/itty-router/wrangler.toml deleted file mode 100644 index f3cb90f4..00000000 --- a/benchmarks/webapp/itty-router/wrangler.toml +++ /dev/null @@ -1,2 +0,0 @@ -name = "itty-router-example-for-benchmark" -compatibility_date = "2021-12-27" diff --git a/benchmarks/webapp/itty-router/yarn.lock b/benchmarks/webapp/itty-router/yarn.lock deleted file mode 100644 index cd96c527..00000000 --- a/benchmarks/webapp/itty-router/yarn.lock +++ /dev/null @@ -1,8 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -itty-router@^2.4.8: - version "2.4.8" - resolved "https://registry.yarnpkg.com/itty-router/-/itty-router-2.4.8.tgz#6b2ab34268a3516ea0112139dc2cca83cdedf2ce" - integrity sha512-VpAHeAN+/ABLqT/zEnwMomNCDh8eRrs06C8HRR8OxjVwGhXtvzoJbggjUnjAeNGxqjV4w7pp87Iu8jzEpr92fg== diff --git a/benchmarks/webapp/package.json b/benchmarks/webapp/package.json new file mode 100644 index 00000000..d044a23c --- /dev/null +++ b/benchmarks/webapp/package.json @@ -0,0 +1,15 @@ +{ + "name": "webapp", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "start:hono": "wrangler dev hono.js --local --port 8787", + "start:itty-router": "wrangler dev itty-router.js --local --port 8788", + "start:sunder": "wrangler dev sunder.js --local --port 8789" + }, + "license": "MIT", + "dependencies": { + "itty-router": "^2.6.1", + "sunder": "^0.10.1" + } +} diff --git a/benchmarks/webapp/sunder/index.js b/benchmarks/webapp/sunder.js similarity index 100% rename from benchmarks/webapp/sunder/index.js rename to benchmarks/webapp/sunder.js diff --git a/benchmarks/webapp/sunder/package.json b/benchmarks/webapp/sunder/package.json deleted file mode 100644 index e4244d77..00000000 --- a/benchmarks/webapp/sunder/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "sunder-example-for-benchmark", - "version": "0.0.1", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "miniflare": "miniflare --port 8789" - }, - "author": "Yusuke Wada (https://github.com/yusukebe)", - "license": "MIT", - "dependencies": { - "sunder": "^0.10.0" - } -} diff --git a/benchmarks/webapp/sunder/wrangler.toml b/benchmarks/webapp/sunder/wrangler.toml deleted file mode 100644 index 2bee2ceb..00000000 --- a/benchmarks/webapp/sunder/wrangler.toml +++ /dev/null @@ -1,2 +0,0 @@ -name = "sunder-example-for-benchmark" -compatibility_date = "2021-12-27" diff --git a/benchmarks/webapp/sunder/yarn.lock b/benchmarks/webapp/sunder/yarn.lock deleted file mode 100644 index 73f214ad..00000000 --- a/benchmarks/webapp/sunder/yarn.lock +++ /dev/null @@ -1,70 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -depd@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" - integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== - -fast-deep-equal@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== - -"http-errors@github:jshttp/http-errors#2.0": - version "2.0.0" - resolved "https://codeload.github.com/jshttp/http-errors/tar.gz/206aa2c15635dc1212c06c279540972aa90e23ea" - dependencies: - depd "2.0.0" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses "2.0.1" - toidentifier "1.0.1" - -inherits@2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -path-to-regexp@^6.1.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.2.0.tgz#f7b3803336104c346889adece614669230645f38" - integrity sha512-f66KywYG6+43afgE/8j/GoiNyygk/bnoCbps++3ErRKsIYkGGupyv07R2Ok5m9i67Iqc+T2g1eAUGUPzWhYTyg== - -secure-json-parse@^2.1.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/secure-json-parse/-/secure-json-parse-2.4.0.tgz#5aaeaaef85c7a417f76271a4f5b0cc3315ddca85" - integrity sha512-Q5Z/97nbON5t/L/sH6mY2EacfjVGwrCcSi5D3btRO2GZ8pf1K1UN7Z9H5J57hjVU2Qzxr1xO+FmBhOvEkzCMmg== - -setprototypeof@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" - integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== - -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== - -sunder@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/sunder/-/sunder-0.10.0.tgz#40f943de8f3c33d7ab4d766729336febcdfa362c" - integrity sha512-uhap0K18pg1pvXKh7JfTFt4JhkUjCi+UAHVs4TRccQ/csDbVfzmayzzZkahlREIalq7Iq/WBQ9ZWpM8qipJAxg== - dependencies: - fast-deep-equal "^3.1.3" - http-errors "github:jshttp/http-errors#2.0" - secure-json-parse "^2.1.0" - tiny-request-router "^1.2.2" - -tiny-request-router@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/tiny-request-router/-/tiny-request-router-1.2.2.tgz#1b80694497e4e8dcbb8e93851ec7f03c6ca13e75" - integrity sha512-6ZMFU7AP9so+hkqmMM9fJ11V44EAcYuHCmNdsyM8k94oVnNDPQwUAAPoBHqchHSpKG6yZbCasgVeRxaY5v2BCg== - dependencies: - path-to-regexp "^6.1.0" - -toidentifier@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" - integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==