0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-25 05:07:03 +01:00
Commit Graph

70 Commits

Author SHA1 Message Date
Taku Amano
ada10e5bf0
fix(stream): Fixed a problem that onAbort() is called even if request is normally closed in deno (#3079)
* Fix(stream): Fixed a problem that onAbort() is called even if request is normally closed in deno

* test: fix stream abort test for Node.js
2024-07-03 10:50:44 +09:00
Taku Amano
2d3bc55954
fix(streaming): call stream.abort() explicitly when request is aborted (#3042)
* feat(utils/stream): enable to abort streaming manually

* feat(utils/stream): prevent multiple aborts, and enable to get the abort status

* fix(streaming): call `stream.abort()` explicitly when request is aborted

* test: add tests for streaming

* docs(stream): add comments

* test: add --allow-net to deno test command in ci.yml

* test(streaming): update test code

* test(stream): retry flaky test up to 3 times at "bun"

* test(streaming): refactor test to use afterEach

* fix(streaming): in bun, `c` is destroyed when the request is returned, so hold it until the end of streaming

* refactor(streaming): tweaks code layout
2024-06-29 07:00:28 +09:00
Yusuke Wada
ae3a67beb1
perf(context): improve initializing Context (#3046)
* perf(context): improve initializing `Context`

* update to pass tests and CI

* removed not used module

* remove not used module
2024-06-27 10:44:37 +09:00
Markus Wolf
a2a04a98a1
fix(aws-lambda): handle multiple cookies in streaming responses (#2926)
* fix: handle multiple cookies in streaming responses

This fix does address that cookies have to be handled
specially in lambda responses.

Fixes #2921

* test: check cookie handling
2024-06-12 19:25:37 +09:00
TATSUNO “Taz” Yasuhiro
ec3648d0c3
refactor(aws-lambda): merge custom-context into types (#2889)
* refactor(aws-lambda): merge custom-context into types so they are excluded from coverage

* refactor: custom-context.ts is not needed since it is hidden by reexport
2024-06-03 00:16:07 +09:00
Yusuke Wada
786f9e2a9d
test(workerd): add tests for WebSocket (#2891) 2024-06-03 00:14:11 +09:00
Yusuke Wada
f634c82451
test(workerd): rename the runtime test wrangler to workerd (#2888)
* test(workerd): rename the runtime test `wrangler` to `workerd`

* fixed ci.yml

* fixed a typo

* use node 20.x
2024-06-02 22:49:40 +09:00
TATSUNO “Taz” Yasuhiro
8cc8a05c89
ci: Report coverage with CodeCov (#2862)
* Output coverage per each test

* Collect coverage

* Exclude test-only files

* update comment

* exclude types

* Add config

* Update bun comment

* Generate coverage in Deno
2024-06-01 04:17:47 +09:00
Yusuke Wada
cc4b2b3c7f
chore(lint): update eslint rules (#2790)
* chore(lint): update eslint rules

* fix formats
2024-05-26 05:17:45 +09:00
ryu
82cfd466f2
chore(deno): change path including deno_dist (#2788) 2024-05-26 04:41:48 +09:00
Yusuke Wada
1b2a4c0800
feat(jsr): support JSR (#2662)
* feat(jsr): reduce slow types (#2369)

* feat(jsr): reduce slow types

* fix: use allow function

* chore: format code

* chore: denoify

* add `deno.json`

* add `jsr-dry-run` command for CI

* don't put `JSX` on `global`

* fix test settings for deno

* don't use `dynamicClass`

* don't declare `ExecutionContext` in `global`

* goodbye denoify

* exports `./middleware`

* exports `./helper`

* exports each helper and middleware

* remove the `awslambda` implementation which is not enough

* feat(jsr): remove helper.ts and middleware.ts (#2667)

* feat(jsr): remove helper.ts and middleware.ts

* fix: fix test

* dont' use `SuperClass`

Co-authored-by: Taku Amano <taku@taaas.jp>

* feat(jsr): delete `mod.ts` (#2669)

* rename `deno.json` to `jsr.json`

* lint

* remove slow type in lambda adapter

* fixed runtime test for deno

* export all utils

* add a GitHub action to publish the package to JSR

* fixed declaring `ContextVariableMap`

* fixed the type error

* include `jsr.json` in `jsr.json`

* update `jsr.json`

---------

Co-authored-by: Shotaro Nakamura <79000684+nakasyou@users.noreply.github.com>
Co-authored-by: Taku Amano <taku@taaas.jp>
2024-05-24 17:47:28 +09:00
Ilias YAHIA
a437161c2b
feat(aws-lambda): add support for alb multiValueQueryStringParameters (#2751) 2024-05-21 08:59:31 +09:00
Ilias YAHIA
e1257f14e6
feat(aws-lambda): add alb event processor (#2657)
* feat(aws-lambda): add alb event processor

* fix: formatting issue
2024-05-13 14:41:57 +09:00
Yusuke Wada
0fafd7aa8b
chore(eslint): enable @typescript-eslint/unbound-method (#2622)
* chore(eslint): enable `@typescript-eslint/unbound-method`

* denoify
2024-05-06 17:38:34 +09:00
Yusuke Wada
92e65fbb6e
Merge pull request from GHSA-3mpf-rcc7-5347 2024-04-23 17:14:16 +09:00
TATSUNO “Taz” Yasuhiro
acb56b8d30
fix(adapter): handle multi value headers in AWS Lambda (#2494)
* Headers can be undefined on ALB

* Delegate headers from multiValueHeaders

* Add test

* Assert header values

* format

* Make multiValueHeaders optional so it can be omitted

* Avoid Object.entries when undefined

* Write tests in runtime_tests
2024-04-18 08:13:37 +09:00
Shotaro Nakamura
47f5c545f2
feat: Introduce WebSocket Helper / Adapter (#2265)
* feat: Add WebSocket API

* chore: format code

* chore: denoify

* feat: remove `bun-types`

* fix(ws): Cloudflare workers

* feat(ws): Add Deno Adapter

* fix(ws): Add Deno exports to package.json

* feat: test code

* chore: denoify

* chore: format code

* fix: eslint

* chore: createBunWebSocket to createWebSocket

* chore: able to import from index.ts

* feat: add workers test

* feat: add deno test

* typo: `normalizedReceiveData`

* refactor: change way to discrimination client type

* fix: bypass test

* fix: format code and bypass test

* fix: forget to delete `console.log` for debug

* feat(ws): remove `hono/ws/{adapter}` import
2024-03-05 22:04:04 +09:00
Taku Amano
b4912f32b6
fix(deno/jsx-precompile): use html() tag function if value is a promise (#2283) 2024-02-28 17:13:45 +09:00
Yusuke Wada
f8371ab356
fix(serve-static): support extensionless files and refactor (#2260) 2024-02-24 22:38:39 +09:00
Taku Amano
473a6f0999
refactor: jsx streaming (#2216)
* refactor(jsx): tweaks loop in order to avoid error for blank content

* feat(jsx): add data-hono-target attribute to streaming content

* chore: denoify

* test: fix runtime_tests/deno-jsx/jsx.test.tsx
2024-02-16 09:04:22 +09:00
Yusuke Wada
37842fbada
fix!(deno): put SSG helper into helper.ts (#2150)
* fix!(deno): put SSG helper into `helper.ts`

* denoify

* fixed runtime test
2024-02-05 05:43:09 +09:00
Yusuke Wada
b24f9e38da Merge branch 'main' into v4 2024-01-29 23:44:20 +09:00
Yusuke Wada
f616ed9abe
chore(lint): set curly rule as all (#2112)
* chore(lint): set `curly` rule as `all`

* denoify
2024-01-29 22:21:09 +09:00
Yusuke Wada
74865a2c6d Merge branch 'main' into v4 2024-01-27 23:02:59 +09:00
ryu
45d612d641
refactor(test): change to not use env command (#2062)
* refactor(test): change to not use `env` command

* fix bun test
2024-01-23 17:07:31 +09:00
watany
23d96a9b08
refactor(ssg): Removal of Libraries Dependent on Node.js (#2012)
* remove Buffer

* fix

* fix

* type Bun

* test import

* fix & rename

* move a ssg test for deno

* import jsx

* console.log

* update CI

* revert toAbcSSG name

* rename

---------

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2024-01-19 11:38:09 +09:00
Yusuke Wada
9090620276
chore(runtime-test): add deno.lock (#2015) 2024-01-18 13:51:52 +09:00
Yusuke Wada
a183fe403e
chore: enables lint and format for .tsx (#1994)
* chore: enables lint and format for `.tsx`

* ignore
2024-01-16 18:38:26 +09:00
Taku Amano
62f11a2817
feat(jsx/dom): rewrite renderer to use virtual tree (#1981)
* feat(jsx/dom): rewrite renderer to use virtual tree

* test(deno): add runtime_tests/deno/deno.json in order to allow `document`, `Element`, etc.

* refactor(jsx/dom): Removed redundant `map()` calls

* refactor(jsx/dom): tweaks getNextChildren for reduce code size

* refactor(jsx/dom): optimize findInsertBefore

* refactor(jsx/dom): optimize `build()`

* refactor(jsx/dom): reuse oldChild even in text nodes.

* feat(jsx/dom): handle promise rejection in use()

* feat(jsx): The result of using Suspense and use() is now the same as React's renderToReadableStream().

* chore: denoify

* test(deno): "dom.iterable" is required for 'Headers.entries()'
2024-01-16 11:32:44 +09:00
Yusuke Wada
6a8b4e61ba Merge branch 'main' into v4 2024-01-15 16:17:45 +09:00
Yusuke Wada
4560df5efc
ci: remove lagon runtime tests and other lagon things (#1971)
* ci: remove lagon runtime tests and other lagon things

* remove lagon from github actions
2024-01-14 19:09:09 +09:00
mosle
92e3556d24
fix(lambda@edge): add bodyEncoding property for base64 response (#1949)
* Add bodyEncoding property for base64 response in Lambda@Edge adapter

* run format:fix
2024-01-12 17:27:16 +09:00
watany
04b686ca39
feat: Introducing a New SSG Adaptor/Helper (#1904)
* first

* v0.1

* faster

* enhanced type

* tsx

* jsx

* split

* fix

* denoify

* fix:  compatible with node:fs/promises

* rename

* fixed

* for bun

* add Deno

* add Deno

* fix

* revert

* 1.0

* denoify

* remove message

* ToSSGResult

* fix comment

* fix comment
2024-01-12 06:04:49 +09:00
Sor4chi
b8b0b384b6
feat: pass context to onNotFound callback in serveStatic (#1865)
* feat: pass context to onNotFound callback in serveStatic

* chore: denoify

* test: update notFoundHandler's callback expect

* feat: add Env generics for serveStatic to support `c.env` type in callback handler

* feat: add Env generics for serveStatic to support c.env type in cloudflare workers module's callback handler
2024-01-02 22:42:16 +09:00
Withee Poositasai
b128d02336
feat: Add onNotFound handler in adapters' serveStatic (#1825)
* feat: add onNotFound handler in adapters' serveStatic

* test: add serveStatic onNotFound tests for bun and deno

* test: add serveStatic onNotFound tests for cloudflare workers
2023-12-27 07:04:46 +09:00
Yoshiaki Sugimoto
7a55399bc2
test: Use vitest for fastly compute testing (#1828)
* use vitest for fastly compute testing

* reflect reviews and solve problem

* chore: update comment

* run lint:fix
2023-12-17 21:17:18 +09:00
Yusuke Wada
19641d07c1 Merge branch 'main' into next 2023-11-28 18:00:14 +09:00
Yusuke Wada
7dc215577a
fix(helper/cookie): make default Path=/ for setCookie()/setSignedCookie() (#1742)
* fix(helper/cookie): make default `path` as `/` for `setCookie()`/`setSignedCookie()`

* denoify

* fixed test
2023-11-28 17:52:34 +09:00
watany
bea87a0429
feat(adaptor): Enhance AWS Lambda Event Handling and Interface (#1710) 2023-11-27 15:31:10 +09:00
Taku Amano
cd6c488b76
feat(jsx): Introduce ErrorBoundary component (#1714)
* feat(jsx/streaming): Support Suspense in non-streaming mode.

* feat(jsx): Introduce ErrorBoundary component.

* chore: denoify

* feat: Support ErrorBoundary[fallbackRender].

* chore: denoify

* Rename utils.ts to components.ts

* refactor: export the ErrorBoundary component from the top level.

* fix: tweaks `resolveStream` to work with nested components

* refactor: Import `childrenToString` from `components.ts`

* fix: return immediately if the element is not found

* test: add test for jsx/components

* fix: run `npm run format:fix`

* chore: denoify
2023-11-21 18:05:05 +09:00
watany
c7e4035700
fix(Adaptor): Lambda Response Streaming With Content Type (#1673)
* lambda 0.1

* ok stream setted content-type

* fix d.ts
2023-11-11 00:44:20 +09:00
Taku Amano
652ef7c867
feat(jsx): Define jsxTemplate/jsxAttr/jsxEscape for "@jsx precompile" of Deno 1.38 (#1651)
* fix(jsx/streaming): Fix for renderToReadableStream(promise: Promise<HtmlEscapedString>).

* feat(jsx): Define jsxTemplate/jsxAttr/jsxEscape for "@jsx precompile" of Deno 1.38

* chore: denoify

* fix(jsx/streaming): some times jsxDEV is called with null props.

* test(deno-jsx): Add runtime tests for JSX by Deno.

* test: Refactor import map.

* test: Added @jsxImportSource to avoid type warnings
2023-11-08 21:07:35 +09:00
watany
7adae90fd7
fix(helper): Stream SSE Helper Non-Closure (#1650)
* fix(helper): Stream SSE Helper Non-Closure

* denoify

* test fixed.
2023-11-08 20:54:02 +09:00
watany
8b4392fa36
feat(adaptor): Support AWS Function URL Streaming (#1625)
* 0.1

* lint

* stream

* type safe

* ignore

* lint

* test Node.writablestream

* 1.0

* fixed pipeline

* fixed
2023-11-07 07:05:23 +09:00
Ochirjav Jargalsaikhan
5f0237525c
fix(lambda): Aws lambda cookies fix (#1613)
* AWS Lambda adapter cookies issue fix implementation

* AWS Lambda adapter cookies issue - tests modified to handle multiple cookies
2023-10-27 06:13:02 +09:00
watany
76a2c7f523
chore(ci): bun v1 (#1599)
* chore(ci): bun v1

* bun use jsx

* bun version
2023-10-20 18:18:05 +09:00
watany
43749a0efd
feat(adaptor): Accessable Lambda "Context" (#1523)
* adding lambda-context

* format

* type any

* ignore denoify

* export type
2023-09-30 21:55:35 +09:00
Derrick Farris
5b07146cf8
test(vitest): replace jest with vitest (#1404)
* test(vitest): replace `jest` with `vitest` for core tests

* test(fastly): `jest` -> `vitest`, correct env for fastly

* test(jest): remove `jest-environment-miniflare` as dep

* test(lagon): configure `lagon` tests to run on `vitest`

* test(lambda): `jest` -> `vitest`

* test(lambda-edge): `jest` -> `vitest`

* test(node): `jest` -> `vitest`

* test(wrangler): `jest` -> `vitest`

* chore(deps): remove `jest` and `ts-jest` from deps

* test(vitest): add `yarn coverage` for checking coverage

* test(fastly): fix check for `globalThis.crypto`

* test(handler): fix stray `.only`

* test(lagon): change env file back to original path

* test(fastly): go back to `jest` until `vitest` has support for fastly env

* test(fastly): remove hack for the `crypto` global from the test
2023-09-08 17:42:28 +09:00
Yusuke Wada
e07019125d
feat: introduce "Helpers" (#1353)
* mv jsx

* introduce helper

* denoify & add src/helper.ts for Deno

* remove `c` not used

* remove `c` in lagon test

* remove `src/adapter.ts` not used
2023-08-21 15:22:37 +09:00
Yusuke Wada
dc0696f2d1
refactor(context): allow passing HonoRequest as 1st arg (#1312)
* perf(context): allow passing `HonoRequest` as 1st arg

* denoify

* test: fix the node runtime test

* test: fix deno tests
2023-08-19 16:20:08 +09:00