From 7166e2e278779e7b40bb51cb596f704201b565d3 Mon Sep 17 00:00:00 2001 From: typicode Date: Mon, 23 Oct 2023 15:48:28 +0200 Subject: [PATCH] fix: node presets with url --- package-lock.json | 14 +++++++------- package.json | 2 +- src/presets/node.ts | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 322044e..6203609 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "6.1.0", "license": "MIT", "dependencies": { - "steno": "^3.1.0" + "steno": "^3.1.1" }, "devDependencies": { "@commitlint/cli": "^17.7.2", @@ -4190,9 +4190,9 @@ } }, "node_modules/steno": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/steno/-/steno-3.1.0.tgz", - "integrity": "sha512-U9mIkOthSBoLxa+4QAXv0aDDHeLn6merFMkjSblSz+WgezKQ0EkS1znRY6hNBZz3kGDm/0ZaP+E+/1X1ho37IQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/steno/-/steno-3.1.1.tgz", + "integrity": "sha512-B7c6EVH7oEiaMRW36SjUnktkDwp/qd4pQiduylyiqvcZEZDeX0IIFZRBZdwO/RaVo60M0wkDwC0e8yeKaR4VGg==", "engines": { "node": ">=16" }, @@ -7816,9 +7816,9 @@ } }, "steno": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/steno/-/steno-3.1.0.tgz", - "integrity": "sha512-U9mIkOthSBoLxa+4QAXv0aDDHeLn6merFMkjSblSz+WgezKQ0EkS1znRY6hNBZz3kGDm/0ZaP+E+/1X1ho37IQ==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/steno/-/steno-3.1.1.tgz", + "integrity": "sha512-B7c6EVH7oEiaMRW36SjUnktkDwp/qd4pQiduylyiqvcZEZDeX0IIFZRBZdwO/RaVo60M0wkDwC0e8yeKaR4VGg==" }, "string_decoder": { "version": "1.3.0", diff --git a/package.json b/package.json index a944c5f..f93ad09 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "prepare": "husky install" }, "dependencies": { - "steno": "^3.1.0" + "steno": "^3.1.1" }, "devDependencies": { "@commitlint/cli": "^17.7.2", diff --git a/src/presets/node.ts b/src/presets/node.ts index 3d4df0a..9431c57 100644 --- a/src/presets/node.ts +++ b/src/presets/node.ts @@ -1,30 +1,30 @@ +import fs from 'node:fs' + import { Memory, MemorySync } from '../adapters/Memory.js' import { JSONFile, JSONFileSync } from '../adapters/node/JSONFile.js' import { Low, LowSync } from '../core/Low.js' export async function JSONPreset( - filename: string | URL, + filename: fs.PathLike, defaultData: Data, - dir?: string | URL, ): Promise> { const adapter = process.env.NODE_ENV === 'test' ? new Memory() - : new JSONFile(new URL(filename, dir)) + : new JSONFile(filename) const db = new Low(adapter, defaultData) await db.read() return db } export function JSONSyncPreset( - filename: string | URL, + filename: fs.PathLike, defaultData: Data, - dir?: string | URL, ): LowSync { const adapter = process.env.NODE_ENV === 'test' ? new MemorySync() - : new JSONFileSync(new URL(filename, dir)) + : new JSONFileSync(filename) const db = new LowSync(adapter, defaultData) db.read() return db