Skip to content

Commit b348e66

Browse files
committed
chore: generate type declaration for vite plugin
1 parent f1c42f2 commit b348e66

File tree

5 files changed

+27
-13
lines changed

5 files changed

+27
-13
lines changed

package-lock.json

Lines changed: 15 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "http-request-mock",
3-
"version": "1.8.20",
3+
"version": "1.8.22",
44
"description": "Intercept & mock http requests issued by XMLHttpRequest, fetch, nodejs https/http module, axios, jquery, superagent, ky, node-fetch, request, got or any other request libraries by intercepting XMLHttpRequest, fetch and nodejs native requests in low level.",
55
"main": "src/index.js",
66
"module": "http-request-mock.esm.mjs",
@@ -129,7 +129,7 @@
129129
"@ngneat/falso": "^4.0.0",
130130
"@types/follow-redirects": "^1.14.1",
131131
"chokidar": "^3.5.2",
132-
"commander": "^2.20.3",
132+
"commander": "^12.1.0",
133133
"follow-redirects": "^1.15.0",
134134
"http-proxy": "^1.18.1"
135135
},

tool/plugin/vite.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ const testPath = (regexp, assetFile) => {
1515
};
1616

1717
/**
18-
* @param {regexp} appEntry Required, app entry file which mock dependencies will be injected into.
19-
* @param {string} mockDir Required, mock directory which contains all mock files & the runtime mock config entry file.
20-
* @param {boolean} enable Optional, whether or not to enable this plugin. Default: true
21-
* @param {boolean} debug Optional, output some debug logs. Default: false
18+
* @param {{appEntry: RegExp; mockDir: string; enable: boolean; debug: boolean}} opts
19+
* appEntry Required, app entry file which mock dependencies will be injected into.
20+
* mockDir Required, mock directory which contains all mock files & the runtime mock config entry file.
21+
* enable Optional, whether or not to enable this plugin. Default: true
22+
* debug Optional, output some debug logs. Default: false
2223
*/
23-
const vitePluginHttpRequestMock = ({ appEntry, mockDir, enable = true, debug = false}) => {
24+
const vitePluginHttpRequestMock = (opts) => {
25+
const { appEntry, mockDir, enable = true, debug = false} = opts;
26+
2427
if (!(appEntry instanceof RegExp)) {
2528
throw new Error(`${pluginName} expects [appEntry] to be a valid RegExp Object.`);
2629
}

tsconfig.esm.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
},
2525
"include": [
2626
"./src/**/*",
27+
"./tool/**/*"
2728
],
2829
"exclude": [
2930
"node_modules",

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
},
2525
"include": [
2626
"./src/**/*",
27+
"./tool/**/*"
2728
],
2829
"exclude": [
2930
"node_modules",

0 commit comments

Comments
 (0)