janja 2.4.3 β 4.0.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.
- package/README.md +29 -40
- package/dist/index.cjs +5536 -0
- package/dist/index.d.ts +705 -20
- package/dist/index.esm.js +4032 -1481
- package/dist/index.js +4085 -1490
- package/dist/index.min.js +1 -0
- package/package.json +52 -33
- package/dist/index.cjs.js +0 -2941
package/README.md
CHANGED
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
The Reeds
|
|
4
|
-
Tr. ZHAO Yanchun
|
|
5
|
-
|
|
6
|
-
The reeds sway, green and green;
|
|
7
|
-
The white dew becomes frost.
|
|
8
|
-
The lady fair I mean
|
|
9
|
-
Looms yonder, all but lost.
|
|
10
|
-
Upstream to her I row;
|
|
11
|
-
The course is long and high.
|
|
12
|
-
Upstream to her I go;
|
|
13
|
-
On the waves she looks shy.
|
|
14
|
-
|
|
15
|
-
The reeds sway, clean and clean;
|
|
16
|
-
The white dew has not dried.
|
|
17
|
-
The lady fair I mean
|
|
18
|
-
Looms by the riverside.
|
|
19
|
-
Upstream to her I row;
|
|
20
|
-
The course is hard and high.
|
|
21
|
-
Upstream to her I go;
|
|
22
|
-
On the strand she seems nigh.
|
|
23
|
-
|
|
24
|
-
The reeds sway, sheen and sheen;
|
|
25
|
-
The white dew as eβer gleams.
|
|
26
|
-
The lady fair I mean
|
|
27
|
-
Stands on the bank, it seems.
|
|
28
|
-
Upstream to her I row;
|
|
29
|
-
The course turns left and right.
|
|
30
|
-
Upstream to her I go;
|
|
31
|
-
On the shoal she beams bright.
|
|
32
|
-
|
|
33
1
|
# Janja
|
|
34
2
|
|
|
35
3
|
<p align="center">A simple, fast, lightweight, and extensible template engine for Node.js and browsers.</p>
|
|
@@ -48,16 +16,17 @@
|
|
|
48
16
|
- π **Layout and partials**: Supports template inheritance and reusable components.
|
|
49
17
|
- π οΈ **Built-in directives and filters**: A collection of built-in directives and filters.
|
|
50
18
|
- π¨ **Custom directives and filters**: Ability to define custom directives and filters.
|
|
51
|
-
- π **
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
19
|
+
- π **Fast**: Templates compile to JavaScript functions, cached per renderer or pre-compiled at build time. See the [benchmarks](./PERFORMANCE.md#benchmarks).
|
|
20
|
+
- π‘οΈ **Safe by default**: HTML auto-escaping, and expressions that cannot reach JavaScript globals or object internals. See [Security](./SECURITY.md) for what is and is not covered.
|
|
21
|
+
- π **Rich filter library**: Date/time, number formatting, text processing, array manipulation, object transformation, and async filters.
|
|
22
|
+
- π **Helpful errors**: Errors throw by default and point at the offending line of the template; a lenient mode and a validator are available.
|
|
23
|
+
- π« **Async and streaming**: Async filters and loaders, and `renderStream()` to send a page while it renders.
|
|
55
24
|
- π **Universal compatibility**: Works in both Node.js and browser environments.
|
|
56
|
-
- π¦ **Zero dependencies**:
|
|
25
|
+
- π¦ **Zero dependencies**: About 19 kB minified and gzipped.
|
|
57
26
|
|
|
58
27
|
## Play Online
|
|
59
28
|
|
|
60
|
-
[
|
|
29
|
+
Try it in the [playground](https://janja.wenfu.dev/playground), which runs the engine in your browser.
|
|
61
30
|
|
|
62
31
|
## Getting Started
|
|
63
32
|
|
|
@@ -72,10 +41,30 @@ or
|
|
|
72
41
|
```javascript
|
|
73
42
|
import { renderFile } from 'janja'
|
|
74
43
|
|
|
75
|
-
|
|
44
|
+
// templates are loaded through the `loader` option, which also resolves `include`
|
|
45
|
+
const options = { loader: (path) => fetch(path).then((res) => res.text()) }
|
|
46
|
+
|
|
47
|
+
document.body.innerHTML = await renderFile('./template.html', { name: 'World' }, options)
|
|
76
48
|
```
|
|
77
49
|
|
|
78
|
-
|
|
50
|
+
## Documentation
|
|
51
|
+
|
|
52
|
+
The documentation lives at **[janja.wenfu.dev](https://janja.wenfu.dev)**. The same content is in this repository:
|
|
53
|
+
|
|
54
|
+
- [Language specification](./SPEC.md) - Syntax and semantics, backed by a conformance suite
|
|
55
|
+
- [Documentation](./documentation.md) - API, CLI and tooling
|
|
56
|
+
- [Filters](./FILTERS.md) - Built-in filter reference
|
|
57
|
+
- [Security](./SECURITY.md) - What is protected, what is not, and how to report issues
|
|
58
|
+
- [Performance](./PERFORMANCE.md) - Caching, pre-compilation and benchmarks
|
|
59
|
+
|
|
60
|
+
## Ecosystem
|
|
61
|
+
|
|
62
|
+
- [`janja-cli`](./packages/janja-cli) - pre-compile, watch and check templates
|
|
63
|
+
- [`vite-plugin-janja`](./packages/vite-plugin-janja) - import templates in Vite and Rollup
|
|
64
|
+
- [`janja-express`](./packages/janja-express), [`janja-koa`](./packages/janja-koa), [`janja-fastify`](./packages/janja-fastify) - server framework integrations
|
|
65
|
+
- [`janja-language-server`](./packages/janja-language-server) - language server for any LSP editor
|
|
66
|
+
- [`eslint-plugin-janja`](./packages/eslint-plugin-janja) - formatting rules
|
|
67
|
+
- [`vscode-janja`](./packages/vscode-janja) - VS Code language support
|
|
79
68
|
|
|
80
69
|
## License
|
|
81
70
|
|