Skip to content
Myr

feat: mustache middleware supports Module Worker mode (#252)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yusuke Wada · committed by GitHub · parent 923a30e · Browse files · 7 files+184 added−128 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+184 added−128 removed

  • tests:+73 added−58 removed
  • other:+111 added−70 removed

7 files+184 added−128 removed

deleted:src/middleware/mustache/index.test.ts-58 removed
modified:src/middleware/mustache/index.ts+1 added-67 removed
added:src/middleware/mustache/module.mts+15 added
added:src/middleware/mustache/mustache.test.ts+73 added
added:src/middleware/mustache/mustache.ts+75 added
modified:src/middleware/mustache/README.md+15 added-2 removed
16 unmodified lines
17```1819## Usage2021index.js:21index.ts:2223```js23```ts24import { Hono } from 'hono'25import { mustache } from 'hono/mustache'2627const app = new Hono()
10 unmodified lines
3839app.fire()40```4142In Module Worker mode:4344```ts45import { Hono } from 'hono'46import { mustache } from 'hono/mustache.module' // <---4748const app = new Hono()49app.use('*', mustache())50// ...5152export default app53```5455index.mustache:5657```mustache58{{> header}}
26 unmodified lines
modified:package.json+5 added-1 removed
24 unmodified lines
25 "./graphql-server": "./dist/middleware/graphql-server/index.js",26 "./jwt": "./dist/middleware/jwt/index.js",27 "./logger": "./dist/middleware/logger/index.js",28 "./mustache": "./dist/middleware/mustache/index.js",29 "./mustache.module": "./dist/middleware/mustache/module.mjs",30 "./powered-by": "./dist/middleware/powered-by/index.js",31 "./pretty-json": "./dist/middleware/pretty-json/index.js",32 "./serve-static": "./dist/middleware/serve-static/index.js",33 "./serve-static.module": "./dist/middleware/serve-static/module.mjs",
30 unmodified lines
64 ],65 "mustache": [66 "./dist/middleware/mustache"67 ],68 "mustache.module": [69 "./dist/middleware/mustache/module.d.mts"70 ],71 "powered-by": [72 "./dist/middleware/powered-by"73 ],74 "pretty-json": [
2 unmodified lines
77 "serve-static": [78 "./dist/middleware/serve-static/index.d.ts"79 ],80 "serve-static.module": [77 "./dist/middleware/serve-static/module.d.ts"81 "./dist/middleware/serve-static/module.d.mts"82 ],83 "router/trie-router": [84 "./dist/router/trie-router/router.d.ts"85 ],
62 unmodified lines