janja 2.4.2 β†’ 3.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 CHANGED
@@ -1,35 +1,3 @@
1
- ![](https://repository-images.githubusercontent.com/989161365/d61a6f29-b7e9-4fbe-8ea2-adac36ea8f44)
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
- - πŸš€ **Pre-compilation**: Enhance rendering performance by precompiling.
52
- - πŸ› **Error handling and debugging**: Provides detailed error reporting and debugging support.
53
- - πŸ›‘οΈ **Security**: Automatic escaping.
54
- - πŸ›« **Asynchronous data loading**: Supports fetching and displaying remote data asynchronously.
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**: Lightweight with no external dependencies.
25
+ - πŸ“¦ **Zero dependencies**: About 19 kB minified and gzipped.
57
26
 
58
27
  ## Play Online
59
28
 
60
- [StackBlitz](https://stackblitz.com/edit/janja?file=main.ts)
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
- document.body.innerHTML = await renderFile('./template.html', { name: 'World' })
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
- [Documentation](./documentation.md)
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