@hono/vite-build 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,6 +42,8 @@ export default defineConfig({
42
42
  build({
43
43
  // Defaults are `src/index.ts`,`./src/index.tsx`,`./app/server.ts`
44
44
  entry: './src/index.tsx',
45
+ // port option is only for Node.js adapter. Default is 3000
46
+ port: 3001,
45
47
  }),
46
48
  ],
47
49
  })
@@ -4,6 +4,7 @@ import '../../entry/index.js';
4
4
 
5
5
  type NodeBuildOptions = {
6
6
  staticRoot?: string | undefined;
7
+ port?: number | undefined;
7
8
  } & BuildOptions;
8
9
  declare const nodeBuildPlugin: (pluginOptions?: NodeBuildOptions) => Plugin;
9
10
 
@@ -1,6 +1,7 @@
1
1
  import buildPlugin from "../../base.js";
2
2
  import { serveStaticHook } from "../../entry/serve-static.js";
3
3
  const nodeBuildPlugin = (pluginOptions) => {
4
+ const port = pluginOptions?.port ?? 3e3;
4
5
  return {
5
6
  ...buildPlugin({
6
7
  ...{
@@ -17,7 +18,7 @@ const nodeBuildPlugin = (pluginOptions) => {
17
18
  entryContentAfterHooks: [
18
19
  async (appName) => {
19
20
  let code = "import { serve } from '@hono/node-server'\n";
20
- code += `serve(${appName})`;
21
+ code += `serve({ fetch: ${appName}.fetch, port: ${port.toString()} })`;
21
22
  return code;
22
23
  }
23
24
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hono/vite-build",
3
3
  "description": "Vite plugin to build your Hono app",
4
- "version": "1.1.1",
4
+ "version": "1.2.0",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.js",
7
7
  "type": "module",