Conversation
|
Hmm, I’m seeing some test suite failures here from some missing variables in Liquid.js |
zachleat
left a comment
There was a problem hiding this comment.
This is looking great but has a few small issues!
I think the big question I have is in the test suite tests—I would imagine these tests would need to be gated behind eleventyConfig.setLiquidParameterParsing("builtin"); similar to what shipped in #2679 (comment)
src/Engines/Liquid.js
Outdated
| let value = tokenizer.readHash() ?? tokenizer.readValue(); | ||
| // readHash() treats unmarked identifiers as hash keys with undefined | ||
| // values, but we want to parse them as positional arguments instead. | ||
| return value?.kind === 64 && value.value === undefined ? value.name : value; |
There was a problem hiding this comment.
I’m seeing some errors here, from LiquidJS’s types: value and name do not exist on type HashToken | ValueToken | RangeToken
There was a problem hiding this comment.
That's weird, I would expect Liquid to be typed so that the value.kind check type-infers value to be a HashToken. I've made that explicit.
nex3
left a comment
There was a problem hiding this comment.
The tests keep timing out locally, so I'm not 100% confident they're passing now. But I did fix all the known issues!
src/Engines/Liquid.js
Outdated
| let value = tokenizer.readHash() ?? tokenizer.readValue(); | ||
| // readHash() treats unmarked identifiers as hash keys with undefined | ||
| // values, but we want to parse them as positional arguments instead. | ||
| return value?.kind === 64 && value.value === undefined ? value.name : value; |
There was a problem hiding this comment.
That's weird, I would expect Liquid to be typed so that the value.kind check type-infers value to be a HashToken. I've made that explicit.
|
I'm clearly missing something about how to correctly set the parameter parsing... |
This is an adaptation of #1733 to use the built-in Liquid argument parser that was added in #2679. Keyword arguments are passed as an object after all the positional arguments.