miki-template 2.2.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.github/workflows/docs.yml +3 -1
  2. package/.github/workflows/release.yml +1 -0
  3. package/benchmarks/ejs-results.json +6 -6
  4. package/benchmarks/ejs.js +5 -3
  5. package/benchmarks/handlebars-results.json +6 -6
  6. package/benchmarks/handlebars.js +5 -8
  7. package/benchmarks/miki-results.json +6 -6
  8. package/benchmarks/miki.js +6 -3
  9. package/benchmarks/pug-results.json +6 -6
  10. package/benchmarks/pug.js +5 -3
  11. package/docs/api/async-render.md +88 -3
  12. package/docs/api/cache.md +90 -3
  13. package/docs/api/compile.md +131 -3
  14. package/docs/api/context-processors.md +80 -3
  15. package/docs/api/filters.md +223 -3
  16. package/docs/api/finder.md +97 -3
  17. package/docs/api/helpers.md +56 -3
  18. package/docs/api/i18n.md +160 -3
  19. package/docs/api/index.md +82 -28
  20. package/docs/api/libraries.md +210 -3
  21. package/docs/api/render-partial.md +84 -3
  22. package/docs/api/render.md +95 -3
  23. package/docs/api/security.md +148 -3
  24. package/docs/api/setup-express.md +78 -2
  25. package/docs/api/tags.md +138 -4
  26. package/docs/filter.md +0 -0
  27. package/docs/guide/advanced-usage.md +403 -6
  28. package/docs/guide/async-rendering.md +312 -4
  29. package/docs/guide/context-processors.md +261 -4
  30. package/docs/guide/custom-filters.md +315 -4
  31. package/docs/guide/custom-tags.md +275 -4
  32. package/docs/guide/filters.md +675 -3
  33. package/docs/guide/getting-started.md +109 -7
  34. package/docs/guide/installation.md +99 -4
  35. package/docs/guide/partial-templates.md +371 -4
  36. package/docs/guide/quick-start.md +228 -6
  37. package/docs/guide/security.md +348 -3
  38. package/docs/guide/tags.md +789 -6
  39. package/docs/guide/template-discovery.md +174 -4
  40. package/docs/guide/template-inheritance.md +277 -4
  41. package/docs/index.md +24 -42
  42. package/docs/integrations/elysia.md +4 -2
  43. package/docs/integrations/express.md +219 -219
  44. package/docs/integrations/fastify.md +4 -2
  45. package/docs/integrations/hono.md +4 -2
  46. package/docs/integrations/index.md +68 -68
  47. package/docs/integrations/koa.md +4 -2
  48. package/docs/integrations/nestjs.md +4 -2
  49. package/docs/integrations/tsed.md +4 -2
  50. package/docs/performance.md +45 -8
  51. package/ex.mjs +1 -1
  52. package/mkdocs.yml +0 -22
  53. package/overrides/main.html +1 -1
  54. package/package.json +1 -1
  55. package/requirements-docs.txt +2 -1
  56. package/src/codegen.js +905 -0
  57. package/src/context.js +42 -30
  58. package/src/filters.js +16 -0
  59. package/src/index.js +66 -61
  60. package/src/tags/control.js +15 -12
  61. package/src/utils.js +60 -0
  62. package/tests/filters.test.js +9 -0
  63. package/.github/workflows/npm-publish-github-packages.yml +0 -36
  64. package/docs/javascripts/extra.js +0 -174
  65. package/docs/stylesheets/extra.css +0 -819
  66. package/overrides/partials/footer.html +0 -9
@@ -1,37 +1,74 @@
1
- # Performance
1
+ # Performance
2
+
3
+
2
4
 
3
5
  miki-template is built for real-world apps. Its compiled-AST engine is especially fast on templates with loops, conditionals, and filters — where other engines struggle.
4
6
 
7
+
8
+
5
9
  ## Benchmark Results
6
10
 
11
+
12
+
7
13
  Renders per second (higher is better):
8
14
 
15
+
16
+
9
17
  | Template | miki-template | pug | handlebars | ejs |
18
+
10
19
  |----------|--------------|-----|------------|-----|
11
- | Small | ~115k rps | 1.7M rps | 417k rps | 182k rps |
12
- | Medium | ~454k rps | 625k rps | 48k rps | 29k rps |
13
- | Large | **~476k rps** | 3.1k rps | 661 rps | 290 rps |
20
+
21
+ | Small | ~770k rps | 1.1M rps | 300k rps | 113k rps |
22
+
23
+ | Medium | ~40k rps | 27k rps | 4k rps | 2k rps |
24
+
25
+ | Large | **~2530 rps** | 1886 rps | 493 rps | 1881 rps |
26
+
27
+
14
28
 
15
29
  ## Key Takeaways
16
30
 
17
- - On **small** templates, miki-template has overhead from the compiled AST approach.
18
- - On **medium** templates, miki-template is competitive with pug.
31
+
32
+
33
+ - On **small** templates, miki-template is competitive with pug.
34
+
35
+ - On **medium** templates, miki-template beats pug.
36
+
19
37
  - On **large/realistic** templates (the ones that matter in production), miki-template **dominates by ~150×**.
20
38
 
39
+
40
+
21
41
  ## Why miki-template Wins on Real Templates
22
42
 
43
+
44
+
23
45
  - **Compiled AST**: Templates are compiled once and reused, avoiding repeated parsing.
46
+
24
47
  - **No runtime interpretation**: No string concatenation or function reconstruction per render.
48
+
25
49
  - **Optimized loops and filters**: for-loops and filters are implemented as efficient node traversals.
50
+
26
51
  - **Cache-friendly**: Compiled templates are cached by default.
27
52
 
53
+
54
+
28
55
  ## Running Benchmarks
29
56
 
57
+
58
+
30
59
  ```bash
60
+
31
61
  npm run bench
62
+
32
63
  ```
33
64
 
65
+
66
+
34
67
  ## Next Steps
35
68
 
36
- - [Getting Started](../guide/getting-started)
37
- - [API Reference](../api/)
69
+
70
+
71
+ - [Getting Started](guide/getting-started.md)
72
+
73
+ - [API Reference](api/index.md)
74
+
package/ex.mjs CHANGED
@@ -26,7 +26,7 @@ const dir=path.join(process.cwd(),"dir")
26
26
  {name:"miki", email:"jack@miki.com",address:"kumba"},
27
27
  {name:"luis",email:"luis@miki.com",address:"kumba"}
28
28
  ]
29
- res.render("index#card",{name:"miki-template context", users:users, data:data})
29
+ res.render("index",{name:"miki-template context", users:users, data:data})
30
30
  // res.send(content)
31
31
  })
32
32
 
package/mkdocs.yml CHANGED
@@ -150,18 +150,6 @@ markdown_extensions:
150
150
  - pymdownx.tasklist:
151
151
  custom_checkbox: true
152
152
  - pymdownx.tilde
153
- - material.extensions.emoji:
154
- options:
155
- custom_icons:
156
- - overrides/.icons
157
- - material.extensions.tabbed
158
- - material.extensions.anchor
159
- - material.extensions.details
160
- - material.extensions.superfences
161
- - material.extensions.magic-link:
162
- repo_url_shorthand: true
163
- user: alainmiki
164
- repo: miki-template
165
153
 
166
154
  extra:
167
155
  social:
@@ -205,13 +193,3 @@ plugins:
205
193
  - optimize:
206
194
  enabled: !ENV [READTHEDOCS, false]
207
195
  concurrency: 4
208
- css:
209
- transpile: true
210
- js:
211
- bundle: true
212
-
213
- extra_css:
214
- - stylesheets/extra.css
215
-
216
- extra_javascript:
217
- - javascripts/extra.js
@@ -3,7 +3,7 @@
3
3
  {% block announce %}
4
4
  <div class="md-announce" role="banner">
5
5
  <div class="md-announce__inner">
6
- <span>🚀 <strong>miki-template v2.0</strong> is now available with improved performance and new features!</span>
6
+ <span>🚀 <strong>miki-template v2.2.3</strong> is now available with improved performance and new features!</span>
7
7
  <a href="https://github.com/alainmiki/miki-template/releases" target="_blank" rel="noopener">View Release Notes</a>
8
8
  <button class="md-announce__button" onclick="this.closest('.md-announce').remove()" aria-label="Dismiss announcement">
9
9
  <span class="md-icon">&#10005;</span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miki-template",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "description": "Django-Style template engine for Node.js and Express",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -1 +1,2 @@
1
- mkdocs-material[imaging]>=9.5
1
+ mkdocs-material[imaging]<9.8
2
+ mkdocs<2