eleventy-plugin-vento 1.1.0 → 1.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/.github/actions/setup/action.yml +2 -3
- package/.github/workflows/{ci.yaml → ci.yml} +2 -1
- package/.github/workflows/release.yml +24 -19
- package/VentoPlugin.js +8 -0
- package/package.json +48 -45
- package/readme.md +32 -7
- package/release.config.js +24 -0
- package/test/input/root.vto +6 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
name:
|
|
2
|
-
description:
|
|
1
|
+
name: Setup
|
|
2
|
+
description: Setup project with pnpm
|
|
3
3
|
|
|
4
4
|
outputs:
|
|
5
5
|
cache-hit:
|
|
@@ -17,7 +17,6 @@ runs:
|
|
|
17
17
|
uses: actions/setup-node@v4
|
|
18
18
|
with:
|
|
19
19
|
node-version-file: .node-version
|
|
20
|
-
registry-url: 'https://registry.npmjs.org'
|
|
21
20
|
cache: pnpm
|
|
22
21
|
cache-dependency-path: pnpm-lock.yaml
|
|
23
22
|
|
|
@@ -2,35 +2,40 @@ name: Release
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
|
|
6
|
-
-
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- alpha
|
|
8
|
+
- beta
|
|
9
|
+
- next
|
|
10
|
+
- next-major
|
|
11
|
+
- v[0-9]+.[0-9]+.[0-9]+
|
|
12
|
+
- v[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+
|
|
7
13
|
|
|
8
14
|
jobs:
|
|
15
|
+
test:
|
|
16
|
+
uses: ./.github/workflows/ci.yml
|
|
17
|
+
|
|
9
18
|
release:
|
|
10
19
|
runs-on: ubuntu-latest
|
|
11
20
|
permissions:
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
contents: write # to be able to publish a GitHub release
|
|
22
|
+
id-token: write # to enable use of OIDC for npm provenance
|
|
23
|
+
issues: write # to be able to comment on released issues
|
|
24
|
+
pull-requests: write # to be able to comment on released pull requests
|
|
25
|
+
needs: test
|
|
14
26
|
steps:
|
|
15
27
|
- uses: actions/checkout@v4
|
|
28
|
+
with:
|
|
29
|
+
fetch-depth: 0
|
|
16
30
|
|
|
17
31
|
- name: Setup
|
|
18
32
|
uses: ./.github/actions/setup
|
|
19
33
|
|
|
20
|
-
- name:
|
|
21
|
-
run:
|
|
22
|
-
|
|
23
|
-
- name: Publish
|
|
24
|
-
env:
|
|
25
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
26
|
-
NPM_CONFIG_PROVENANCE: true
|
|
27
|
-
run: |
|
|
28
|
-
pnpm publish --no-git-checks --access public
|
|
29
|
-
|
|
30
|
-
- name: Write changelog
|
|
31
|
-
run: pnpm dlx changelogithub@latest --output CHANGELOG.md
|
|
34
|
+
- name: Verify provenance attestations and registry signatures
|
|
35
|
+
run: npm audit signatures
|
|
32
36
|
|
|
33
37
|
- name: Release
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
env:
|
|
39
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
40
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
41
|
+
run: pnpm exec semantic-release
|
package/VentoPlugin.js
CHANGED
|
@@ -57,6 +57,7 @@ export function VentoPlugin(eleventyConfig, options = {}) {
|
|
|
57
57
|
eleventyConfig.addTemplateFormats('vto');
|
|
58
58
|
eleventyConfig.addExtension('vto', {
|
|
59
59
|
outputFileExtension: 'html',
|
|
60
|
+
|
|
60
61
|
async compile(inputContent, inputPath) {
|
|
61
62
|
return async (data) => {
|
|
62
63
|
if (options.addHelpers) {
|
|
@@ -76,5 +77,12 @@ export function VentoPlugin(eleventyConfig, options = {}) {
|
|
|
76
77
|
return await env.runString(inputContent, data, inputPath).then((result) => result.content);
|
|
77
78
|
};
|
|
78
79
|
},
|
|
80
|
+
|
|
81
|
+
compileOptions: {
|
|
82
|
+
permalink(contents, inputPath) {
|
|
83
|
+
if (!contents) return contents;
|
|
84
|
+
return (data) => env.runString(contents, data, inputPath).then((result) => result.content);
|
|
85
|
+
},
|
|
86
|
+
},
|
|
79
87
|
});
|
|
80
88
|
}
|
package/package.json
CHANGED
|
@@ -1,46 +1,49 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
2
|
+
"name": "eleventy-plugin-vento",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "Adds support for the Vento templating language to Eleventy.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"packageManager": "pnpm@9.1.4",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=16"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "rm -rf test/output; cd test/input; eleventy",
|
|
12
|
+
"test-serve": "rm -rf test/output; cd test/input; eleventy --serve"
|
|
13
|
+
},
|
|
14
|
+
"main": "./VentoPlugin.js",
|
|
15
|
+
"repository": "git@github.com:noelforte/eleventy-plugin-vento.git",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/noelforte/eleventy-plugin-vento/issues"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"eleventy",
|
|
21
|
+
"eleventy-plugin",
|
|
22
|
+
"ventojs",
|
|
23
|
+
"templating"
|
|
24
|
+
],
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "Noel Forte",
|
|
27
|
+
"email": "noel@forte.is",
|
|
28
|
+
"url": "https://forte.is/"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"ventojs": "0.12.6"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@11ty/eleventy": "3.0.0-alpha.10",
|
|
36
|
+
"conventional-changelog-conventionalcommits": "^8.0.0",
|
|
37
|
+
"eslint": "9.4.0",
|
|
38
|
+
"eslint-config-flat-gitignore": "0.1.5",
|
|
39
|
+
"eslint-config-prettier": "9.1.0",
|
|
40
|
+
"globals": "15.3.0",
|
|
41
|
+
"semantic-release": "24.0.0"
|
|
42
|
+
},
|
|
43
|
+
"prettier": {
|
|
44
|
+
"bracketSameLine": true,
|
|
45
|
+
"singleQuote": true,
|
|
46
|
+
"semi": true,
|
|
47
|
+
"trailingComma": "es5"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/readme.md
CHANGED
|
@@ -6,6 +6,7 @@ An [Eleventy](https://11ty.dev/) plugin that adds support for [Vento](https://ve
|
|
|
6
6
|
[Usage](#usage)<br>
|
|
7
7
|
[Plugin Options](#plugin-options)<br>
|
|
8
8
|
[Vento Filters](#vento-filters)<br>
|
|
9
|
+
[Vento Plugins](#vento-plugins)<br>
|
|
9
10
|
[JavaScript Helpers](#javascript-helpers)<br>
|
|
10
11
|
|
|
11
12
|
## Installing
|
|
@@ -43,6 +44,9 @@ export default function (eleventyConfig) {
|
|
|
43
44
|
// A set of filters to load into Vento
|
|
44
45
|
filters: {},
|
|
45
46
|
|
|
47
|
+
// An array of Vento plugins to load
|
|
48
|
+
plugins: [],
|
|
49
|
+
|
|
46
50
|
// Define whether Javascript Functions should be added
|
|
47
51
|
// to page data. See below for usage notes on this.
|
|
48
52
|
addHelpers: true
|
|
@@ -57,7 +61,7 @@ export default function (eleventyConfig) {
|
|
|
57
61
|
}
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
View the [full list of options](https://vento.js.org/configuration/#options/) to pass as a Vento Configuration object.
|
|
64
|
+
View the [full list of options](https://vento.js.org/configuration/#options/) to pass as a Vento Configuration object (as `ventoOptions`).
|
|
61
65
|
|
|
62
66
|
## Vento Filters
|
|
63
67
|
|
|
@@ -66,12 +70,14 @@ Set the `filters` property to an object with methods, these will be loaded as fi
|
|
|
66
70
|
Here's an example of defining an `italicize` filter like the example in the Vento documentation:
|
|
67
71
|
|
|
68
72
|
```js
|
|
69
|
-
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
export default function (eleventyConfig) {
|
|
74
|
+
eleventyConfig.addPlugin(VentoPlugin, {
|
|
75
|
+
filters: {
|
|
76
|
+
italicize(text) {
|
|
77
|
+
return `<em>${text}</em>`;
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
});
|
|
75
81
|
}
|
|
76
82
|
```
|
|
77
83
|
|
|
@@ -83,6 +89,25 @@ And now we can use our filter in a template:
|
|
|
83
89
|
|
|
84
90
|
See https://vento.js.org/configuration/#filters for more information about filters and how they work.
|
|
85
91
|
|
|
92
|
+
## Vento Plugins
|
|
93
|
+
|
|
94
|
+
If you'd like to extend the Vento library with any plugins, include them in an array passed to the `plugins` option. Here's an example loading the [auto trim](https://vento.js.org/plugins/auto-trim/) plugin:
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
import { VentoPlugin } from 'eleventy-plugin-vento';
|
|
98
|
+
import autoTrim, { defaultTags } from 'ventojs/plugins/autotrim_plugin.js';
|
|
99
|
+
|
|
100
|
+
export default function (eleventyConfig) {
|
|
101
|
+
eleventyConfig.addPlugin(VentoPlugin, {
|
|
102
|
+
plugins: [
|
|
103
|
+
autoTrim({
|
|
104
|
+
tags: ['tag', ...defaultTags],
|
|
105
|
+
}),
|
|
106
|
+
],
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
86
111
|
## JavaScript Helpers
|
|
87
112
|
|
|
88
113
|
Vento can [run arbitrary JavaScript](https://vento.js.org/syntax/javascript/) in templates through its `{{> ...}}` operator, which evaluates at the time the template is run. However, you may want to use Eleventy Shortcodes and Filters in your templates as well.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const presetConfig = {
|
|
2
|
+
types: [
|
|
3
|
+
{ type: 'feat', section: 'New Features' },
|
|
4
|
+
{ type: 'fix', section: 'Bug Fixes' },
|
|
5
|
+
{ type: 'refactor', section: 'Refactorings' },
|
|
6
|
+
{ type: 'docs', hidden: 'Documentation' },
|
|
7
|
+
{ type: 'chore', hidden: true },
|
|
8
|
+
{ type: 'perf', hidden: true },
|
|
9
|
+
{ type: 'style', hidden: true },
|
|
10
|
+
{ type: 'test', hidden: true },
|
|
11
|
+
],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @type {import('semantic-release').Options} */
|
|
15
|
+
export default {
|
|
16
|
+
preset: 'conventionalcommits',
|
|
17
|
+
presetConfig,
|
|
18
|
+
plugins: [
|
|
19
|
+
['@semantic-release/commit-analyzer'],
|
|
20
|
+
'@semantic-release/release-notes-generator',
|
|
21
|
+
'@semantic-release/npm',
|
|
22
|
+
'@semantic-release/github',
|
|
23
|
+
],
|
|
24
|
+
};
|