Skip to content

Commit f59f65d

Browse files
committed
progress
1 parent dc7b426 commit f59f65d

1 file changed

Lines changed: 61 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,72 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
55

6-
## [1.0.0] AST Compiler - 2026-03-16
6+
## [1.0.0] AST Compiler - 2026-03-20
7+
8+
9+
### Added
10+
- Support for nested inline partials.
11+
- Lambda support for data variables and helper arguments.
12+
- `helperMissing` and `blockHelperMissing` hooks: handle calls to unknown helpers with the same API as in Handlebars.js, replacing the old `helperResolver` option.
13+
- `assumeObjects` compile option.
14+
- `knownHelpers` compile option (optimizes known helper execution, and allows disabling individual built-in helpers).
15+
- Support for deprecated `{{person/firstname}}` path expressions (please don't use in new code, though).
16+
17+
### Changed
18+
- Replaced `helperResolver` option with `helperMissing` and `blockHelperMissing` hooks (the same API as in Handlebars.js).
19+
- Exceptions thrown by custom helpers are no longer caught and re-thrown, so the original exception can now be caught in your own code for easier debugging (https://github.com/devtheorem/php-handlebars/issues/13).
20+
- Updated various error messages to align with those output by Handlebars.js.
21+
22+
### Removed
23+
- `helpers` compile option. All helpers must now be passed at runtime when executing the template (just like in Handlebars.js). This can significantly reduce compile time, since PHP files no longer have to be read and tokenized to extract helper functions. It also enables sharing helper closures across multiple templates, and removes limitations on what they can access and do.
24+
- Internal `Context` argument that was previously passed to the `partialResolver` closure. Now only the partial name is passed.
25+
26+
### Fixed
27+
- Fatal error with deeply nested `else if` using custom helper (https://github.com/devtheorem/php-handlebars/issues/2).
28+
- Incorrect rendering of float values (https://github.com/devtheorem/php-handlebars/issues/11).
29+
- Support for `@partial-block` in conditions.
30+
- Support for `@partial-block` in nested partials (https://github.com/zordius/lightncandy/issues/292).
31+
- Ability to precompile partials and pass them at runtime (https://github.com/zordius/lightncandy/issues/341).
32+
- Fatal error when a string parameter to a partial includes curly braces (https://github.com/zordius/lightncandy/issues/316).
33+
- Behavior when modifying root context in a custom helper (https://github.com/zordius/lightncandy/issues/350).
34+
- Escaping of block params and partial names.
35+
- Numerous other bugs related to scoping, depth-relative paths, block params, inverted block helpers, and section iteration.
36+
37+
38+
Double-check every LightnCandy and PHP Handlebars issue where I left a comment, to see if any need to be updated following the helpers changes.
39+
40+
41+
Comment with fixed after release:
42+
- https://github.com/zordius/lightncandy/issues/350
43+
- https://github.com/zordius/lightncandy/issues/292
44+
- https://github.com/zordius/lightncandy/issues/341
45+
46+
47+
[Valid use for Lightncandy::prepare()](https://github.com/zordius/lightncandy/issues/346)
48+
- Comment that PHP Handlebars supports compile() method just like Handlebars.js
49+
50+
51+
[SafeString fails with FLAG\_EXTHELPER | FLAG\_BESTPERFORMANCE](https://github.com/zordius/lightncandy/issues/354)
52+
- Comment suggesting to try PHP Handlebars, which can often outperform LightnCandy without needing any special flags.
53+
54+
55+
https://github.com/zordius/lightncandy/issues/342
56+
https://github.com/zordius/lightncandy/issues/228
57+
58+
59+
[Unable to resolve partial when using sub expression and partial resolver](https://github.com/devtheorem/php-handlebars/issues/5)
60+
- Maybe comment with approach using helper rather than partial?
61+
62+
63+
Old: to review
764

865
### Added
9-
- Rewrote the parser and compiler using a proper AST, based on the same lexical analysis and grammar specification used by Handlebars.js. This eliminates a large class of edge cases and parsing bugs that the old regex-based approach failed to handle correctly.
10-
- `helperMissing` and `blockHelperMissing` hooks: register these as runtime helpers to handle calls to unknown helpers, replacing the old `helperResolver` option.
66+
- Rewrote the parser and compiler to use an AST, with the same lexical analysis and grammar specification as Handlebars.js. This eliminates a large class of edge cases and parsing bugs that the old regex-based approach failed to handle correctly.
67+
1168
- `assumeObjects` compile option: intermediate path segments are required to exist, but terminal segments may be absent. Produces leaner compiled output than full strict mode.
1269
- `knownHelpers` compile option: tells the compiler which helpers will be registered at runtime, enabling more efficient code generation. `knownHelpersOnly` now works as in Handlebars.js — unknown helpers are dropped entirely rather than emitting a dynamic fallback.
13-
- Precompiled partial support: the `partials` runtime option now accepts `Closure` values in addition to template strings, so partials can be pre-compiled once and reused across renders.
70+
- Precompiled partial support: the `partials` runtime option now accepts `Closure` values (created via `Handlebars::compile()`), so partials can be pre-compiled once and reused across renders.
1471
- Lambda support for data variables: when a value in the render context is a `Closure`, it is now invoked with the current scope and its return value used, matching Handlebars.js lambda semantics.
15-
- Scoped path syntax (`{{./value}}`, `{{this/value}}`) now correctly bypasses block params and helper lookup, resolving directly from the current context.
16-
- Block statements with pathed or depth-relative paths and explicit params (e.g. `{{#../helper param}}`) are now compiled correctly.
1772

1873
### Changed
1974
- All helpers must now be passed at render time via the `helpers` key in the options array. The `helpers` compile option on `Options` has been removed. This matches Handlebars.js behavior, allows helper closures to be shared across templates, and eliminates the overhead of reading and tokenizing PHP helper files at compile time.

0 commit comments

Comments
 (0)