eleventy-plugin-vento 1.0.4 → 1.1.1
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 +26 -0
- package/.github/renovate.json +1 -11
- package/.github/workflows/ci.yaml +5 -35
- package/.github/workflows/release.yml +36 -0
- package/.node-version +1 -0
- package/VentoPlugin.js +8 -3
- package/package.json +45 -43
- package/readme.md +31 -7
- package/test/input/eleventy.config.js +2 -0
- package/test/input/whitespace-control.vto +5 -0
- package/.mise.toml +0 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Handle pnpm dependencies
|
|
2
|
+
description: Cache and restore the dependencies with pnpm
|
|
3
|
+
|
|
4
|
+
outputs:
|
|
5
|
+
cache-hit:
|
|
6
|
+
description: 'Whether restoring the cache was successful or not'
|
|
7
|
+
value: ${{ steps.setup-node.outputs.cache-hit }}
|
|
8
|
+
|
|
9
|
+
runs:
|
|
10
|
+
using: composite
|
|
11
|
+
steps:
|
|
12
|
+
- name: Setup pnpm
|
|
13
|
+
uses: pnpm/action-setup@v4
|
|
14
|
+
|
|
15
|
+
- name: Setup node
|
|
16
|
+
id: setup-node
|
|
17
|
+
uses: actions/setup-node@v4
|
|
18
|
+
with:
|
|
19
|
+
node-version-file: .node-version
|
|
20
|
+
registry-url: 'https://registry.npmjs.org'
|
|
21
|
+
cache: pnpm
|
|
22
|
+
cache-dependency-path: pnpm-lock.yaml
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: pnpm install --frozen-lockfile
|
|
26
|
+
shell: bash
|
package/.github/renovate.json
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": ["github>noelforte/renovate-config", "group:allNonMajor"]
|
|
3
|
-
"customManagers": [
|
|
4
|
-
{
|
|
5
|
-
"customType": "regex",
|
|
6
|
-
"fileMatch": ["(^|\\/)\\.mise\\.toml$"],
|
|
7
|
-
"matchStrings": [
|
|
8
|
-
"#renovate: datasource=(?<datasource>\\S+)(\\s|\\sversioning=(?<versioning>\\S+)\\s)(?<depName>\\S+)\\s?=\\s?\"(?<currentValue>[^\\\"]+)\""
|
|
9
|
-
],
|
|
10
|
-
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
2
|
+
"extends": ["github>noelforte/renovate-config", "group:allNonMajor"]
|
|
13
3
|
}
|
|
@@ -2,47 +2,17 @@ name: CI
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches: [renovate
|
|
5
|
+
branches: [renovate/**, dev]
|
|
6
6
|
workflow_dispatch:
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
ci:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
steps:
|
|
12
|
-
|
|
13
|
-
- name: Check out repository
|
|
14
|
-
uses: actions/checkout@v4.1.6
|
|
12
|
+
- uses: actions/checkout@v4
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
uses: jdx/mise-action@v2
|
|
14
|
+
- name: Setup
|
|
15
|
+
uses: ./.github/actions/setup
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
- name: Setup pnpm
|
|
22
|
-
uses: pnpm/action-setup@v4.0.0
|
|
23
|
-
|
|
24
|
-
# Get metadata
|
|
25
|
-
- name: Get pnpm store directory
|
|
26
|
-
id: get-pnpm-store
|
|
27
|
-
shell: bash
|
|
28
|
-
run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
|
29
|
-
|
|
30
|
-
# Setup the cache
|
|
31
|
-
- uses: actions/cache@v4
|
|
32
|
-
name: Restore cache
|
|
33
|
-
id: cache-deps
|
|
34
|
-
with:
|
|
35
|
-
path: ${{ steps.get-pnpm-store.outputs.path }}
|
|
36
|
-
key:
|
|
37
|
-
deps_os-${{ runner.os }}_arch-${{ runner.arch }}_${{
|
|
38
|
-
hashFiles('./pnpm-lock.yaml') }}
|
|
39
|
-
|
|
40
|
-
# Install dependencies
|
|
41
|
-
- name: Install dependencies
|
|
42
|
-
run: pnpm install --frozen-lockfile --prefer-offline
|
|
43
|
-
shell: bash
|
|
44
|
-
|
|
45
|
-
# ========== CHECK ========== #
|
|
46
|
-
- name: Run checks
|
|
17
|
+
- name: Test
|
|
47
18
|
run: pnpm test
|
|
48
|
-
shell: bash
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
contents: write
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup
|
|
18
|
+
uses: ./.github/actions/setup
|
|
19
|
+
|
|
20
|
+
- name: Test
|
|
21
|
+
run: pnpm test
|
|
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
|
|
32
|
+
|
|
33
|
+
- name: Release
|
|
34
|
+
uses: softprops/action-gh-release@v2
|
|
35
|
+
with:
|
|
36
|
+
body_path: CHANGELOG.md
|
package/.node-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
20.14.0
|
package/VentoPlugin.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Adds Vento
|
|
2
|
+
* @file Adds support for the Vento templating language to Eleventy.
|
|
3
3
|
*
|
|
4
4
|
* @typedef VentoPluginOptions
|
|
5
5
|
* @prop {Object<string,(...any) => any} [filters={}] An object containing methods that
|
|
6
6
|
* will be loaded as filters into Vento.
|
|
7
|
+
* @prop {Function[]} [plugins=[]] An array of plugins to load into vento.
|
|
7
8
|
* @prop {import('ventojs').Options} [ventoOptions] Vento engine configuration object
|
|
8
9
|
* that will be merged with default options.
|
|
9
|
-
* @prop {string|boolean} [addHelpers=true]
|
|
10
|
-
* [Javascript Functions](https://www.11ty.dev/docs/languages/javascript/#javascript-template-functions)
|
|
10
|
+
* @prop {string|boolean} [addHelpers=true]
|
|
11
|
+
* Whether [Javascript Functions](https://www.11ty.dev/docs/languages/javascript/#javascript-template-functions)
|
|
11
12
|
* should be merged into data provided to templates. If a string, functions will be namespaced under
|
|
12
13
|
* a property with this name.
|
|
13
14
|
*/
|
|
@@ -31,6 +32,7 @@ export function VentoPlugin(eleventyConfig, options = {}) {
|
|
|
31
32
|
options = {
|
|
32
33
|
addHelpers: true,
|
|
33
34
|
filters: {},
|
|
35
|
+
plugins: [],
|
|
34
36
|
ventoOptions: {
|
|
35
37
|
includes: path.join(dir.input, dir.includes),
|
|
36
38
|
autoescape: false,
|
|
@@ -44,6 +46,9 @@ export function VentoPlugin(eleventyConfig, options = {}) {
|
|
|
44
46
|
// Load user-defined filters into vento
|
|
45
47
|
for (const filter in options.filters) env.filters[filter] = options.filters[filter];
|
|
46
48
|
|
|
49
|
+
// Load user-defined plugins into vento
|
|
50
|
+
for (const plugin of options.plugins) env.use(plugin);
|
|
51
|
+
|
|
47
52
|
eleventyConfig.on('eleventy.before', () => {
|
|
48
53
|
env.cache.clear();
|
|
49
54
|
});
|
package/package.json
CHANGED
|
@@ -1,44 +1,46 @@
|
|
|
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
|
-
|
|
2
|
+
"name": "eleventy-plugin-vento",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "Adds support for the Vento templating language to Eleventy.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=16"
|
|
8
|
+
},
|
|
9
|
+
"main": "./VentoPlugin.js",
|
|
10
|
+
"repository": "git@github.com:noelforte/eleventy-plugin-vento.git",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/noelforte/eleventy-plugin-vento/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"eleventy",
|
|
16
|
+
"eleventy-plugin",
|
|
17
|
+
"ventojs",
|
|
18
|
+
"templating"
|
|
19
|
+
],
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "Noel Forte",
|
|
22
|
+
"email": "noel@forte.is",
|
|
23
|
+
"url": "https://forte.is/"
|
|
24
|
+
},
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"ventojs": "0.12.6"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"eslint": "9.4.0",
|
|
31
|
+
"eslint-config-flat-gitignore": "0.1.5",
|
|
32
|
+
"eslint-config-prettier": "9.1.0",
|
|
33
|
+
"globals": "15.3.0",
|
|
34
|
+
"@11ty/eleventy": "3.0.0-alpha.10"
|
|
35
|
+
},
|
|
36
|
+
"prettier": {
|
|
37
|
+
"bracketSameLine": true,
|
|
38
|
+
"singleQuote": true,
|
|
39
|
+
"semi": true,
|
|
40
|
+
"trailingComma": "es5"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"test": "rm -rf test/output; cd test/input; eleventy",
|
|
44
|
+
"test-serve": "rm -rf test/output; cd test/input; eleventy --serve"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/readme.md
CHANGED
|
@@ -43,6 +43,9 @@ export default function (eleventyConfig) {
|
|
|
43
43
|
// A set of filters to load into Vento
|
|
44
44
|
filters: {},
|
|
45
45
|
|
|
46
|
+
// An array of Vento plugins to load
|
|
47
|
+
plugins: [],
|
|
48
|
+
|
|
46
49
|
// Define whether Javascript Functions should be added
|
|
47
50
|
// to page data. See below for usage notes on this.
|
|
48
51
|
addHelpers: true
|
|
@@ -57,7 +60,7 @@ export default function (eleventyConfig) {
|
|
|
57
60
|
}
|
|
58
61
|
```
|
|
59
62
|
|
|
60
|
-
View the [full list of options](https://vento.js.org/configuration/#options/) to pass as a Vento Configuration object.
|
|
63
|
+
View the [full list of options](https://vento.js.org/configuration/#options/) to pass as a Vento Configuration object (as `ventoOptions`).
|
|
61
64
|
|
|
62
65
|
## Vento Filters
|
|
63
66
|
|
|
@@ -66,12 +69,14 @@ Set the `filters` property to an object with methods, these will be loaded as fi
|
|
|
66
69
|
Here's an example of defining an `italicize` filter like the example in the Vento documentation:
|
|
67
70
|
|
|
68
71
|
```js
|
|
69
|
-
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
export default function (eleventyConfig) {
|
|
73
|
+
eleventyConfig.addPlugin(VentoPlugin, {
|
|
74
|
+
filters: {
|
|
75
|
+
italicize(text) {
|
|
76
|
+
return `<em>${text}</em>`;
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
75
80
|
}
|
|
76
81
|
```
|
|
77
82
|
|
|
@@ -83,6 +88,25 @@ And now we can use our filter in a template:
|
|
|
83
88
|
|
|
84
89
|
See https://vento.js.org/configuration/#filters for more information about filters and how they work.
|
|
85
90
|
|
|
91
|
+
## Vento Plugins
|
|
92
|
+
|
|
93
|
+
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:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import { VentoPlugin } from 'eleventy-plugin-vento';
|
|
97
|
+
import autoTrim, { defaultTags } from 'ventojs/plugins/autotrim_plugin.js';
|
|
98
|
+
|
|
99
|
+
export default function (eleventyConfig) {
|
|
100
|
+
eleventyConfig.addPlugin(VentoPlugin, {
|
|
101
|
+
plugins: [
|
|
102
|
+
autoTrim({
|
|
103
|
+
tags: ['tag', ...defaultTags],
|
|
104
|
+
}),
|
|
105
|
+
],
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
86
110
|
## JavaScript Helpers
|
|
87
111
|
|
|
88
112
|
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.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VentoPlugin } from '../../VentoPlugin.js';
|
|
2
|
+
import autoTrim from 'ventojs/plugins/auto_trim.js';
|
|
2
3
|
|
|
3
4
|
export const config = {
|
|
4
5
|
dir: {
|
|
@@ -15,6 +16,7 @@ export default async function (eleventyConfig) {
|
|
|
15
16
|
return `<em>${content}</em>`;
|
|
16
17
|
},
|
|
17
18
|
},
|
|
19
|
+
plugins: [autoTrim()],
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
eleventyConfig.addShortcode('possumPosse', () => 'Release the possums!!!');
|
package/.mise.toml
DELETED