Skip to content

Commit

Permalink
fix: upgrade to @gera2ld/jsx-dom@2
Browse files Browse the repository at this point in the history
  • Loading branch information
gera2ld committed Nov 13, 2021
1 parent 9e51d59 commit fbdcf85
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
*.log
*.lock
pnpm-lock.yaml
/.idea
/dist
/.nyc_output
Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint
34 changes: 15 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,19 @@
"description": "Use JSX for HTML elements.",
"author": "Gerald <gera2ld@163.com>",
"license": "ISC",
"husky": {
"hooks": {
"pre-push": "yarn lint"
}
},
"unpkg": "dist/index.min.js",
"jsdelivr": "dist/index.min.js",
"repository": "git@github.com:violentmonkey/vm-dom.git",
"scripts": {
"prepare": "husky install",
"dev": "rollup -wc rollup.conf.js",
"prebuild": "npm run ci && npm run clean",
"build": "tsc && npm run build:js",
"build:types": "tsc",
"build:js": "rollup -c rollup.conf.js",
"build": "run-s ci clean build:*",
"lint": "eslint --ext .ts .",
"prepublishOnly": "npm run build",
"ci": "npm run lint",
"clean": "del-cli dist types",
"build:js": "rollup -c rollup.conf.js"
"prepublishOnly": "run-s build",
"ci": "run-s lint",
"clean": "del-cli dist types"
},
"publishConfig": {
"access": "public",
Expand All @@ -33,15 +29,15 @@
],
"typings": "types/index.d.ts",
"devDependencies": {
"@gera2ld/plaid": "~2.2.1",
"@gera2ld/plaid-common-ts": "~2.2.0",
"@gera2ld/plaid-rollup": "~2.2.0",
"del-cli": "^3.0.1",
"husky": "^4.3.0",
"typedoc": "^0.20.25"
"@gera2ld/plaid": "~2.4.0",
"@gera2ld/plaid-common-ts": "~2.4.0",
"@gera2ld/plaid-rollup": "~2.4.0",
"del-cli": "^4.0.1",
"husky": "^7.0.4",
"typedoc": "^0.22.8"
},
"dependencies": {
"@babel/runtime": "^7.12.13",
"@gera2ld/jsx-dom": "^1.2.1"
"@babel/runtime": "^7.16.3",
"@gera2ld/jsx-dom": "^2.0.0"
}
}
15 changes: 5 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { createElement, Fragment } from '@gera2ld/jsx-dom';

export { createElement, Fragment };

const NS_HTML = 'http://www.w3.org/1999/xhtml';

createElement.createElement = (tag: string) => document.createElementNS(NS_HTML, tag);
export {
h, createElement, Fragment, mountDom, mountDom as m,
} from '@gera2ld/jsx-dom';

/**
* Return all elements that match the given `xpath` as an array.
Expand Down Expand Up @@ -54,11 +50,10 @@ export function observe(
const result = callback(mutations, ob);
if (result) disconnect();
});
observer.observe(node, {
observer.observe(node, Object.assign({
childList: true,
subtree: true,
...options,
});
}, options));
disconnect = () => observer.disconnect();
return disconnect;
}

0 comments on commit fbdcf85

Please sign in to comment.