janja 2.1.0 → 2.1.2
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/LICENSE +21 -0
- package/README.md +50 -0
- package/dist/index.cjs.js +1390 -1227
- package/dist/index.d.ts +65 -105
- package/dist/index.esm.js +1390 -1227
- package/dist/index.js +1390 -1227
- package/package.json +23 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 李文富
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Janja
|
|
2
|
+
|
|
3
|
+
<p align="center">A simple, fast, lightweight, and extensible template engine for Node.js and browsers.</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://github.com/vvenv/janja/actions/workflows/test.yml"><img src="https://github.com/vvenv/janja/actions/workflows/test.yml/badge.svg" alt="test"></a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="./README-zh-CN.md">中文</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
## Key Features
|
|
14
|
+
|
|
15
|
+
- 📝 **Intuitive template syntax**: Simple syntax for variables, conditionals, and loops.
|
|
16
|
+
- 🔄 **Layout and partials**: Supports template inheritance and reusable components.
|
|
17
|
+
- 🛠️ **Built-in directives and filters**: A collection of built-in directives and filters.
|
|
18
|
+
- 🎨 **Custom directives and filters**: Ability to define custom directives and filters.
|
|
19
|
+
- 🚀 **Pre-compilation**: Enhance rendering performance by precompiling.
|
|
20
|
+
- 🐛 **Error handling and debugging**: Provides detailed error reporting and debugging support.
|
|
21
|
+
- 🛡️ **Security**: Sandbox mode, and automatic escaping.
|
|
22
|
+
- 🛫 **Asynchronous data loading**: Supports fetching and displaying remote data asynchronously.
|
|
23
|
+
- 🌐 **Universal compatibility**: Works in both Node.js and browser environments.
|
|
24
|
+
- 📦 **Zero dependencies**: Lightweight with no external dependencies.
|
|
25
|
+
|
|
26
|
+
## Play Online
|
|
27
|
+
|
|
28
|
+
[StackBlitz](https://stackblitz.com/edit/janja?file=main.ts)
|
|
29
|
+
|
|
30
|
+
## Getting Started
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
import { render } from 'janja'
|
|
34
|
+
|
|
35
|
+
document.body.innerHTML = await render('Hello, {{= name }}!', { name: 'World' })
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
or
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
import { renderFile } from 'janja'
|
|
42
|
+
|
|
43
|
+
document.body.innerHTML = await renderFile('./template.html', { name: 'World' })
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
[Documentation](./documentation.md)
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
`Janja` is released under the [MIT License](https://opensource.org/licenses/MIT). You are free to use, modify, and distribute it as long as you comply with the license terms.
|