From 74316c5276965c24db5a792e1223feaba0becff3 Mon Sep 17 00:00:00 2001 From: coderhxl Date: Sat, 28 Jan 2023 21:27:49 +0800 Subject: [PATCH] =?UTF-8?q?jsdom=20=E7=B1=BB=E5=9E=8B=20-=20=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E9=85=8D=E7=BD=AE=E6=97=B6=E5=9F=BA=E7=A1=80=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=8D=E4=B8=BA=20undefined=20=E6=89=8D=E4=BC=9A?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 ++++-- pnpm-lock.yaml | 2 ++ publish/package.json | 5 ++++- src/utils.ts | 8 +++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ce6f5bf5..55a42ed2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "x-crawl", - "version": "0.0.1", + "version": "0.0.2", "author": "CoderHxl", "description": "XCrawl is a Nodejs multifunctional crawler library.", "license": "MIT", @@ -13,7 +13,8 @@ "prettier": "prettier --write ." }, "dependencies": { - "jsdom": "^21.1.0" + "jsdom": "^21.1.0", + "x-crawl": "link:" }, "devDependencies": { "@babel/core": "^7.20.12", @@ -22,6 +23,7 @@ "@rollup/plugin-babel": "^6.0.3", "@rollup/plugin-run": "^3.0.1", "@rollup/plugin-terser": "^0.3.0", + "@types/jsdom": "^20.0.1", "@types/node": "^18.11.18", "@typescript-eslint/eslint-plugin": "^5.48.2", "@typescript-eslint/parser": "^5.48.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9396371a..177322ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,9 +19,11 @@ specifiers: rollup-plugin-typescript2: ^0.34.1 ts-jest: ^29.0.5 typescript: ^4.9.4 + x-crawl: 'link:' dependencies: jsdom: 21.1.0 + x-crawl: 'link:' devDependencies: '@babel/core': 7.20.12 diff --git a/publish/package.json b/publish/package.json index d162108c..0128d413 100644 --- a/publish/package.json +++ b/publish/package.json @@ -1,6 +1,6 @@ { "name": "x-crawl", - "version": "0.0.1", + "version": "0.0.2", "author": "CoderHxl", "description": "XCrawl is a Nodejs multifunctional crawler library.", "license": "MIT", @@ -27,5 +27,8 @@ }, "dependencies": { "jsdom": "^21.1.0" + }, + "devDependencies": { + "@types/jsdom": "^20.0.1" } } diff --git a/src/utils.ts b/src/utils.ts index 8941a8d7..3ea8e492 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -85,14 +85,16 @@ export function mergeConfig( for (const requestItem of requestConifgArr) { const { url, timeout } = requestItem - requestItem.url = baseUrl + url + if (!isUndefined(baseUrl)) { + requestItem.url = baseUrl + url + } - if (isUndefined(timeout)) { + if (isUndefined(timeout) && !isUndefined(baseTimeout)) { requestItem.timeout = baseTimeout } } - if (isUndefined(intervalTime)) { + if (isUndefined(intervalTime) && !isUndefined(baseIntervalTime)) { config.intervalTime = baseIntervalTime }