|
1 | 1 | # History |
2 | | -## 3.0.0 / 2025-11-10 |
| 2 | + |
| 3 | +## 3.0.0-alpha.1 / 2025-11-13 |
| 4 | +Alpha pre-release of the 3.x line. Summary of key changes since 2.x: |
| 5 | + |
| 6 | +- API redesign (engine + context) |
| 7 | + - New PugEngine for template loading and caching |
| 8 | + - New RenderContext for render-time options (prettyPrint, defaultMode, globals) |
| 9 | + - Pug4J static facade now delegates to PugEngine/RenderContext |
| 10 | + |
| 11 | +- Important features |
| 12 | + - Java Records support as first-class model objects (via RecordWrapper) |
| 13 | + |
| 14 | +- Deprecations (removal planned in 4.0.0) |
| 15 | + - PugConfiguration deprecated in favor of PugEngine + RenderContext |
| 16 | + - Several Pug4J overloads (template/URL/Reader/getTemplate) deprecated |
| 17 | + - PugTemplate.process(...) restored for compatibility and marked deprecated |
| 18 | + |
| 19 | +- Configuration additions |
| 20 | + - Cache tuning options on PugConfiguration (max size, expression cache size, rebuild) |
| 21 | + |
| 22 | +- Internal and quality improvements |
| 23 | + - Compiler streamlined around a visitor pattern with clearer errors |
| 24 | + - Better thread-safety and centralized render context handling |
| 25 | + |
| 26 | +- Build/runtime |
| 27 | + - Baseline: Java 17 (bytecode 17) |
| 28 | + - Dependency refresh: GraalVM JS 25.0.0, SLF4J 2.0.17, JEXL 3.5.0, Caffeine 3.2.x |
| 29 | + |
3 | 30 | **Breaking Changes:** |
4 | 31 | * **Java 17+ required**: Minimum Java version raised from Java 8 to Java 17 |
5 | 32 | * **Major dependency updates**: |
6 | | - * GraalVM updated to 25.0.0 (simplified dependencies using `polyglot` and `js-community`) |
7 | | - * Caffeine cache updated to 3.2.2 |
8 | | - * Flexmark updated to 0.64.8 |
| 33 | + * GraalVM updated to 25.0.0 (simplified dependencies using `polyglot` and `js-community`) |
| 34 | + * Caffeine cache updated to 3.2.2 |
| 35 | + * Flexmark updated to 0.64.8 |
9 | 36 | * **Major API redesign**: New immutable builder-based API |
10 | | - * **`PugConfiguration` deprecated**: Replaced by `PugEngine` and `RenderContext` |
11 | | - * **`PugEngine`**: Immutable template factory with builder pattern for configuration |
12 | | - * **`RenderContext`**: Immutable render-time settings (prettyPrint, defaultMode, globalVariables) |
13 | | - * Templates no longer self-render - use `engine.render(template, model, context)` instead |
14 | | - * Simple API (`Pug4J`) cleaned up: `getTemplate()` methods deprecated (not part of simple API) |
15 | | - * Deprecated template-based render methods in `Pug4J` class |
| 37 | + * **`PugConfiguration` deprecated**: Replaced by `PugEngine` and `RenderContext` |
| 38 | + * **`PugEngine`**: Immutable template factory with builder pattern for configuration |
| 39 | + * **`RenderContext`**: Immutable render-time settings (prettyPrint, defaultMode, globalVariables) |
| 40 | + * Templates no longer self-render - use `engine.render(template, model, context)` instead |
| 41 | + * Simple API (`Pug4J`) cleaned up: `getTemplate()` methods deprecated (not part of simple API) |
| 42 | + * Deprecated template-based render methods in `Pug4J` class |
16 | 43 |
|
17 | 44 | **New Features:** |
18 | 45 | * **Java Records Support**: Records are now fully supported as model objects |
19 | | - * Records are automatically wrapped when added to the model (via `RecordWrapper`) |
20 | | - * Component access using property syntax (e.g., `person.name` in templates) |
21 | | - * Nested records fully supported (e.g., `person.address.city`) |
22 | | - * Custom methods on records can be called using function syntax |
23 | | - * Works with both JEXL (default) and GraalJS expression handlers |
24 | | - * Immutable by design, matching record semantics |
| 46 | + * Records are automatically wrapped when added to the model (via `RecordWrapper`) |
| 47 | + * Component access using property syntax (e.g., `person.name` in templates) |
| 48 | + * Nested records fully supported (e.g., `person.address.city`) |
| 49 | + * Custom methods on records can be called using function syntax |
| 50 | + * Works with both JEXL (default) and GraalJS expression handlers |
| 51 | + * Immutable by design, matching record semantics |
25 | 52 | * **New convenience methods**: `PugEngine.forPath(path)` for quick engine setup |
26 | 53 | * **Configurable expression cache**: Separate control over template and expression caching |
27 | 54 |
|
28 | | -**Improvements:** |
29 | | -* Enhanced error handling in `RecordWrapper` with proper logging for reflection errors |
30 | | -* Improved GraalVM integration with better proxy object handling for records |
31 | | -* Custom `RecordWrapperUberspect` for JEXL to enable method calls on wrapped records |
32 | | -* Added comprehensive test coverage for record support (both JEXL and GraalJS) |
33 | | -* Better separation of concerns: template loading, caching, and rendering are now clearly separated |
34 | | -* Thread-safe builder pattern for engine and context configuration |
35 | | - |
36 | | -**Bug Fixes:** |
37 | | -* Fixed GraalJS Map handling issue that prevented ProxyObject methods from being called |
38 | | -* Improved method resolution to avoid conflicts between property access and method calls |
39 | | - |
40 | | -**Migration Guide:** |
41 | | -```java |
42 | | -// Old API (2.x) |
43 | | -PugConfiguration config = new PugConfiguration(); |
44 | | -config.setTemplateLoader(loader); |
45 | | -config.setPrettyPrint(true); |
46 | | -config.setMode(Mode.HTML); |
47 | | -PugTemplate template = config.getTemplate("index"); |
48 | | -String html = config.renderTemplate(template, model); |
49 | | - |
50 | | -// New API (3.0+) |
51 | | -PugEngine engine = PugEngine.builder() |
52 | | - .templateLoader(loader) |
53 | | - .build(); |
54 | | - |
55 | | -RenderContext context = RenderContext.builder() |
56 | | - .prettyPrint(true) |
57 | | - .defaultMode(Mode.HTML) |
58 | | - .build(); |
59 | | - |
60 | | -PugTemplate template = engine.getTemplate("index"); |
61 | | -String html = engine.render(template, model, context); |
62 | | - |
63 | | -// Or use the simple API |
64 | | -String html = Pug4J.render("index.pug", model); |
65 | | -``` |
66 | | - |
67 | | -**Documentation:** |
68 | | -* Added comprehensive Java Records documentation to README.md with examples |
69 | | -* Updated CLAUDE.md to reflect new Java 17+ requirement |
70 | | -* Added Breaking Changes section for 3.0.0 |
71 | | -* Updated API documentation with new PugEngine and RenderContext examples |
72 | 55 |
|
73 | 56 | ## 2.4.1 / 2025-11-13 |
74 | 57 | * Remove ++ and -- conversion, because it is supported by jexl. |
|
0 commit comments