0
0
mirror of https://github.com/honojs/hono.git synced 2024-12-01 11:51:01 +01:00
Commit Graph

109 Commits

Author SHA1 Message Date
Sor4chi
7768865e7a
fix: move c.stream* to helper (#1846)
* refactor: move streaming helper to `streaming/sse.ts`

* feat: add streamSSE's export in streaming handler

* feat: move `stream` and `streamText` to streaming helper

* chore: add deprecated expression for `c.stream` and `c.streamText`

* fix: use `stream` helper in streamSSE

* refactor: move `streamText` to `text.ts`

* test: add some case to `stream` and `streamText`

* test: refactor `streamSSE` case for uniformity

* chore: denoify

* fix: update jsdoc's deprecated description, simplify `c.stream` and `c.streamText`

* fix: match the header notation with that of `streamSSE

* chore: denoify

* refactor: remove unnecesary export
2023-12-27 06:55:24 +09:00
Yusuke Wada
4c4c4ee42c
fix(context): set status correctly (#1814)
* fix(context): set `status` correctly

* denoify
2023-12-13 16:21:53 +09:00
Yusuke Wada
af8d16b6db
fix(context): c.json() allows object and returns JSONParsed<T> (#1806)
* fix(context): `c.json()` allows object and returns JSONParsed<T>

* denoify
2023-12-13 09:01:34 +09:00
Yusuke Wada
0f33cf8d45
fix(context): set headers values correctly (#1808)
* fix(context): set headers values correctly

* denoify
2023-12-12 13:04:53 +09:00
Yusuke Wada
42912df795
fix(context): Strict type checking c.json() (#1776)
* fix(context): Strict type checking `c.json()`

* denoify
2023-12-04 22:14:49 +09:00
Yusuke Wada
22b5f532b4
refactor: use # for private properties (#1762)
* refactor: use `#` for private properties

* denoify
2023-12-04 17:29:24 +09:00
Taku Amano
d16aedfffd
feat: Ensure that calls to c.json() have a type equivalent to c.jsonT() (#1728)
* feat: Ensure that calls to `c.json()` have a type equivalent to `c.jsonT()`

* refactor: Objects with "response" properties are never returned by the handler

* refactor: "status" is not needed in TypedResponse

* refactor: Revive `c.jsonT()` and add @deprecated label

* refactor: Tweaks commenting on "eslint-disable" broken by `format:fix`

* test: Use `c.json()` instead of `c.jsonT()` to make sure there are no problems

* refactor: allow ambiguous type for `c.json()`

* chore: denoify

* fix: Remove unused TypedResponse from import statement
2023-12-03 09:03:14 +09:00
Yusuke Wada
472fee3629 Merge branch 'main' into next 2023-12-02 05:22:10 +09:00
Yusuke Wada
4fdfdd6d12
fix(context): Set content-type with c.text() correctly (#1761)
* fix(context): Set `content-type` with `c.text()` correctly

* denoify
2023-12-02 05:15:09 +09:00
Yusuke Wada
10c16c23ef
feat(context): remove experimental from c.render/c.setRenderer() (#1748)
* feat(context): remove `experimental` from `c.render` and `c.setRenderer()`

* denoify
2023-11-29 17:38:45 +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
Yusuke Wada
871cf80b6a
fix(context): c.text() set the status set by c.status() (#1702)
* fix(context): `c.text()` set the status set by `c.status()`

* fixed logic

* denoify
2023-11-15 22:16:38 +09:00
Yusuke Wada
5e3e85a179
Merge pull request #1690 from honojs/next
Next
2023-11-13 14:25:42 +09:00
Yusuke Wada
db3387353f
fix(context): implement ContextVariableMap for c.var (#1682)
* fix(context): implement `ContextVariableMap` for `c.var`

* denoify
2023-11-12 09:06:40 +09:00
Taku Amano
fedeb3d696
feat: Introduce streaming API with Suspense and use. (#1630)
* feat(jsx): Support async component.

* chore: denoify

* feat: Support nested async components.

* chore: denoify

* Remove unintended file from commit.

* test(jsx): Add test for html tagged template strings.

* feat: Introduce streaming API with `Suspense` and `use`.

* chore: denoify

* "use" receives only Promise.

* feat: Support multiple calls and nested calls to "use".

* refactor: tweaks replacement script.

* test: Add test for replacement result of streaming

* chore: denoify

* test: Add test "Complex fallback content"

* refactor: Add "typescript-eslint/no-explicit-any".

* Use jsdom instead of happy-dom due to ci failure.

* test: update test data for suspense.

* refactor: Remove excessive exports

* refactor: Changed initialization of `useContexts[]` to clarify intent.

* perf: improve `renderToReadableStream()` performance.

* chore: denoify

* pref: Shortened the output JS a bit.

* pref: Delete unneeded condition

* docs(jsx/streaming): Add `@experimental` flag to streaming API.

* fix(jsx/streadming): fix loop when using fullfilled Promise with null or undefined.

* fix(jsx/streaming): Catch unhandledRejection to avoid streaming not being closed.

* chore(jsx/streaming): Add entries for jsx/streaming to package.json.

* chore: denoify

* feat(jsx/streaming): Support the Async Component inside Suspense.

* chore: denoify

* feat(jsx/streaming): remove implementation of `use()`.
2023-11-07 07:09:04 +09:00
Yusuke Wada
3ead9a761c
feat(helper/adapter): add runtime option to env (#1622)
* feat(helper/adapter): add `runtime` option to `env`

* denoify
2023-10-27 11:06:21 +09:00
Yusuke Wada
850ae92c47
fix(context): change FetchEvent detection way (#1595)
* fix(context): change `FetchEvent` detection way

* denoify
2023-10-18 22:24:19 +09:00
Yusuke Wada
2feb300578 Merge branch 'main' into next 2023-10-06 05:17:45 +09:00
Yusuke Wada
c703dd3726
fix(types): don't use webworker types (#1548)
* fix(types): don't use webworker types

* denoify
2023-10-06 05:14:16 +09:00
Taku Amano
b05ed376b2
feat(jsx): Introduce Context API and jsx-renderer middleware (#1496)
Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2023-10-05 16:57:33 +09:00
Yusuke Wada
e326208fdf
fix(context): use FetchEvent instead of FetchEventLike (#1532) 2023-10-03 23:09:16 +09:00
Yusuke Wada
2c47bf5890
fix(context): fix c.stream() and c.streamText() matters (#1482)
* fix(context): fix `c.stream()` and `c.streamText()`

* denoify

* remove the not used line
2023-09-20 22:53:30 +09:00
Sor4chi
31f0605209 feat: Add c.stream() (#1437)
* feat: implement stream api utility-class

* test: write the test of StreamApi

* feat: implement `c.stream` to context

* test: write the test of `c.stream()`

* chore: denoify

* fix: extend for bytes, remove buffer system, add pipe and log interface

* test: update test about log, pipe, etc... for streaming API

* feat: extend textStream interface, remove utf-8 content-type

* test: add test about `c.textStream`

* refactor: update some args name

* chore: denoify

* fix: for deno, removed the optional parameter of `write` and `writeln`

* chore: denoify

* feat: add charset for textStream content-type header

* fix: rename textStream to streamText

* fix: reuse stream in streamText for bundle size

* feat: add `stream.wait()` api

* chore: denoify

* fix: rename `stream.wait` to `stream.sleep`

* test: use `stream.sleep` for waiting

* refactor: remove `stream.log`

* fix: remove preHeader from `c.stream()` and use `transfer-encoding` only `c.streamText()`

* chore: denoify

* refactoring: remove preHeader initialize

* test: reduce sleep duration

* chore: denoify

Co-authored-by: Glen Maddern <glenmaddern@gmail.com>
2023-09-17 00:57:26 +09:00
Yusuke Wada
665f456f84
feat(context): introduce c.var (#1406)
* feat(context): introduce `c.var`

* denoify

* make it a property

* denoify

* make it a read-only

* fix the complex pattern
2023-09-09 17:11:16 +09:00
Yusuke Wada
40c350cd88
feat(context): introduce c.render() (#1397)
* feat(context): introduce `c.render()`

* denoify
2023-09-05 16:01:58 +09:00
Derrick Farris
8cea5bc9c3
feat(context): add status to TypedResponse (#1403)
* feat(context): add `status` to `TypedResponse`

* test(context): make sure `tRes` has `status` prop
2023-09-05 15:58:43 +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
asaxeye
88e7650ee8
fix(types): corrected argument types for Context methods (#1357) 2023-08-21 00:23:05 +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
Yusuke Wada
8b0f189a3f refactor(json-pretty): don't use c.pretty() (#1288) 2023-08-05 18:14:57 +09:00
Yusuke Wada
47ae014724
perf(context): add init flag (#1284)
* perf(context): add `init` flag

* denoify
2023-08-04 00:09:12 +09:00
Yusuke Wada
8ebd8b7b76
fix(jsonT): remove overloads from JSONTRespond (#1208)
* fix(`jsonT`): remove overloads from `JSONTRespond`

* denoify

* update tests
2023-06-29 20:09:00 +09:00
Yusuke Wada
5b873fcc5c
fix(types): allow not to set skipLibCheck (#1206)
* fix(types): allow not to set `skipLibCheck`

* use `unknown`

* denoify
2023-06-29 16:48:00 +09:00
ayame113
81d271279c
feat: Allow context.jsonT to take interface as an argument (#1162) 2023-06-06 10:23:09 +09:00
Taku Amano
8a1b9aa9a8
refactor: Tweaks variable names to reduce code. (#1157)
* refactor: Tweaks variable names to reduce code.

* Delete meaningless comments

* chore: denoify
2023-06-04 09:16:29 +09:00
Yusuke Wada
a2d22807e4
feat: app.mount() (#1104)
* feat: `mount()`

* update tests

* check header values

* chore: denoify

* make it as `app.mount()`

* denoify

* Generate new URL more simply. (#1112)

* Generate new URL more simply.

* chore: denoify

---------

Co-authored-by: Taku Amano <taku@taaas.jp>
2023-05-18 14:03:50 +09:00
Yusuke Wada
390d05b006
feat(app): app.routerName() (#1105)
* feat(context): `c.routerName()`

* chore: denoify

* Enable to get router name via `app.routerName`. (#1110)

---------

Co-authored-by: Taku Amano <taku@taaas.jp>
2023-05-18 00:05:28 +09:00
Taku Amano
c25745c6fa
fix(context): Fix typo in charset, again. (#1086)
* fix(context): Fix typo in charset.

* chore: denoify
2023-05-10 08:27:40 +09:00
Yusuke Wada
bcc08081ef
fix(context): enable extending ContextVarableMap (#1080)
* fix(context): enable extending `ContextVarableMap`

* denoify
2023-05-09 21:55:40 +09:00
Yusuke Wada
116aea542d Merge branch 'main' into next 2023-05-05 17:46:30 +09:00
Yusuke Wada
a73f0d23f0
feat: Cookie Middleware and deprecate c.req.cookie() / c.cookie() (#1066)
* feat: add Cookie Middleware and deprecate `c.req.cookie()` / `c.cookie()`

* chore: denoify
2023-05-05 11:08:03 +09:00
Yusuke Wada
d06a3123e7 Merge branch 'main' into next 2023-05-02 16:30:24 +09:00
Yusuke Wada
85528398c3
fix: check global.fastly instead of require('fastly:env') (#1057)
* fix: use `global.fastly` instead of `require('fastly:env')`

* denoify
2023-05-02 16:26:39 +09:00
Yusuke Wada
0a19deaa5b
perf: shorten code (#1051) 2023-04-30 21:07:00 +09:00
Taku Amano
ac7eeda87f
fix(context): Fix typo in charset. (#1046) 2023-04-28 12:06:23 +09:00
Yusuke Wada
e0cead6100
fix(context): fixed a bug for c.header() with a append option (#997)
* fix(context): fixed a bug for `c.header()` with a `append` option

* denoify
2023-03-19 12:08:17 +09:00
Yusuke Wada
0238dc6b91
feat(req): introduce c.req.path (#988)
* feat(req): introduce `c.req.path`

* denoify

* we don't have to handle fragments

* fixed the test

* denoify
2023-03-17 16:32:19 +09:00
Yusuke Wada
ea7a1b2d95
refactor: remove lint warnings (#976) 2023-03-13 22:08:16 +09:00
Yusuke Wada
9c4197a772
feat(validator): support type transformation (#969)
* feat(validator): support type transformation

* denoify

* create `ValidationFunction` and add a test

* denoify

* rename

* denoify
2023-03-11 22:17:08 +09:00
Yusuke Wada
7548eaa0f6
feat(context): allow passing RequestInit to c.json() etc. (#959)
* feat(context): allow passing `RequestInit` to `c.json()` etc.

* denoify

resolve #952
2023-03-09 23:54:47 +09:00