eleventy-plugin-vento 2.1.0 → 2.2.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.
Files changed (49) hide show
  1. package/.github/workflows/release.yml +3 -3
  2. package/VentoPlugin.js +4 -3
  3. package/eslint.config.js +1 -1
  4. package/package.json +4 -4
  5. package/release.config.js +1 -1
  6. package/tests/permalinks/dynamic-js/dynamic-js.11tydata.js +5 -0
  7. package/tests/permalinks/dynamic-js/dynamic-permalink-js.vto +6 -0
  8. package/{test → tests}/permalinks/permalinks.test.js +4 -10
  9. /package/{test → tests}/autotrim/__snapshots__/autotrim-all.html +0 -0
  10. /package/{test → tests}/autotrim/__snapshots__/autotrim-single.html +0 -0
  11. /package/{test → tests}/autotrim/autotrim.test.js +0 -0
  12. /package/{test → tests}/autotrim/build/autotrim-all.html +0 -0
  13. /package/{test → tests}/autotrim/build/autotrim-single.html +0 -0
  14. /package/{test → tests}/autotrim/index.vto +0 -0
  15. /package/{test → tests}/basic/__snapshots__/template-basic.html +0 -0
  16. /package/{test → tests}/basic/basic.test.js +0 -0
  17. /package/{test → tests}/basic/index.vto +0 -0
  18. /package/{test → tests}/filters/__snapshots__/filters-arguments.html +0 -0
  19. /package/{test → tests}/filters/__snapshots__/filters-basic.html +0 -0
  20. /package/{test → tests}/filters/basic.vto +0 -0
  21. /package/{test → tests}/filters/filters.test.js +0 -0
  22. /package/{test → tests}/filters/with-arguments.vto +0 -0
  23. /package/{test → tests}/filters/with-this.vto +0 -0
  24. /package/{test → tests}/get-instance.js +0 -0
  25. /package/{test → tests}/includes/__snapshots__/includes-basic.html +0 -0
  26. /package/{test → tests}/includes/__snapshots__/includes-data.html +0 -0
  27. /package/{test → tests}/includes/_includes/partial.vto +0 -0
  28. /package/{test → tests}/includes/basic.vto +0 -0
  29. /package/{test → tests}/includes/includes.test.js +0 -0
  30. /package/{test → tests}/includes/with-data.vto +0 -0
  31. /package/{test → tests}/layouts/__snapshots__/example-layout-1.html +0 -0
  32. /package/{test → tests}/layouts/__snapshots__/example-layout-2.html +0 -0
  33. /package/{test → tests}/layouts/_includes/layout1.vto +0 -0
  34. /package/{test → tests}/layouts/_includes/layout2.vto +0 -0
  35. /package/{test → tests}/layouts/layouts.test.js +0 -0
  36. /package/{test → tests}/layouts/page1.vto +0 -0
  37. /package/{test → tests}/layouts/page2.vto +0 -0
  38. /package/{test → tests}/permalinks/__snapshots__/permalink-nested.html +0 -0
  39. /package/{test → tests}/permalinks/__snapshots__/permalink-root.html +0 -0
  40. /package/{test → tests}/permalinks/_includes/layout.vto +0 -0
  41. /package/{test → tests}/permalinks/at-nested.vto +0 -0
  42. /package/{test → tests}/permalinks/at-root.vto +0 -0
  43. /package/{test → tests}/permalinks/dynamic/dynamic-permalink.vto +0 -0
  44. /package/{test → tests}/permalinks/dynamic/dynamic.11tydata.json +0 -0
  45. /package/{test → tests}/permalinks/skip.vto +0 -0
  46. /package/{test → tests}/shortcodes/__snapshots__/shortcode-with-arguments.html +0 -0
  47. /package/{test → tests}/shortcodes/basic.vto +0 -0
  48. /package/{test → tests}/shortcodes/shortcodes.test.js +0 -0
  49. /package/{test → tests}/shortcodes/with-arguments.vto +0 -0
@@ -9,11 +9,8 @@ on:
9
9
  workflow_dispatch:
10
10
 
11
11
  jobs:
12
- test:
13
- uses: ./.github/workflows/ci.yml
14
12
  release:
15
13
  runs-on: ubuntu-latest
16
- needs: test
17
14
  permissions:
18
15
  contents: write # to be able to publish a GitHub release
19
16
  id-token: write # to enable use of OIDC for npm provenance
@@ -27,6 +24,9 @@ jobs:
27
24
  - name: Setup
28
25
  uses: ./.github/actions/setup
29
26
 
27
+ - name: Check project for errors
28
+ run: pnpm test
29
+
30
30
  - name: Verify provenance attestations and registry signatures
31
31
  run: npm audit signatures
32
32
 
package/VentoPlugin.js CHANGED
@@ -73,13 +73,14 @@ export function VentoPlugin(eleventyConfig, options = {}) {
73
73
  if (options.trimTags === true) env.use(autoTrim());
74
74
  else if (options.trimTags) env.use(autoTrim({ tags: options.trimTags }));
75
75
 
76
+ eleventyConfig.on('eleventy.before', () => env.cache.clear());
77
+
76
78
  // Add vto as a template format and create a custom template for it
77
79
  eleventyConfig.addTemplateFormats('vto');
78
80
  eleventyConfig.addExtension('vto', {
79
81
  outputFileExtension: 'html',
80
82
 
81
83
  async compile(inputContent, inputPath) {
82
- env.cache.clear();
83
84
  return async (data) => {
84
85
  if (options.addHelpers) {
85
86
  // Extract a possible namespace from the addHelpers option
@@ -113,10 +114,10 @@ export function VentoPlugin(eleventyConfig, options = {}) {
113
114
  },
114
115
 
115
116
  compileOptions: {
116
- permalink(linkContents, inputPath) {
117
+ permalink(linkContents) {
117
118
  if (typeof linkContents !== 'string') return linkContents;
118
119
  return async (data) => {
119
- const result = await env.runString(linkContents, data, inputPath);
120
+ const result = await env.runString(linkContents, data);
120
121
  return result.content;
121
122
  };
122
123
  },
package/eslint.config.js CHANGED
@@ -17,7 +17,7 @@ export default [
17
17
 
18
18
  // Configure ignores
19
19
  {
20
- ignores: ['**/.cache', '**/_site', '**/node_modules', '**/functions'],
20
+ ignores: ['**/node_modules'],
21
21
  },
22
22
 
23
23
  // Configure defaults
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "eleventy-plugin-vento",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Adds support for the Vento templating language to Eleventy.",
5
5
  "type": "module",
6
- "packageManager": "pnpm@9.2.0",
6
+ "packageManager": "pnpm@9.3.0",
7
7
  "engines": {
8
8
  "node": ">=16"
9
9
  },
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
- "ventojs": "0.12.6"
35
+ "ventojs": "0.12.7"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@11ty/eleventy": "3.0.0-alpha.10",
@@ -40,7 +40,7 @@
40
40
  "eslint": "9.4.0",
41
41
  "eslint-config-flat-gitignore": "0.1.5",
42
42
  "eslint-config-prettier": "9.1.0",
43
- "globals": "15.3.0",
43
+ "globals": "15.4.0",
44
44
  "semantic-release": "24.0.0",
45
45
  "vitest": "1.6.0"
46
46
  },
package/release.config.js CHANGED
@@ -3,7 +3,7 @@ const presetConfig = {
3
3
  { type: 'feat', section: 'New Features' },
4
4
  { type: 'fix', section: 'Bug Fixes' },
5
5
  { type: 'refactor', section: 'Refactorings' },
6
- { type: 'docs', hidden: 'Documentation' },
6
+ { type: 'docs', section: 'Documentation' },
7
7
  { type: 'chore', hidden: true },
8
8
  { type: 'perf', hidden: true },
9
9
  { type: 'style', hidden: true },
@@ -0,0 +1,5 @@
1
+ export default {
2
+ permalink({ title }) {
3
+ return `${this.slugify(title)}.html`;
4
+ },
5
+ };
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: Directory data test page (js)
3
+ layout: layout.vto
4
+ ---
5
+
6
+ This page has directory data set with dynamic permalinks
@@ -5,27 +5,21 @@ const results = await runBuild(import.meta.dirname);
5
5
 
6
6
  test('render a page at a nested permalink', async () => {
7
7
  const page = results.find(({ url }) => url === '/page/at/nested/permalink/');
8
- await expect(page.content).toMatchFileSnapshot(
9
- './__snapshots__/permalink-nested.html'
10
- );
8
+ await expect(page.content).toMatchFileSnapshot('./__snapshots__/permalink-nested.html');
11
9
  });
12
10
 
13
11
  test('render a page at root url', async () => {
14
12
  const page = results.find(({ url }) => url === '/');
15
- expect(page.content).toMatchFileSnapshot(
16
- './__snapshots__/permalink-root.html'
17
- );
13
+ expect(page.content).toMatchFileSnapshot('./__snapshots__/permalink-root.html');
18
14
  });
19
15
 
20
16
  test('render a page at a dynamic permalink', async () => {
21
- const page = results.find(
22
- ({ url }) => url === '/directory-data-test-page.html'
23
- );
17
+ const page = results.find(({ url }) => url === '/directory-data-test-page.html');
24
18
 
25
19
  expect(page).toBeDefined();
26
20
  });
27
21
 
28
22
  test('skips rendering a file', () => {
29
23
  const writtenTemplates = results.filter(({ url }) => Boolean(url));
30
- expect(writtenTemplates.length).toBe(3);
24
+ expect(writtenTemplates.length).toBe(4);
31
25
  });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes