From 20aca624c53d7b961a921c6ba28f02751093564c Mon Sep 17 00:00:00 2001 From: mathieudutour Date: Tue, 19 Aug 2025 12:04:08 +0200 Subject: [PATCH] Fix SQL utils on windows --- docs/utils-reference/getting-started.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- src/sql-utils.ts | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/utils-reference/getting-started.md b/docs/utils-reference/getting-started.md index 8698f6a..d2106d0 100644 --- a/docs/utils-reference/getting-started.md +++ b/docs/utils-reference/getting-started.md @@ -16,6 +16,10 @@ npm install --save @raycast/utils ## Changelog +### v2.2.1 + +- Fix compiled file to actually make `useSQL` and `executeSQL` work on Windows. + ### v2.2.0 - Make `useSQL` and `executeSQL` work on Windows. diff --git a/package-lock.json b/package-lock.json index 48f0afc..1339a6e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@raycast/utils", - "version": "2.2.0", + "version": "2.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@raycast/utils", - "version": "2.2.0", + "version": "2.2.1", "license": "MIT", "dependencies": { "dequal": "^2.0.3" diff --git a/package.json b/package.json index 6eeccbe..4310d0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@raycast/utils", - "version": "2.2.0", + "version": "2.2.1", "description": "Set of utilities to streamline building Raycast extensions", "author": "Raycast Technologies Ltd.", "homepage": "https://developers.raycast.com/utilities/getting-started", diff --git a/src/sql-utils.ts b/src/sql-utils.ts index a6bcb0e..6375ab3 100644 --- a/src/sql-utils.ts +++ b/src/sql-utils.ts @@ -30,7 +30,9 @@ export async function baseExecuteSQL( let sqlite3: typeof import("node:sqlite"); try { - sqlite3 = require("node:sqlite"); + // this is a bit ugly but we can't directly import "node:sqlite" here because parcel will hoist it anyway and it will break when it's not available + const dynamicImport = (module: string) => import(module); + sqlite3 = await dynamicImport("node:sqlite"); } catch (error) { // If sqlite3 is not available, we fallback to using the sqlite3 CLI (available on macOS and Linux by default). return sqliteFallback(databasePath, query, options);