Skip to content

Commit dba836d

Browse files
committed
feat: support more clear do config
1 parent 0cf1124 commit dba836d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/vite-plugin-cloudflare-functions/src/vite/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ export function CloudflarePagesFunctions(userConfig: UserConfig = {}): Plugin {
7272
}
7373
if (userConfig.wrangler?.do) {
7474
for (const [key, value] of Object.entries(userConfig.wrangler.do)) {
75+
const config = typeof value === 'string' ? value : `${value.class}@${value.script}`;
7576
bindings.push('--do');
76-
bindings.push(`"${key}=${value}"`);
77+
bindings.push(`"${key}=${config}"`);
7778
}
7879
}
7980
if (userConfig.wrangler?.r2) {

packages/vite-plugin-cloudflare-functions/src/vite/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ export interface UserConfig {
5959
/**
6060
* Bind Durable Object
6161
*/
62-
do?: Record<string, string>;
62+
do?: Record<string, string | { class: string; script: string }>;
6363

6464
/**
6565
* Bind R2 bucket
6666
*/
6767
r2?: string | string[];
6868

6969
/**
70-
* Determines which version of the Workers runtime is used.
70+
* Determines which version of the Workers runtime is used.
7171
*/
7272
compatibilityDate?: string;
7373
};

0 commit comments

Comments
 (0)