rspack-plugin-mock 0.4.0 → 0.4.1
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/dist/{chunk-VKD4VKFQ.js → chunk-4XOUX6CL.js} +118 -117
- package/dist/{chunk-2SSCBSV5.js → chunk-JMXFIX5Q.js} +260 -258
- package/dist/{chunk-T2VK464W.cjs → chunk-TKSRTJX5.cjs} +240 -238
- package/dist/{chunk-ZUCMHLWW.cjs → chunk-YAHWW6TX.cjs} +118 -117
- package/dist/helper.d.cts +6 -6
- package/dist/helper.d.ts +6 -6
- package/dist/index.cjs +25 -25
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +14 -14
- package/dist/{mockWebsocket-CPuTAvL0.d.ts → mockWebsocket-DBgZBsdo.d.ts} +15 -15
- package/dist/{mockWebsocket-Dc9CZBfv.d.cts → mockWebsocket-Ki_cShTv.d.cts} +15 -15
- package/dist/rsbuild.cjs +11 -11
- package/dist/rsbuild.d.cts +5 -5
- package/dist/rsbuild.d.ts +5 -5
- package/dist/rsbuild.js +3 -3
- package/dist/server.cjs +2 -2
- package/dist/server.d.cts +8 -8
- package/dist/server.d.ts +8 -8
- package/dist/server.js +1 -1
- package/dist/{types-BgpcN3jm.d.ts → types-Aw0AciTG.d.cts} +5 -5
- package/dist/{types-BgpcN3jm.d.cts → types-Aw0AciTG.d.ts} +5 -5
- package/package.json +15 -15
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RspackPluginInstance, Compiler, RspackOptionsNormalized } from '@rspack/core';
|
|
2
|
-
import { i as LogLevel,
|
|
2
|
+
import { i as LogLevel, b as MockOptions, c as MockServerPluginOptions, S as ServerBuildOption } from './types-Aw0AciTG.js';
|
|
3
3
|
import { Server as Server$1 } from 'node:http';
|
|
4
4
|
import { Http2SecureServer } from 'node:http2';
|
|
5
|
-
import EventEmitter from 'node:events';
|
|
6
5
|
import { FSWatcher } from 'node:fs';
|
|
6
|
+
import EventEmitter from 'node:events';
|
|
7
7
|
|
|
8
8
|
interface Logger {
|
|
9
9
|
debug: (msg: string, level?: boolean | LogLevel) => void;
|
|
@@ -14,18 +14,6 @@ interface Logger {
|
|
|
14
14
|
declare const logLevels: Record<LogLevel, number>;
|
|
15
15
|
declare function createLogger(prefix: string, defaultLevel?: LogLevel): Logger;
|
|
16
16
|
|
|
17
|
-
interface ResolvedCompilerOptions {
|
|
18
|
-
alias: Record<string, false | string | (string | false)[]>;
|
|
19
|
-
proxies: (string | ((pathname: string, req: any) => boolean))[];
|
|
20
|
-
wsProxies: (string | ((pathname: string, req: any) => boolean))[];
|
|
21
|
-
plugins: RspackPluginInstance[];
|
|
22
|
-
context?: string;
|
|
23
|
-
}
|
|
24
|
-
type ResolvePluginOptions = Required<Omit<MockServerPluginOptions, 'build'>> & ResolvedCompilerOptions & {
|
|
25
|
-
logger: Logger;
|
|
26
|
-
build: false | ServerBuildOption;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
17
|
interface MockCompilerOptions {
|
|
30
18
|
alias?: Record<string, false | string | (string | false)[]>;
|
|
31
19
|
plugins: RspackPluginInstance[];
|
|
@@ -55,6 +43,18 @@ declare class MockCompiler extends EventEmitter {
|
|
|
55
43
|
watchMockFiles(): void;
|
|
56
44
|
}
|
|
57
45
|
|
|
46
|
+
interface ResolvedCompilerOptions {
|
|
47
|
+
alias: Record<string, false | string | (string | false)[]>;
|
|
48
|
+
proxies: (string | ((pathname: string, req: any) => boolean))[];
|
|
49
|
+
wsProxies: (string | ((pathname: string, req: any) => boolean))[];
|
|
50
|
+
plugins: RspackPluginInstance[];
|
|
51
|
+
context?: string;
|
|
52
|
+
}
|
|
53
|
+
type ResolvePluginOptions = Required<Omit<MockServerPluginOptions, 'build'>> & ResolvedCompilerOptions & {
|
|
54
|
+
logger: Logger;
|
|
55
|
+
build: false | ServerBuildOption;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
58
|
interface MiddlewareOptions {
|
|
59
59
|
alias: Record<string, false | string | (string | false)[]>;
|
|
60
60
|
proxies: (string | ((pathname: string, req: any) => boolean))[];
|
|
@@ -73,4 +73,4 @@ interface MockSocketOptions {
|
|
|
73
73
|
}
|
|
74
74
|
declare function mockWebSocket(compiler: MockCompiler, httpServer: Server$1 | Http2SecureServer, { wsProxies: proxies, cookiesOptions, logger, }: MockSocketOptions): void;
|
|
75
75
|
|
|
76
|
-
export { type Logger as L, type
|
|
76
|
+
export { type Logger as L, type MockCompilerOptions as M, type ResolvePluginOptions as R, type Server as S, MockCompiler as a, type MiddlewareOptions as b, createMockCompiler as c, createMockMiddleware as d, type Middleware as e, type MockSocketOptions as f, createLogger as g, logLevels as l, mockWebSocket as m };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RspackPluginInstance, Compiler, RspackOptionsNormalized } from '@rspack/core';
|
|
2
|
-
import { i as LogLevel,
|
|
2
|
+
import { i as LogLevel, b as MockOptions, c as MockServerPluginOptions, S as ServerBuildOption } from './types-Aw0AciTG.cjs';
|
|
3
3
|
import { Server as Server$1 } from 'node:http';
|
|
4
4
|
import { Http2SecureServer } from 'node:http2';
|
|
5
|
-
import EventEmitter from 'node:events';
|
|
6
5
|
import { FSWatcher } from 'node:fs';
|
|
6
|
+
import EventEmitter from 'node:events';
|
|
7
7
|
|
|
8
8
|
interface Logger {
|
|
9
9
|
debug: (msg: string, level?: boolean | LogLevel) => void;
|
|
@@ -14,18 +14,6 @@ interface Logger {
|
|
|
14
14
|
declare const logLevels: Record<LogLevel, number>;
|
|
15
15
|
declare function createLogger(prefix: string, defaultLevel?: LogLevel): Logger;
|
|
16
16
|
|
|
17
|
-
interface ResolvedCompilerOptions {
|
|
18
|
-
alias: Record<string, false | string | (string | false)[]>;
|
|
19
|
-
proxies: (string | ((pathname: string, req: any) => boolean))[];
|
|
20
|
-
wsProxies: (string | ((pathname: string, req: any) => boolean))[];
|
|
21
|
-
plugins: RspackPluginInstance[];
|
|
22
|
-
context?: string;
|
|
23
|
-
}
|
|
24
|
-
type ResolvePluginOptions = Required<Omit<MockServerPluginOptions, 'build'>> & ResolvedCompilerOptions & {
|
|
25
|
-
logger: Logger;
|
|
26
|
-
build: false | ServerBuildOption;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
17
|
interface MockCompilerOptions {
|
|
30
18
|
alias?: Record<string, false | string | (string | false)[]>;
|
|
31
19
|
plugins: RspackPluginInstance[];
|
|
@@ -55,6 +43,18 @@ declare class MockCompiler extends EventEmitter {
|
|
|
55
43
|
watchMockFiles(): void;
|
|
56
44
|
}
|
|
57
45
|
|
|
46
|
+
interface ResolvedCompilerOptions {
|
|
47
|
+
alias: Record<string, false | string | (string | false)[]>;
|
|
48
|
+
proxies: (string | ((pathname: string, req: any) => boolean))[];
|
|
49
|
+
wsProxies: (string | ((pathname: string, req: any) => boolean))[];
|
|
50
|
+
plugins: RspackPluginInstance[];
|
|
51
|
+
context?: string;
|
|
52
|
+
}
|
|
53
|
+
type ResolvePluginOptions = Required<Omit<MockServerPluginOptions, 'build'>> & ResolvedCompilerOptions & {
|
|
54
|
+
logger: Logger;
|
|
55
|
+
build: false | ServerBuildOption;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
58
|
interface MiddlewareOptions {
|
|
59
59
|
alias: Record<string, false | string | (string | false)[]>;
|
|
60
60
|
proxies: (string | ((pathname: string, req: any) => boolean))[];
|
|
@@ -73,4 +73,4 @@ interface MockSocketOptions {
|
|
|
73
73
|
}
|
|
74
74
|
declare function mockWebSocket(compiler: MockCompiler, httpServer: Server$1 | Http2SecureServer, { wsProxies: proxies, cookiesOptions, logger, }: MockSocketOptions): void;
|
|
75
75
|
|
|
76
|
-
export { type Logger as L, type
|
|
76
|
+
export { type Logger as L, type MockCompilerOptions as M, type ResolvePluginOptions as R, type Server as S, MockCompiler as a, type MiddlewareOptions as b, createMockCompiler as c, createMockMiddleware as d, type Middleware as e, type MockSocketOptions as f, createLogger as g, logLevels as l, mockWebSocket as m };
|
package/dist/rsbuild.cjs
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkYAHWW6TXcjs = require('./chunk-YAHWW6TX.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkTKSRTJX5cjs = require('./chunk-TKSRTJX5.cjs');
|
|
11
11
|
|
|
12
12
|
// src/rsbuild.ts
|
|
13
|
-
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
14
13
|
var _http = require('http');
|
|
15
14
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
15
|
+
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
16
16
|
var _utils = require('@pengzhanbo/utils');
|
|
17
17
|
var _core = require('@rspack/core'); var _core2 = _interopRequireDefault(_core);
|
|
18
18
|
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
@@ -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 = _chunkYAHWW6TXcjs.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 _chunkYAHWW6TXcjs.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 = _chunkYAHWW6TXcjs.createMockCompiler.call(void 0, resolvedOptions);
|
|
44
44
|
api.modifyRsbuildConfig((config) => {
|
|
45
45
|
updateServerProxyConfigByHttpMock(config);
|
|
46
|
-
const mockMiddleware =
|
|
46
|
+
const mockMiddleware = _chunkYAHWW6TXcjs.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
|
+
_chunkTKSRTJX5cjs.mockWebSocket.call(void 0, mockCompiler, server, resolvedOptions);
|
|
68
68
|
server.listen(port);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -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
|
+
_chunkTKSRTJX5cjs.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
|
+
_chunkTKSRTJX5cjs.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
|
+
_chunkTKSRTJX5cjs.rewriteRequest.call(void 0, proxyReq, req);
|
|
134
134
|
},
|
|
135
135
|
onError: onError || onProxyError
|
|
136
136
|
};
|
package/dist/rsbuild.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import 'node:http';
|
|
5
|
-
import 'node:stream';
|
|
2
|
+
import { c as MockServerPluginOptions } from './types-Aw0AciTG.cjs';
|
|
3
|
+
import 'co-body';
|
|
6
4
|
import 'cookies';
|
|
7
5
|
import 'cors';
|
|
8
6
|
import 'formidable';
|
|
7
|
+
import 'node:buffer';
|
|
8
|
+
import 'node:http';
|
|
9
|
+
import 'node:stream';
|
|
9
10
|
import 'ws';
|
|
10
|
-
import 'co-body';
|
|
11
11
|
|
|
12
12
|
declare function pluginMockServer(options?: MockServerPluginOptions): RsbuildPlugin;
|
|
13
13
|
|
package/dist/rsbuild.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import 'node:http';
|
|
5
|
-
import 'node:stream';
|
|
2
|
+
import { c as MockServerPluginOptions } from './types-Aw0AciTG.js';
|
|
3
|
+
import 'co-body';
|
|
6
4
|
import 'cookies';
|
|
7
5
|
import 'cors';
|
|
8
6
|
import 'formidable';
|
|
7
|
+
import 'node:buffer';
|
|
8
|
+
import 'node:http';
|
|
9
|
+
import 'node:stream';
|
|
9
10
|
import 'ws';
|
|
10
|
-
import 'co-body';
|
|
11
11
|
|
|
12
12
|
declare function pluginMockServer(options?: MockServerPluginOptions): RsbuildPlugin;
|
|
13
13
|
|
package/dist/rsbuild.js
CHANGED
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
createMockCompiler,
|
|
4
4
|
createMockMiddleware,
|
|
5
5
|
resolvePluginOptions
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4XOUX6CL.js";
|
|
7
7
|
import {
|
|
8
8
|
mockWebSocket,
|
|
9
9
|
rewriteRequest
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JMXFIX5Q.js";
|
|
11
11
|
|
|
12
12
|
// src/rsbuild.ts
|
|
13
|
-
import process from "process";
|
|
14
13
|
import { createServer } from "http";
|
|
15
14
|
import path from "path";
|
|
15
|
+
import process from "process";
|
|
16
16
|
import { isArray, toArray } from "@pengzhanbo/utils";
|
|
17
17
|
import rspack from "@rspack/core";
|
|
18
18
|
import color from "picocolors";
|
package/dist/server.cjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkTKSRTJX5cjs = require('./chunk-TKSRTJX5.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -15,4 +15,4 @@ var _chunkT2VK464Wcjs = require('./chunk-T2VK464W.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.baseMiddleware =
|
|
18
|
+
exports.baseMiddleware = _chunkTKSRTJX5cjs.baseMiddleware; exports.createLogger = _chunkTKSRTJX5cjs.createLogger; exports.logLevels = _chunkTKSRTJX5cjs.logLevels; exports.mockWebSocket = _chunkTKSRTJX5cjs.mockWebSocket; exports.sortByValidator = _chunkTKSRTJX5cjs.sortByValidator; exports.transformMockData = _chunkTKSRTJX5cjs.transformMockData; exports.transformRawData = _chunkTKSRTJX5cjs.transformRawData;
|
package/dist/server.d.cts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { L as Logger,
|
|
3
|
-
export {
|
|
4
|
-
import '
|
|
5
|
-
import 'node:http';
|
|
6
|
-
import 'node:stream';
|
|
1
|
+
import { c as MockServerPluginOptions, M as MockHttpItem, a as MockWebsocketItem, b as MockOptions } from './types-Aw0AciTG.cjs';
|
|
2
|
+
import { L as Logger, a as MockCompiler, e as Middleware } from './mockWebsocket-Ki_cShTv.cjs';
|
|
3
|
+
export { f as MockSocketOptions, g as createLogger, l as logLevels, m as mockWebSocket } from './mockWebsocket-Ki_cShTv.cjs';
|
|
4
|
+
import 'co-body';
|
|
7
5
|
import 'cookies';
|
|
8
6
|
import 'cors';
|
|
9
7
|
import 'formidable';
|
|
8
|
+
import 'node:buffer';
|
|
9
|
+
import 'node:http';
|
|
10
|
+
import 'node:stream';
|
|
10
11
|
import 'ws';
|
|
11
|
-
import 'co-body';
|
|
12
12
|
import '@rspack/core';
|
|
13
13
|
import 'node:http2';
|
|
14
|
-
import 'node:events';
|
|
15
14
|
import 'node:fs';
|
|
15
|
+
import 'node:events';
|
|
16
16
|
|
|
17
17
|
interface BaseMiddlewareOptions {
|
|
18
18
|
formidableOptions: MockServerPluginOptions['formidableOptions'];
|
package/dist/server.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { L as Logger,
|
|
3
|
-
export {
|
|
4
|
-
import '
|
|
5
|
-
import 'node:http';
|
|
6
|
-
import 'node:stream';
|
|
1
|
+
import { c as MockServerPluginOptions, M as MockHttpItem, a as MockWebsocketItem, b as MockOptions } from './types-Aw0AciTG.js';
|
|
2
|
+
import { L as Logger, a as MockCompiler, e as Middleware } from './mockWebsocket-DBgZBsdo.js';
|
|
3
|
+
export { f as MockSocketOptions, g as createLogger, l as logLevels, m as mockWebSocket } from './mockWebsocket-DBgZBsdo.js';
|
|
4
|
+
import 'co-body';
|
|
7
5
|
import 'cookies';
|
|
8
6
|
import 'cors';
|
|
9
7
|
import 'formidable';
|
|
8
|
+
import 'node:buffer';
|
|
9
|
+
import 'node:http';
|
|
10
|
+
import 'node:stream';
|
|
10
11
|
import 'ws';
|
|
11
|
-
import 'co-body';
|
|
12
12
|
import '@rspack/core';
|
|
13
13
|
import 'node:http2';
|
|
14
|
-
import 'node:events';
|
|
15
14
|
import 'node:fs';
|
|
15
|
+
import 'node:events';
|
|
16
16
|
|
|
17
17
|
interface BaseMiddlewareOptions {
|
|
18
18
|
formidableOptions: MockServerPluginOptions['formidableOptions'];
|
package/dist/server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import http from 'node:http';
|
|
3
|
-
import { Readable } from 'node:stream';
|
|
1
|
+
import { Options } from 'co-body';
|
|
4
2
|
import Cookies from 'cookies';
|
|
5
3
|
import { CorsOptions } from 'cors';
|
|
6
4
|
import formidable from 'formidable';
|
|
5
|
+
import { Buffer } from 'node:buffer';
|
|
6
|
+
import http from 'node:http';
|
|
7
|
+
import { Readable } from 'node:stream';
|
|
7
8
|
import { WebSocketServer } from 'ws';
|
|
8
|
-
import { Options } from 'co-body';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Configure plugin
|
|
@@ -567,4 +567,4 @@ type FormidableFile = formidable.File | formidable.File[];
|
|
|
567
567
|
type LogType = 'info' | 'warn' | 'error' | 'debug';
|
|
568
568
|
type LogLevel = LogType | 'silent';
|
|
569
569
|
|
|
570
|
-
export type { BodyParserOptions as B, ExtraRequest as E, FormidableFile as F, LogType as L,
|
|
570
|
+
export type { BodyParserOptions as B, ExtraRequest as E, FormidableFile as F, LogType as L, MockHttpItem as M, ResponseBody as R, ServerBuildOption as S, WebSocketSetupContext as W, MockWebsocketItem as a, MockOptions as b, MockServerPluginOptions as c, MockMatchPriority as d, MockMatchSpecialPriority as e, Method as f, MockRequest as g, MockResponse as h, LogLevel as i };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import http from 'node:http';
|
|
3
|
-
import { Readable } from 'node:stream';
|
|
1
|
+
import { Options } from 'co-body';
|
|
4
2
|
import Cookies from 'cookies';
|
|
5
3
|
import { CorsOptions } from 'cors';
|
|
6
4
|
import formidable from 'formidable';
|
|
5
|
+
import { Buffer } from 'node:buffer';
|
|
6
|
+
import http from 'node:http';
|
|
7
|
+
import { Readable } from 'node:stream';
|
|
7
8
|
import { WebSocketServer } from 'ws';
|
|
8
|
-
import { Options } from 'co-body';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Configure plugin
|
|
@@ -567,4 +567,4 @@ type FormidableFile = formidable.File | formidable.File[];
|
|
|
567
567
|
type LogType = 'info' | 'warn' | 'error' | 'debug';
|
|
568
568
|
type LogLevel = LogType | 'silent';
|
|
569
569
|
|
|
570
|
-
export type { BodyParserOptions as B, ExtraRequest as E, FormidableFile as F, LogType as L,
|
|
570
|
+
export type { BodyParserOptions as B, ExtraRequest as E, FormidableFile as F, LogType as L, MockHttpItem as M, ResponseBody as R, ServerBuildOption as S, WebSocketSetupContext as W, MockWebsocketItem as a, MockOptions as b, MockServerPluginOptions as c, MockMatchPriority as d, MockMatchSpecialPriority as e, Method as f, MockRequest as g, MockResponse as h, LogLevel as i };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rspack-plugin-mock",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.1",
|
|
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",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"pnpm": ">=9"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@rsbuild/core": ">=0.
|
|
78
|
-
"@rspack/core": ">=0.
|
|
77
|
+
"@rsbuild/core": ">=1.0.0",
|
|
78
|
+
"@rspack/core": ">=1.0.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
81
81
|
"@rsbuild/core": {
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@pengzhanbo/utils": "^1.1.2",
|
|
90
|
-
"@rollup/pluginutils": "^5.1.
|
|
91
|
-
"chokidar": "
|
|
90
|
+
"@rollup/pluginutils": "^5.1.2",
|
|
91
|
+
"chokidar": "3.6.0",
|
|
92
92
|
"co-body": "^6.2.0",
|
|
93
93
|
"cookies": "^0.9.1",
|
|
94
94
|
"cors": "^2.8.5",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"http-status": "^1.7.4",
|
|
99
99
|
"is-core-module": "^2.15.1",
|
|
100
100
|
"json5": "^2.2.3",
|
|
101
|
-
"memfs": "^4.
|
|
101
|
+
"memfs": "^4.14.0",
|
|
102
102
|
"mime-types": "^2.1.35",
|
|
103
103
|
"path-to-regexp": "7.1.0",
|
|
104
104
|
"picocolors": "^1.1.0",
|
|
@@ -106,9 +106,9 @@
|
|
|
106
106
|
"ws": "^8.18.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@pengzhanbo/eslint-config": "^1.
|
|
110
|
-
"@rsbuild/core": "1.0.
|
|
111
|
-
"@rspack/core": "^1.0.
|
|
109
|
+
"@pengzhanbo/eslint-config": "^1.18.1",
|
|
110
|
+
"@rsbuild/core": "^1.0.14",
|
|
111
|
+
"@rspack/core": "^1.0.11",
|
|
112
112
|
"@types/co-body": "^6.1.3",
|
|
113
113
|
"@types/cookies": "^0.9.0",
|
|
114
114
|
"@types/cors": "^2.8.17",
|
|
@@ -116,15 +116,15 @@
|
|
|
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.5
|
|
119
|
+
"@types/node": "^22.7.5",
|
|
120
120
|
"@types/ws": "^8.5.12",
|
|
121
|
-
"bumpp": "^9.
|
|
121
|
+
"bumpp": "^9.7.1",
|
|
122
122
|
"conventional-changelog-cli": "^5.0.0",
|
|
123
|
-
"eslint": "^9.
|
|
124
|
-
"husky": "^9.1.
|
|
123
|
+
"eslint": "^9.12.0",
|
|
124
|
+
"husky": "^9.1.6",
|
|
125
125
|
"lint-staged": "^15.2.10",
|
|
126
|
-
"tsup": "^8.
|
|
127
|
-
"typescript": "^5.
|
|
126
|
+
"tsup": "^8.3.0",
|
|
127
|
+
"typescript": "^5.6.3"
|
|
128
128
|
},
|
|
129
129
|
"lint-staged": {
|
|
130
130
|
"*": "eslint --fix"
|