Guilherme Carreiro and GitHub
32b50ecafe
Bump Liquid to 5.11.0 ( #2012 )
...
This commit reverts the Inline Snippets tag (#2001 ) and bumps
Liquid to 5.11. For now, the inclusion of Inline Snippets
in the latest Liquid release is being treated as a bug.
While #2001 does implement the scope contained in RFC#1916,
we need to take a step back to make sure we’re setting our
sights high enough with this feature, and that we’re truly
supporting theme developers in the ways they need.
If you have any feedback, please leave a comment on RFC#1916.
- Liquid Developer Tools
v5.11.0
2025-11-19 18:03:23 +01:00
Gray Gilmore and GitHub
cbd8a0a2ee
Merge pull request #2007 from Shopify/gg-change-key-behavior
...
Don't raise if no variable found when `using context.key?` with `strict_variables`
2025-11-04 13:01:20 -08:00
Gray Gilmore
9973f3399e
Don't raise if no variable found when using context.key?
...
Previously if you set `strict_variables` to `true` on the context using
`key?('key_name')` would raise a `Liquid::UndefinedVariable` error.
Raising this error makes sense if you're trying to access the variable
directly with something like `context['key_name']` but by using `key?`
you're safely checking if it exists first.
You should be able to enable `strict_variables` and use `key?` in
combination with each other to ensure code safety.
2025-10-30 15:33:07 -07:00
Guilherme Carreiro and Guilherme Carreiro
248f3a412f
Bump to 5.10.0
v5.10.0
2025-10-30 12:28:52 +01:00
Guilherme Carreiro and Guilherme Carreiro
a16ec56a40
Update error handling for keeping backward-compatibility on error messages in the render tag
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
12fd93fbe2
Missing inline snippets should display same error as filebased
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
5ceb0e9cec
Raise error on invalid snippet name
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
98fbd985d8
Remove unneeded read method
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
ae05ba071c
Add liquid_public_docs yard tag to snippet tag
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
4205131148
Extract snippet resource scoring logic into assign_score_of
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
db350c54ff
Allow render tag to recognize drops that respond to to_partial
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
0cc6cdd553
Remove ... syntax references
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
40e45e32ac
Raise syntax error on incorrect render identifier type
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
d4d2237b90
Support prop spreading
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
0ceeefba02
Implement resource limits and remove leftover string references
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
65fb80a347
Render arguments should maintain correct precedence
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
489a03118c
Remove inline snippet specific example files
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
99116638fd
Support with, for, and as inline snippet syntax
...
This commit updates the render method to share parts
of the snippet and block rendering logic to enable
inline snippets to support `with`, `for`, and `as`
syntax
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
9bcfd32e65
Support ... inline snippet syntax
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
c7ad1c90ca
Change inline snippet identifier from string to variable
...
Currently, snippet files identified by strings. This
PR makes changes to render to allow for new inline
snippets to use variables as identifiers instead
2025-10-30 12:00:44 +01:00
Julia Boutin and Guilherme Carreiro
12bbbc4537
Create SnippetDrop and set in scope
2025-10-30 12:00:44 +01:00
1eca707c4a
Update inline snippets syntax
...
Previously, inline snippets syntax looked a bit
different, they:
- used strings as tag identifiers
- defined tag arguments {% snippet "input" |type| %}
This PR updates snippets to better reflect
the currently proposed syntax
Co-authored-by: Orlando Qiu <[email protected] >
2025-10-30 12:00:44 +01:00
Josh Faigan and Guilherme Carreiro
ed9c4e31c4
Introduce new inline snippets tag
...
Inline snippets will reduce code duplication and
improve the developer experience, eliminating the
need for one-off snippet files
2025-10-30 12:00:44 +01:00
Guilherme Carreiro and Guilherme Carreiro
c357f91e0c
Bump to 5.9.0
v5.9.0
2025-10-27 17:25:36 +01:00
Guilherme Carreiro and Guilherme Carreiro
1f58216f48
Add unit test mixing positional and kwargs arguments
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Gray Gilmore
d38795168b
Update test/integration/tags/table_row_test.rb
...
Co-authored-by: Gray Gilmore <[email protected] >
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Gray Gilmore
51f312b220
Update README.md
...
Co-authored-by: Gray Gilmore <[email protected] >
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
44f0429c08
Extract /\w+:0x\h{8}/ regex to UNNAMED_CYCLE_PATTERN constant
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
e57b7efe4e
Simplify render/include tags following PR review feedback
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
15430c0770
Add rigid mode to rake benchmark task
...
The benchmark results show that rigid mode performs a bit better than both strict
and lax modes across most metrics, including tokenization, parsing, rendering,
and their combined operations. Rigid mode consistently delivers the highest
number of iterations per second, with performance differences staying within
1–2% compared to the other modes
```
================================================================================
/opt/rubies/3.4.1/bin/ruby ./performance/benchmark.rb lax
Running benchmark for 20 seconds (with 10 seconds warmup).
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
tokenize: 332.000 i/100ms
parse: 14.000 i/100ms
render: 61.000 i/100ms
parse & render: 11.000 i/100ms
Calculating -------------------------------------
tokenize: 3.325k (± 1.0%) i/s (300.73 μs/i) - 66.732k in 20.070562s
parse: 148.166 (± 0.7%) i/s (6.75 ms/i) - 2.968k in 20.032971s
render: 654.428 (± 4.0%) i/s (1.53 ms/i) - 13.115k in 20.090452s
parse & render: 116.108 (± 1.7%) i/s (8.61 ms/i) - 2.332k in 20.089221s
================================================================================
/opt/rubies/3.4.1/bin/ruby ./performance/benchmark.rb strict
Running benchmark for 20 seconds (with 10 seconds warmup).
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
tokenize: 332.000 i/100ms
parse: 14.000 i/100ms
render: 61.000 i/100ms
parse & render: 11.000 i/100ms
Calculating -------------------------------------
tokenize: 3.332k (± 0.2%) i/s (300.14 μs/i) - 66.732k in 20.029095s
parse: 145.674 (± 0.0%) i/s (6.86 ms/i) - 2.926k in 20.086104s
render: 656.711 (± 4.6%) i/s (1.52 ms/i) - 13.115k in 20.050810s
parse & render: 114.705 (± 0.0%) i/s (8.72 ms/i) - 2.299k in 20.043028s
================================================================================
/opt/rubies/3.4.1/bin/ruby ./performance/benchmark.rb rigid
Running benchmark for 20 seconds (with 10 seconds warmup).
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
tokenize: 333.000 i/100ms
parse: 14.000 i/100ms
render: 62.000 i/100ms
parse & render: 11.000 i/100ms
Calculating -------------------------------------
tokenize: 3.334k (± 0.3%) i/s (299.93 μs/i) - 66.933k in 20.075484s
parse: 148.349 (± 2.0%) i/s (6.74 ms/i) - 2.968k in 20.019775s
render: 663.752 (± 2.6%) i/s (1.51 ms/i) - 13.268k in 20.010303s
parse & render: 116.464 (± 2.6%) i/s (8.59 ms/i) - 2.332k in 20.037869s
liquid$
```
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
6aa4041c0f
Rename with_error_mode(...) to with_error_modes(...)
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Alok Swamy
d63dd104de
Update test/integration/tags/render_tag_test.rb
...
Co-authored-by: Alok Swamy <[email protected] >
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Alok Swamy
1733586242
Update test/unit/tags/case_tag_unit_test.rb
...
Co-authored-by: Alok Swamy <[email protected] >
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Alok Swamy
5a210fc8f6
Update Rakefile
...
Co-authored-by: Alok Swamy <[email protected] >
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
8d7bb9b6f8
Update History.md (5.8.8 -> 5.9.0)
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
4f35764d44
Update History.md
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
018442b7d1
Covered changes with more tests, remove redundant cases, and the new with_error_mode(*modes)
...
Most of changes update this:
```
[:lax, :strict].each do |mode|
with_error_mode(mode) do
assert_template_result(...
```
to be this:
```
with_error_mode(:lax, :strict) do
assert_template_result(...
```
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
a23c71e40b
Fix variable to keep it backward-compatible in strict mode
...
* lax_parse - no changes
* strict_parse - uses the `lax_parse_filter_expressions` (as it was doing before)
* rigid_parse - uses the `rigid_parse_filter_expressions`
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
738540a601
Update infrastructure that handles parsing switching:
...
* Remove development helpers from parse context
* Simplify strict_parse_with_error_mode_fallback and update
documentation
* Add unit tests for `Liquid::Expression` and `Liquid::ParseContext`
* Update test helpers to work better with the `:rigid` mode
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
4cd367d971
* Update bin/render script to present an error when no template is passed
...
* Remove `bin/example.liquid` as it's not executable
2025-10-27 16:33:31 +01:00
Charles-P. Clermont and Guilherme Carreiro
34ab3bdc8e
Fix assert_template_result tests not picking up Liquid::Environment.default.error_mode
...
The `rake test` command gave us the impression that we were running all the tests
on all the error modes, that was false.
2025-10-27 16:33:31 +01:00
Charles-P. Clermont and Guilherme Carreiro
1be1e36a8d
Fixup cycle rigid parsing to be backwards compatible
2025-10-27 16:33:31 +01:00
Charles-P. Clermont and Guilherme Carreiro
902ff978a6
Fixup include parsing of with expression
2025-10-27 16:33:31 +01:00
Charles-P. Clermont and Guilherme Carreiro
2ba81b3f1a
Fix alias parsing
2025-10-27 16:33:31 +01:00
Charles-P. Clermont and Guilherme Carreiro
5660ce6945
render end of string is not optional
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
5ec3008b37
Add rigid parser to tablerow tag
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
5248025439
Remove redundant tests where rigid and strict modes have the same
...
behavior
2025-10-27 16:33:31 +01:00
Guilherme Carreiro and Guilherme Carreiro
0bc69b86b7
No longer test ParseContext directly on RigidModeUnitTest as
...
now the `safe: true` calls are considered safe
Test the entire template instead
2025-10-27 16:33:31 +01:00
Charles-P. Clermont and Guilherme Carreiro
b5fbad08c6
rigid set_attribute in for parsing
2025-10-27 16:33:31 +01:00
Charles-P. Clermont and Guilherme Carreiro
b8958f626d
Stricter 1:1 refactor of strict_parse for Variable
2025-10-27 16:33:31 +01:00