@soga/lowdb 1.0.1 → 1.3.6
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.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +11 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as lowdb_lib_core_Low from 'lowdb/lib/core/Low';
|
|
2
2
|
|
|
3
|
-
declare function getDb<T = any>(filepath: string, defaultData?: T): Promise<
|
|
3
|
+
declare function getDb<T = any>(filepath: string, defaultData?: T): Promise<lowdb_lib_core_Low.Low<T>>;
|
|
4
4
|
type LowType<T = any> = Awaited<ReturnType<typeof getDb<T>>>;
|
|
5
5
|
|
|
6
6
|
export { type LowType, getDb };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as lowdb_lib_core_Low from 'lowdb/lib/core/Low';
|
|
2
2
|
|
|
3
|
-
declare function getDb<T = any>(filepath: string, defaultData?: T): Promise<
|
|
3
|
+
declare function getDb<T = any>(filepath: string, defaultData?: T): Promise<lowdb_lib_core_Low.Low<T>>;
|
|
4
4
|
type LowType<T = any> = Awaited<ReturnType<typeof getDb<T>>>;
|
|
5
5
|
|
|
6
6
|
export { type LowType, getDb };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e,s=Object.defineProperty,t=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i={};((e,t)=>{for(var a in t)s(e,a,{get:t[a],enumerable:!0})})(i,{getDb:()=>m}),module.exports=(e=i,((e,i,c,n)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let l of a(i))r.call(e,l)||l===c||s(e,l,{get:()=>i[l],enumerable:!(n=t(i,l))||n.enumerable});return e})(s({},"__esModule",{value:!0}),e));var c=require("fs-extra"),n=require("path"),l=require("lowdb/node"),o=class extends Error{rewritable;message;stack;details;cause;constructor(e){super(e.message),this.rewritable=e.rewritable||!1,this.message=e.message||"",this.details=e.detail?[e.detail]:this.message?[this.message]:[],this.stack=e.stack,this.name="DError",this.cause=e.cause}toJson(){return{name:this.name,message:this.message,stack:this.stack,details:this.details,cause:this.cause}}toString(){const e=this.toJson();return JSON.stringify(e,null,2)}},u=(e,s={})=>{if(e instanceof o){if(!e.rewritable)return e;s.message&&(e.message=s.message);const t=s.detail||s.message;return t&&(e.details=e.details?[t,...e.details]:[t]),s.stack&&(e.stack=`${s.stack}\n${e.stack}`),s.cause?e.cause=s.cause:e.cause&&(e.cause=e.cause),e}{const t=new o({message:e.message,stack:e.stack});s.message&&(t.message=s.message);const a=s.detail||s.message;return a&&(t.details=t.details?[a,...t.details]:[a]),s.stack&&(t.stack=`${s.stack}\n${t.stack}`),s.cause?t.cause=s.cause:e.cause&&(t.cause=e.cause),void 0!==s.rewritable&&(t.rewritable=s.rewritable),t}};async function m(e,s={}){try{const t=(0,n.dirname)(e);await(0,c.ensureDir)(t);return await(0,l.JSONFilePreset)(e,s)}catch(s){throw u(s,{rewritable:!0,message:"Failed to use lowdb",detail:`Failed to use lowdb: ${e}`})}}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ensureDir as
|
|
1
|
+
import{ensureDir as s}from"fs-extra";import{dirname as e}from"path";import{JSONFilePreset as a}from"lowdb/node";var t=class extends Error{rewritable;message;stack;details;cause;constructor(s){super(s.message),this.rewritable=s.rewritable||!1,this.message=s.message||"",this.details=s.detail?[s.detail]:this.message?[this.message]:[],this.stack=s.stack,this.name="DError",this.cause=s.cause}toJson(){return{name:this.name,message:this.message,stack:this.stack,details:this.details,cause:this.cause}}toString(){const s=this.toJson();return JSON.stringify(s,null,2)}};async function i(i,r={}){try{const t=e(i);await s(t);return await a(i,r)}catch(s){throw((s,e={})=>{if(s instanceof t){if(!s.rewritable)return s;e.message&&(s.message=e.message);const a=e.detail||e.message;return a&&(s.details=s.details?[a,...s.details]:[a]),e.stack&&(s.stack=`${e.stack}\n${s.stack}`),e.cause?s.cause=e.cause:s.cause&&(s.cause=s.cause),s}{const a=new t({message:s.message,stack:s.stack});e.message&&(a.message=e.message);const i=e.detail||e.message;return i&&(a.details=a.details?[i,...a.details]:[i]),e.stack&&(a.stack=`${e.stack}\n${a.stack}`),e.cause?a.cause=e.cause:s.cause&&(a.cause=s.cause),void 0!==e.rewritable&&(a.rewritable=e.rewritable),a}})(s,{rewritable:!0,message:"Failed to use lowdb",detail:`Failed to use lowdb: ${i}`})}}export{i as getDb};
|
package/package.json
CHANGED
|
@@ -3,15 +3,10 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.3.6",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"module": "./dist/index.mjs",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"demo": "tsx ./demo/demo.ts",
|
|
12
|
-
"build": "rimraf dist && tsup src/index.ts --format cjs,esm --dts --minify terser",
|
|
13
|
-
"prepublishOnly": "npm run build"
|
|
14
|
-
},
|
|
15
10
|
"files": [
|
|
16
11
|
"dist"
|
|
17
12
|
],
|
|
@@ -20,15 +15,20 @@
|
|
|
20
15
|
"license": "ISC",
|
|
21
16
|
"description": "",
|
|
22
17
|
"dependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
18
|
+
"fs-extra": "^11.3.2",
|
|
19
|
+
"lowdb": "^7.0.1",
|
|
20
|
+
"@soga/error": "^1.3.6"
|
|
26
21
|
},
|
|
27
22
|
"devDependencies": {
|
|
28
23
|
"@types/fs-extra": "^11.0.4",
|
|
29
24
|
"rimraf": "^6.0.1",
|
|
30
25
|
"terser": "^5.43.1",
|
|
31
26
|
"tsup": "^8.5.0",
|
|
32
|
-
"tsx": "^4.20.
|
|
27
|
+
"tsx": "^4.20.6",
|
|
28
|
+
"@soga/typescript-config": "^1.3.6"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"demo": "tsx ./demo/demo.ts",
|
|
32
|
+
"build": "rimraf dist && tsup src/index.ts --format cjs,esm --dts --minify terser"
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
}
|