eleventy-plugin-vento 4.5.0 → 4.6.0-beta.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # eleventy-plugin-vento
2
2
 
3
+ ## 4.6.0-beta.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5ed2cca: Update `ventojs` to v2
8
+
9
+ ## 4.5.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 1fbab3a: Update `ventojs` to 1.15.2
14
+
3
15
  ## 4.5.0
4
16
 
5
17
  ### Minor Changes
@@ -211,7 +223,7 @@
211
223
 
212
224
  While more verbose, this change ensures that there isn't any ambiguity between a tag that needs ignoring and JS negation expressions:
213
225
 
214
- ```hbs
226
+ ```vto
215
227
  <!-- These are functionally equivalent and can lead to collisions in rendering functionality -->
216
228
 
217
229
  {{! conditionStatementToIgnore }}
@@ -333,7 +345,7 @@
333
345
 
334
346
  Of course, the big news is that **paired** shortcodes are now officially supported by this plugin!! Prior to this release, paired shortcodes were exposed just like regular shortcodes, but were plain JS functions. With this release you can now use paired shortcodes just like any other tag.
335
347
 
336
- ```hbs
348
+ ```vto
337
349
  <!-- Before: everything is jammed into the function call :( -->
338
350
  {{ blockquote("<p>Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.</p>\n<p>It is a way I have of driving off the spleen and regulating the circulation.</p>", "Herman Melville", "1851") }}
339
351
 
@@ -390,7 +402,7 @@
390
402
 
391
403
  Prior to this release this feature was referred to as the "SSR" or "hybrid-rendering" syntax. It's purpose was to skip over processing a tag like Vento's built-in `{{ echo }}` tag, but with a much shorter syntax: `{{! ... }}`. Any code following a `!` in your markup is wrapped in `{{ }}` and output as-is.
392
404
 
393
- ```hbs
405
+ ```vto
394
406
  {{!> console.log('Hello world'); }} <!-- tag remains in output -->
395
407
  ```
396
408
 
package/dist/plugin.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import UserConfig from '@11ty/eleventy/UserConfig';
2
2
  import { LiteralUnion } from 'type-fest';
3
3
  import * as ventojs from 'ventojs';
4
- import { Plugin } from 'ventojs/src/environment.js';
4
+ import { Plugin } from 'ventojs/core/environment.js';
5
5
 
6
6
  interface PluginOptions {
7
7
  /**
package/dist/plugin.js CHANGED
@@ -9,7 +9,8 @@ import createVentoEnv from "ventojs";
9
9
  function createVentoTag(tagInfo) {
10
10
  let LEVEL = 1;
11
11
  const IS_PAIRED = tagInfo.group === "pairedShortcodes";
12
- const tag = (env, code, output, tokens) => {
12
+ const tag = (env, token, output, tokens) => {
13
+ const code = token[1];
13
14
  const match = code === tagInfo.name || code.startsWith(`${tagInfo.name} `);
14
15
  if (!match) {
15
16
  return;
@@ -28,12 +29,8 @@ function createVentoTag(tagInfo) {
28
29
  compiled.push(
29
30
  "{",
30
31
  `let ${nestedVarname} = "";`,
31
- ...env.compileTokens(tokens, nestedVarname, [`/${tagInfo.name}`])
32
+ ...env.compileTokens(tokens, nestedVarname, `/${tagInfo.name}`)
32
33
  );
33
- if (tokens.length > 0 && (tokens[0][0] !== "tag" || tokens[0][1] !== `/${tagInfo.name}`)) {
34
- throw new Error(`Vento: Missing closing tag for ${tagInfo.name} tag: ${code}`);
35
- }
36
- tokens.shift();
37
34
  }
38
35
  args.unshift(thisArg);
39
36
  compiled.push(
@@ -90,8 +87,8 @@ function createVentoEngine(options) {
90
87
  env.tags.push(shortcodeTag);
91
88
  }
92
89
  }
93
- function getTemplateFunction(source, file, useVentoCache = true) {
94
- let template = env.cache.get(file);
90
+ async function getTemplateFunction(source, file, useVentoCache = true) {
91
+ let template = await env.cache.get(file);
95
92
  if ((template == null ? void 0 : template.source) === source) {
96
93
  debugCache("Cache HIT for `%s`, used precompiled template", file);
97
94
  } else {
@@ -218,21 +215,21 @@ function VentoPlugin(eleventyConfig, userOptions) {
218
215
  eleventyConfig.addExtension("vto", {
219
216
  outputFileExtension: "html",
220
217
  read: true,
221
- compile(inputContent, inputPath) {
218
+ async compile(inputContent, inputPath) {
222
219
  inputPath = path.normalize(inputPath);
223
220
  debugMain("Getting template function for `%s`", inputPath);
224
- const template = engine.getTemplateFunction(inputContent, inputPath, false);
221
+ const template = await engine.getTemplateFunction(inputContent, inputPath, false);
225
222
  return async (data) => await renderVentoTemplate(template, data, inputPath);
226
223
  },
227
224
  compileOptions: {
228
225
  // Custom permalink compilation
229
- permalink(permalinkContent, inputPath) {
226
+ async permalink(permalinkContent, inputPath) {
230
227
  if (typeof permalinkContent !== "string" || !/\{\{\s+.+\s+\}\}/.test(permalinkContent)) {
231
228
  return permalinkContent;
232
229
  }
233
230
  inputPath = "Permalink::" + path.normalize(inputPath);
234
231
  debugMain("Getting template function for `%s`", inputPath);
235
- const template = engine.getTemplateFunction(permalinkContent, inputPath);
232
+ const template = await engine.getTemplateFunction(permalinkContent, inputPath);
236
233
  return async (data) => await renderVentoTemplate(template, data, inputPath);
237
234
  }
238
235
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleventy-plugin-vento",
3
- "version": "4.5.0",
3
+ "version": "4.6.0-beta.0",
4
4
  "description": "Adds support for the Vento templating language to Eleventy.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -37,26 +37,26 @@
37
37
  "license": "MIT",
38
38
  "dependencies": {
39
39
  "debug": "4.4.1",
40
- "ventojs": "1.14.0"
40
+ "ventojs": "2.0.0-canary.3"
41
41
  },
42
42
  "devDependencies": {
43
- "11ty.ts": "0.0.5",
44
- "@11ty/eleventy": "3.1.1",
45
- "@changesets/cli": "2.29.4",
46
- "@eslint/js": "9.28.0",
43
+ "11ty.ts": "0.0.6",
44
+ "@11ty/eleventy": "3.1.2",
45
+ "@changesets/cli": "2.29.6",
46
+ "@eslint/js": "9.34.0",
47
47
  "@types/debug": "4.1.12",
48
- "@types/node": "22.15.30",
49
- "eslint": "9.28.0",
50
- "eslint-config-prettier": "10.1.5",
51
- "eslint-plugin-unicorn": "59.0.1",
52
- "globals": "16.2.0",
53
- "knip": "5.60.2",
48
+ "@types/node": "22.18.0",
49
+ "eslint": "9.34.0",
50
+ "eslint-config-prettier": "10.1.8",
51
+ "eslint-plugin-unicorn": "60.0.0",
52
+ "globals": "16.3.0",
53
+ "knip": "5.63.0",
54
54
  "tsup": "8.5.0",
55
- "tsx": "4.19.4",
55
+ "tsx": "4.20.5",
56
56
  "type-fest": "4.41.0",
57
- "typescript": "5.8.3",
58
- "typescript-eslint": "8.33.1",
59
- "vitest": "3.2.2"
57
+ "typescript": "5.9.2",
58
+ "typescript-eslint": "8.40.0",
59
+ "vitest": "3.2.4"
60
60
  },
61
61
  "prettier": {
62
62
  "bracketSameLine": true,
@@ -66,10 +66,10 @@
66
66
  },
67
67
  "scripts": {
68
68
  "test": "vitest --run",
69
- "check": "pnpm --color run '/^check:/'",
70
- "check:lint": "eslint '.'",
71
- "check:types": "tsc --noEmit",
72
- "check:project": "knip",
69
+ "lint": "pnpm --color run '/^lint:/'",
70
+ "lint:syntax": "eslint '.'",
71
+ "lint:types": "tsc --noEmit",
72
+ "lint:project": "knip",
73
73
  "build": "tsup",
74
74
  "dev": "tsup --watch ./src",
75
75
  "ci:version": "changeset version && pnpm install --no-frozen-lockfile",
package/readme.md CHANGED
@@ -77,7 +77,7 @@ View the [full list of options](https://vento.js.org/configuration/#options/) to
77
77
  > [!NOTE]
78
78
  > Remember, Vento can pipe any JS data type to any built-in global as the first-argument or any `.prototype` method in addition to declared filters. For instance to print the `eleventy` variable as JSON you could use the following snippet:
79
79
  >
80
- > ```nunjucks
80
+ > ```vto
81
81
  > {{ eleventy |> JSON.stringify }}
82
82
  > ```
83
83
  >
@@ -120,13 +120,13 @@ Single and Paired Shortcodes added via Eleventy's `.addShortcode()`, `.addAsyncS
120
120
 
121
121
  When using shortcodes in your templates, write them like any other Vento tag:
122
122
 
123
- ```nunjucks
123
+ ```vto
124
124
  {{ myShortcode }}
125
125
  ```
126
126
 
127
127
  To pass arguments, add a space and your arguments, comma-separated. Arguments are interpreted as JavaScript so type-safety should be considered (quote strings, use booleans if your shortcode expects them, etc.)
128
128
 
129
- ```nunjucks
129
+ ```vto
130
130
  {{ myShortcode 'arg1', 'arg2' }}
131
131
  {{ myBooleanShortcode false, false, true }}
132
132
  {{ myNumberShortcode 10, 20, 0 }}
@@ -135,7 +135,7 @@ To pass arguments, add a space and your arguments, comma-separated. Arguments ar
135
135
 
136
136
  For paired shortcodes, the syntax is the same, just add a closing tag. Paired shortcodes also accept arguments and can re-process nested Vento tags (including other shortcodes).
137
137
 
138
- ```nunjucks
138
+ ```vto
139
139
  {{ codeBlock 'css' }} <!-- takes arguments too -->
140
140
  a {
141
141
  color: red;