@cloudwerk/vite-plugin 0.2.0 → 0.3.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/dist/index.d.ts CHANGED
@@ -52,6 +52,11 @@ interface CloudwerkVitePluginOptions {
52
52
  * @default 'hono-jsx'
53
53
  */
54
54
  renderer?: 'hono-jsx' | 'react';
55
+ /**
56
+ * Directory for static assets served at root.
57
+ * @default 'public'
58
+ */
59
+ publicDir?: string;
55
60
  }
56
61
  /**
57
62
  * Resolved plugin options after applying defaults and loading config.
@@ -73,6 +78,8 @@ interface ResolvedCloudwerkOptions {
73
78
  hydrationEndpoint: string;
74
79
  /** UI renderer name */
75
80
  renderer: 'hono-jsx' | 'react';
81
+ /** Directory for static assets (relative to root) */
82
+ publicDir: string;
76
83
  /** Vite root directory (absolute path) */
77
84
  root: string;
78
85
  }
package/dist/index.js CHANGED
@@ -965,6 +965,20 @@ function cloudwerkPlugin(options = {}) {
965
965
  }
966
966
  return {
967
967
  name: "cloudwerk",
968
+ /**
969
+ * Pass publicDir configuration to Vite.
970
+ * This enables Vite's built-in static file serving for the public directory.
971
+ */
972
+ async config(userConfig) {
973
+ if (userConfig.publicDir !== void 0) {
974
+ return {};
975
+ }
976
+ const root = userConfig.root ?? process.cwd();
977
+ const cloudwerkConfig = await loadConfig(root);
978
+ return {
979
+ publicDir: options.publicDir ?? cloudwerkConfig.publicDir ?? "public"
980
+ };
981
+ },
968
982
  /**
969
983
  * Resolve configuration and build initial manifest.
970
984
  */
@@ -998,6 +1012,7 @@ function cloudwerkPlugin(options = {}) {
998
1012
  verbose: options.verbose ?? false,
999
1013
  hydrationEndpoint: options.hydrationEndpoint ?? "/__cloudwerk",
1000
1014
  renderer: options.renderer ?? cloudwerkConfig.ui?.renderer ?? "hono-jsx",
1015
+ publicDir: options.publicDir ?? cloudwerkConfig.publicDir ?? "public",
1001
1016
  root
1002
1017
  };
1003
1018
  state = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudwerk/vite-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Vite plugin for Cloudwerk file-based routing with virtual entry generation",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "@swc/core": "^1.3.100",
22
- "@cloudwerk/core": "^0.8.0",
23
- "@cloudwerk/ui": "^0.8.0"
22
+ "@cloudwerk/core": "^0.9.0",
23
+ "@cloudwerk/ui": "^0.9.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "vite": "^5.0.0 || ^6.0.0",
@@ -33,7 +33,9 @@
33
33
  }
34
34
  },
35
35
  "devDependencies": {
36
+ "@hono/vite-dev-server": ">=0.18.0",
36
37
  "@types/node": "^20.0.0",
38
+ "hono": "^4.0.0",
37
39
  "tsup": "^8.0.0",
38
40
  "typescript": "^5.0.0",
39
41
  "vite": "^6.0.0",