miki-template 1.3.3 → 1.3.7
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.
- package/.eslintrc.json +16 -0
- package/.github/release-notes/v1.3.1.md +55 -55
- package/.github/release-notes/v1.3.3.md +77 -0
- package/.github/workflows/ci.yml +38 -54
- package/.github/workflows/release.yml +106 -0
- package/AGENT.md +71 -71
- package/API_REFERENCE.md +314 -314
- package/CHANGELOG.md +173 -169
- package/CODE_OF_CONDUCT.md +14 -14
- package/CONTRIBUTING.md +27 -27
- package/README.md +342 -321
- package/ROADMAP.md +40 -40
- package/benchmarks/report.json +16 -16
- package/benchmarks/run.js +49 -49
- package/benchmarks/stress.mjs +647 -647
- package/benchmarks/templates/large.dtpl +7 -7
- package/benchmarks/templates/medium.dtpl +3 -3
- package/benchmarks/templates/small.dtpl +7 -7
- package/context/component.md +109 -109
- package/context/prd.md +131 -131
- package/context/project-structure.md +33 -33
- package/dir/base.html +22 -22
- package/dir/cmpnt.html +10 -10
- package/dir/footer.html +2 -2
- package/dir/home.html +80 -80
- package/dir/index.html +80 -0
- package/dir/navbar.html +8 -8
- package/docs/README.md +18 -18
- package/docs/advanced_usage.md +71 -71
- package/docs/api.md +119 -119
- package/docs/filters.md +708 -708
- package/docs/installation.md +106 -106
- package/docs/overview.md +79 -57
- package/docs/partialdef.md +70 -70
- package/docs/security.md +27 -27
- package/docs/tags.md +673 -673
- package/docs/usage.md +646 -646
- package/eslint.config.mjs +42 -42
- package/ex.mjs +34 -32
- package/live-test/package-lock.json +915 -0
- package/live-test/package.json +9 -0
- package/live-test/server.js +14 -0
- package/live-test/views/base.html +8 -0
- package/live-test/views/child.html +7 -0
- package/live-test/views/index.html +1 -0
- package/miki-template-extension/.github/workflows/ci.yml +116 -116
- package/miki-template-extension/.vscodeignore +7 -7
- package/miki-template-extension/CHANGELOG.md +99 -99
- package/miki-template-extension/LICENSE +21 -21
- package/miki-template-extension/README.md +273 -273
- package/miki-template-extension/extension.js +1013 -1013
- package/miki-template-extension/icon.svg +10 -10
- package/miki-template-extension/package.json +280 -280
- package/miki-template-extension/snippets/miki-template.json +717 -717
- package/miki-template-extension/syntaxes/language-configuration.json +114 -114
- package/miki-template-extension/syntaxes/miki-template.tmLanguage.json +355 -355
- package/miki-template-extension/tests/grammar-tests.json +162 -162
- package/miki-template-extension/tests/run-grammar-tests.js +82 -82
- package/package.json +40 -34
- package/sample-app/package-lock.json +901 -0
- package/sample-app/package.json +9 -0
- package/sample-app/server.js +14 -0
- package/sample-app/views/index.html +1 -0
- package/scripts/build-vsix.js +129 -129
- package/scripts/build-vsix.ps1 +15 -15
- package/snippets/miki-template.json +177 -177
- package/src/asyncRender.js +20 -20
- package/src/cache.js +80 -80
- package/src/context.js +126 -126
- package/src/context_processors.js +48 -48
- package/src/esm.mjs +89 -84
- package/src/filters.js +975 -975
- package/src/i18n.js +171 -171
- package/src/index.js +1112 -940
- package/src/lexer.js +114 -114
- package/src/libraries.js +371 -371
- package/src/parser.js +270 -270
- package/src/security.js +53 -53
- package/src/tags/control.js +719 -719
- package/src/tags/extra.js +154 -154
- package/src/tags/helpers.js +26 -26
- package/src/tags/i18n.js +256 -256
- package/src/tags/inheritance.js +335 -335
- package/src/tags/registry.js +18 -18
- package/src/tags/util.js +400 -400
- package/src/types.d.ts +107 -107
- package/syntaxes/language-configuration.json +26 -26
- package/syntaxes/miki-template.tmLanguage.json +146 -146
- package/tests/asyncRender.test.js +17 -17
- package/tests/base.html +6 -6
- package/tests/child.html +3 -3
- package/tests/context_processors.test.js +13 -13
- package/tests/esm.test.mjs +61 -61
- package/tests/filters.test.js +254 -254
- package/tests/finder-appdirs.test.js +19 -0
- package/tests/finder.test.js +17 -0
- package/tests/fixtures/views/nested/index.html +1 -0
- package/tests/fixtures/views/partial.html +1 -0
- package/tests/fixtures/views/sub/deepfile.html +1 -0
- package/tests/fixtures/views-appdirs/product/site/detail.html +1 -0
- package/tests/include_security.test.js +9 -9
- package/tests/integration/README.md +32 -32
- package/tests/integration/features.test.cjs +1681 -1681
- package/tests/integration/features.test.mjs +1697 -1697
- package/tests/integration/finder.esm.test.mjs +13 -0
- package/tests/integration/templates/base.miki +6 -6
- package/tests/integration/templates/child.miki +6 -6
- package/tests/integration/templates/index.html +17 -17
- package/tests/lexer.test.js +45 -45
- package/tests/parser.test.js +57 -57
- package/tests/partial.html +1 -1
- package/tests/partialdef.test.js +79 -79
- package/tests/production_checks.js +57 -57
- package/tests/security.test.js +28 -28
- package/tests/tags.test.js +233 -233
package/CHANGELOG.md
CHANGED
|
@@ -1,169 +1,173 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [1.3.
|
|
4
|
-
### Fixed
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- `
|
|
17
|
-
- `
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- `
|
|
33
|
-
- `
|
|
34
|
-
- `
|
|
35
|
-
- `
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
- `
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
- `
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
- `
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
- `
|
|
54
|
-
- `
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
- `
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- `
|
|
61
|
-
- `
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
- `
|
|
66
|
-
- `
|
|
67
|
-
- `
|
|
68
|
-
-
|
|
69
|
-
- `
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
###
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- **
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
- **`
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
- `
|
|
97
|
-
- `
|
|
98
|
-
- `
|
|
99
|
-
- `
|
|
100
|
-
- `
|
|
101
|
-
- `
|
|
102
|
-
- `
|
|
103
|
-
- `
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
- `
|
|
119
|
-
- `firstof`
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
- `
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
-
|
|
127
|
-
- `
|
|
128
|
-
- `
|
|
129
|
-
- `
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
- `
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
- `
|
|
139
|
-
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.3.4] - 2026-09-05
|
|
4
|
+
### Fixed
|
|
5
|
+
- **Express views path resolution** — normalize `views` entries and ensure miki treats file paths as directories when resolving templates and `#partial` lookups. This fixes `Failed to lookup view "home" in views directory ".../dir"` when `miki-template` is used from a host project's `node_modules` and `views` is passed as a file path.
|
|
6
|
+
|
|
7
|
+
## [1.3.3] - 2026-09-04
|
|
8
|
+
### Fixed
|
|
9
|
+
- **`date` and `time` filters** — multi-character tokens (`yyyy`, `MM`, `dd`, `HH`, `mm`, `ii`, `ss`) now work correctly. Previously `"yyyy-MM-dd"` rendered as `"24242424-JunJun-1515"` because each character was treated as an independent token. The fix uses longest-first token matching and adds backward-compatible single-character aliases (`m`/`d`/`H`/`i`/`s` for Django-style unpadded values).
|
|
10
|
+
|
|
11
|
+
### Performance
|
|
12
|
+
- **Inheritance parent-source cache** — `{% extends %}` no longer re-reads the parent template from disk on every render. A 64-entry LRU cache in `src/cache.js` (`getParentSource` / `hasParentSource`) memoises the parent source. Inheritance rendering improved from ~481 rps to **~2,056 rps** in the stress benchmark (4.3× faster, no functional change).
|
|
13
|
+
|
|
14
|
+
### Tooling
|
|
15
|
+
- **`benchmarks/stress.mjs`** — comprehensive 37-check stress benchmark covering correctness, compile speed, render speed, cache behavior, scale, endurance, partial rendering, async, and concurrency. Run with `node benchmarks/stress.mjs`. Exits with code 1 on any failure.
|
|
16
|
+
- **`eslint.config.mjs`** — added `URL`, `URLSearchParams`, `TextEncoder`, `TextDecoder`, `fetch`, `crypto`, `performance` to the Node 18+ globals list so `no-undef` no longer flags standard Web APIs.
|
|
17
|
+
- Removed dead code flagged by the linter: unused `elifBranches` variable in `parseIfChanged`, unused `extractPluralMappings` function in `i18n.js`. Renamed unused tag-parser `parser` parameters to `_parser` in `lorem` library and `parseLoad`.
|
|
18
|
+
|
|
19
|
+
### Verification
|
|
20
|
+
- `npx eslint src/**/*.js` — 0 errors, 0 warnings
|
|
21
|
+
- `npm test` — 397/397 passing
|
|
22
|
+
- `node benchmarks/stress.mjs` — 37/37 passing
|
|
23
|
+
|
|
24
|
+
## [1.3.1] - 2026-09-03
|
|
25
|
+
### Highlights
|
|
26
|
+
- **One-line Express integration**: `miki.setupExpress(app, { extension: 'html', views: dir })` — wires the view engine, `views` directory, and a `res.render` shim that lets you do `res.render('home#card', ...)` for HTMX-style partial responses. No more boilerplate, no extra middleware.
|
|
27
|
+
- **Render-any-partial-from-string**: `renderPartialFromSource(source, partialName, ctx, opts)` loads a template string and returns only the named `{% partialdef %}` body. This is what powers `res.render('view#partial')` and HTMX responses.
|
|
28
|
+
- **True built-in libraries**: `humanize`, `cache`, and `lorem` are now auto-activated on module load — `{% lorem %}` works without `{% load lorem %}`. Existing libraries now also expose helpers, not just tags.
|
|
29
|
+
- **Comprehensive integration test suite**: 382 tests covering every tag, filter, and feature under both CommonJS and ESM, all running against a **real Express HTTP server** on ephemeral ports.
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
- `miki.setupExpress(app, { extension, views, async })` — one-line Express bootstrap. Sets `view engine`, registers the engine, and patches `res.render` to handle `view#partial` selectors. Replaces the need to call `app.engine()`, `app.set('views')`, and `app.set('view engine')` manually.
|
|
33
|
+
- `miki.express()` — factory that returns a view-engine function suitable for `app.engine(...)`. Honors `view#partial` suffixes.
|
|
34
|
+
- `miki.expressPartialRenderer()` — middleware that adds `res.renderPartial(view, locals)`. Useful as a drop-in HTMX helper.
|
|
35
|
+
- `renderPartialFromSource(source, partialName, context, options)` — render a single named partial from a template string. Resolves `extends` chains so partials defined inside `{% block %}` tags are discoverable. Walks the AST and registers every `PartialDefNode` it finds, even when nested inside `{% for %}` or `{% if %}` blocks that won't render during partial lookup.
|
|
36
|
+
- `renderPartialFromFile(filePath, partialName, context, options)` — file-based convenience wrapper.
|
|
37
|
+
- `Context.get(name)` now returns `undefined` for missing keys (was `''`). This lets `default_if_none` distinguish "not provided" from an explicit empty string, matching Django.
|
|
38
|
+
- `escapeHtml(value, force = false)` — added a `force` flag so the `|escape` filter re-escapes even a `SafeString` (Django parity).
|
|
39
|
+
- `Context` constructor now supports `partialDefs` and `options` for cloning the partial registry.
|
|
40
|
+
- New exports: `setupExpress`, `express`, `expressPartialRenderer`, `renderPartialFromFile`, `renderPartialFromSource`, `clearContextProcessors`.
|
|
41
|
+
- ESM surface (`src/esm.mjs`) now exposes all the new helpers, with the same `default` + named import shape.
|
|
42
|
+
- Lorem library now ships a real `{% lorem N method %}` tag, a `lorem` filter, plus helpers. Built-in and auto-activated.
|
|
43
|
+
- `library.activate(name)` now also activates helpers and `registerTag` functions, not just filters.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
- Context processors now follow Django semantics: **existing context values win** over processor defaults. If you render with `{ user: req.user }` and a processor returns `{ user: 'Guest' }`, the explicit value is preserved.
|
|
47
|
+
- `__express` and `__expressAsync` now detect a `#partial` suffix in the view name and delegate to `renderPartialFromSource` automatically. This makes `app.engine('html', miki.__express)` already HTMX-ready — `setupExpress` just adds convenience.
|
|
48
|
+
- `cache.getCompiled` ignores function-valued and `undefined` options when building cache keys, so passing the same `urlHelper` function to multiple `compile()` calls no longer causes cache misses.
|
|
49
|
+
- Lexer rewritten with brace-depth counting for more reliable `{{ }}` and `{% %}` tokenization in templates with nested braces, escaped braces, and unusual whitespace.
|
|
50
|
+
- Filters now receive the rendering `context` as a final argument, so custom filters can read other context variables (e.g. for locale-aware formatting).
|
|
51
|
+
- `for` and `with` tags fully reworked for the user-reported edge cases:
|
|
52
|
+
- `{% with x=1, y=2 as pair %}` — pair list followed by an alias.
|
|
53
|
+
- `{% with value=expr %}` — single pair (no comma).
|
|
54
|
+
- `{% with x=1, y=2 %}` — pure pair list (no alias).
|
|
55
|
+
- Quoted values containing commas (`{% with a="x,y" %}`) parse correctly.
|
|
56
|
+
- Pair values may be context variables.
|
|
57
|
+
- `partial` now accepts `with` kwargs and overrides context for the partial scope.
|
|
58
|
+
- `include` now supports `file#partial` syntax — the same partial-selector pattern works with `{% include %}` as with `res.render`.
|
|
59
|
+
- `url` tag respects `urlHelper` more cleanly: kwargs (a trailing object literal) are passed as the last argument instead of being conflated with positional args.
|
|
60
|
+
- `static` tag normalizes leading slashes; prefix can be customized.
|
|
61
|
+
- `csrf_token` and `csp_nonce_attr` outputs are properly escaped to prevent attribute injection.
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
- `with a=x b=y` (multi-pair) was previously treated as a single value/expression. Now correctly binds each pair.
|
|
65
|
+
- `cycle` with `as` form emits nothing but stores the value, matching Django.
|
|
66
|
+
- `block.super` works inside partials that override blocks.
|
|
67
|
+
- `extends` resolves `views` from `options.settings.views` (Express's normal path), `options.views`, or the default.
|
|
68
|
+
- Path traversal protection now applies to `extends` *and* `include`, including `include "file#partial"` form.
|
|
69
|
+
- `if` conditions handle dotted lookup, function auto-call, and missing variables without throwing.
|
|
70
|
+
- `default` vs `default_if_none`: `default` falls back on empty string, `null`, and `undefined`; `default_if_none` only on `null`/`undefined`. Both now match Django exactly.
|
|
71
|
+
- `removetags` filter now accepts multiple tag names.
|
|
72
|
+
- `safe` / `escape` filters correctly re-escape `SafeString` only when forced.
|
|
73
|
+
- `Context.get('a.b.c')` no longer stringifies `undefined` to `''`, fixing `{% if x %}` checks against missing variables.
|
|
74
|
+
- Cache key collisions when passing the same template string with different function-valued options (e.g. `urlHelper`).
|
|
75
|
+
|
|
76
|
+
### Compatibility
|
|
77
|
+
- No breaking changes. All existing public APIs continue to work. New APIs are opt-in.
|
|
78
|
+
|
|
79
|
+
## [1.2.0] - 2026-09-01
|
|
80
|
+
### Added
|
|
81
|
+
- Full **ESM** support via `src/esm.mjs` wrapper and conditional `package.json` exports.
|
|
82
|
+
- **TypeScript** type definitions (`src/types.d.ts`).
|
|
83
|
+
- **Async Express 5+** adapter: `__expressAsync(filePath, options) → Promise<string>`.
|
|
84
|
+
- **i18n**: `trans` tag/filter, `blocktrans`, `language`, plural rules, `registerTranslation`.
|
|
85
|
+
- **Plugin/library system**: `registerLibrary`, `registerLibraryFromPath`, built-ins (`humanize`, `cache`, `lorem`).
|
|
86
|
+
- **`load` tag** now activates registered libraries (no longer a stub).
|
|
87
|
+
- **`widthratio`** tag for proportional width calculations.
|
|
88
|
+
- **`debug`** tag for dumping template context during development.
|
|
89
|
+
- **`regroup`** filter for grouping arrays by attribute.
|
|
90
|
+
- **`strftime`** filter with full `date-fns` format support.
|
|
91
|
+
- **Unclosed tag validation**: throws descriptive errors for missing `endif`/`endfor`/`endwith`.
|
|
92
|
+
- **Filter chaining on string literals**: `{{ "Hello"|lower|capfirst }}` now works.
|
|
93
|
+
- New exports: `getFilter`, `stripExpressContext`, `activateLibrary`.
|
|
94
|
+
|
|
95
|
+
### Fixed
|
|
96
|
+
- `for` loop now supports filter expressions in iterable path (e.g. `items|regroup:"category"`).
|
|
97
|
+
- `Context.reset()` properly clears cycle state and blocks between renders.
|
|
98
|
+
- `__express` strips Express framework keys (`_locals`, `settings`, `cache`) from context.
|
|
99
|
+
- `renderPartial` renders only the named partial, not the full template.
|
|
100
|
+
- `with` tag correctly handles multiple `key=value` assignments and quoted values.
|
|
101
|
+
- `if` tag condition evaluation handles `not`, `and`, `or`, and operator precedence correctly.
|
|
102
|
+
- `forloop.parentloop` correctly propagates for nested loops.
|
|
103
|
+
- `floatformat` default behavior matches Django (1 decimal place).
|
|
104
|
+
- `timesince`/`timeuntil` handle seconds, minutes, hours, days correctly.
|
|
105
|
+
- `pluralize` correctly handles singular vs plural forms.
|
|
106
|
+
- `default` filter treats empty string `''` as falsy like Django.
|
|
107
|
+
- `striptags` correctly removes HTML tags and handles edge cases.
|
|
108
|
+
- Spaceless tag preserves whitespace inside tag attributes correctly.
|
|
109
|
+
|
|
110
|
+
### Changed
|
|
111
|
+
- Condition evaluation rewritten to use shunting-yard algorithm for correct operator precedence.
|
|
112
|
+
- Simplified `for` loop to use `[key, value]` tuples internally for cleaner unpacking.
|
|
113
|
+
- Improved `partialdef` to support both quoted and unquoted partial names.
|
|
114
|
+
- `floatformat` with `-1` argument now removes all decimals.
|
|
115
|
+
|
|
116
|
+
## [1.1.0] - 2026-08-31
|
|
117
|
+
### Added
|
|
118
|
+
- Missing `comment`/`endcomment` tag support for block comments.
|
|
119
|
+
- `firstof` tag to return the first non-falsy value from arguments.
|
|
120
|
+
- `length_is` filter for comparing length to a value.
|
|
121
|
+
- `urlencode`, `escapeuri`, `stringformat`, `cut`, `addslashes`, `removetags` filters for Django parity.
|
|
122
|
+
- `Context.reset()` method for clearing state between renders.
|
|
123
|
+
- `firstof` filter variant for inline first-truthy selection.
|
|
124
|
+
|
|
125
|
+
### Fixed
|
|
126
|
+
- Malformed code in `inheritance.js` with extra closing braces.
|
|
127
|
+
- `__express` was not exported from the module.
|
|
128
|
+
- `__express` now strips Express framework keys (`_locals`, `settings`, etc.) from context.
|
|
129
|
+
- `renderPartial` now properly extracts and renders only the named partial definition.
|
|
130
|
+
- `with` tag now correctly handles multiple `key=value` assignments and quoted values.
|
|
131
|
+
- `if` tag condition evaluation now properly handles `not`, `and`, `or`, and operator precedence.
|
|
132
|
+
- `for` loop now correctly unpacks `key, value` from objects and `item, index` from arrays.
|
|
133
|
+
- `forloop.parentloop` now correctly chains for nested loops.
|
|
134
|
+
- Cycle state (`cycleStates`) now resets per render via `Context.reset()`.
|
|
135
|
+
- Async helpers now work correctly with `asyncRender`.
|
|
136
|
+
- Partial definitions now collected at compile time for proper `renderPartial` support.
|
|
137
|
+
- Path traversal protection added to `extends` tag (previously only on `include`).
|
|
138
|
+
- `floatformat` default behavior now matches Django (1 decimal place).
|
|
139
|
+
- `timesince`/`timeuntil` now handles seconds, minutes, hours, days correctly.
|
|
140
|
+
- `pluralize` now correctly handles singular vs plural forms.
|
|
141
|
+
- `default` filter now treats empty string `''` as falsy like Django.
|
|
142
|
+
- `striptags` now correctly removes HTML tags and handles edge cases.
|
|
143
|
+
- Spaceless tag now preserves whitespace inside tag attributes correctly.
|
|
144
|
+
|
|
145
|
+
### Changed
|
|
146
|
+
- Rewrote condition evaluation to use shunting-yard algorithm for correct operator precedence.
|
|
147
|
+
- Simplified `for` loop to use `[key, value]` tuples internally for cleaner unpacking.
|
|
148
|
+
- Improved `partialdef` to support both quoted and unquoted partial names.
|
|
149
|
+
- `floatformat` with `-1` argument now removes all decimals.
|
|
150
|
+
|
|
151
|
+
## [1.0.0] - 2026-08-29
|
|
152
|
+
### Added
|
|
153
|
+
- Full Django‑style template engine with variables, filters, tags, inheritance, partials, and context processors.
|
|
154
|
+
- Security features: auto‑escaping, `markSafe`, `csrf_token` and `csp_nonce_attr` tags.
|
|
155
|
+
- Extensible API: `registerTag`, `registerFilter`, `markSafe`.
|
|
156
|
+
- Express integration via `__express` adapter.
|
|
157
|
+
- Comprehensive test suite (40 passing tests) and benchmark suite.
|
|
158
|
+
- Detailed documentation hierarchy (`docs/`): overview, installation, usage, tags, filters, partialdef, security, API reference, contribution guide.
|
|
159
|
+
- CI workflow using GitHub Actions.
|
|
160
|
+
- Project scaffolding, linting, and contribution guardrails (`AGENT.md`).
|
|
161
|
+
|
|
162
|
+
### Fixed
|
|
163
|
+
- Auto‑escaping now respects `SafeString` values.
|
|
164
|
+
- Context processors correctly propagate returned context.
|
|
165
|
+
- Fixed tag parsing edge cases in `IfNode` and `PartialDefNode`.
|
|
166
|
+
|
|
167
|
+
### Changed
|
|
168
|
+
- Updated README with npm version and CI badges.
|
|
169
|
+
- Added `CHANGELOG.md` for release notes.
|
|
170
|
+
|
|
171
|
+
[1.2.0]: https://github.com/your-repo/miki-template/releases/tag/v1.2.0
|
|
172
|
+
[1.1.0]: https://github.com/your-repo/miki-template/releases/tag/v1.1.0
|
|
173
|
+
[1.0.0]: https://github.com/your-repo/miki-template/releases/tag/v1.0.0
|
package/CODE_OF_CONDUCT.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
We pledge to make participation in our project a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity, experience level, nationality, personal appearance, race, religion, or sexual orientation.
|
|
5
|
-
|
|
6
|
-
## Our Standards
|
|
7
|
-
Examples of behavior that contributes to creating a positive environment include:
|
|
8
|
-
- Using welcoming and inclusive language.
|
|
9
|
-
- Being respectful of differing viewpoints and experiences.
|
|
10
|
-
- Gracefully accepting constructive criticism.
|
|
11
|
-
- Focusing on what is best for the community.
|
|
12
|
-
- Showing empathy towards other community members.
|
|
13
|
-
|
|
14
|
-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct.
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
We pledge to make participation in our project a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity, experience level, nationality, personal appearance, race, religion, or sexual orientation.
|
|
5
|
+
|
|
6
|
+
## Our Standards
|
|
7
|
+
Examples of behavior that contributes to creating a positive environment include:
|
|
8
|
+
- Using welcoming and inclusive language.
|
|
9
|
+
- Being respectful of differing viewpoints and experiences.
|
|
10
|
+
- Gracefully accepting constructive criticism.
|
|
11
|
+
- Focusing on what is best for the community.
|
|
12
|
+
- Showing empathy towards other community members.
|
|
13
|
+
|
|
14
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
# Contributing to Django-Style Template Engine
|
|
2
|
-
|
|
3
|
-
Thank you for your interest in contributing! Please follow these guidelines:
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 🛠️ Development Setup
|
|
8
|
-
|
|
9
|
-
1. **Clone the Repository**
|
|
10
|
-
2. **Install Dependencies**:
|
|
11
|
-
```bash
|
|
12
|
-
npm install
|
|
13
|
-
```
|
|
14
|
-
3. **Run the Tests**:
|
|
15
|
-
```bash
|
|
16
|
-
npm test
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## 🛑 Guardrails & Standards
|
|
22
|
-
|
|
23
|
-
Before submitting a PR, make sure your code aligns with the strict requirements outlined in [AGENT.md](file:///c:/Users/Coder%20Miki/Desktop/miki-template/AGENT.md):
|
|
24
|
-
- Ensure full parity with Django syntax behavior.
|
|
25
|
-
- Do not use `eval()` for safety.
|
|
26
|
-
- Write corresponding unit tests in `tests/` for all new features or bug fixes.
|
|
27
|
-
- Verify that auto-escaping remains secure by default.
|
|
1
|
+
# Contributing to Django-Style Template Engine
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing! Please follow these guidelines:
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🛠️ Development Setup
|
|
8
|
+
|
|
9
|
+
1. **Clone the Repository**
|
|
10
|
+
2. **Install Dependencies**:
|
|
11
|
+
```bash
|
|
12
|
+
npm install
|
|
13
|
+
```
|
|
14
|
+
3. **Run the Tests**:
|
|
15
|
+
```bash
|
|
16
|
+
npm test
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🛑 Guardrails & Standards
|
|
22
|
+
|
|
23
|
+
Before submitting a PR, make sure your code aligns with the strict requirements outlined in [AGENT.md](file:///c:/Users/Coder%20Miki/Desktop/miki-template/AGENT.md):
|
|
24
|
+
- Ensure full parity with Django syntax behavior.
|
|
25
|
+
- Do not use `eval()` for safety.
|
|
26
|
+
- Write corresponding unit tests in `tests/` for all new features or bug fixes.
|
|
27
|
+
- Verify that auto-escaping remains secure by default.
|