rspack-plugin-mock 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/{chunk-EY46RSAC.js → chunk-2SSCBSV5.js} +14 -14
- package/dist/{chunk-ZEC4FWWY.cjs → chunk-T2VK464W.cjs} +14 -14
- package/dist/{chunk-OURZXZQM.js → chunk-VKD4VKFQ.js} +11 -8
- package/dist/{chunk-GI65LCB7.cjs → chunk-ZUCMHLWW.cjs} +22 -19
- package/dist/helper.cjs +55 -2
- package/dist/helper.d.cts +15 -1
- package/dist/helper.d.ts +15 -1
- package/dist/helper.js +54 -1
- package/dist/index.cjs +10 -10
- package/dist/index.js +2 -2
- package/dist/rsbuild.cjs +16 -16
- package/dist/rsbuild.js +7 -7
- package/dist/server.cjs +2 -2
- package/dist/server.js +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -7,8 +7,8 @@ Implement a mock-dev-server in `rspack` and `rsbuild` that is fully consistent w
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<a href="https://www.npmjs.com/package/rspack-plugin-mock"><img alt="npm" src="https://img.shields.io/npm/v/rspack-plugin-mock?style=flat-square&colorA=564341&colorB=EDED91"></a>
|
|
9
9
|
<img alt="node-current" src="https://img.shields.io/node/v/rspack-plugin-mock?style=flat-square&colorA=564341&colorB=EDED91">
|
|
10
|
-
<img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/rspack-plugin-mock/peer/@rspack/core?style=flat-square&colorA=564341&colorB=EDED91">
|
|
11
|
-
<img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/rspack-plugin-mock/peer/@rsbuild/core?style=flat-square&colorA=564341&colorB=EDED91">
|
|
10
|
+
<img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/rspack-plugin-mock/peer/@rspack/core?style=flat-square&colorA=564341&colorB=EDED91&label=rspack">
|
|
11
|
+
<img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/rspack-plugin-mock/peer/@rsbuild/core?style=flat-square&colorA=564341&colorB=EDED91&label=rsbuild">
|
|
12
12
|
<img alt="npm" src="https://img.shields.io/npm/dm/rspack-plugin-mock?style=flat-square&colorA=564341&colorB=EDED91">
|
|
13
13
|
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/pengzhanbo/rspack-plugin-mock/lint.yml?style=flat-square&colorA=564341&colorB=EDED91">
|
|
14
14
|
</p>
|
package/README.zh-CN.md
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<a href="https://www.npmjs.com/package/rspack-plugin-mock"><img alt="npm" src="https://img.shields.io/npm/v/rspack-plugin-mock?style=flat-square&colorA=564341&colorB=EDED91"></a>
|
|
9
9
|
<img alt="node-current" src="https://img.shields.io/node/v/rspack-plugin-mock?style=flat-square&colorA=564341&colorB=EDED91">
|
|
10
|
-
<img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/rspack-plugin-mock/peer/@rspack/core?style=flat-square&colorA=564341&colorB=EDED91">
|
|
11
|
-
<img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/rspack-plugin-mock/peer/@rsbuild/core?style=flat-square&colorA=564341&colorB=EDED91">
|
|
10
|
+
<img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/rspack-plugin-mock/peer/@rspack/core?style=flat-square&colorA=564341&colorB=EDED91&label=rspack">
|
|
11
|
+
<img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/rspack-plugin-mock/peer/@rsbuild/core?style=flat-square&colorA=564341&colorB=EDED91&label=rsbuild">
|
|
12
12
|
<img alt="npm" src="https://img.shields.io/npm/dm/rspack-plugin-mock?style=flat-square&colorA=564341&colorB=EDED91">
|
|
13
13
|
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/pengzhanbo/rspack-plugin-mock/lint.yml?style=flat-square&colorA=564341&colorB=EDED91">
|
|
14
14
|
</p>
|
|
@@ -747,12 +747,6 @@ function mockWebSocket(compiler, httpServer, {
|
|
|
747
747
|
poolMap.set(mockUrl, wssMap = /* @__PURE__ */ new Map());
|
|
748
748
|
return wssMap;
|
|
749
749
|
};
|
|
750
|
-
const getWss = (wssMap, pathname) => {
|
|
751
|
-
let wss = wssMap.get(pathname);
|
|
752
|
-
if (!wss)
|
|
753
|
-
wssMap.set(pathname, wss = new WebSocketServer({ noServer: true }));
|
|
754
|
-
return wss;
|
|
755
|
-
};
|
|
756
750
|
const addHmr = (filepath, mockUrl) => {
|
|
757
751
|
let urlList = hmrMap.get(filepath);
|
|
758
752
|
if (!urlList)
|
|
@@ -784,14 +778,6 @@ ${e}
|
|
|
784
778
|
);
|
|
785
779
|
}
|
|
786
780
|
};
|
|
787
|
-
const emitConnection = (wss, ws, req, connectionList) => {
|
|
788
|
-
wss.emit("connection", ws, req);
|
|
789
|
-
ws.on("close", () => {
|
|
790
|
-
const i = connectionList.findIndex((item) => item.ws === ws);
|
|
791
|
-
if (i !== -1)
|
|
792
|
-
connectionList.splice(i, 1);
|
|
793
|
-
});
|
|
794
|
-
};
|
|
795
781
|
const restartWss = (wssMap, wss, mock, pathname, filepath) => {
|
|
796
782
|
const { cleanupList, connectionList, context } = wssContextMap.get(wss);
|
|
797
783
|
cleanupRunner(cleanupList);
|
|
@@ -879,6 +865,20 @@ ${e}
|
|
|
879
865
|
hmrMap.clear();
|
|
880
866
|
});
|
|
881
867
|
}
|
|
868
|
+
function getWss(wssMap, pathname) {
|
|
869
|
+
let wss = wssMap.get(pathname);
|
|
870
|
+
if (!wss)
|
|
871
|
+
wssMap.set(pathname, wss = new WebSocketServer({ noServer: true }));
|
|
872
|
+
return wss;
|
|
873
|
+
}
|
|
874
|
+
function emitConnection(wss, ws, req, connectionList) {
|
|
875
|
+
wss.emit("connection", ws, req);
|
|
876
|
+
ws.on("close", () => {
|
|
877
|
+
const i = connectionList.findIndex((item) => item.ws === ws);
|
|
878
|
+
if (i !== -1)
|
|
879
|
+
connectionList.splice(i, 1);
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
882
|
function cleanupRunner(cleanupList) {
|
|
883
883
|
let cleanup;
|
|
884
884
|
while (cleanup = cleanupList.shift())
|
|
@@ -747,12 +747,6 @@ function mockWebSocket(compiler, httpServer, {
|
|
|
747
747
|
poolMap.set(mockUrl, wssMap = /* @__PURE__ */ new Map());
|
|
748
748
|
return wssMap;
|
|
749
749
|
};
|
|
750
|
-
const getWss = (wssMap, pathname) => {
|
|
751
|
-
let wss = wssMap.get(pathname);
|
|
752
|
-
if (!wss)
|
|
753
|
-
wssMap.set(pathname, wss = new (0, _ws.WebSocketServer)({ noServer: true }));
|
|
754
|
-
return wss;
|
|
755
|
-
};
|
|
756
750
|
const addHmr = (filepath, mockUrl) => {
|
|
757
751
|
let urlList = hmrMap.get(filepath);
|
|
758
752
|
if (!urlList)
|
|
@@ -784,14 +778,6 @@ ${e}
|
|
|
784
778
|
);
|
|
785
779
|
}
|
|
786
780
|
};
|
|
787
|
-
const emitConnection = (wss, ws, req, connectionList) => {
|
|
788
|
-
wss.emit("connection", ws, req);
|
|
789
|
-
ws.on("close", () => {
|
|
790
|
-
const i = connectionList.findIndex((item) => item.ws === ws);
|
|
791
|
-
if (i !== -1)
|
|
792
|
-
connectionList.splice(i, 1);
|
|
793
|
-
});
|
|
794
|
-
};
|
|
795
781
|
const restartWss = (wssMap, wss, mock, pathname, filepath) => {
|
|
796
782
|
const { cleanupList, connectionList, context } = wssContextMap.get(wss);
|
|
797
783
|
cleanupRunner(cleanupList);
|
|
@@ -879,6 +865,20 @@ ${e}
|
|
|
879
865
|
hmrMap.clear();
|
|
880
866
|
})]);
|
|
881
867
|
}
|
|
868
|
+
function getWss(wssMap, pathname) {
|
|
869
|
+
let wss = wssMap.get(pathname);
|
|
870
|
+
if (!wss)
|
|
871
|
+
wssMap.set(pathname, wss = new (0, _ws.WebSocketServer)({ noServer: true }));
|
|
872
|
+
return wss;
|
|
873
|
+
}
|
|
874
|
+
function emitConnection(wss, ws, req, connectionList) {
|
|
875
|
+
wss.emit("connection", ws, req);
|
|
876
|
+
ws.on("close", () => {
|
|
877
|
+
const i = connectionList.findIndex((item) => item.ws === ws);
|
|
878
|
+
if (i !== -1)
|
|
879
|
+
connectionList.splice(i, 1);
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
882
|
function cleanupRunner(cleanupList) {
|
|
883
883
|
let cleanup;
|
|
884
884
|
while (cleanup = cleanupList.shift())
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
transformRawData,
|
|
10
10
|
urlParse,
|
|
11
11
|
vfs
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-2SSCBSV5.js";
|
|
13
13
|
|
|
14
14
|
// src/core/mockMiddleware.ts
|
|
15
15
|
import cors from "cors";
|
|
@@ -199,6 +199,9 @@ function resolveRspackOptions({
|
|
|
199
199
|
watch = false
|
|
200
200
|
}) {
|
|
201
201
|
const targets = ["node >= 18.0.0"];
|
|
202
|
+
if (alias && "@swc/helpers" in alias) {
|
|
203
|
+
delete alias["@swc/helpers"];
|
|
204
|
+
}
|
|
202
205
|
return {
|
|
203
206
|
mode: "production",
|
|
204
207
|
context: cwd,
|
|
@@ -206,7 +209,6 @@ function resolveRspackOptions({
|
|
|
206
209
|
watch,
|
|
207
210
|
target: "node18.0",
|
|
208
211
|
externalsType: isEsm ? "module" : "commonjs2",
|
|
209
|
-
externals: /^[^./].*/,
|
|
210
212
|
resolve: {
|
|
211
213
|
alias,
|
|
212
214
|
extensions: [".js", ".ts", ".cjs", ".mjs", ".json5", ".json"]
|
|
@@ -418,6 +420,7 @@ import { toArray as toArray3 } from "@pengzhanbo/utils";
|
|
|
418
420
|
// src/core/loadFromCode.ts
|
|
419
421
|
import path2 from "path";
|
|
420
422
|
import fs2, { promises as fsp2 } from "fs";
|
|
423
|
+
import { pathToFileURL } from "url";
|
|
421
424
|
async function loadFromCode({
|
|
422
425
|
filepath,
|
|
423
426
|
code,
|
|
@@ -425,16 +428,16 @@ async function loadFromCode({
|
|
|
425
428
|
cwd
|
|
426
429
|
}) {
|
|
427
430
|
filepath = path2.resolve(cwd, filepath);
|
|
428
|
-
const fileBase = `${filepath}.timestamp-${Date.now()}`;
|
|
429
431
|
const ext = isESM ? ".mjs" : ".cjs";
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
+
const filepathTmp = `${filepath}.timestamp-${Date.now()}${ext}`;
|
|
433
|
+
const file = pathToFileURL(filepathTmp).toString();
|
|
434
|
+
await fsp2.writeFile(filepathTmp, code, "utf8");
|
|
432
435
|
try {
|
|
433
|
-
const
|
|
434
|
-
return
|
|
436
|
+
const mod = await import(file);
|
|
437
|
+
return mod.default || mod;
|
|
435
438
|
} finally {
|
|
436
439
|
try {
|
|
437
|
-
fs2.unlinkSync(
|
|
440
|
+
fs2.unlinkSync(filepathTmp);
|
|
438
441
|
} catch {
|
|
439
442
|
}
|
|
440
443
|
}
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkT2VK464Wcjs = require('./chunk-T2VK464W.cjs');
|
|
13
13
|
|
|
14
14
|
// src/core/mockMiddleware.ts
|
|
15
15
|
var _cors = require('cors'); var _cors2 = _interopRequireDefault(_cors);
|
|
16
16
|
var _pathtoregexp = require('path-to-regexp');
|
|
17
17
|
function createMockMiddleware(compiler, options) {
|
|
18
18
|
function mockMiddleware(middlewares, reload) {
|
|
19
|
-
middlewares.unshift(
|
|
19
|
+
middlewares.unshift(_chunkT2VK464Wcjs.baseMiddleware.call(void 0, compiler, options));
|
|
20
20
|
const corsMiddleware = createCorsMiddleware(compiler, options);
|
|
21
21
|
if (corsMiddleware) {
|
|
22
22
|
middlewares.unshift(corsMiddleware);
|
|
@@ -39,9 +39,9 @@ function createCorsMiddleware(compiler, options) {
|
|
|
39
39
|
}
|
|
40
40
|
const proxies = options.proxies;
|
|
41
41
|
return !enabled ? void 0 : function(req, res, next) {
|
|
42
|
-
const { pathname } =
|
|
42
|
+
const { pathname } = _chunkT2VK464Wcjs.urlParse.call(void 0, req.url);
|
|
43
43
|
if (!pathname || proxies.length === 0 || !proxies.some(
|
|
44
|
-
(context) =>
|
|
44
|
+
(context) => _chunkT2VK464Wcjs.doesProxyContextMatchUrl.call(void 0, context, req.url, req)
|
|
45
45
|
)) {
|
|
46
46
|
return next();
|
|
47
47
|
}
|
|
@@ -73,7 +73,7 @@ function resolvePluginOptions({
|
|
|
73
73
|
bodyParserOptions = {},
|
|
74
74
|
priority = {}
|
|
75
75
|
} = {}, { alias, context, plugins, proxies }) {
|
|
76
|
-
const logger =
|
|
76
|
+
const logger = _chunkT2VK464Wcjs.createLogger.call(void 0,
|
|
77
77
|
"rspack:mock",
|
|
78
78
|
_utils.isBoolean.call(void 0, log) ? log ? "info" : "error" : log
|
|
79
79
|
);
|
|
@@ -148,7 +148,7 @@ function createCompiler(options, callback) {
|
|
|
148
148
|
const info = stats.toJson();
|
|
149
149
|
logError(info.errors);
|
|
150
150
|
}
|
|
151
|
-
const code =
|
|
151
|
+
const code = _chunkT2VK464Wcjs.vfs.readFileSync("/output.js", "utf-8");
|
|
152
152
|
const externals = [];
|
|
153
153
|
if (!isWatch) {
|
|
154
154
|
const modules = _optionalChain([stats, 'optionalAccess', _4 => _4.toJson, 'call', _5 => _5(), 'access', _6 => _6.modules]) || [];
|
|
@@ -165,7 +165,7 @@ function createCompiler(options, callback) {
|
|
|
165
165
|
}
|
|
166
166
|
const compiler = rspackCore.rspack(rspackOptions, isWatch ? handler : void 0);
|
|
167
167
|
if (compiler)
|
|
168
|
-
compiler.outputFileSystem =
|
|
168
|
+
compiler.outputFileSystem = _chunkT2VK464Wcjs.vfs;
|
|
169
169
|
if (!isWatch) {
|
|
170
170
|
_optionalChain([compiler, 'optionalAccess', _9 => _9.run, 'call', _10 => _10(async (...args) => {
|
|
171
171
|
await handler(...args);
|
|
@@ -199,6 +199,9 @@ function resolveRspackOptions({
|
|
|
199
199
|
watch = false
|
|
200
200
|
}) {
|
|
201
201
|
const targets = ["node >= 18.0.0"];
|
|
202
|
+
if (alias && "@swc/helpers" in alias) {
|
|
203
|
+
delete alias["@swc/helpers"];
|
|
204
|
+
}
|
|
202
205
|
return {
|
|
203
206
|
mode: "production",
|
|
204
207
|
context: cwd,
|
|
@@ -206,7 +209,6 @@ function resolveRspackOptions({
|
|
|
206
209
|
watch,
|
|
207
210
|
target: "node18.0",
|
|
208
211
|
externalsType: isEsm ? "module" : "commonjs2",
|
|
209
|
-
externals: /^[^./].*/,
|
|
210
212
|
resolve: {
|
|
211
213
|
alias,
|
|
212
214
|
extensions: [".js", ".ts", ".cjs", ".mjs", ".json5", ".json"]
|
|
@@ -366,7 +368,7 @@ async function writeMockEntryFile(entryFile, files, cwd) {
|
|
|
366
368
|
const importers = [];
|
|
367
369
|
const exporters = [];
|
|
368
370
|
for (const [index, filepath] of files.entries()) {
|
|
369
|
-
const file =
|
|
371
|
+
const file = _chunkT2VK464Wcjs.normalizePath.call(void 0, _path2.default.join(cwd, filepath));
|
|
370
372
|
importers.push(`import * as m${index} from '${file}'`);
|
|
371
373
|
exporters.push(`[m${index}, '${filepath}']`);
|
|
372
374
|
}
|
|
@@ -384,7 +386,7 @@ export default [
|
|
|
384
386
|
function getPluginPackageInfo() {
|
|
385
387
|
let pkg = {};
|
|
386
388
|
try {
|
|
387
|
-
const filepath = _path2.default.join(
|
|
389
|
+
const filepath = _path2.default.join(_chunkT2VK464Wcjs.packageDir, "../package.json");
|
|
388
390
|
if (_fs2.default.existsSync(filepath)) {
|
|
389
391
|
pkg = JSON.parse(_fs2.default.readFileSync(filepath, "utf8"));
|
|
390
392
|
}
|
|
@@ -398,7 +400,7 @@ function getPluginPackageInfo() {
|
|
|
398
400
|
function getHostDependencies(context) {
|
|
399
401
|
let pkg = {};
|
|
400
402
|
try {
|
|
401
|
-
const content =
|
|
403
|
+
const content = _chunkT2VK464Wcjs.lookupFile.call(void 0, context, ["package.json"]);
|
|
402
404
|
if (content)
|
|
403
405
|
pkg = JSON.parse(content);
|
|
404
406
|
} catch (e3) {
|
|
@@ -418,6 +420,7 @@ var _chokidar = require('chokidar'); var _chokidar2 = _interopRequireDefault(_ch
|
|
|
418
420
|
// src/core/loadFromCode.ts
|
|
419
421
|
|
|
420
422
|
|
|
423
|
+
var _url = require('url');
|
|
421
424
|
async function loadFromCode({
|
|
422
425
|
filepath,
|
|
423
426
|
code,
|
|
@@ -425,16 +428,16 @@ async function loadFromCode({
|
|
|
425
428
|
cwd
|
|
426
429
|
}) {
|
|
427
430
|
filepath = _path2.default.resolve(cwd, filepath);
|
|
428
|
-
const fileBase = `${filepath}.timestamp-${Date.now()}`;
|
|
429
431
|
const ext = isESM ? ".mjs" : ".cjs";
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
+
const filepathTmp = `${filepath}.timestamp-${Date.now()}${ext}`;
|
|
433
|
+
const file = _url.pathToFileURL.call(void 0, filepathTmp).toString();
|
|
434
|
+
await _fs.promises.writeFile(filepathTmp, code, "utf8");
|
|
432
435
|
try {
|
|
433
|
-
const
|
|
434
|
-
return
|
|
436
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require(file)));
|
|
437
|
+
return mod.default || mod;
|
|
435
438
|
} finally {
|
|
436
439
|
try {
|
|
437
|
-
_fs2.default.unlinkSync(
|
|
440
|
+
_fs2.default.unlinkSync(filepathTmp);
|
|
438
441
|
} catch (e4) {
|
|
439
442
|
}
|
|
440
443
|
}
|
|
@@ -452,7 +455,7 @@ var MockCompiler = (_class = class extends _events2.default {
|
|
|
452
455
|
const { include, exclude } = this.options;
|
|
453
456
|
this.fileFilter = _pluginutils.createFilter.call(void 0, include, exclude, { resolve: false });
|
|
454
457
|
try {
|
|
455
|
-
const pkg =
|
|
458
|
+
const pkg = _chunkT2VK464Wcjs.lookupFile.call(void 0, this.cwd, ["package.json"]);
|
|
456
459
|
this.moduleType = !!pkg && JSON.parse(pkg).type === "module" ? "esm" : "cjs";
|
|
457
460
|
} catch (e5) {
|
|
458
461
|
}
|
|
@@ -489,7 +492,7 @@ var MockCompiler = (_class = class extends _events2.default {
|
|
|
489
492
|
isESM: this.moduleType === "esm",
|
|
490
493
|
cwd: this.cwd
|
|
491
494
|
});
|
|
492
|
-
this._mockData =
|
|
495
|
+
this._mockData = _chunkT2VK464Wcjs.transformMockData.call(void 0, _chunkT2VK464Wcjs.transformRawData.call(void 0, result));
|
|
493
496
|
this.emit("update", this.watchInfo || {});
|
|
494
497
|
} catch (e) {
|
|
495
498
|
this.options.logger.error(e.stack || e.message);
|
package/dist/helper.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/core/defineMock.ts
|
|
2
2
|
var _utils = require('@pengzhanbo/utils');
|
|
3
3
|
function defineMock(config) {
|
|
4
4
|
return config;
|
|
@@ -14,6 +14,59 @@ function createDefineMock(transformer) {
|
|
|
14
14
|
return define;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// src/core/defineMockData.ts
|
|
18
|
+
|
|
19
|
+
var mockDataCache = /* @__PURE__ */ new Map();
|
|
20
|
+
var responseCache = /* @__PURE__ */ new WeakMap();
|
|
21
|
+
var staleInterval = 70;
|
|
22
|
+
var CacheImpl = class {
|
|
23
|
+
|
|
24
|
+
// 初始化数据的备份,用于 判断 传入的初始化数据是否发生变更
|
|
25
|
+
#initialValue;
|
|
26
|
+
#lastUpdate;
|
|
27
|
+
constructor(value) {
|
|
28
|
+
this.value = value;
|
|
29
|
+
this.#initialValue = _utils.deepClone.call(void 0, value);
|
|
30
|
+
this.#lastUpdate = Date.now();
|
|
31
|
+
}
|
|
32
|
+
hotUpdate(value) {
|
|
33
|
+
if (Date.now() - this.#lastUpdate < staleInterval)
|
|
34
|
+
return;
|
|
35
|
+
if (!_utils.deepEqual.call(void 0, value, this.#initialValue)) {
|
|
36
|
+
this.value = value;
|
|
37
|
+
this.#initialValue = _utils.deepClone.call(void 0, value);
|
|
38
|
+
this.#lastUpdate = Date.now();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function defineMockData(key, initialData) {
|
|
43
|
+
if (!mockDataCache.has(key))
|
|
44
|
+
mockDataCache.set(key, new CacheImpl(initialData));
|
|
45
|
+
const cache = mockDataCache.get(key);
|
|
46
|
+
cache.hotUpdate(initialData);
|
|
47
|
+
if (responseCache.has(cache))
|
|
48
|
+
return responseCache.get(cache);
|
|
49
|
+
const res = [
|
|
50
|
+
() => cache.value,
|
|
51
|
+
(val) => {
|
|
52
|
+
if (_utils.isFunction.call(void 0, val))
|
|
53
|
+
val = _nullishCoalesce(val(cache.value), () => ( cache.value));
|
|
54
|
+
cache.value = val;
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
Object.defineProperty(res, "value", {
|
|
58
|
+
get() {
|
|
59
|
+
return cache.value;
|
|
60
|
+
},
|
|
61
|
+
set(val) {
|
|
62
|
+
cache.value = val;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
responseCache.set(cache, res);
|
|
66
|
+
return res;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
17
70
|
|
|
18
71
|
|
|
19
|
-
exports.createDefineMock = createDefineMock; exports.defineMock = defineMock;
|
|
72
|
+
exports.createDefineMock = createDefineMock; exports.defineMock = defineMock; exports.defineMockData = defineMockData;
|
package/dist/helper.d.cts
CHANGED
|
@@ -69,4 +69,18 @@ declare function defineMock(config: MockOptions): MockOptions;
|
|
|
69
69
|
*/
|
|
70
70
|
declare function createDefineMock(transformer: (mock: MockHttpItem | MockWebsocketItem) => MockHttpItem | MockWebsocketItem | void): typeof defineMock;
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
type MockData<T = any> = readonly [
|
|
73
|
+
/**
|
|
74
|
+
* getter
|
|
75
|
+
*/
|
|
76
|
+
() => T,
|
|
77
|
+
/**
|
|
78
|
+
* setter
|
|
79
|
+
*/
|
|
80
|
+
(val: T | ((val: T) => T | void)) => void
|
|
81
|
+
] & {
|
|
82
|
+
value: T;
|
|
83
|
+
};
|
|
84
|
+
declare function defineMockData<T = any>(key: string, initialData: T): MockData<T>;
|
|
85
|
+
|
|
86
|
+
export { type MockData, MockHttpItem, MockOptions, MockWebsocketItem, createDefineMock, defineMock, defineMockData };
|
package/dist/helper.d.ts
CHANGED
|
@@ -69,4 +69,18 @@ declare function defineMock(config: MockOptions): MockOptions;
|
|
|
69
69
|
*/
|
|
70
70
|
declare function createDefineMock(transformer: (mock: MockHttpItem | MockWebsocketItem) => MockHttpItem | MockWebsocketItem | void): typeof defineMock;
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
type MockData<T = any> = readonly [
|
|
73
|
+
/**
|
|
74
|
+
* getter
|
|
75
|
+
*/
|
|
76
|
+
() => T,
|
|
77
|
+
/**
|
|
78
|
+
* setter
|
|
79
|
+
*/
|
|
80
|
+
(val: T | ((val: T) => T | void)) => void
|
|
81
|
+
] & {
|
|
82
|
+
value: T;
|
|
83
|
+
};
|
|
84
|
+
declare function defineMockData<T = any>(key: string, initialData: T): MockData<T>;
|
|
85
|
+
|
|
86
|
+
export { type MockData, MockHttpItem, MockOptions, MockWebsocketItem, createDefineMock, defineMock, defineMockData };
|
package/dist/helper.js
CHANGED
|
@@ -13,7 +13,60 @@ function createDefineMock(transformer) {
|
|
|
13
13
|
};
|
|
14
14
|
return define;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
// src/core/defineMockData.ts
|
|
18
|
+
import { deepClone, deepEqual, isFunction } from "@pengzhanbo/utils";
|
|
19
|
+
var mockDataCache = /* @__PURE__ */ new Map();
|
|
20
|
+
var responseCache = /* @__PURE__ */ new WeakMap();
|
|
21
|
+
var staleInterval = 70;
|
|
22
|
+
var CacheImpl = class {
|
|
23
|
+
value;
|
|
24
|
+
// 初始化数据的备份,用于 判断 传入的初始化数据是否发生变更
|
|
25
|
+
#initialValue;
|
|
26
|
+
#lastUpdate;
|
|
27
|
+
constructor(value) {
|
|
28
|
+
this.value = value;
|
|
29
|
+
this.#initialValue = deepClone(value);
|
|
30
|
+
this.#lastUpdate = Date.now();
|
|
31
|
+
}
|
|
32
|
+
hotUpdate(value) {
|
|
33
|
+
if (Date.now() - this.#lastUpdate < staleInterval)
|
|
34
|
+
return;
|
|
35
|
+
if (!deepEqual(value, this.#initialValue)) {
|
|
36
|
+
this.value = value;
|
|
37
|
+
this.#initialValue = deepClone(value);
|
|
38
|
+
this.#lastUpdate = Date.now();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function defineMockData(key, initialData) {
|
|
43
|
+
if (!mockDataCache.has(key))
|
|
44
|
+
mockDataCache.set(key, new CacheImpl(initialData));
|
|
45
|
+
const cache = mockDataCache.get(key);
|
|
46
|
+
cache.hotUpdate(initialData);
|
|
47
|
+
if (responseCache.has(cache))
|
|
48
|
+
return responseCache.get(cache);
|
|
49
|
+
const res = [
|
|
50
|
+
() => cache.value,
|
|
51
|
+
(val) => {
|
|
52
|
+
if (isFunction(val))
|
|
53
|
+
val = val(cache.value) ?? cache.value;
|
|
54
|
+
cache.value = val;
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
Object.defineProperty(res, "value", {
|
|
58
|
+
get() {
|
|
59
|
+
return cache.value;
|
|
60
|
+
},
|
|
61
|
+
set(val) {
|
|
62
|
+
cache.value = val;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
responseCache.set(cache, res);
|
|
66
|
+
return res;
|
|
67
|
+
}
|
|
16
68
|
export {
|
|
17
69
|
createDefineMock,
|
|
18
|
-
defineMock
|
|
70
|
+
defineMock,
|
|
71
|
+
defineMockData
|
|
19
72
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkZUCMHLWWcjs = require('./chunk-ZUCMHLWW.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkT2VK464Wcjs = require('./chunk-T2VK464W.cjs');
|
|
13
13
|
|
|
14
14
|
// src/rspack.ts
|
|
15
15
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -25,11 +25,11 @@ var MockServerPlugin = class {
|
|
|
25
25
|
const compilerOptions = compiler.options;
|
|
26
26
|
const options = resolvePluginOptions2(compiler, this.options);
|
|
27
27
|
if (_process2.default.env.NODE_ENV !== "production") {
|
|
28
|
-
const mockCompiler =
|
|
29
|
-
const mockMiddleware =
|
|
28
|
+
const mockCompiler = _chunkZUCMHLWWcjs.createMockCompiler.call(void 0, options);
|
|
29
|
+
const mockMiddleware = _chunkZUCMHLWWcjs.createMockMiddleware.call(void 0, mockCompiler, options);
|
|
30
30
|
const setupMiddlewares = _optionalChain([compilerOptions, 'access', _ => _.devServer, 'optionalAccess', _2 => _2.setupMiddlewares]);
|
|
31
|
-
const waitServer =
|
|
32
|
-
|
|
31
|
+
const waitServer = _chunkT2VK464Wcjs.waitingFor.call(void 0, (server) => {
|
|
32
|
+
_chunkT2VK464Wcjs.mockWebSocket.call(void 0, mockCompiler, server, options);
|
|
33
33
|
});
|
|
34
34
|
compilerOptions.devServer = {
|
|
35
35
|
...compilerOptions.devServer,
|
|
@@ -52,7 +52,7 @@ var MockServerPlugin = class {
|
|
|
52
52
|
const onProxyReq = item.onProxyReq;
|
|
53
53
|
item.onProxyReq = (proxyReq, req, ...args) => {
|
|
54
54
|
_optionalChain([onProxyReq, 'optionalCall', _8 => _8(proxyReq, req, ...args)]);
|
|
55
|
-
|
|
55
|
+
_chunkT2VK464Wcjs.rewriteRequest.call(void 0, proxyReq, req);
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
return item;
|
|
@@ -66,7 +66,7 @@ var MockServerPlugin = class {
|
|
|
66
66
|
compiler.hooks.watchRun.tap(PLUGIN_NAME, () => mockCompiler.run());
|
|
67
67
|
compiler.hooks.watchClose.tap(PLUGIN_NAME, () => mockCompiler.close());
|
|
68
68
|
} else if (options.build !== false) {
|
|
69
|
-
compiler.hooks.afterEmit.tap(PLUGIN_NAME, () =>
|
|
69
|
+
compiler.hooks.afterEmit.tap(PLUGIN_NAME, () => _chunkZUCMHLWWcjs.buildMockServer.call(void 0,
|
|
70
70
|
options,
|
|
71
71
|
compilerOptions.output.path || _path2.default.resolve(_process2.default.cwd(), "dist")
|
|
72
72
|
));
|
|
@@ -86,7 +86,7 @@ function resolvePluginOptions2(compiler, options) {
|
|
|
86
86
|
}
|
|
87
87
|
return [];
|
|
88
88
|
});
|
|
89
|
-
return
|
|
89
|
+
return _chunkZUCMHLWWcjs.resolvePluginOptions.call(void 0, options, {
|
|
90
90
|
alias,
|
|
91
91
|
context,
|
|
92
92
|
plugins: _utils.toArray.call(void 0, definePluginInstance),
|
|
@@ -100,4 +100,4 @@ function resolvePluginOptions2(compiler, options) {
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
exports.MockCompiler =
|
|
103
|
+
exports.MockCompiler = _chunkZUCMHLWWcjs.MockCompiler; exports.MockServerPlugin = MockServerPlugin; exports.createMockCompiler = _chunkZUCMHLWWcjs.createMockCompiler; exports.createMockMiddleware = _chunkZUCMHLWWcjs.createMockMiddleware; exports.mockWebSocket = _chunkT2VK464Wcjs.mockWebSocket; exports.resolvePluginOptions = resolvePluginOptions2;
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
createMockCompiler,
|
|
5
5
|
createMockMiddleware,
|
|
6
6
|
resolvePluginOptions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VKD4VKFQ.js";
|
|
8
8
|
import {
|
|
9
9
|
mockWebSocket,
|
|
10
10
|
rewriteRequest,
|
|
11
11
|
waitingFor
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-2SSCBSV5.js";
|
|
13
13
|
|
|
14
14
|
// src/rspack.ts
|
|
15
15
|
import process from "process";
|
package/dist/rsbuild.cjs
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkZUCMHLWWcjs = require('./chunk-ZUCMHLWW.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkT2VK464Wcjs = require('./chunk-T2VK464W.cjs');
|
|
11
11
|
|
|
12
12
|
// src/rsbuild.ts
|
|
13
13
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -22,7 +22,7 @@ function pluginMockServer(options = {}) {
|
|
|
22
22
|
name: "plugin-mock-server",
|
|
23
23
|
setup(api) {
|
|
24
24
|
const rsbuildConfig = api.getRsbuildConfig();
|
|
25
|
-
const resolvedOptions =
|
|
25
|
+
const resolvedOptions = _chunkZUCMHLWWcjs.resolvePluginOptions.call(void 0, options, {
|
|
26
26
|
proxies: resolveConfigProxies(rsbuildConfig),
|
|
27
27
|
alias: {},
|
|
28
28
|
context: api.context.rootPath,
|
|
@@ -32,7 +32,7 @@ function pluginMockServer(options = {}) {
|
|
|
32
32
|
if (resolvedOptions.build) {
|
|
33
33
|
api.onAfterBuild(async () => {
|
|
34
34
|
const config = api.getNormalizedConfig();
|
|
35
|
-
await
|
|
35
|
+
await _chunkZUCMHLWWcjs.buildMockServer.call(void 0,
|
|
36
36
|
resolvedOptions,
|
|
37
37
|
_path2.default.resolve(_process2.default.cwd(), config.output.distPath.root || "dist")
|
|
38
38
|
);
|
|
@@ -40,10 +40,10 @@ function pluginMockServer(options = {}) {
|
|
|
40
40
|
}
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
const mockCompiler =
|
|
43
|
+
const mockCompiler = _chunkZUCMHLWWcjs.createMockCompiler.call(void 0, resolvedOptions);
|
|
44
44
|
api.modifyRsbuildConfig((config) => {
|
|
45
45
|
updateServerProxyConfigByHttpMock(config);
|
|
46
|
-
const mockMiddleware =
|
|
46
|
+
const mockMiddleware = _chunkZUCMHLWWcjs.createMockMiddleware.call(void 0, mockCompiler, resolvedOptions);
|
|
47
47
|
config.dev ??= {};
|
|
48
48
|
config.dev.setupMiddlewares ??= [];
|
|
49
49
|
config.dev.setupMiddlewares.push((middlewares, server2) => {
|
|
@@ -64,7 +64,7 @@ function pluginMockServer(options = {}) {
|
|
|
64
64
|
mockCompiler.run();
|
|
65
65
|
if (shouldMockWs) {
|
|
66
66
|
server = _http.createServer.call(void 0, );
|
|
67
|
-
|
|
67
|
+
_chunkT2VK464Wcjs.mockWebSocket.call(void 0, mockCompiler, server, resolvedOptions);
|
|
68
68
|
server.listen(port);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -87,14 +87,14 @@ function pluginMockServer(options = {}) {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
+
function onProxyError(err, _req, res) {
|
|
91
|
+
console.error(_picocolors2.default.red(_optionalChain([err, 'optionalAccess', _13 => _13.stack]) || err.message));
|
|
92
|
+
res.statusCode = 500;
|
|
93
|
+
res.end();
|
|
94
|
+
}
|
|
90
95
|
function updateServerProxyConfigByHttpMock(config) {
|
|
91
|
-
if (!_optionalChain([config, 'access',
|
|
96
|
+
if (!_optionalChain([config, 'access', _14 => _14.server, 'optionalAccess', _15 => _15.proxy]))
|
|
92
97
|
return;
|
|
93
|
-
const onProxyError = (err, _req, res) => {
|
|
94
|
-
console.error(_picocolors2.default.red(_optionalChain([err, 'optionalAccess', _15 => _15.stack]) || err.message));
|
|
95
|
-
res.statusCode = 500;
|
|
96
|
-
res.end();
|
|
97
|
-
};
|
|
98
98
|
if (_utils.isArray.call(void 0, config.server.proxy)) {
|
|
99
99
|
config.server.proxy = config.server.proxy.map((item) => {
|
|
100
100
|
if (typeof item !== "function" && !item.ws) {
|
|
@@ -105,7 +105,7 @@ function updateServerProxyConfigByHttpMock(config) {
|
|
|
105
105
|
onError: onError || onProxyError,
|
|
106
106
|
onProxyReq: (proxyReq, req, ...args) => {
|
|
107
107
|
_optionalChain([onProxyReq, 'optionalCall', _16 => _16(proxyReq, req, ...args)]);
|
|
108
|
-
|
|
108
|
+
_chunkT2VK464Wcjs.rewriteRequest.call(void 0, proxyReq, req);
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
}
|
|
@@ -115,7 +115,7 @@ function updateServerProxyConfigByHttpMock(config) {
|
|
|
115
115
|
const onProxyReq = config.server.proxy.onProxyReq;
|
|
116
116
|
config.server.proxy.onProxyReq = (proxyReq, req, ...args) => {
|
|
117
117
|
_optionalChain([onProxyReq, 'optionalCall', _17 => _17(proxyReq, req, ...args)]);
|
|
118
|
-
|
|
118
|
+
_chunkT2VK464Wcjs.rewriteRequest.call(void 0, proxyReq, req);
|
|
119
119
|
};
|
|
120
120
|
config.server.proxy.onError ??= onProxyError;
|
|
121
121
|
} else if (config.server.proxy) {
|
|
@@ -130,7 +130,7 @@ function updateServerProxyConfigByHttpMock(config) {
|
|
|
130
130
|
...rest,
|
|
131
131
|
onProxyReq: (proxyReq, req, ...args) => {
|
|
132
132
|
_optionalChain([onProxyReq, 'optionalCall', _18 => _18(proxyReq, req, ...args)]);
|
|
133
|
-
|
|
133
|
+
_chunkT2VK464Wcjs.rewriteRequest.call(void 0, proxyReq, req);
|
|
134
134
|
},
|
|
135
135
|
onError: onError || onProxyError
|
|
136
136
|
};
|
package/dist/rsbuild.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
createMockCompiler,
|
|
4
4
|
createMockMiddleware,
|
|
5
5
|
resolvePluginOptions
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VKD4VKFQ.js";
|
|
7
7
|
import {
|
|
8
8
|
mockWebSocket,
|
|
9
9
|
rewriteRequest
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2SSCBSV5.js";
|
|
11
11
|
|
|
12
12
|
// src/rsbuild.ts
|
|
13
13
|
import process from "process";
|
|
@@ -87,14 +87,14 @@ function pluginMockServer(options = {}) {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
+
function onProxyError(err, _req, res) {
|
|
91
|
+
console.error(color.red(err?.stack || err.message));
|
|
92
|
+
res.statusCode = 500;
|
|
93
|
+
res.end();
|
|
94
|
+
}
|
|
90
95
|
function updateServerProxyConfigByHttpMock(config) {
|
|
91
96
|
if (!config.server?.proxy)
|
|
92
97
|
return;
|
|
93
|
-
const onProxyError = (err, _req, res) => {
|
|
94
|
-
console.error(color.red(err?.stack || err.message));
|
|
95
|
-
res.statusCode = 500;
|
|
96
|
-
res.end();
|
|
97
|
-
};
|
|
98
98
|
if (isArray(config.server.proxy)) {
|
|
99
99
|
config.server.proxy = config.server.proxy.map((item) => {
|
|
100
100
|
if (typeof item !== "function" && !item.ws) {
|
package/dist/server.cjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkT2VK464Wcjs = require('./chunk-T2VK464W.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -15,4 +15,4 @@ var _chunkZEC4FWWYcjs = require('./chunk-ZEC4FWWY.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.baseMiddleware =
|
|
18
|
+
exports.baseMiddleware = _chunkT2VK464Wcjs.baseMiddleware; exports.createLogger = _chunkT2VK464Wcjs.createLogger; exports.logLevels = _chunkT2VK464Wcjs.logLevels; exports.mockWebSocket = _chunkT2VK464Wcjs.mockWebSocket; exports.sortByValidator = _chunkT2VK464Wcjs.sortByValidator; exports.transformMockData = _chunkT2VK464Wcjs.transformMockData; exports.transformRawData = _chunkT2VK464Wcjs.transformRawData;
|
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rspack-plugin-mock",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "inject api mock server to development server",
|
|
6
6
|
"author": "pengzhanbo <q942450674@outlook.com> (https://github.com/pengzhanbo)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -92,23 +92,23 @@
|
|
|
92
92
|
"co-body": "^6.2.0",
|
|
93
93
|
"cookies": "^0.9.1",
|
|
94
94
|
"cors": "^2.8.5",
|
|
95
|
-
"debug": "^4.3.
|
|
95
|
+
"debug": "^4.3.7",
|
|
96
96
|
"fast-glob": "^3.3.2",
|
|
97
97
|
"formidable": "2.1.2",
|
|
98
98
|
"http-status": "^1.7.4",
|
|
99
|
-
"is-core-module": "^2.15.
|
|
99
|
+
"is-core-module": "^2.15.1",
|
|
100
100
|
"json5": "^2.2.3",
|
|
101
101
|
"memfs": "^4.11.1",
|
|
102
102
|
"mime-types": "^2.1.35",
|
|
103
|
-
"path-to-regexp": "
|
|
104
|
-
"picocolors": "^1.0
|
|
103
|
+
"path-to-regexp": "7.1.0",
|
|
104
|
+
"picocolors": "^1.1.0",
|
|
105
105
|
"portfinder": "^1.0.32",
|
|
106
106
|
"ws": "^8.18.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@pengzhanbo/eslint-config": "^1.
|
|
110
|
-
"@rsbuild/core": "1.0.1-
|
|
111
|
-
"@rspack/core": "1.0.
|
|
109
|
+
"@pengzhanbo/eslint-config": "^1.15.0",
|
|
110
|
+
"@rsbuild/core": "1.0.1-rc.5",
|
|
111
|
+
"@rspack/core": "^1.0.3",
|
|
112
112
|
"@types/co-body": "^6.1.3",
|
|
113
113
|
"@types/cookies": "^0.9.0",
|
|
114
114
|
"@types/cors": "^2.8.17",
|
|
@@ -116,13 +116,13 @@
|
|
|
116
116
|
"@types/formidable": "2.0.6",
|
|
117
117
|
"@types/is-core-module": "^2.2.2",
|
|
118
118
|
"@types/mime-types": "^2.1.4",
|
|
119
|
-
"@types/node": "^22.
|
|
119
|
+
"@types/node": "^22.5.4",
|
|
120
120
|
"@types/ws": "^8.5.12",
|
|
121
|
-
"bumpp": "^9.
|
|
121
|
+
"bumpp": "^9.5.2",
|
|
122
122
|
"conventional-changelog-cli": "^5.0.0",
|
|
123
|
-
"eslint": "^9.
|
|
124
|
-
"husky": "^9.1.
|
|
125
|
-
"lint-staged": "^15.2.
|
|
123
|
+
"eslint": "^9.10.0",
|
|
124
|
+
"husky": "^9.1.5",
|
|
125
|
+
"lint-staged": "^15.2.10",
|
|
126
126
|
"tsup": "^8.2.4",
|
|
127
127
|
"typescript": "^5.5.4"
|
|
128
128
|
},
|