rspack-plugin-mock 0.4.1 → 0.5.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/dist/{chunk-4XOUX6CL.js → chunk-E5FBQV7W.js} +13 -13
- package/dist/{chunk-JMXFIX5Q.js → chunk-KN5FLSDL.js} +7 -7
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -4
- package/dist/rsbuild.d.cts +2 -1
- package/dist/rsbuild.d.ts +2 -1
- package/dist/rsbuild.js +5 -5
- package/dist/server.js +1 -1
- package/package.json +12 -12
|
@@ -9,20 +9,20 @@ import {
|
|
|
9
9
|
transformRawData,
|
|
10
10
|
urlParse,
|
|
11
11
|
vfs
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KN5FLSDL.js";
|
|
13
13
|
|
|
14
14
|
// src/core/build.ts
|
|
15
|
-
import fs from "fs";
|
|
16
|
-
import fsp from "fs/promises";
|
|
17
|
-
import path from "path";
|
|
18
|
-
import process from "process";
|
|
15
|
+
import fs from "node:fs";
|
|
16
|
+
import fsp from "node:fs/promises";
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
import process from "node:process";
|
|
19
19
|
import { toArray } from "@pengzhanbo/utils";
|
|
20
20
|
import { createFilter } from "@rollup/pluginutils";
|
|
21
21
|
import fg from "fast-glob";
|
|
22
22
|
import color2 from "picocolors";
|
|
23
23
|
|
|
24
24
|
// src/core/createRspackCompiler.ts
|
|
25
|
-
import { createRequire } from "module";
|
|
25
|
+
import { createRequire } from "node:module";
|
|
26
26
|
import * as rspackCore from "@rspack/core";
|
|
27
27
|
import isCore from "is-core-module";
|
|
28
28
|
import color from "picocolors";
|
|
@@ -311,18 +311,18 @@ function getHostDependencies(context) {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
// src/core/mockCompiler.ts
|
|
314
|
-
import EventEmitter from "events";
|
|
315
|
-
import path3 from "path";
|
|
316
|
-
import process2 from "process";
|
|
314
|
+
import EventEmitter from "node:events";
|
|
315
|
+
import path3 from "node:path";
|
|
316
|
+
import process2 from "node:process";
|
|
317
317
|
import { toArray as toArray2 } from "@pengzhanbo/utils";
|
|
318
318
|
import { createFilter as createFilter2 } from "@rollup/pluginutils";
|
|
319
319
|
import chokidar from "chokidar";
|
|
320
320
|
import fastGlob from "fast-glob";
|
|
321
321
|
|
|
322
322
|
// src/core/loadFromCode.ts
|
|
323
|
-
import fs2, { promises as fsp2 } from "fs";
|
|
324
|
-
import path2 from "path";
|
|
325
|
-
import { pathToFileURL } from "url";
|
|
323
|
+
import fs2, { promises as fsp2 } from "node:fs";
|
|
324
|
+
import path2 from "node:path";
|
|
325
|
+
import { pathToFileURL } from "node:url";
|
|
326
326
|
async function loadFromCode({
|
|
327
327
|
filepath,
|
|
328
328
|
code,
|
|
@@ -494,7 +494,7 @@ function createCorsMiddleware(compiler, options) {
|
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
// src/core/resolvePluginOptions.ts
|
|
497
|
-
import process3 from "process";
|
|
497
|
+
import process3 from "node:process";
|
|
498
498
|
import { isBoolean, toArray as toArray3 } from "@pengzhanbo/utils";
|
|
499
499
|
function resolvePluginOptions({
|
|
500
500
|
prefix = [],
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
} from "@pengzhanbo/utils";
|
|
9
9
|
|
|
10
10
|
// src/core/utils.ts
|
|
11
|
-
import fs from "fs";
|
|
12
|
-
import os from "os";
|
|
13
|
-
import path from "path";
|
|
14
|
-
import { parse as queryParse } from "querystring";
|
|
15
|
-
import { fileURLToPath, URL as URL2 } from "url";
|
|
11
|
+
import fs from "node:fs";
|
|
12
|
+
import os from "node:os";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import { parse as queryParse } from "node:querystring";
|
|
15
|
+
import { fileURLToPath, URL as URL2 } from "node:url";
|
|
16
16
|
import Debug from "debug";
|
|
17
17
|
import { createFsFromVolume, Volume } from "memfs";
|
|
18
18
|
import { match } from "path-to-regexp";
|
|
@@ -193,7 +193,7 @@ function keysCount(obj) {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
// src/core/requestRecovery.ts
|
|
196
|
-
import { Buffer } from "buffer";
|
|
196
|
+
import { Buffer } from "node:buffer";
|
|
197
197
|
var requestCollectCache = /* @__PURE__ */ new WeakMap();
|
|
198
198
|
function collectRequest(req) {
|
|
199
199
|
const chunks = [];
|
|
@@ -217,7 +217,7 @@ function rewriteRequest(proxyReq, req) {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
// src/core/baseMiddleware.ts
|
|
220
|
-
import { Buffer as Buffer2 } from "buffer";
|
|
220
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
221
221
|
import {
|
|
222
222
|
isArray as isArray3,
|
|
223
223
|
isEmptyObject as isEmptyObject3,
|
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import { R as ResolvePluginOptions } from './mockWebsocket-Ki_cShTv.cjs';
|
|
|
2
2
|
export { e as Middleware, b as MiddlewareOptions, a as MockCompiler, M as MockCompilerOptions, f as MockSocketOptions, S as Server, c as createMockCompiler, d as createMockMiddleware, m as mockWebSocket } from './mockWebsocket-Ki_cShTv.cjs';
|
|
3
3
|
import { RspackPluginInstance, Compiler } from '@rspack/core';
|
|
4
4
|
import { c as MockServerPluginOptions } from './types-Aw0AciTG.cjs';
|
|
5
|
+
export { B as BodyParserOptions, E as ExtraRequest, F as FormidableFile, i as LogLevel, L as LogType, f as Method, M as MockHttpItem, d as MockMatchPriority, e as MockMatchSpecialPriority, b as MockOptions, g as MockRequest, h as MockResponse, a as MockWebsocketItem, R as ResponseBody, S as ServerBuildOption, W as WebSocketSetupContext } from './types-Aw0AciTG.cjs';
|
|
5
6
|
import 'node:http';
|
|
6
7
|
import 'node:http2';
|
|
7
8
|
import 'node:fs';
|
|
@@ -21,4 +22,4 @@ declare class MockServerPlugin implements RspackPluginInstance {
|
|
|
21
22
|
}
|
|
22
23
|
declare function resolvePluginOptions(compiler: Compiler, options: MockServerPluginOptions): ResolvePluginOptions;
|
|
23
24
|
|
|
24
|
-
export { MockServerPlugin, resolvePluginOptions };
|
|
25
|
+
export { MockServerPlugin, MockServerPluginOptions, resolvePluginOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { R as ResolvePluginOptions } from './mockWebsocket-DBgZBsdo.js';
|
|
|
2
2
|
export { e as Middleware, b as MiddlewareOptions, a as MockCompiler, M as MockCompilerOptions, f as MockSocketOptions, S as Server, c as createMockCompiler, d as createMockMiddleware, m as mockWebSocket } from './mockWebsocket-DBgZBsdo.js';
|
|
3
3
|
import { RspackPluginInstance, Compiler } from '@rspack/core';
|
|
4
4
|
import { c as MockServerPluginOptions } from './types-Aw0AciTG.js';
|
|
5
|
+
export { B as BodyParserOptions, E as ExtraRequest, F as FormidableFile, i as LogLevel, L as LogType, f as Method, M as MockHttpItem, d as MockMatchPriority, e as MockMatchSpecialPriority, b as MockOptions, g as MockRequest, h as MockResponse, a as MockWebsocketItem, R as ResponseBody, S as ServerBuildOption, W as WebSocketSetupContext } from './types-Aw0AciTG.js';
|
|
5
6
|
import 'node:http';
|
|
6
7
|
import 'node:http2';
|
|
7
8
|
import 'node:fs';
|
|
@@ -21,4 +22,4 @@ declare class MockServerPlugin implements RspackPluginInstance {
|
|
|
21
22
|
}
|
|
22
23
|
declare function resolvePluginOptions(compiler: Compiler, options: MockServerPluginOptions): ResolvePluginOptions;
|
|
23
24
|
|
|
24
|
-
export { MockServerPlugin, resolvePluginOptions };
|
|
25
|
+
export { MockServerPlugin, MockServerPluginOptions, resolvePluginOptions };
|
package/dist/index.js
CHANGED
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
createMockCompiler,
|
|
5
5
|
createMockMiddleware,
|
|
6
6
|
resolvePluginOptions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-E5FBQV7W.js";
|
|
8
8
|
import {
|
|
9
9
|
mockWebSocket,
|
|
10
10
|
rewriteRequest,
|
|
11
11
|
waitingFor
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KN5FLSDL.js";
|
|
13
13
|
|
|
14
14
|
// src/rspack.ts
|
|
15
|
-
import path from "path";
|
|
16
|
-
import process from "process";
|
|
15
|
+
import path from "node:path";
|
|
16
|
+
import process from "node:process";
|
|
17
17
|
import { isString, toArray } from "@pengzhanbo/utils";
|
|
18
18
|
import rspack from "@rspack/core";
|
|
19
19
|
var PLUGIN_NAME = "rspack-plugin-mock";
|
package/dist/rsbuild.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
import { c as MockServerPluginOptions } from './types-Aw0AciTG.cjs';
|
|
3
|
+
export { B as BodyParserOptions, E as ExtraRequest, F as FormidableFile, i as LogLevel, L as LogType, f as Method, M as MockHttpItem, d as MockMatchPriority, e as MockMatchSpecialPriority, b as MockOptions, g as MockRequest, h as MockResponse, a as MockWebsocketItem, R as ResponseBody, S as ServerBuildOption, W as WebSocketSetupContext } from './types-Aw0AciTG.cjs';
|
|
3
4
|
import 'co-body';
|
|
4
5
|
import 'cookies';
|
|
5
6
|
import 'cors';
|
|
@@ -11,4 +12,4 @@ import 'ws';
|
|
|
11
12
|
|
|
12
13
|
declare function pluginMockServer(options?: MockServerPluginOptions): RsbuildPlugin;
|
|
13
14
|
|
|
14
|
-
export { pluginMockServer };
|
|
15
|
+
export { MockServerPluginOptions, pluginMockServer };
|
package/dist/rsbuild.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
import { c as MockServerPluginOptions } from './types-Aw0AciTG.js';
|
|
3
|
+
export { B as BodyParserOptions, E as ExtraRequest, F as FormidableFile, i as LogLevel, L as LogType, f as Method, M as MockHttpItem, d as MockMatchPriority, e as MockMatchSpecialPriority, b as MockOptions, g as MockRequest, h as MockResponse, a as MockWebsocketItem, R as ResponseBody, S as ServerBuildOption, W as WebSocketSetupContext } from './types-Aw0AciTG.js';
|
|
3
4
|
import 'co-body';
|
|
4
5
|
import 'cookies';
|
|
5
6
|
import 'cors';
|
|
@@ -11,4 +12,4 @@ import 'ws';
|
|
|
11
12
|
|
|
12
13
|
declare function pluginMockServer(options?: MockServerPluginOptions): RsbuildPlugin;
|
|
13
14
|
|
|
14
|
-
export { pluginMockServer };
|
|
15
|
+
export { MockServerPluginOptions, pluginMockServer };
|
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-E5FBQV7W.js";
|
|
7
7
|
import {
|
|
8
8
|
mockWebSocket,
|
|
9
9
|
rewriteRequest
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KN5FLSDL.js";
|
|
11
11
|
|
|
12
12
|
// src/rsbuild.ts
|
|
13
|
-
import { createServer } from "http";
|
|
14
|
-
import path from "path";
|
|
15
|
-
import process from "process";
|
|
13
|
+
import { createServer } from "node:http";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import process from "node: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.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.5.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",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@pengzhanbo/utils": "^1.1.2",
|
|
90
|
-
"@rollup/pluginutils": "^5.1.
|
|
90
|
+
"@rollup/pluginutils": "^5.1.3",
|
|
91
91
|
"chokidar": "3.6.0",
|
|
92
92
|
"co-body": "^6.2.0",
|
|
93
93
|
"cookies": "^0.9.1",
|
|
@@ -95,20 +95,20 @@
|
|
|
95
95
|
"debug": "^4.3.7",
|
|
96
96
|
"fast-glob": "^3.3.2",
|
|
97
97
|
"formidable": "2.1.2",
|
|
98
|
-
"http-status": "^
|
|
98
|
+
"http-status": "^2.0.0",
|
|
99
99
|
"is-core-module": "^2.15.1",
|
|
100
100
|
"json5": "^2.2.3",
|
|
101
101
|
"memfs": "^4.14.0",
|
|
102
102
|
"mime-types": "^2.1.35",
|
|
103
103
|
"path-to-regexp": "7.1.0",
|
|
104
|
-
"picocolors": "^1.1.
|
|
104
|
+
"picocolors": "^1.1.1",
|
|
105
105
|
"portfinder": "^1.0.32",
|
|
106
106
|
"ws": "^8.18.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@pengzhanbo/eslint-config": "^1.18.
|
|
110
|
-
"@rsbuild/core": "^1.0
|
|
111
|
-
"@rspack/core": "^1.
|
|
109
|
+
"@pengzhanbo/eslint-config": "^1.18.2",
|
|
110
|
+
"@rsbuild/core": "^1.1.0",
|
|
111
|
+
"@rspack/core": "^1.1.1",
|
|
112
112
|
"@types/co-body": "^6.1.3",
|
|
113
113
|
"@types/cookies": "^0.9.0",
|
|
114
114
|
"@types/cors": "^2.8.17",
|
|
@@ -116,14 +116,14 @@
|
|
|
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.
|
|
120
|
-
"@types/ws": "^8.5.
|
|
121
|
-
"bumpp": "^9.
|
|
119
|
+
"@types/node": "^22.9.0",
|
|
120
|
+
"@types/ws": "^8.5.13",
|
|
121
|
+
"bumpp": "^9.8.1",
|
|
122
122
|
"conventional-changelog-cli": "^5.0.0",
|
|
123
|
-
"eslint": "^9.
|
|
123
|
+
"eslint": "^9.14.0",
|
|
124
124
|
"husky": "^9.1.6",
|
|
125
125
|
"lint-staged": "^15.2.10",
|
|
126
|
-
"tsup": "^8.3.
|
|
126
|
+
"tsup": "^8.3.5",
|
|
127
127
|
"typescript": "^5.6.3"
|
|
128
128
|
},
|
|
129
129
|
"lint-staged": {
|