@hono/vite-dev-server
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -9,4 +9,4 @@ import { WorkerOptions } from 'miniflare'; | ||
}; | ||
declare function devServer(options?: DevServerOptions): Plugin[]; | ||
declare function devServer(options?: DevServerOptions): Plugin; | ||
export { DevServerOptions, devServer }; |
@@ -1,1 +0,1 @@ | ||
import{getRequestListener as f}from"@hono/node-server";import{Miniflare as h}from"miniflare";const v='addEventListener("fetch", (event) => event.respondWith(new Response(null, { status: 404 })));';function x(n){const r=n?.entry??"./src/index.ts";return[{name:"sonik-dev-server",config:()=>({build:{rollupOptions:{input:[r]}}}),configureServer:async s=>{const c=new h({script:v,...n?.cf});async function p(u){return async function(t,l,i){if(t.url?.endsWith(".ts")||t.url?.endsWith(".tsx")||t.url?.startsWith("/@")||t.url?.startsWith("/node_modules"))return i();const o=(await u.ssrLoadModule(r)).default;if(!o)return console.error(`Failed to find a named export "default" from ${r}`),i();f(async d=>{const e=await o.fetch(d,await c.getBindings());if(n?.injectClientScript!==!1&&!e.headers.get("transfer-encoding")?.match("chunked")&&e.headers.get("content-type")?.match(/^text\/html/)){const m=await e.text()+'<script type="module" src="/@vite/client"></script>',a=new Headers(e.headers);return a.delete("content-length"),new Response(m,{status:e.status,headers:a})}return e})(t,l)}}s.middlewares.use(await p(s))}}]}export{x as devServer}; | ||
import{getRequestListener as m}from"@hono/node-server";import{Miniflare as f}from"miniflare";const v='addEventListener("fetch", (event) => event.respondWith(new Response(null, { status: 404 })));';function S(n){const r=n?.entry??"./src/index.ts";return{name:"@hono/vite-dev-server",config:()=>({build:{rollupOptions:{input:[r]}}}),configureServer:async s=>{const p=new f({script:v,...n?.cf});async function u(l){return async function(t,d,i){if(t.url?.endsWith(".ts")||t.url?.endsWith(".tsx")||t.url?.startsWith("/@")||t.url?.startsWith("/node_modules"))return i();const c=(await l.ssrLoadModule(r)).default;if(!c)return console.error(`Failed to find a named export "default" from ${r}`),i();m(async h=>{const e=await c.fetch(h,await p.getBindings(),{waitUntil:async o=>o,passThroughOnException:()=>{throw new Error("`passThroughOnException` is not supported")}});if(console.log(e.status),n?.injectClientScript!==!1&&!e.headers.get("transfer-encoding")?.match("chunked")&&e.headers.get("content-type")?.match(/^text\/html/)){const o=await e.text()+'<script type="module" src="/@vite/client"></script>',a=new Headers(e.headers);return a.delete("content-length"),new Response(o,{status:e.status,headers:a})}return e})(t,d)}}s.middlewares.use(await u(s))}}}export{S as devServer}; |
{ | ||
"name": "@hono/vite-dev-server", | ||
"description": "Vite dev-server plugin for Hono", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"types": "dist/index.d.ts", | ||
@@ -6,0 +6,0 @@ "module": "dist/index.js", |
@@ -13,2 +13,6 @@ # @hono/vite-dev-server | ||
## Demo | ||
https://github.com/honojs/vite-plugins/assets/10682/a93ee4c5-2e1a-4b17-8bb2-64f955f2f0b0 | ||
## Supported applications | ||
@@ -108,3 +112,3 @@ | ||
devServer({ | ||
entry: './test/mock/worker.ts', | ||
entry: 'src/index.ts', | ||
cf: { | ||
@@ -111,0 +115,0 @@ bindings: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6481
138