eleventy-plugin-edgejs 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/README.md CHANGED
@@ -12,6 +12,9 @@ npm install eleventy-plugin-edgejs
12
12
 
13
13
  ## Usage
14
14
 
15
+ > [!TIP]
16
+ > This repository includes a working Eleventy site with more template and syntax examples. Browse the [example source](./example) or see the [Example Site](#example-site) section for instructions on running it locally.
17
+
15
18
  Register the plugin in your Eleventy config file:
16
19
 
17
20
  ```js
@@ -281,6 +284,19 @@ In your layout file (`_includes/layout.edge`):
281
284
  </html>
282
285
  ```
283
286
 
287
+ ## Example Site
288
+
289
+ This repository includes a working Eleventy site with more template and syntax examples. To run it locally:
290
+
291
+ ```sh
292
+ git clone https://github.com/reverentgeek/eleventy-plugin-edgejs.git
293
+ cd eleventy-plugin-edgejs
294
+ npm install
295
+ npm run start:example
296
+ ```
297
+
298
+ This starts a local dev server so you can browse the examples and experiment with Edge.js templates.
299
+
284
300
  ## Further Reading
285
301
 
286
302
  - [Edge.js documentation](https://edgejs.dev/)
package/edgeJsPlugin.js CHANGED
@@ -43,6 +43,23 @@ Template.prototype.renderRaw = function ( contents, state, templatePath ) {
43
43
  return result;
44
44
  };
45
45
 
46
+ // Patch Template.prototype.reThrow to preserve the original error as .cause.
47
+ // Edge.js discards the original error class when wrapping in EdgeError, which breaks
48
+ // Eleventy's two-pass rendering system — it can't detect TemplateContentPrematureUseError
49
+ // and fails instead of deferring the template to a second pass.
50
+ const _originalReThrow = Template.prototype.reThrow;
51
+
52
+ Template.prototype.reThrow = function ( error, filename, lineNumber ) {
53
+ try {
54
+ _originalReThrow.call( this, error, filename, lineNumber );
55
+ } catch ( wrapped ) {
56
+ if ( wrapped !== error ) {
57
+ wrapped.cause = error;
58
+ }
59
+ throw wrapped;
60
+ }
61
+ };
62
+
46
63
  // Patch Template.prototype.render for includes/components that may also contain async calls
47
64
  const _originalRender = Template.prototype.render;
48
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleventy-plugin-edgejs",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Eleventy plugin for Edge.js templating",
5
5
  "type": "module",
6
6
  "main": "edgeJsPlugin.js",