fix: Windows compat for contains/containsSync and toLiquidAsync arg order

Made-with: Cursor
This commit is contained in:
Yang Jun
2026-04-06 14:30:41 +08:00
parent b181b08543
commit 3538864119
8 changed files with 25 additions and 20 deletions
+1 -1
View File
@@ -12,6 +12,6 @@ All core logic is written once as a `Generator` function (`function *`). Use `yi
Never duplicate logic into separate async and sync methods. A single generator serves both paths.
When wrapping an async+sync function pair (e.g. `contains`/`containsSync`, `exists`/`existsSync`, `readFile`/`readFileSync`), use `toLiquidAsync(syncFn, asyncFn?)` which returns a `LiquidAsync<F>` — one function that picks the sync or async implementation based on a leading `sync: boolean` arg. Then `yield` the result inside a generator to let the driver handle it in both modes.
When wrapping an async+sync function pair (e.g. `contains`/`containsSync`, `exists`/`existsSync`, `readFile`/`readFileSync`), use `toLiquidAsync(asyncFn, syncFn?)` which returns a `LiquidAsync<F>` — one function that picks the sync or async implementation based on a leading `sync: boolean` arg. Then `yield` the result inside a generator to let the driver handle it in both modes.
See `src/util/async.ts`.