feat: await promises returned by Drop.valueOf() (#948) (#953) (#959)

* feat: WIP async Drop valueOf resolution (#948)

Incomplete/abandoned implementation of async Drop.valueOf() awaited across the render pipeline. Kept for reference only; known to be inconsistent and not production-ready.

Co-authored-by: Cursor <[email protected]>

* feat!: resolve async Drop.valueOf() for filters and tags

Co-authored-by: Cursor <[email protected]>

* fix: keep Drops on filter and tag inputs

Filters and tag arguments still receive the Drop. Await valueOf() at output, conditions, and operators, and restore the existing render/include Drop tests.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Yang Jun
2026-10-02 00:58:49 +08:00
committed by GitHub
co-authored by Cursor
parent e68514f066
commit 7dfa76b7b2
19 changed files with 359 additions and 77 deletions
+2 -2
View File
@@ -38,7 +38,7 @@ The following modified template also contains 3 values to random from, but they'
It can be tricky to parse all these cases manually, but there's a [Tokenizer][Tokenizer] class in LiquidJS you can make use of.
```javascript
const { Liquid, Tokenizer, evalToken } = require('liquidjs')
const { Liquid, Tokenizer, evalTokenValue } = require('liquidjs')
engine.registerTag('random', {
parse(tagToken) {
const tokenizer = new Tokenizer(tagToken.args)
@@ -52,7 +52,7 @@ engine.registerTag('random', {
const index = Math.floor(this.items.length * Math.random())
const token = this.items[index]
// in LiquidJS, we use yield to wait for async call
const value = yield evalToken(token, context)
const value = yield evalTokenValue(token, context)
emitter.write(value)
}
})