File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# @xiaohuohumax/xpath-selector
22
3+ ## 1.0.6
4+
5+ ### Patch Changes
6+
7+ - 修正类型推导
8+
39## 1.0.5
410
511### Patch Changes
Original file line number Diff line number Diff line change @@ -173,6 +173,13 @@ const title = xpathSelector({
173173})
174174
175175console .log (title ) // Output: "Test Page"
176+
177+ const links = xpathSelector <HTMLAnchorElement , ' nodes' >({
178+ expression: ' //a' ,
179+ returnType: ' nodes' ,
180+ })
181+
182+ console .log (links ) // Output: [<a href="#">Hello</a>, <a href="#">World</a>]
176183```
177184
1781854 . 修改 vite.config.ts 排除 xpath-selector 依赖
Original file line number Diff line number Diff line change 11{
22 "name" : " @xiaohuohumax/xpath-selector" ,
33 "type" : " module" ,
4- "version" : " 1.0.5 " ,
4+ "version" : " 1.0.6 " ,
55 "description" : " XPath Selector -- 一个 XPath 选择器库,快速获取节点数据" ,
66 "author" : {
77 "name" : " xiaohuohumax" ,
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ function returnTypeTransition<T extends ReturnType>(returnType: T): ReturnTypeTr
5252 return returnTypeMap [ returnType ]
5353}
5454
55- export default function xpathSelector < T extends ReturnType > ( options : Options < T > ) {
56- return fontoxpath . evaluateXPath < fontoxpath . Node , ReturnTypeTransition < T > > (
55+ export default function xpathSelector < N extends fontoxpath . Node , T extends ReturnType > ( options : Options < T > ) {
56+ return fontoxpath . evaluateXPath < N , ReturnTypeTransition < T > > (
5757 options . expression ,
5858 options . node || document ,
5959 null ,
You can’t perform that action at this time.
0 commit comments