|
3 | 3 | All notable changes to this project will be documented in this file. |
4 | 4 | This project adheres to [Semantic Versioning](http://semver.org/). |
5 | 5 |
|
| 6 | +## [4.0.0] / 16 January 2020 |
| 7 | + |
| 8 | +Majority of using projects don't have to worry by this being a new major version. |
| 9 | + |
| 10 | +**TLDR;** if your project manipulates `Writer.prototype.parse | Writer.cache` directly or uses `.to_html()`, you probably have to change that code. |
| 11 | + |
| 12 | +This release allows the internal template cache to be customised, either by disabling it completely |
| 13 | +or provide a custom strategy deciding how the cache should behave when mustache.js parses templates. |
| 14 | + |
| 15 | +```js |
| 16 | +const mustache = require('mustache'); |
| 17 | + |
| 18 | +// disable caching |
| 19 | +Mustache.templateCache = undefined; |
| 20 | + |
| 21 | +// or use a built-in Map in modern environments |
| 22 | +Mustache.templateCache = new Map(); |
| 23 | +``` |
| 24 | + |
| 25 | +Projects that wanted to customise the caching behaviour in earlier versions of mustache.js were forced to |
| 26 | +override internal method responsible for parsing templates; `Writer.prototype.parse`. In short, that was unfortunate |
| 27 | +because there is more than caching happening in that method. |
| 28 | + |
| 29 | +We've improved that now by introducing a first class API that only affects template caching. |
| 30 | + |
| 31 | +The default template cache behaves as before and is still compatible with older JavaScript environments. |
| 32 | +For those who wants to provide a custom more sopisiticated caching strategy, one can do that with an object that adheres to the following requirements: |
| 33 | + |
| 34 | +```ts |
| 35 | +{ |
| 36 | + set(cacheKey: string, value: string): void |
| 37 | + get(cacheKey: string): string | undefined |
| 38 | + clear(): void |
| 39 | +} |
| 40 | +``` |
| 41 | + |
| 42 | +### Added |
| 43 | + |
| 44 | +* [#731]: Allow template caching to be customised, by [@AndrewLeedham]. |
| 45 | + |
| 46 | +### Removed |
| 47 | + |
| 48 | +* [#735]: Remove `.to_html()`, by [@phillipj]. |
| 49 | + |
6 | 50 | ## [3.2.1] / 30 December 2019 |
7 | 51 |
|
8 | 52 | ### Fixed |
@@ -417,6 +461,7 @@ This release is made to revert changes introduced in [2.3.1] that caused unexpec |
417 | 461 | * Fixed a bug that clashed with QUnit (thanks [@kannix]). |
418 | 462 | * Added volo support (thanks [@guybedford]). |
419 | 463 |
|
| 464 | +[4.0.0]: https://github.com/janl/mustache.js/compare/v3.2.1...v4.0.0 |
420 | 465 | [3.2.1]: https://github.com/janl/mustache.js/compare/v3.2.0...v3.2.1 |
421 | 466 | [3.2.0]: https://github.com/janl/mustache.js/compare/v3.1.0...v3.2.0 |
422 | 467 | [3.1.0]: https://github.com/janl/mustache.js/compare/v3.0.3...v3.1.0 |
@@ -488,10 +533,13 @@ This release is made to revert changes introduced in [2.3.1] that caused unexpec |
488 | 533 | [#717]: https://github.com/janl/mustache.js/issues/717 |
489 | 534 | [#728]: https://github.com/janl/mustache.js/issues/728 |
490 | 535 | [#733]: https://github.com/janl/mustache.js/issues/733 |
| 536 | +[#731]: https://github.com/janl/mustache.js/issues/731 |
| 537 | +[#735]: https://github.com/janl/mustache.js/issues/735 |
491 | 538 |
|
492 | 539 | [@afc163]: https://github.com/afc163 |
493 | 540 | [@andersk]: https://github.com/andersk |
494 | 541 | [@Andersos]: https://github.com/Andersos |
| 542 | +[@AndrewLeedham]: https://github.com/AndrewLeedham |
495 | 543 | [@bbrooks]: https://github.com/bbrooks |
496 | 544 | [@calvinf]: https://github.com/calvinf |
497 | 545 | [@cmbuckley]: https://github.com/cmbuckley |
|
0 commit comments