ghtml 3.0.0 → 3.0.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.
@@ -25,7 +25,7 @@ jobs:
25
25
 
26
26
  # Install dependencies
27
27
  - name: Install dependencies
28
- run: npm install --ignore-scripts
28
+ run: npm install
29
29
 
30
30
  # Run benchmark on PR code
31
31
  - name: Run benchmark on PR code
@@ -18,6 +18,8 @@ jobs:
18
18
  with:
19
19
  node-version: ^20
20
20
  registry-url: https://registry.npmjs.org
21
+ - run: npm install
22
+ - run: npm run typescript
21
23
  - run: npm publish --provenance --access public
22
24
  env:
23
25
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -22,5 +22,5 @@ jobs:
22
22
  - uses: actions/setup-node@v4
23
23
  with:
24
24
  node-version: ${{ matrix.node-version }}
25
- - run: npm install --ignore-scripts
25
+ - run: npm install
26
26
  - run: npm test
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Replace your template engine with fast JavaScript by leveraging the power of tagged templates.",
4
4
  "author": "Gürgün Dayıoğlu",
5
5
  "license": "MIT",
6
- "version": "3.0.0",
6
+ "version": "3.0.2",
7
7
  "type": "module",
8
8
  "bin": "./bin/src/index.js",
9
9
  "main": "./src/index.js",
@@ -18,7 +18,8 @@
18
18
  "benchmark": "node bench/index.js",
19
19
  "test": "npm run lint && c8 --100 node --test test/*.js",
20
20
  "lint": "eslint . && prettier --check .",
21
- "lint:fix": "eslint --fix . && prettier --write ."
21
+ "lint:fix": "eslint --fix . && prettier --write .",
22
+ "typescript": "tsc src/*.js --allowJs --declaration --emitDeclarationOnly"
22
23
  },
23
24
  "dependencies": {
24
25
  "glob": "^10.4.5"
@@ -27,7 +28,8 @@
27
28
  "@fastify/pre-commit": "^2.1.0",
28
29
  "c8": "^10.1.2",
29
30
  "grules": "^0.23.0",
30
- "tinybench": "^2.8.0"
31
+ "tinybench": "^2.8.0",
32
+ "typescript": ">=5.5.4"
31
33
  },
32
34
  "repository": {
33
35
  "type": "git",
package/src/html.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @param {{ raw: Readonly<string[]> }} literals Tagged template literals.
3
+ * @param {...any} expressions Expressions to interpolate.
4
+ * @returns {string} The HTML string.
5
+ */
6
+ export function html({ raw: literals }: {
7
+ raw: Readonly<string[]>;
8
+ }, ...expressions: any[]): string;
9
+ /**
10
+ * @param {{ raw: Readonly<string[]> }} literals Tagged template literals.
11
+ * @param {...any} expressions Expressions to interpolate.
12
+ * @yields {string} The HTML strings.
13
+ */
14
+ export function htmlGenerator({ raw: literals }: {
15
+ raw: Readonly<string[]>;
16
+ }, ...expressions: any[]): {};
17
+ /**
18
+ * @param {{ raw: Readonly<string[]> }} literals Tagged template literals.
19
+ * @param {...any} expressions Expressions to interpolate.
20
+ * @yields {string} The HTML strings.
21
+ */
22
+ export function htmlAsyncGenerator({ raw: literals }: {
23
+ raw: Readonly<string[]>;
24
+ }, ...expressions: any[]): {};
package/src/html.js CHANGED
@@ -39,7 +39,7 @@ const escapeFunction = (string) => {
39
39
  };
40
40
 
41
41
  /**
42
- * @param {{ raw: string[] }} literals Tagged template literals.
42
+ * @param {{ raw: Readonly<string[]> }} literals Tagged template literals.
43
43
  * @param {...any} expressions Expressions to interpolate.
44
44
  * @returns {string} The HTML string.
45
45
  */
@@ -72,7 +72,7 @@ const html = ({ raw: literals }, ...expressions) => {
72
72
  };
73
73
 
74
74
  /**
75
- * @param {{ raw: string[] }} literals Tagged template literals.
75
+ * @param {{ raw: Readonly<string[]> }} literals Tagged template literals.
76
76
  * @param {...any} expressions Expressions to interpolate.
77
77
  * @yields {string} The HTML strings.
78
78
  */
@@ -166,7 +166,7 @@ const htmlGenerator = function* ({ raw: literals }, ...expressions) {
166
166
  };
167
167
 
168
168
  /**
169
- * @param {{ raw: string[] }} literals Tagged template literals.
169
+ * @param {{ raw: Readonly<string[]> }} literals Tagged template literals.
170
170
  * @param {...any} expressions Expressions to interpolate.
171
171
  * @yields {string} The HTML strings.
172
172
  */
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param {string} path The path to the file to render.
3
+ * @returns {string} The cached content of the file.
4
+ */
5
+ export function includeFile(path: string): string;
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { html, htmlGenerator, htmlAsyncGenerator } from "./html.js";