@wxn0brp/db-storage-dir 0.101.0 → 0.101.1

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/README.md CHANGED
@@ -8,6 +8,8 @@ This plugin provides directory-based operations for ValtheraDB.
8
8
  npm install @wxn0brp/db-storage-dir json5
9
9
  ```
10
10
 
11
+ > **Note:** `json5` is an optional dependency. When running with Bun, native JSON5 support is used automatically. Set `VALTHERA_DIR_DISABLE_BUN=1` to disable Bun's native JSON5 and use the `json5` package instead.
12
+
11
13
  ## Usage
12
14
 
13
15
  ```typescript
package/dist/format.js CHANGED
@@ -16,14 +16,21 @@ export const format = {
16
16
  return json5.stringify(data);
17
17
  },
18
18
  async init() {
19
- if (!json5)
20
- json5 = await import("json5");
19
+ if (json5)
20
+ return;
21
+ // @ts-ignore
22
+ if (typeof Bun !== "undefined" && Bun?.JSON5 && !process?.env?.VALTHERA_DIR_DISABLE_BUN)
23
+ json5 = Bun.JSON5;
24
+ else {
25
+ const imp = await import("json5");
26
+ json5 = imp.default;
27
+ }
21
28
  }
22
29
  },
23
30
  };
24
31
  export function extendJson(format) {
25
32
  if (format._extended)
26
- return;
33
+ return format;
27
34
  return {
28
35
  ...format,
29
36
  _extended: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-storage-dir",
3
- "version": "0.101.0",
3
+ "version": "0.101.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "wxn0brP",