Skip to content

Commit 74316c5

Browse files
committed
jsdom 类型 - 合并配置时基础配置不为 undefined 才会进行处理
1 parent 2f18c9f commit 74316c5

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "x-crawl",
4-
"version": "0.0.1",
4+
"version": "0.0.2",
55
"author": "CoderHxl",
66
"description": "XCrawl is a Nodejs multifunctional crawler library.",
77
"license": "MIT",
@@ -13,7 +13,8 @@
1313
"prettier": "prettier --write ."
1414
},
1515
"dependencies": {
16-
"jsdom": "^21.1.0"
16+
"jsdom": "^21.1.0",
17+
"x-crawl": "link:"
1718
},
1819
"devDependencies": {
1920
"@babel/core": "^7.20.12",
@@ -22,6 +23,7 @@
2223
"@rollup/plugin-babel": "^6.0.3",
2324
"@rollup/plugin-run": "^3.0.1",
2425
"@rollup/plugin-terser": "^0.3.0",
26+
"@types/jsdom": "^20.0.1",
2527
"@types/node": "^18.11.18",
2628
"@typescript-eslint/eslint-plugin": "^5.48.2",
2729
"@typescript-eslint/parser": "^5.48.2",

pnpm-lock.yaml

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

publish/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "x-crawl",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"author": "CoderHxl",
55
"description": "XCrawl is a Nodejs multifunctional crawler library.",
66
"license": "MIT",
@@ -27,5 +27,8 @@
2727
},
2828
"dependencies": {
2929
"jsdom": "^21.1.0"
30+
},
31+
"devDependencies": {
32+
"@types/jsdom": "^20.0.1"
3033
}
3134
}

src/utils.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ export function mergeConfig<T extends IFetchConfig>(
8585
for (const requestItem of requestConifgArr) {
8686
const { url, timeout } = requestItem
8787

88-
requestItem.url = baseUrl + url
88+
if (!isUndefined(baseUrl)) {
89+
requestItem.url = baseUrl + url
90+
}
8991

90-
if (isUndefined(timeout)) {
92+
if (isUndefined(timeout) && !isUndefined(baseTimeout)) {
9193
requestItem.timeout = baseTimeout
9294
}
9395
}
9496

95-
if (isUndefined(intervalTime)) {
97+
if (isUndefined(intervalTime) && !isUndefined(baseIntervalTime)) {
9698
config.intervalTime = baseIntervalTime
9799
}
98100

0 commit comments

Comments
 (0)