eleventy-plugin-vento 2.3.0 → 2.5.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/.github/renovate.json +11 -1
- package/.github/workflows/ci.yml +2 -5
- package/.github/workflows/release.yml +5 -7
- package/.node-version +1 -1
- package/.vscode/tests.code-snippets +16 -0
- package/jsconfig.json +2 -1
- package/package.json +10 -9
- package/readme.md +68 -1
- package/release.config.js +9 -2
- package/tests/autotrim/autotrim.test.js +2 -4
- package/tests/basic/basic.test.js +2 -4
- package/tests/filters/filters.test.js +4 -11
- package/tests/includes/includes.test.js +1 -1
- package/tests/layouts/layouts.test.js +3 -7
- package/tests/permalinks/permalinks.test.js +1 -1
- package/tests/shortcodes/shortcodes.test.js +1 -1
- package/tests/ssr/ssr.test.js +1 -1
package/.github/renovate.json
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": ["github>noelforte/renovate-config",
|
|
2
|
+
"extends": ["github>noelforte/renovate-config"],
|
|
3
|
+
"packageRules": [
|
|
4
|
+
{
|
|
5
|
+
"matchDepTypes": ["dependencies"],
|
|
6
|
+
"semanticCommitType": "upstream",
|
|
7
|
+
"semanticCommitScope": null
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"matchDepTypes": ["devDependencies"]
|
|
11
|
+
}
|
|
12
|
+
]
|
|
3
13
|
}
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
name: Release
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
4
|
+
workflow_run:
|
|
5
|
+
types: [completed]
|
|
6
|
+
workflows: [CI]
|
|
5
7
|
branches: [main, alpha, beta, next]
|
|
6
|
-
workflow_dispatch:
|
|
7
8
|
|
|
8
9
|
jobs:
|
|
9
|
-
test:
|
|
10
|
-
uses: ./.github/workflows/ci.yml
|
|
11
|
-
|
|
12
10
|
release:
|
|
11
|
+
if: github.event.workflow_run.conclusion == 'success'
|
|
13
12
|
runs-on: ubuntu-latest
|
|
14
|
-
needs: test
|
|
15
13
|
permissions:
|
|
16
14
|
contents: write # to be able to publish a GitHub release
|
|
17
15
|
id-token: write # to enable use of OIDC for npm provenance
|
|
@@ -32,4 +30,4 @@ jobs:
|
|
|
32
30
|
env:
|
|
33
31
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
34
32
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
35
|
-
run: pnpm exec semantic-release
|
|
33
|
+
run: pnpm exec semantic-release
|
package/.node-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
20.
|
|
1
|
+
20.15.1
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"New test suite": {
|
|
3
|
+
"scope": "javascript",
|
|
4
|
+
"prefix": "VentoPluginTest",
|
|
5
|
+
"body": [
|
|
6
|
+
"import { expect, test } from 'vitest';",
|
|
7
|
+
"import { runBuild } from '#test-instance';\n",
|
|
8
|
+
"const results = await runBuild(import.meta.dirname, {",
|
|
9
|
+
"\t${1:eleventy(configApi) {\\}},",
|
|
10
|
+
"\t${2:vento: {\\}},",
|
|
11
|
+
"});"
|
|
12
|
+
],
|
|
13
|
+
"description": "Create a new test suite for eleventy-plugin-vento",
|
|
14
|
+
"isFileTemplate": true
|
|
15
|
+
}
|
|
16
|
+
}
|
package/jsconfig.json
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eleventy-plugin-vento",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Adds support for the Vento templating language to Eleventy.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"packageManager": "pnpm@9.
|
|
6
|
+
"packageManager": "pnpm@9.5.0",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=16"
|
|
9
9
|
},
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"main": "./VentoPlugin.js",
|
|
15
15
|
"imports": {
|
|
16
|
-
"#lib/*": "./lib/*"
|
|
16
|
+
"#lib/*": "./lib/*",
|
|
17
|
+
"#test-instance": "./tests/get-instance.js"
|
|
17
18
|
},
|
|
18
19
|
"exports": {
|
|
19
20
|
".": "./VentoPlugin.js"
|
|
@@ -35,15 +36,15 @@
|
|
|
35
36
|
},
|
|
36
37
|
"license": "MIT",
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"ventojs": "0.12.
|
|
39
|
+
"ventojs": "0.12.9"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@11ty/eleventy": "3.0.0-alpha.
|
|
42
|
-
"conventional-changelog-conventionalcommits": "
|
|
43
|
-
"eslint
|
|
42
|
+
"@11ty/eleventy": "3.0.0-alpha.14",
|
|
43
|
+
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
44
|
+
"eslint": "9.6.0",
|
|
45
|
+
"eslint-config-flat-gitignore": "0.1.7",
|
|
44
46
|
"eslint-config-prettier": "9.1.0",
|
|
45
|
-
"
|
|
46
|
-
"globals": "15.4.0",
|
|
47
|
+
"globals": "15.8.0",
|
|
47
48
|
"semantic-release": "24.0.0",
|
|
48
49
|
"vitest": "1.6.0"
|
|
49
50
|
},
|
package/readme.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
# eleventy-plugin-vento 🌬️🎈🐀
|
|
2
2
|
|
|
3
|
+
<a href="https://github.com/noelforte/eleventy-plugin-vento/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/noelforte/eleventy-plugin-vento/ci.yml?branch=main&style=flat-square&logo=github&logoColor=fff&label=Tests&labelColor=333" alt="Github Actions Status"></a>
|
|
4
|
+
<a href="https://npmjs.com/package/eleventy-plugin-vento"><img src="https://img.shields.io/npm/v/eleventy-plugin-vento?style=flat-square&logo=npm&logoColor=fff&labelColor=333" alt="eleventy-plugin-vento on npm"></a>
|
|
5
|
+
<a href="https://github.com/semantic-release/semantic-release"><img src="https://img.shields.io/badge/semantic--release-Conventional_Commits-fa6673?style=flat-square&logo=semanticrelease&logoColor=fff&labelColor=333" alt="semantic-release"></a>
|
|
6
|
+
|
|
3
7
|
An [Eleventy](https://11ty.dev/) plugin that adds support for [Vento](https://vento.js.org/) templates.
|
|
4
8
|
|
|
9
|
+
## Contents
|
|
10
|
+
|
|
5
11
|
[Installing](#installing)<br>
|
|
6
12
|
[Usage](#usage)<br>
|
|
7
13
|
[Plugin Options](#plugin-options)<br>
|
|
@@ -9,6 +15,7 @@ An [Eleventy](https://11ty.dev/) plugin that adds support for [Vento](https://ve
|
|
|
9
15
|
[Vento Plugins](#vento-plugins)<br>
|
|
10
16
|
[Auto-Trimming Tags](#auto-trimming-tags)<br>
|
|
11
17
|
[JavaScript Helpers](#javascript-helpers)<br>
|
|
18
|
+
[Hybrid Rendering](#hybrid-rendering)<br>
|
|
12
19
|
|
|
13
20
|
## Installing
|
|
14
21
|
|
|
@@ -159,7 +166,7 @@ Alternatively, if you'd rather keep functions namespaced in your page data, pass
|
|
|
159
166
|
addPlugin(VentoPlugin, { addHelpers: 'functions' });
|
|
160
167
|
```
|
|
161
168
|
|
|
162
|
-
```
|
|
169
|
+
```nunjucks
|
|
163
170
|
<!-- With the above, this: -->
|
|
164
171
|
<p>This is something {{ italicize('really') }} important.</p>
|
|
165
172
|
<p>{{ possumPosse() }}</p>
|
|
@@ -176,3 +183,63 @@ eleventyConfig.addPlugin(VentoPlugin, {
|
|
|
176
183
|
addHelpers: false,
|
|
177
184
|
});
|
|
178
185
|
```
|
|
186
|
+
|
|
187
|
+
## Hybrid Rendering
|
|
188
|
+
|
|
189
|
+
Exclusive to this plugin is the ability to skip processing a vento tag entirely and instead preserve the tag in the markup. This could be useful if you're doing some hybrid rendering and would like to defer certain tags from being processed until load time, so they can be rendered on the server.
|
|
190
|
+
|
|
191
|
+
To skip over a tag, add a `!` directly after the opening tag.
|
|
192
|
+
|
|
193
|
+
```nunjucks
|
|
194
|
+
<!-- This: -->
|
|
195
|
+
{{! doSomeServerSideStuff() }}
|
|
196
|
+
|
|
197
|
+
<!-- Renders as: -->
|
|
198
|
+
{{ doSomeServerSideStuff() }}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Works with JS expressions too:
|
|
202
|
+
|
|
203
|
+
```nunjucks
|
|
204
|
+
{{!> 2 + 2 }}
|
|
205
|
+
|
|
206
|
+
<!-- Renders as: -->
|
|
207
|
+
{{> 2 + 2 }}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The Vento language offers similar functionality via the [`echo` tag](https://vento.js.org/syntax/print/#echo) which works great for blocks, but can be verbose for 1-off tags.
|
|
211
|
+
|
|
212
|
+
Consider the following:
|
|
213
|
+
|
|
214
|
+
```nunjucks
|
|
215
|
+
{{ echo }}
|
|
216
|
+
<!-- Will be preserved in output -->
|
|
217
|
+
{{ if someCondition }}
|
|
218
|
+
<p>{{ getServerData }}</p>
|
|
219
|
+
{{ /echo }}
|
|
220
|
+
|
|
221
|
+
<!-- Can't render this without exiting and re-entering echo -->
|
|
222
|
+
<p>Page built on: {{ localBuildTime }}</p>
|
|
223
|
+
|
|
224
|
+
{{ echo }}
|
|
225
|
+
{{ /if }}
|
|
226
|
+
{{ /echo }}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Rather than having to do multiple `{{ /echo }} ... {{ echo }}` statements, the previous can be rewritten as such:
|
|
230
|
+
|
|
231
|
+
```nunjucks
|
|
232
|
+
<!-- This: -->
|
|
233
|
+
{{! if someCondition }}
|
|
234
|
+
<p>{{! getServerData }}</p>
|
|
235
|
+
|
|
236
|
+
<p>Page built on: {{ localBuildTime }}</p>
|
|
237
|
+
{{! /if }}
|
|
238
|
+
|
|
239
|
+
<!-- Renders as: -->
|
|
240
|
+
{{ if someCondition }}
|
|
241
|
+
<p>{{ getServerData }}</p>
|
|
242
|
+
|
|
243
|
+
<p>Page built on: 04-08-2024</p>
|
|
244
|
+
{{ /if }}
|
|
245
|
+
```
|
package/release.config.js
CHANGED
|
@@ -2,8 +2,9 @@ const presetConfig = {
|
|
|
2
2
|
types: [
|
|
3
3
|
{ type: 'feat', section: 'New Features' },
|
|
4
4
|
{ type: 'fix', section: 'Bug Fixes' },
|
|
5
|
-
{ type: 'refactor', section: '
|
|
6
|
-
{ type: '
|
|
5
|
+
{ type: 'refactor', section: 'Refactors' },
|
|
6
|
+
{ type: 'upstream', section: 'Dependency Updates' },
|
|
7
|
+
{ type: 'docs', hidden: true },
|
|
7
8
|
{ type: 'chore', hidden: true },
|
|
8
9
|
{ type: 'perf', hidden: true },
|
|
9
10
|
{ type: 'style', hidden: true },
|
|
@@ -11,10 +12,16 @@ const presetConfig = {
|
|
|
11
12
|
],
|
|
12
13
|
};
|
|
13
14
|
|
|
15
|
+
const releaseRules = [
|
|
16
|
+
{ breaking: true, release: 'major' },
|
|
17
|
+
{ type: 'upstream', release: 'minor' },
|
|
18
|
+
];
|
|
19
|
+
|
|
14
20
|
/** @type {import('semantic-release').Options} */
|
|
15
21
|
export default {
|
|
16
22
|
preset: 'conventionalcommits',
|
|
17
23
|
presetConfig,
|
|
24
|
+
releaseRules,
|
|
18
25
|
plugins: [
|
|
19
26
|
['@semantic-release/commit-analyzer'],
|
|
20
27
|
'@semantic-release/release-notes-generator',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect, test } from 'vitest';
|
|
2
|
-
import { runBuild } from '
|
|
2
|
+
import { runBuild } from '#test-instance';
|
|
3
3
|
|
|
4
4
|
const [trimSingle, trimAll] = await Promise.all([
|
|
5
5
|
runBuild(import.meta.dirname, { vento: { trimTags: ['set'] } }),
|
|
@@ -8,9 +8,7 @@ const [trimSingle, trimAll] = await Promise.all([
|
|
|
8
8
|
|
|
9
9
|
test('should trim a single tag', async () => {
|
|
10
10
|
const page = trimSingle[0];
|
|
11
|
-
await expect(page.content).toMatchFileSnapshot(
|
|
12
|
-
'./build/autotrim-single.html'
|
|
13
|
-
);
|
|
11
|
+
await expect(page.content).toMatchFileSnapshot('./build/autotrim-single.html');
|
|
14
12
|
});
|
|
15
13
|
|
|
16
14
|
test('should trim all tags', async () => {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { expect, test } from 'vitest';
|
|
2
|
-
import { runBuild } from '
|
|
2
|
+
import { runBuild } from '#test-instance';
|
|
3
3
|
|
|
4
4
|
const results = await runBuild(import.meta.dirname);
|
|
5
5
|
|
|
6
6
|
test('renders a basic template', async () => {
|
|
7
7
|
const page = results[0];
|
|
8
|
-
await expect(page.content).toMatchFileSnapshot(
|
|
9
|
-
'./__snapshots__/template-basic.html'
|
|
10
|
-
);
|
|
8
|
+
await expect(page.content).toMatchFileSnapshot('./__snapshots__/template-basic.html');
|
|
11
9
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect, test } from 'vitest';
|
|
2
|
-
import { runBuild } from '
|
|
2
|
+
import { runBuild } from '#test-instance';
|
|
3
3
|
|
|
4
4
|
const results = await runBuild(import.meta.dirname, {
|
|
5
5
|
eleventy(configApi) {
|
|
@@ -9,10 +9,7 @@ const results = await runBuild(import.meta.dirname, {
|
|
|
9
9
|
(content) => content.toUpperCase()
|
|
10
10
|
);
|
|
11
11
|
|
|
12
|
-
configApi.addFilter(
|
|
13
|
-
'wrapWith',
|
|
14
|
-
(content, tag) => `<${tag}>${content}</${tag}>`
|
|
15
|
-
);
|
|
12
|
+
configApi.addFilter('wrapWith', (content, tag) => `<${tag}>${content}</${tag}>`);
|
|
16
13
|
|
|
17
14
|
configApi.addFilter('pageUrlCompare', function (url) {
|
|
18
15
|
return url === this.page.url;
|
|
@@ -22,16 +19,12 @@ const results = await runBuild(import.meta.dirname, {
|
|
|
22
19
|
|
|
23
20
|
test('transforms string with built-in method', async () => {
|
|
24
21
|
const page = results.find(({ url }) => url === '/basic/');
|
|
25
|
-
await expect(page.content).toMatchFileSnapshot(
|
|
26
|
-
'./__snapshots__/filters-basic.html'
|
|
27
|
-
);
|
|
22
|
+
await expect(page.content).toMatchFileSnapshot('./__snapshots__/filters-basic.html');
|
|
28
23
|
});
|
|
29
24
|
|
|
30
25
|
test('transforms string with passed arguments', async () => {
|
|
31
26
|
const page = results.find(({ url }) => url === '/with-arguments/');
|
|
32
|
-
await expect(page.content).toMatchFileSnapshot(
|
|
33
|
-
'./__snapshots__/filters-arguments.html'
|
|
34
|
-
);
|
|
27
|
+
await expect(page.content).toMatchFileSnapshot('./__snapshots__/filters-arguments.html');
|
|
35
28
|
});
|
|
36
29
|
|
|
37
30
|
test('verify page context in scoped data', async () => {
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { expect, test } from 'vitest';
|
|
2
|
-
import { runBuild } from '
|
|
2
|
+
import { runBuild } from '#test-instance';
|
|
3
3
|
|
|
4
4
|
const results = await runBuild(import.meta.dirname);
|
|
5
5
|
|
|
6
6
|
test('render page with example layout 1', async () => {
|
|
7
7
|
const page = results.find(({ url }) => url === '/page1/');
|
|
8
|
-
await expect(page.content).toMatchFileSnapshot(
|
|
9
|
-
'./__snapshots__/example-layout-1.html'
|
|
10
|
-
);
|
|
8
|
+
await expect(page.content).toMatchFileSnapshot('./__snapshots__/example-layout-1.html');
|
|
11
9
|
});
|
|
12
10
|
|
|
13
11
|
test('render page with example layout 2', async () => {
|
|
14
12
|
const page = results.find(({ url }) => url === '/page2/');
|
|
15
|
-
await expect(page.content).toMatchFileSnapshot(
|
|
16
|
-
'./__snapshots__/example-layout-2.html'
|
|
17
|
-
);
|
|
13
|
+
await expect(page.content).toMatchFileSnapshot('./__snapshots__/example-layout-2.html');
|
|
18
14
|
});
|
package/tests/ssr/ssr.test.js
CHANGED