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.
@@ -1,5 +1,5 @@
1
- name: Handle pnpm dependencies
2
- description: Cache and restore the dependencies with pnpm
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,8 +2,9 @@ name: CI
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [renovate/**, dev]
5
+ branches: [renovate/**]
6
6
  workflow_dispatch:
7
+ workflow_call:
7
8
 
8
9
  jobs:
9
10
  ci:
@@ -2,35 +2,40 @@ name: Release
2
2
 
3
3
  on:
4
4
  push:
5
- tags:
6
- - 'v*.*.*'
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
- id-token: write
13
- contents: write
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: 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
34
+ - name: Verify provenance attestations and registry signatures
35
+ run: npm audit signatures
32
36
 
33
37
  - name: Release
34
- uses: softprops/action-gh-release@v2
35
- with:
36
- body_path: CHANGELOG.md
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
- "name": "eleventy-plugin-vento",
3
- "version": "1.1.0",
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
- }
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
- filters: {
71
- italicize(text) {
72
- return `<em>${text}</em>`
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
+ };
@@ -0,0 +1,6 @@
1
+ ---
2
+ permalink: /
3
+ layout: page-layout.vto
4
+ ---
5
+
6
+ This should render on the homepage.