Compare commits
6 Commits
f07da84fee
...
5aa84907bb
Author | SHA1 | Date |
---|---|---|
|
5aa84907bb | |
|
7b3b7996e4 | |
|
bb21c0b263 | |
|
b9fa57530a | |
|
8c77d5f9aa | |
|
f04d68edad |
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
'@hono/node-ws': minor
|
||||
'@hono/node-ws': patch
|
||||
---
|
||||
|
||||
Make it uncrashable
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
# @hono/hello
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#235](https://github.com/honojs/middleware/pull/235) [`a3da3da`](https://github.com/honojs/middleware/commit/a3da3dac910e24075466932ac39bb4e529dfb483) Thanks [@yusukebe](https://github.com/yusukebe)! - chore: tweak
|
||||
|
||||
## 0.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#228](https://github.com/honojs/middleware/pull/228) [`b9baf4a`](https://github.com/honojs/middleware/commit/b9baf4a9902ddd2dd09dd65e00699088fcbac403) Thanks [@yusukebe](https://github.com/yusukebe)! - feat: bump infer type correctly using `satisfies`
|
||||
|
||||
## 0.0.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#44](https://github.com/honojs/middleware/pull/44) [`fe80b93`](https://github.com/honojs/middleware/commit/fe80b939e5e8cfbfdb6fe9a59c8c6477ce1bb766) Thanks [@yusukebe](https://github.com/yusukebe)! - fix peerDependencies
|
||||
|
||||
## 0.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 5a14c91: fix types
|
||||
|
||||
## 0.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 10dd016: new message
|
||||
|
||||
## 0.0.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 845f880: this is a "blank" update
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 45a22b8: `@honojs` to `@hono`
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 0e7e7e2: nothing is changed
|
|
@ -1,28 +0,0 @@
|
|||
# Hello middleware for Hono
|
||||
|
||||
[](https://codecov.io/github/honojs/middleware)
|
||||
|
||||
An example project of the third-party middleware for [Hono](https://github.com/honojs/hono).
|
||||
This middleware add `X-Message` header to the Response.
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { hello } from '@hono/hello'
|
||||
import { Hono } from 'hono'
|
||||
|
||||
const app = new Hono()
|
||||
|
||||
app.use('*', hello('Hello!! Hono!!'))
|
||||
app.get('/', (c) => c.text('foo'))
|
||||
|
||||
export default app
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
Yusuke Wada <https://github.com/yusukebe>
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
|
@ -1,54 +0,0 @@
|
|||
{
|
||||
"name": "@hono/effect",
|
||||
"version": "0.1.1",
|
||||
"description": "An example of third-party middleware for Hono",
|
||||
"type": "module",
|
||||
"module": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup ./src/index.ts",
|
||||
"prepack": "yarn build",
|
||||
"publint": "attw --pack && publint",
|
||||
"typecheck": "tsc -b tsconfig.json",
|
||||
"test": "vitest"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org",
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/honojs/middleware.git",
|
||||
"directory": "packages/effect"
|
||||
},
|
||||
"homepage": "https://github.com/honojs/middleware",
|
||||
"peerDependencies": {
|
||||
"hono": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.17.4",
|
||||
"publint": "^0.3.9",
|
||||
"tsup": "^8.4.0",
|
||||
"typescript": "^5.8.2",
|
||||
"vitest": "^3.0.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"effect": "^3.14.11"
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
import { Hono } from 'hono'
|
||||
import { hello } from '.'
|
||||
|
||||
describe('Hello middleware', () => {
|
||||
const app = new Hono()
|
||||
|
||||
app.use('/hello/*', hello())
|
||||
app.get('/hello/foo', (c) => c.text('foo'))
|
||||
|
||||
app.use('/x/*', hello('X'))
|
||||
app.get('/x/foo', (c) => c.text('foo'))
|
||||
|
||||
it('Should be hello message', async () => {
|
||||
const res = await app.request('http://localhost/hello/foo')
|
||||
expect(res).not.toBeNull()
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers.get('X-Message')).toBe('Hello!')
|
||||
})
|
||||
|
||||
it('Should be X', async () => {
|
||||
const res = await app.request('http://localhost/x/foo')
|
||||
expect(res).not.toBeNull()
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers.get('X-Message')).toBe('X')
|
||||
})
|
||||
})
|
|
@ -1,15 +0,0 @@
|
|||
import { Effect } from 'effect'
|
||||
import { Hono } from 'hono'
|
||||
import type { Context } from 'hono'
|
||||
import { createMiddleware } from 'hono/factory'
|
||||
|
||||
export const effect = async <ContextType extends Context, SuccessType>(
|
||||
program: Effect.Effect<SuccessType>,
|
||||
c: ContextType
|
||||
) => {
|
||||
const result = await Effect.runPromise(program)
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
const app = new Hono().get('/', (c) => effect(c))
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"tsBuildInfoFile": "dist/tsconfig.build.tsbuildinfo",
|
||||
"emitDeclarationOnly": false
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["**/*.test.ts"],
|
||||
"references": []
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc/packages/hello",
|
||||
"types": ["vitest/globals"]
|
||||
},
|
||||
"include": ["**/*.test.ts", "vitest.config.ts"],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.build.json"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
import { defineProject } from 'vitest/config'
|
||||
|
||||
export default defineProject({
|
||||
test: {
|
||||
globals: true,
|
||||
},
|
||||
})
|
29
yarn.lock
29
yarn.lock
|
@ -1962,21 +1962,6 @@ __metadata:
|
|||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@hono/effect@workspace:packages/effect":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@hono/effect@workspace:packages/effect"
|
||||
dependencies:
|
||||
"@arethetypeswrong/cli": "npm:^0.17.4"
|
||||
effect: "npm:^3.14.11"
|
||||
publint: "npm:^0.3.9"
|
||||
tsup: "npm:^8.4.0"
|
||||
typescript: "npm:^5.8.2"
|
||||
vitest: "npm:^3.0.8"
|
||||
peerDependencies:
|
||||
hono: "*"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@hono/esbuild-transpiler@workspace:packages/esbuild-transpiler":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@hono/esbuild-transpiler@workspace:packages/esbuild-transpiler"
|
||||
|
@ -3736,7 +3721,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@standard-schema/spec@npm:1.0.0, @standard-schema/spec@npm:^1.0.0":
|
||||
"@standard-schema/spec@npm:1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "@standard-schema/spec@npm:1.0.0"
|
||||
checksum: a1ab9a8bdc09b5b47aa8365d0e0ec40cc2df6437be02853696a0e377321653b0d3ac6f079a8c67d5ddbe9821025584b1fb71d9cc041a6666a96f1fadf2ece15f
|
||||
|
@ -6286,16 +6271,6 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"effect@npm:^3.14.11":
|
||||
version: 3.14.11
|
||||
resolution: "effect@npm:3.14.11"
|
||||
dependencies:
|
||||
"@standard-schema/spec": "npm:^1.0.0"
|
||||
fast-check: "npm:^3.23.1"
|
||||
checksum: 1a1055845fdedc18713746ea600ffdddd6417f753c91b8f6ba0867cc058d4c99507dd0019be73d52cf01003dae14efe79d8092da0b4dd1e22bdf6ef84398b8b4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"electron-to-chromium@npm:^1.5.73":
|
||||
version: 1.5.123
|
||||
resolution: "electron-to-chromium@npm:1.5.123"
|
||||
|
@ -7360,7 +7335,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fast-check@npm:^3.21.0, fast-check@npm:^3.23.1":
|
||||
"fast-check@npm:^3.21.0":
|
||||
version: 3.23.2
|
||||
resolution: "fast-check@npm:3.23.2"
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in New Issue