From 1054068d3fee27d7d7456ba3b3164f75cb7859f6 Mon Sep 17 00:00:00 2001 From: tknkaa Date: Wed, 1 Apr 2026 17:48:10 +0800 Subject: [PATCH 1/2] fix(drizzle): add missing closing parenthesis in D1 getDb function When generating the database client file for Cloudflare D1, the template string was missing a closing parenthesis in the arrow function parameter, resulting in invalid TypeScript syntax. This caused the parser to fail with 'Unexpected token' error during project creation when using the drizzle addon with D1 database option. Changed: export const getDb = (d1: D1Database => drizzle(d1, { schema }); To: export const getDb = (d1: D1Database) => drizzle(d1, { schema }); Fixes the error: Unable to process 'src/lib/server/db/index.ts'. Reason: Unexpected token --- packages/sv/src/addons/drizzle.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sv/src/addons/drizzle.ts b/packages/sv/src/addons/drizzle.ts index f61e63b2d..897949172 100644 --- a/packages/sv/src/addons/drizzle.ts +++ b/packages/sv/src/addons/drizzle.ts @@ -350,7 +350,7 @@ export default defineAddon({ js.imports.addNamed(ast, { from: 'drizzle-orm/d1', imports: ['drizzle'] }); const getDbFn = js.common.parseStatement( - `export const getDb = (d1${ts(': D1Database')} => drizzle(d1, { schema });` + `export const getDb = (d1${ts(': D1Database')}) => drizzle(d1, { schema });` ); ast.body.push(getDbFn); From 16a87d9392684b450cc955dc0db357ca166cae2e Mon Sep 17 00:00:00 2001 From: jycouet Date: Wed, 1 Apr 2026 15:13:26 +0200 Subject: [PATCH 2/2] add changeset --- .changeset/fifty-vans-nail.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fifty-vans-nail.md diff --git a/.changeset/fifty-vans-nail.md b/.changeset/fifty-vans-nail.md new file mode 100644 index 000000000..2ce0e429c --- /dev/null +++ b/.changeset/fifty-vans-nail.md @@ -0,0 +1,5 @@ +--- +'sv': patch +--- + +fix(drizzle): add missing closing parenthesis in D1 getDb function