Skip to content

Commit

Permalink
chore(deps): bump
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Dec 2, 2024
1 parent aba63f4 commit a23d322
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 30 deletions.
12 changes: 3 additions & 9 deletions bench/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,14 @@ bench.add("multiple string expressions", () => {
const items1 = ["Item 1", undefined, "Item 2", null, 2000, 1500.5];
bench.add("array expressions", () => {
result = html`<ul>
${items1.map((item) => {
return html`<li>${item}</li>`;
})}
${items1.map((item) => html`<li>${item}</li>`)}
</ul>`;
});

const items2 = ["Item 1", "Item <1.5>", "Item 2", "Item <2.5>", "Item 3"];
bench.add("array expressions with escapable chars", () => {
result = html`<ul>
${items2.map((item) => {
return html`<li>"${item}" & '${item}'</li>`;
})}
${items2.map((item) => html`<li>"${item}" & '${item}'</li>`)}
</ul>`;
});

Expand All @@ -59,9 +55,7 @@ bench.add("multiple types of expressions", () => {
<div>Id: <span>${user.id}</span></div>
${null}${123}${456n}
<ul>
!${items2.map((item) => {
return html`<li>${item}</li>`;
})}
!${items2.map((item) => html`<li>${item}</li>`)}
</ul>
`;
});
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
"glob": "^10.4.5"
},
"devDependencies": {
"@fastify/pre-commit": "^2.1.0",
"@fastify/pre-commit": "^2.2.0",
"c8": "^10.1.2",
"globals": "^15.11.0",
"grules": "^0.25.10",
"tinybench": "^3.0.0",
"typescript": ">=5.6.2"
"globals": "^15.13.0",
"grules": "^0.26.1",
"tinybench": "^3.0.7",
"typescript": ">=5.7.2"
},
"repository": {
"type": "git",
Expand Down
22 changes: 6 additions & 16 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ test("renders multiple html calls", () => {

test("renders multiple html calls with different expression types", () => {
const obj = {};
obj.toString = () => {
return "description of the object";
};
obj.toString = () => "description of the object";

// prettier-ignore
assert.strictEqual(
Expand All @@ -151,7 +149,7 @@ test("renders multiple html calls with different expression types", () => {
!${conditionFalse
? ""
:
html`<em> ${array1.map((i) => {return i + 1;})} </em>`}<br />
html`<em> ${array1.map((i) => i + 1)} </em>`}<br />
And also, ${false} ${null}${undefined}${obj} is ${true}
</p>
`,
Expand Down Expand Up @@ -194,9 +192,7 @@ test("htmlGenerator renders unsafe content", () => {
});

test("htmlGenerator works with nested htmlGenerator calls in an array", () => {
const generator = htmlGenerator`<ul>!${[1, 2, 3].map((index) => {
return htmlGenerator`<li>${index}</li>`;
})}</ul>`;
const generator = htmlGenerator`<ul>!${[1, 2, 3].map((index) => htmlGenerator`<li>${index}</li>`)}</ul>`;
let accumulator = "";

for (const value of generator) {
Expand Down Expand Up @@ -347,9 +343,7 @@ test("htmlAsyncGenerator works with other generators (escaped)", async () => {
});

test("htmlAsyncGenerator works with nested htmlAsyncGenerator calls in an array", async () => {
const generator = htmlAsyncGenerator`!${[1, 2, 3].map((i) => {
return htmlAsyncGenerator`${i}: <p>${readFile("test/test.md", "utf8")}</p>`;
})}`;
const generator = htmlAsyncGenerator`!${[1, 2, 3].map((i) => htmlAsyncGenerator`${i}: <p>${readFile("test/test.md", "utf8")}</p>`)}`;
let accumulator = "";

for await (const value of generator) {
Expand All @@ -363,9 +357,7 @@ test("htmlAsyncGenerator works with nested htmlAsyncGenerator calls in an array"
});

test("htmlAsyncGenerator renders chunks with promises (escaped)", async () => {
const generator = htmlAsyncGenerator`<ul>!${[1, 2].map((i) => {
return htmlAsyncGenerator`${i}: ${readFile("test/test.md", "utf8")}`;
})}</ul>`;
const generator = htmlAsyncGenerator`<ul>!${[1, 2].map((i) => htmlAsyncGenerator`${i}: ${readFile("test/test.md", "utf8")}`)}</ul>`;
const fileContent = readFileSync("test/test.md", "utf8").replaceAll(
">",
"&#62;",
Expand Down Expand Up @@ -394,9 +386,7 @@ test("htmlAsyncGenerator renders chunks with promises (escaped)", async () => {
});

test("htmlAsyncGenerator renders chunks with promises (raw)", async () => {
const generator = htmlAsyncGenerator`<ul>!${[1, 2].map((i) => {
return htmlAsyncGenerator`${i}: !${readFile("test/test.md", "utf8")}`;
})}</ul>`;
const generator = htmlAsyncGenerator`<ul>!${[1, 2].map((i) => htmlAsyncGenerator`${i}: !${readFile("test/test.md", "utf8")}`)}</ul>`;
const fileContent = readFileSync("test/test.md", "utf8");

let value = await generator.next();
Expand Down

0 comments on commit a23d322

Please sign in to comment.