Skip to content

Commit 4b872f0

Browse files
committed
[fix] 3 detail bugs
[optimize] upgrade to Husky 9
1 parent 22c9f33 commit 4b872f0

File tree

7 files changed

+50
-57
lines changed

7 files changed

+50
-57
lines changed

Diff for: .husky/pre-commit

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
#!/bin/sh
2-
3-
. "$(dirname "$0")/_/husky.sh"
4-
51
npm test

Diff for: .husky/pre-push

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
#!/bin/sh
2-
3-
. "$(dirname "$0")/_/husky.sh"
4-
51
npm run build

Diff for: package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dom-renderer",
3-
"version": "2.1.0",
3+
"version": "2.1.3",
44
"license": "LGPL-3.0-or-later",
55
"author": "[email protected]",
66
"description": "A light-weight DOM Renderer supports Web components standard & TypeScript language",
@@ -29,8 +29,8 @@
2929
},
3030
"devDependencies": {
3131
"@types/jest": "^29.5.12",
32-
"@types/node": "^18.19.14",
33-
"husky": "^8.0.3",
32+
"@types/node": "^18.19.15",
33+
"husky": "^9.0.10",
3434
"jest": "^29.7.0",
3535
"jest-environment-jsdom": "^29.7.0",
3636
"lint-staged": "^15.2.2",
@@ -56,7 +56,7 @@
5656
},
5757
"browserslist": "> 0.5%, last 2 versions, not dead, IE 11",
5858
"scripts": {
59-
"prepare": "husky install",
59+
"prepare": "husky",
6060
"test": "lint-staged && jest",
6161
"parcel": "tsc -p tsconfig.json && mv dist/jsx-runtime.* . && cp jsx-runtime.js jsx-dev-runtime.js && mv dist/dist/* dist/ && rm -rf dist/dist",
6262
"build": "rm -rf dist/ docs/ && typedoc && npm run parcel",

Diff for: pnpm-lock.yaml

+39-39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: source/dist/DOMRenderer.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,8 @@ export class DOMRenderer {
9090
for (const oldNode of [...root.childNodes]) {
9191
const index = newNodes.indexOf(oldNode);
9292

93-
if (index < 0) {
94-
oldNode.remove();
95-
continue;
96-
} else if (index === 0) {
93+
if (index < 0) continue;
94+
else if (index === 0) {
9795
newNodes.shift();
9896
continue;
9997
}

Diff for: source/jsx-runtime.ts

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export function jsx(
3131
}
3232

3333
export const jsxs = jsx;
34+
export const jsxDEV = jsx;
3435

3536
/**
3637
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#react-automatic-runtime-1}

Diff for: test/DOMRenderer.spec.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,19 @@ describe('DOM Renderer', () => {
5858
});
5959

6060
it('should update DOM children without keys', () => {
61-
const newNode = renderer.patch(
61+
var newNode = renderer.patch(
6262
{ ...root },
6363
{ ...root, children: [{ children: [new VNode({ tagName: 'i' })] }] }
6464
);
6565
expect(document.body.innerHTML).toBe('<i></i>');
6666

67-
renderer.patch(newNode, {
67+
newNode = renderer.patch(newNode, {
6868
...root,
6969
children: [{ children: [new VNode({ tagName: 'a' })] }]
7070
});
7171
expect(document.body.innerHTML).toBe('<a></a>');
72+
73+
renderer.patch(newNode, root);
7274
});
7375

7476
it('should not invoke duplicated Connected Callbacks during updating', () => {

0 commit comments

Comments
 (0)