You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CHANGELOG.md 19KB

12 years ago
12 years ago
13 years ago
13 years ago
13 years ago
13 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. # Change Log
  2. All notable changes to this project will be documented in this file.
  3. This project adheres to [Semantic Versioning](http://semver.org/).
  4. ## [3.2.0] / 18 December 2019
  5. ### Added
  6. * [#728]: Expose ECMAScript Module in addition to UMD (CommonJS, AMD & global scope), by [@phillipj] and [@zekth].
  7. ### Using mustache.js as an ES module
  8. To stay backwards compatible with already using projects, the default exposed module format is still UMD.
  9. That means projects using mustache.js as an CommonJS, AMD or global scope module, from npm or directly from github.com
  10. can keep on doing that for now.
  11. For those projects who would rather want to use mustache.js as an ES module, the `mustache/mustache.mjs` file has to
  12. be `import`ed directly.
  13. Below are some usage scenarios for different runtimes.
  14. #### Modern browser with ES module support
  15. ```html
  16. <!-- index.html -->
  17. <script type="module">
  18. import mustache from "https://unpkg.com/mustache@3.2.0/mustache.mjs"
  19. console.log(mustache.render('Hello {{name}}!', { name: 'Santa' }))
  20. // Hello Santa!
  21. </script>
  22. ```
  23. #### [Node.js](https://nodejs.org) (>= v13.2.0 or using --experimental-modules flag)
  24. ```js
  25. // index.mjs
  26. import mustache from 'mustache/mustache.mjs'
  27. console.log(mustache.render('Hello {{name}}!', { name: 'Santa' }))
  28. // Hello Santa!
  29. ```
  30. ES Module support for Node.js will be improved in the future when [Conditional Exports](https://nodejs.org/api/esm.html#esm_conditional_exports)
  31. is enabled by default rather than being behind an experimental flag.
  32. More info in [Node.js ECMAScript Modules docs](https://nodejs.org/api/esm.html).
  33. #### [Deno](https://deno.land/)
  34. ```js
  35. // index.ts
  36. import mustache from 'https://unpkg.com/mustache@3.2.0/mustache.mjs'
  37. console.log(mustache.render('Hello {{name}}!', { name: 'Santa' }))
  38. // Hello Santa!
  39. ```
  40. ## [3.1.0] / 13 September 2019
  41. ### Added
  42. * [#717]: Added support .js files as views in command line tool, by [@JEStaubach].
  43. ### Fixed
  44. * [#716]: Bugfix for indentation of inline partials, by [@yotammadem].
  45. ## [3.0.3] / 27 August 2019
  46. ### Added
  47. * [#713]: Add test cases for custom functions in partials, by [@wol-soft].
  48. ### Fixed
  49. * [#714]: Bugfix for wrong function output in partials with indentation, by [@phillipj].
  50. ## [3.0.2] / 21 August 2019
  51. ### Fixed
  52. * [#705]: Fix indentation of partials, by [@kevindew] and [@yotammadem].
  53. ### Dev
  54. * [#701]: Fix test failure for Node 10 and above, by [@andersk].
  55. * [#704]: Lint all test files just like the source files, by [@phillipj].
  56. * Start experimenting & comparing GitHub Actions vs Travis CI, by [@phillipj].
  57. ## [3.0.1] / 11 November 2018
  58. * [#679]: Fix partials not rendering tokens when using custom tags, by [@stackchain].
  59. ## [3.0.0] / 16 September 2018
  60. We are very happy to announce a new major version of mustache.js. We want to be very careful not to break projects
  61. out in the wild, and adhering to [Semantic Versioning](http://semver.org/) we have therefore cut this new major version.
  62. The changes introduced will likely not require any actions for most using projects. The things to look out for that
  63. might cause unexpected rendering results are described in the migration guide below.
  64. A big shout out and thanks to [@raymond-lam] for this release! Without his contributions with code and issue triaging,
  65. this release would never have happened.
  66. ### Major
  67. * [#618]: Allow rendering properties of primitive types that are not objects, by [@raymond-lam].
  68. * [#643]: `Writer.prototype.parse` to cache by tags in addition to template string, by [@raymond-lam].
  69. * [#664]: Fix `Writer.prototype.parse` cache, by [@seminaoki].
  70. ### Minor
  71. * [#673]: Add `tags` parameter to `Mustache.render()`, by [@raymond-lam].
  72. ### Migrating from mustache.js v2.x to v3.x
  73. #### Rendering properties of primitive types
  74. We have ensured properties of primitive types can be rendered at all times. That means `Array.length`, `String.length`
  75. and similar. A corner case where this could cause unexpected output follows:
  76. View:
  77. ```
  78. {
  79. stooges: [
  80. { name: "Moe" },
  81. { name: "Larry" },
  82. { name: "Curly" }
  83. ]
  84. }
  85. ```
  86. Template:
  87. ```
  88. {{#stooges}}
  89. {{name}}: {{name.length}} characters
  90. {{/stooges}}
  91. ```
  92. Output with v3.0:
  93. ```
  94. Moe: 3 characters
  95. Larry: 5 characters
  96. Curly: 5 characters
  97. ```
  98. Output with v2.x:
  99. ```
  100. Moe: characters
  101. Larry: characters
  102. Curly: characters
  103. ```
  104. #### Caching for templates with custom delimiters
  105. We have improved the templates cache to ensure custom delimiters are taken into consideration for the cache.
  106. This improvement might cause unexpected rendering behaviour for using projects actively using the custom delimiters functionality.
  107. Previously it was possible to use `Mustache.parse()` as a means to set global custom delimiters. If custom
  108. delimiters were provided as an argument, it would affect all following calls to `Mustache.render()`.
  109. Consider the following:
  110. ```js
  111. const template = "[[item.title]] [[item.value]]";
  112. mustache.parse(template, ["[[", "]]"]);
  113. console.log(
  114. mustache.render(template, {
  115. item: {
  116. title: "TEST",
  117. value: 1
  118. }
  119. })
  120. );
  121. >> TEST 1
  122. ```
  123. The above illustrates the fact that `Mustache.parse()` made mustache.js cache the template without considering
  124. the custom delimiters provided. This is no longer true.
  125. We no longer encourage using `Mustache.parse()` for this purpose, but have rather added a fourth argument to
  126. `Mustache.render()` letting you provide custom delimiters when rendering.
  127. If you still need the pre-parse the template and use custom delimiters at the same time, ensure to provide
  128. the custom delimiters as argument to `Mustache.render()` as well.
  129. ## [2.3.2] / 17 August 2018
  130. This release is made to revert changes introduced in [2.3.1] that caused unexpected behaviour for several users.
  131. ### Minor
  132. * [#670]: Rollback template cache causing unexpected behaviour, by [@raymond-lam].
  133. ## [2.3.1] / 7 August 2018
  134. ### Minor
  135. * [#643]: `Writer.prototype.parse` to cache by tags in addition to template string, by [@raymond-lam].
  136. * [#664]: Fix `Writer.prototype.parse` cache, by [@seminaoki].
  137. ### Dev
  138. * [#666]: Install release tools with npm rather than pre-commit hook & `Rakefile`, by [@phillipj].
  139. * [#667], [#668]: Stabilize browser test suite, by [@phillipj].
  140. ### Docs
  141. * [#644]: Document global Mustache.escape overriding capacity, by [@paultopia].
  142. * [#657]: Correct `Mustache.parse()` return type documentation, by [@bbrooks].
  143. ## [2.3.0] / 8 November 2016
  144. ### Minor
  145. * [#540]: Add optional `output` argument to mustache CLI, by [@wizawu].
  146. * [#597]: Add compatibility with amdclean, by [@mightyplow].
  147. ### Dev
  148. * [#553]: Assert `null` lookup when rendering an unescaped value, by [@dasilvacontin].
  149. * [#580], [#610]: Ignore eslint for greenkeeper updates, by [@phillipj].
  150. * [#560]: Fix CLI tests for Windows, by [@kookookchoozeus].
  151. * Run browser tests w/node v4, by [@phillipj].
  152. ### Docs
  153. * [#542]: Add API documentation to README, by [@tomekwi].
  154. * [#546]: Add missing syntax highlighting to README code blocks, by [@pra85].
  155. * [#569]: Update Ctemplate links in README, by [@mortonfox].
  156. * [#592]: Change "loadUser" to "loadUser()" in README, by [@Flaque].
  157. * [#593]: Adding doctype to HTML code example in README, by [@calvinf].
  158. ### Dependencies
  159. * eslint -> 2.2.0. Breaking changes fix by [@phillipj]. [#548]
  160. * eslint -> 2.5.1.
  161. * mocha -> 3.0.2.
  162. * zuul -> 3.11.0.
  163. ## [2.2.1] / 13 December 2015
  164. ### Fixes
  165. * Improve HTML escaping, by [@phillipj].
  166. * Fix inconsistency in defining global mustache object, by [@simast].
  167. * Fix switch-case indent error, by [@norfish].
  168. * Unpin chai and eslint versions, by [@dasilvacontin].
  169. * Update README.md with proper grammar, by [@EvanLovely].
  170. * Update mjackson username in README, by [@mjackson].
  171. * Remove syntax highlighting in README code sample, by [@imagentleman].
  172. * Fix typo in README, by [@Xcrucifier].
  173. * Fix link typo in README, by [@keirog].
  174. ## [2.2.0] / 15 October 2015
  175. ### Added
  176. * Add Partials support to CLI, by [@palkan].
  177. ### Changed
  178. * Move install instructions to README's top, by [@mateusortiz]
  179. * Improved devhook install output, by [@ShashankaNataraj].
  180. * Clarifies and improves language in documentation, by [@jfmercer].
  181. * Linting CLI tool, by [@phillipj].
  182. * npm 2.x and node v4 on Travis, by [@phillipj].
  183. ### Fixes
  184. * Fix README spelling error to "aforementioned", by [@djchie].
  185. * Equal error message test in .render() for server and browser, by [@phillipj].
  186. ### Dependencies
  187. * chai -> 3.3.0
  188. * eslint -> 1.6.0
  189. ## [2.1.3] / 23 July 2015
  190. ### Added
  191. * Throw error when providing .render() with invalid template type, by [@phillipj].
  192. * Documents use of string literals containing double quotes, by [@jfmercer].
  193. ### Changed
  194. * Move mustache gif to githubusercontent, by [@Andersos].
  195. ### Fixed
  196. * Update UMD Shim to be resilient to HTMLElement global pollution, by [@mikesherov].
  197. ## [2.1.2] / 17 June 2015
  198. ### Added
  199. * Mustache global definition ([#466]) by [@yousefcisco].
  200. ## [2.1.1] / 11 June 2015
  201. ### Added
  202. * State that we use semver on the change log, by [@dasilvacontin].
  203. * Added version links to change log, by [@dasilvacontin].
  204. ### Fixed
  205. * Bugfix for using values from view's context prototype, by [@phillipj].
  206. * Improve test with undefined/null lookup hit using dot notation, by [@dasilvacontin].
  207. * Bugfix for null/undefined lookup hit when using dot notation, by [@phillipj].
  208. * Remove moot `version` property from bower.json, by [@kkirsche].
  209. * bower.json doesn't require a version bump via hook, by [@dasilvacontin].
  210. ## [2.1.0] / 5 June 2015
  211. * Added license attribute to package.json, by [@pgilad].
  212. * Minor changes to make mustache.js compatible with both WSH and ASP, by [@nagaozen].
  213. * Improve CLI view parsing error, by [@phillipj].
  214. * Bugfix for view context cache, by [@phillipj].
  215. ## [2.0.0] / 27 Mar 2015
  216. * Fixed lookup not stopping upon finding `undefined` or `null` values, by [@dasilvacontin].
  217. * Refactored pre-commit hook, by [@dasilvacontin].
  218. ## [1.2.0] / 24 Mar 2015
  219. * Added -v option to CLI, by [@phillipj].
  220. * Bugfix for rendering Number when it serves as the Context, by [@phillipj].
  221. * Specified files in package.json for a cleaner install, by [@phillipj].
  222. ## [1.1.0] / 18 Feb 2015
  223. * Refactor Writer.renderTokens() for better readability, by [@phillipj].
  224. * Cleanup tests section in readme, by [@phillipj].
  225. * Added JSHint to tests/CI, by [@phillipj].
  226. * Added node v0.12 on travis, by [@phillipj].
  227. * Created command line tool, by [@phillipj].
  228. * Added *falsy* to Inverted Sections description in README, by [@kristijanmatic].
  229. ## [1.0.0] / 20 Dec 2014
  230. * Inline tag compilation, by [@mjackson].
  231. * Fixed AMD registration, volo package.json entry, by [@jrburke].
  232. * Added spm support, by [@afc163].
  233. * Only access properties of objects on Context.lookup, by [@cmbuckley].
  234. ## [0.8.2] / 17 Mar 2014
  235. * Supporting Bower through a bower.json file.
  236. ## [0.8.1] / 3 Jan 2014
  237. * Fix usage of partial templates.
  238. ## [0.8.0] / 2 Dec 2013
  239. * Remove compile* writer functions, use mustache.parse instead. Smaller API.
  240. * Throw an error when rendering a template that contains higher-order sections and
  241. the original template is not provided.
  242. * Remove low-level Context.make function.
  243. * Better code readability and inline documentation.
  244. * Stop caching templates by name.
  245. ## [0.7.3] / 5 Nov 2013
  246. * Don't require the original template to be passed to the rendering function
  247. when using compiled templates. This is still required when using higher-order
  248. functions in order to be able to extract the portion of the template
  249. that was contained by that section. Fixes [#262].
  250. * Performance improvements.
  251. ## [0.7.2] / 27 Dec 2012
  252. * Fixed a rendering bug ([#274]) when using nested higher-order sections.
  253. * Better error reporting on failed parse.
  254. * Converted tests to use mocha instead of vows.
  255. ## [0.7.1] / 6 Dec 2012
  256. * Handle empty templates gracefully. Fixes [#265], [#267], and [#270].
  257. * Cache partials by template, not by name. Fixes [#257].
  258. * Added Mustache.compileTokens to compile the output of Mustache.parse. Fixes
  259. [#258].
  260. ## [0.7.0] / 10 Sep 2012
  261. * Rename Renderer => Writer.
  262. * Allow partials to be loaded dynamically using a callback (thanks
  263. [@TiddoLangerak] for the suggestion).
  264. * Fixed a bug with higher-order sections that prevented them from being
  265. passed the raw text of the section from the original template.
  266. * More concise token format. Tokens also include start/end indices in the
  267. original template.
  268. * High-level API is consistent with the Writer API.
  269. * Allow partials to be passed to the pre-compiled function (thanks
  270. [@fallenice]).
  271. * Don't use eval (thanks [@cweider]).
  272. ## [0.6.0] / 31 Aug 2012
  273. * Use JavaScript's definition of falsy when determining whether to render an
  274. inverted section or not. Issue [#186].
  275. * Use Mustache.escape to escape values inside {{}}. This function may be
  276. reassigned to alter the default escaping behavior. Issue [#244].
  277. * Fixed a bug that clashed with QUnit (thanks [@kannix]).
  278. * Added volo support (thanks [@guybedford]).
  279. [3.2.0]: https://github.com/janl/mustache.js/compare/v3.1.0...v3.2.0
  280. [3.1.0]: https://github.com/janl/mustache.js/compare/v3.0.3...v3.1.0
  281. [3.0.3]: https://github.com/janl/mustache.js/compare/v3.0.2...v3.0.3
  282. [3.0.2]: https://github.com/janl/mustache.js/compare/v3.0.1...v3.0.2
  283. [3.0.1]: https://github.com/janl/mustache.js/compare/v3.0.0...v3.0.1
  284. [3.0.0]: https://github.com/janl/mustache.js/compare/v2.3.2...v3.0.0
  285. [2.3.2]: https://github.com/janl/mustache.js/compare/v2.3.1...v2.3.2
  286. [2.3.1]: https://github.com/janl/mustache.js/compare/v2.3.0...v2.3.1
  287. [2.3.0]: https://github.com/janl/mustache.js/compare/v2.2.1...v2.3.0
  288. [2.2.1]: https://github.com/janl/mustache.js/compare/v2.2.0...v2.2.1
  289. [2.2.0]: https://github.com/janl/mustache.js/compare/v2.1.3...v2.2.0
  290. [2.1.3]: https://github.com/janl/mustache.js/compare/v2.1.2...v2.1.3
  291. [2.1.2]: https://github.com/janl/mustache.js/compare/v2.1.1...v2.1.2
  292. [2.1.1]: https://github.com/janl/mustache.js/compare/v2.1.0...v2.1.1
  293. [2.1.0]: https://github.com/janl/mustache.js/compare/v2.0.0...v2.1.0
  294. [2.0.0]: https://github.com/janl/mustache.js/compare/v1.2.0...v2.0.0
  295. [1.2.0]: https://github.com/janl/mustache.js/compare/v1.1.0...v1.2.0
  296. [1.1.0]: https://github.com/janl/mustache.js/compare/v1.0.0...v1.1.0
  297. [1.0.0]: https://github.com/janl/mustache.js/compare/0.8.2...v1.0.0
  298. [0.8.2]: https://github.com/janl/mustache.js/compare/0.8.1...0.8.2
  299. [0.8.1]: https://github.com/janl/mustache.js/compare/0.8.0...0.8.1
  300. [0.8.0]: https://github.com/janl/mustache.js/compare/0.7.3...0.8.0
  301. [0.7.3]: https://github.com/janl/mustache.js/compare/0.7.2...0.7.3
  302. [0.7.2]: https://github.com/janl/mustache.js/compare/0.7.1...0.7.2
  303. [0.7.1]: https://github.com/janl/mustache.js/compare/0.7.0...0.7.1
  304. [0.7.0]: https://github.com/janl/mustache.js/compare/0.6.0...0.7.0
  305. [0.6.0]: https://github.com/janl/mustache.js/compare/0.5.2...0.6.0
  306. [#186]: https://github.com/janl/mustache.js/issues/186
  307. [#244]: https://github.com/janl/mustache.js/issues/244
  308. [#257]: https://github.com/janl/mustache.js/issues/257
  309. [#258]: https://github.com/janl/mustache.js/issues/258
  310. [#262]: https://github.com/janl/mustache.js/issues/262
  311. [#265]: https://github.com/janl/mustache.js/issues/265
  312. [#267]: https://github.com/janl/mustache.js/issues/267
  313. [#270]: https://github.com/janl/mustache.js/issues/270
  314. [#274]: https://github.com/janl/mustache.js/issues/274
  315. [#466]: https://github.com/janl/mustache.js/issues/466
  316. [#540]: https://github.com/janl/mustache.js/issues/540
  317. [#542]: https://github.com/janl/mustache.js/issues/542
  318. [#546]: https://github.com/janl/mustache.js/issues/546
  319. [#548]: https://github.com/janl/mustache.js/issues/548
  320. [#553]: https://github.com/janl/mustache.js/issues/553
  321. [#560]: https://github.com/janl/mustache.js/issues/560
  322. [#569]: https://github.com/janl/mustache.js/issues/569
  323. [#580]: https://github.com/janl/mustache.js/issues/580
  324. [#592]: https://github.com/janl/mustache.js/issues/592
  325. [#593]: https://github.com/janl/mustache.js/issues/593
  326. [#597]: https://github.com/janl/mustache.js/issues/597
  327. [#610]: https://github.com/janl/mustache.js/issues/610
  328. [#643]: https://github.com/janl/mustache.js/issues/643
  329. [#644]: https://github.com/janl/mustache.js/issues/644
  330. [#657]: https://github.com/janl/mustache.js/issues/657
  331. [#664]: https://github.com/janl/mustache.js/issues/664
  332. [#666]: https://github.com/janl/mustache.js/issues/666
  333. [#667]: https://github.com/janl/mustache.js/issues/667
  334. [#668]: https://github.com/janl/mustache.js/issues/668
  335. [#670]: https://github.com/janl/mustache.js/issues/670
  336. [#618]: https://github.com/janl/mustache.js/issues/618
  337. [#673]: https://github.com/janl/mustache.js/issues/673
  338. [#679]: https://github.com/janl/mustache.js/issues/679
  339. [#701]: https://github.com/janl/mustache.js/issues/701
  340. [#704]: https://github.com/janl/mustache.js/issues/704
  341. [#705]: https://github.com/janl/mustache.js/issues/705
  342. [#713]: https://github.com/janl/mustache.js/issues/713
  343. [#714]: https://github.com/janl/mustache.js/issues/714
  344. [#716]: https://github.com/janl/mustache.js/issues/716
  345. [#717]: https://github.com/janl/mustache.js/issues/717
  346. [#728]: https://github.com/janl/mustache.js/issues/728
  347. [@afc163]: https://github.com/afc163
  348. [@andersk]: https://github.com/andersk
  349. [@Andersos]: https://github.com/Andersos
  350. [@bbrooks]: https://github.com/bbrooks
  351. [@calvinf]: https://github.com/calvinf
  352. [@cmbuckley]: https://github.com/cmbuckley
  353. [@cweider]: https://github.com/cweider
  354. [@dasilvacontin]: https://github.com/dasilvacontin
  355. [@djchie]: https://github.com/djchie
  356. [@EvanLovely]: https://github.com/EvanLovely
  357. [@fallenice]: https://github.com/fallenice
  358. [@Flaque]: https://github.com/Flaque
  359. [@guybedford]: https://github.com/guybedford
  360. [@imagentleman]: https://github.com/imagentleman
  361. [@JEStaubach]: https://github.com/JEStaubach
  362. [@jfmercer]: https://github.com/jfmercer
  363. [@jrburke]: https://github.com/jrburke
  364. [@kannix]: https://github.com/kannix
  365. [@keirog]: https://github.com/keirog
  366. [@kkirsche]: https://github.com/kkirsche
  367. [@kookookchoozeus]: https://github.com/kookookchoozeus
  368. [@kristijanmatic]: https://github.com/kristijanmatic
  369. [@kevindew]: https://github.com/kevindew
  370. [@mateusortiz]: https://github.com/mateusortiz
  371. [@mightyplow]: https://github.com/mightyplow
  372. [@mikesherov]: https://github.com/mikesherov
  373. [@mjackson]: https://github.com/mjackson
  374. [@mortonfox]: https://github.com/mortonfox
  375. [@nagaozen]: https://github.com/nagaozen
  376. [@norfish]: https://github.com/norfish
  377. [@palkan]: https://github.com/palkan
  378. [@paultopia]: https://github.com/paultopia
  379. [@pgilad]: https://github.com/pgilad
  380. [@phillipj]: https://github.com/phillipj
  381. [@pra85]: https://github.com/pra85
  382. [@raymond-lam]: https://github.com/raymond-lam
  383. [@seminaoki]: https://github.com/seminaoki
  384. [@ShashankaNataraj]: https://github.com/ShashankaNataraj
  385. [@simast]: https://github.com/simast
  386. [@stackchain]: https://github.com/stackchain
  387. [@TiddoLangerak]: https://github.com/TiddoLangerak
  388. [@tomekwi]: https://github.com/tomekwi
  389. [@wizawu]: https://github.com/wizawu
  390. [@wol-soft]: https://github.com/wol-soft
  391. [@Xcrucifier]: https://github.com/Xcrucifier
  392. [@yotammadem]: https://github.com/yotammadem
  393. [@yousefcisco]: https://github.com/yousefcisco
  394. [@zekth]: https://github.com/zekth