@samitouri / QOSami-HFS / commits / 17fc2495

removed dependency 'immer'

Massimo Melina committed Apr 1, 2026 at 12:02 UTC 17fc2495dbe3a560c1e235d58a7405debc97a69d
2 files changed +4 -6
package.json
-1
@@ -92,7 +92,6 @@
92 "fs-x-attributes": "^1.0.2",
93 "fswin": "^3.24.829",
94 "iconv-lite": "^0.7.0",
95 - "immer": "^10.1.3",
95 "ip2location-nodejs": "^9.7.0",
96 "koa": "^3.1.2",
97 "koa-compress": "^5.2.0",
src/config.ts
+4 -5
@@ -10,12 +10,9 @@ import { statSync } from 'fs'
10 import { basename, join, resolve } from 'path'
11 import events from './events'
12 import { copyFile } from 'fs/promises'
13 -import { produce, setAutoFreeze } from 'immer'
13 import { argv } from './argv'
14 import { statWithTimeout } from './util-files'
15
17 -setAutoFreeze(false) // we still want to mess with objects later (eg: account.belongs)
18 -
16 // keep definition of config properties
17 const configProps: Record<string, { defaultValue?: unknown }> = {}
18
@@ -80,8 +77,10 @@ export function defineConfig<T, CT=unknown>(k: string, defaultValue: T, compiler
77 }, { warnAfter: 1000 }) // e.g. each plugin watch enable_plugins
78 },
79 set(v: T | Updater) {
83 - if (typeof v === 'function')
84 - this.set(produce(this.get(), v as Updater))
80 + if (typeof v === 'function') {
81 + const draft = structuredClone(this.get())
82 + this.set((v as Updater)(draft) ?? draft) // use return value if provided
83 + }
84 else
85 setConfig1(k, v)
86 },