html-express-js 4.0.0 → 4.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-express-js",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "An Express template engine to render HTML views using native JavaScript",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -55,7 +55,7 @@
55
55
  "prettier": "^3.0.3",
56
56
  "release-it": "17.1.1",
57
57
  "reload": "^3.2.0",
58
- "sinon": "^20.0.0",
58
+ "sinon": "^21.0.0",
59
59
  "typescript": "^5.4.3"
60
60
  }
61
61
  }
package/src/index.d.ts CHANGED
@@ -5,9 +5,9 @@
5
5
  * @param {import('express').Request} req
6
6
  * @param {import('express').Response} res
7
7
  * @param {Record<string, any>} [data]
8
- * @returns {Promise<void>} HTML with includes available (appended to state)
8
+ * @returns {Promise<string>} HTML with includes available (appended to state)
9
9
  */
10
- export function renderView(filePath: string, req: import("express").Request, res: import("express").Response, data?: Record<string, any>): Promise<void>;
10
+ export function renderView(filePath: string, req: import("express").Request, res: import("express").Response, data?: Record<string, any>): Promise<string>;
11
11
  /**
12
12
  * Template literal that supports string
13
13
  * interpolating in passed HTML.
package/src/index.js CHANGED
@@ -79,12 +79,13 @@ async function renderFileTemplate(path, data, state) {
79
79
  * @param {import('express').Request} req
80
80
  * @param {import('express').Response} res
81
81
  * @param {Record<string, any>} [data]
82
- * @returns {Promise<void>} HTML with includes available (appended to state)
82
+ * @returns {Promise<string>} HTML with includes available (appended to state)
83
83
  */
84
84
  export async function renderView(filePath, req, res, data = {}) {
85
85
  const requestState = buildRequestState ? await buildRequestState(req) : {};
86
86
  const html = await buildViewHtml(filePath, data, requestState);
87
87
  res.send(html);
88
+ return html;
88
89
  }
89
90
 
90
91
  /**