rspack-plugin-mock 1.2.0 → 2.0.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rspack-plugin-mock",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "2.0.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",
@@ -19,47 +19,31 @@
19
19
  "rsbuild-plugin"
20
20
  ],
21
21
  "imports": {
22
- "#json5-loader": "./dist/json5-loader.cjs"
22
+ "#json5-loader": "./dist/json5-loader.mjs"
23
23
  },
24
24
  "exports": {
25
25
  ".": {
26
26
  "import": {
27
27
  "types": "./dist/index.d.ts",
28
28
  "default": "./dist/index.js"
29
- },
30
- "require": {
31
- "types": "./dist/index.d.cts",
32
- "default": "./dist/index.cjs"
33
29
  }
34
30
  },
35
31
  "./server": {
36
32
  "import": {
37
33
  "types": "./dist/server.d.ts",
38
34
  "default": "./dist/server.js"
39
- },
40
- "require": {
41
- "types": "./dist/server.d.cts",
42
- "default": "./dist/server.cjs"
43
35
  }
44
36
  },
45
37
  "./rsbuild": {
46
38
  "import": {
47
39
  "types": "./dist/rsbuild.d.ts",
48
40
  "default": "./dist/rsbuild.js"
49
- },
50
- "require": {
51
- "types": "./dist/rsbuild.d.cts",
52
- "default": "./dist/rsbuild.cjs"
53
41
  }
54
42
  },
55
43
  "./helper": {
56
44
  "import": {
57
45
  "types": "./dist/helper.d.ts",
58
46
  "default": "./dist/helper.js"
59
- },
60
- "require": {
61
- "types": "./dist/helper.d.cts",
62
- "default": "./dist/helper.cjs"
63
47
  }
64
48
  },
65
49
  "./package.json": "./package.json"
@@ -70,12 +54,12 @@
70
54
  "dist"
71
55
  ],
72
56
  "engines": {
73
- "node": ">=18.20.0",
57
+ "node": ">=20.19.0",
74
58
  "pnpm": ">=9"
75
59
  },
76
60
  "peerDependencies": {
77
- "@rsbuild/core": ">=1.0.0",
78
- "@rspack/core": ">=1.0.0"
61
+ "@rsbuild/core": ">=2.0.0",
62
+ "@rspack/core": ">=2.0.0"
79
63
  },
80
64
  "peerDependenciesMeta": {
81
65
  "@rsbuild/core": {
@@ -86,54 +70,58 @@
86
70
  }
87
71
  },
88
72
  "dependencies": {
89
- "@pengzhanbo/utils": "^2.1.0",
90
- "@rollup/pluginutils": "^5.2.0",
91
- "chokidar": "3.6.0",
73
+ "@pengzhanbo/utils": "^3.6.0",
74
+ "ansis": "^4.2.0",
75
+ "chokidar": "^5.0.0",
92
76
  "co-body": "^6.2.0",
93
- "cookies": "^0.9.1",
94
- "cors": "^2.8.5",
95
- "debug": "^4.4.1",
96
- "fast-glob": "^3.3.3",
77
+ "cors": "^2.8.6",
78
+ "debug": "^4.4.3",
97
79
  "formidable": "^3.5.4",
98
80
  "http-status": "^2.1.0",
99
81
  "is-core-module": "^2.16.1",
100
82
  "json5": "^2.2.3",
101
- "memfs": "^4.17.2",
102
- "mime-types": "^3.0.1",
103
- "path-to-regexp": "6.3.0",
104
- "picocolors": "^1.1.1",
105
- "portfinder": "^1.0.37",
106
- "ws": "^8.18.3"
83
+ "local-pkg": "^1.1.2",
84
+ "memfs": "^4.57.2",
85
+ "mime-types": "^3.0.2",
86
+ "path-to-regexp": "^8.4.2",
87
+ "picomatch": "^4.0.4",
88
+ "tinyglobby": "^0.2.16",
89
+ "ws": "^8.20.0"
107
90
  },
108
91
  "devDependencies": {
109
- "@pengzhanbo/eslint-config": "^1.34.0",
110
- "@rsbuild/core": "^1.4.3",
111
- "@rspack/core": "^1.4.2",
92
+ "@pengzhanbo/eslint-config": "^2.4.0",
93
+ "@rsbuild/core": "^2.0.3",
94
+ "@rspack/core": "^2.0.1",
112
95
  "@types/co-body": "^6.1.3",
113
- "@types/cookies": "^0.9.1",
114
96
  "@types/cors": "^2.8.19",
115
- "@types/debug": "^4.1.12",
116
- "@types/formidable": "^3.4.5",
97
+ "@types/debug": "^4.1.13",
98
+ "@types/formidable": "^3.5.1",
117
99
  "@types/is-core-module": "^2.2.2",
118
100
  "@types/mime-types": "^3.0.1",
119
- "@types/node": "^22.16.0",
101
+ "@types/node": "^25.6.0",
102
+ "@types/picomatch": "^4.0.3",
120
103
  "@types/ws": "^8.18.1",
121
- "bumpp": "^10.2.0",
104
+ "bumpp": "^11.0.1",
122
105
  "conventional-changelog-cli": "^5.0.0",
123
- "eslint": "^9.30.1",
106
+ "eslint": "^10.3.0",
124
107
  "husky": "^9.1.7",
125
- "lint-staged": "^16.1.2",
126
- "tsdown": "^0.12.9",
127
- "typescript": "^5.8.3"
108
+ "lint-staged": "^16.4.0",
109
+ "tsdown": "^0.21.10",
110
+ "typescript": "^6.0.3"
128
111
  },
129
112
  "lint-staged": {
130
113
  "*": "eslint --fix"
131
114
  },
115
+ "publishConfig": {
116
+ "access": "public",
117
+ "provenance": true
118
+ },
132
119
  "scripts": {
133
120
  "dev": "tsdown src --watch",
134
121
  "build": "tsdown",
135
122
  "lint": "eslint .",
123
+ "release:publish": "pnpm -r publish",
136
124
  "release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
137
- "release": "bumpp package.json --execute=\"pnpm release:changelog\" --commit --all --push --tag && pnpm publish --access public"
125
+ "release": "bumpp package.json --execute=\"pnpm release:changelog\" --commit --all --push --tag"
138
126
  }
139
127
  }
@@ -1,30 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
-
25
- Object.defineProperty(exports, '__toESM', {
26
- enumerable: true,
27
- get: function () {
28
- return __toESM;
29
- }
30
- });
package/dist/helper.cjs DELETED
@@ -1,140 +0,0 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const __pengzhanbo_utils = require_chunk.__toESM(require("@pengzhanbo/utils"));
3
- const node_stream = require_chunk.__toESM(require("node:stream"));
4
-
5
- //#region src/core/defineMock.ts
6
- function defineMock(config) {
7
- return config;
8
- }
9
- /**
10
- * Return a custom defineMock function to support preprocessing of mock config.
11
- *
12
- * 返回一个自定义的 defineMock 函数,用于支持对 mock config 的预处理。
13
- * @param transformer preprocessing function
14
- * @example
15
- * ```ts
16
- * const definePostMock = createDefineMock((mock) => {
17
- * mock.url = '/api/post/' + mock.url
18
- * })
19
- * export default definePostMock({
20
- * url: 'list',
21
- * body: [{ title: '1' }, { title: '2' }],
22
- * })
23
- * ```
24
- */
25
- function createDefineMock(transformer) {
26
- const define = (config) => {
27
- if ((0, __pengzhanbo_utils.isArray)(config)) config = config.map((item) => transformer(item) || item);
28
- else config = transformer(config) || config;
29
- return config;
30
- };
31
- return define;
32
- }
33
-
34
- //#endregion
35
- //#region src/core/defineMockData.ts
36
- const mockDataCache = /* @__PURE__ */ new Map();
37
- const responseCache = /* @__PURE__ */ new WeakMap();
38
- const staleInterval = 70;
39
- var CacheImpl = class {
40
- value;
41
- #initialValue;
42
- #lastUpdate;
43
- constructor(value) {
44
- this.value = value;
45
- this.#initialValue = (0, __pengzhanbo_utils.deepClone)(value);
46
- this.#lastUpdate = Date.now();
47
- }
48
- hotUpdate(value) {
49
- if (Date.now() - this.#lastUpdate < staleInterval) return;
50
- if (!(0, __pengzhanbo_utils.deepEqual)(value, this.#initialValue)) {
51
- this.value = value;
52
- this.#initialValue = (0, __pengzhanbo_utils.deepClone)(value);
53
- this.#lastUpdate = Date.now();
54
- }
55
- }
56
- };
57
- function defineMockData(key, initialData) {
58
- if (!mockDataCache.has(key)) mockDataCache.set(key, new CacheImpl(initialData));
59
- const cache = mockDataCache.get(key);
60
- cache.hotUpdate(initialData);
61
- if (responseCache.has(cache)) return responseCache.get(cache);
62
- const res = [() => cache.value, (val) => {
63
- if ((0, __pengzhanbo_utils.isFunction)(val)) val = val(cache.value) ?? cache.value;
64
- cache.value = val;
65
- }];
66
- Object.defineProperty(res, "value", {
67
- get() {
68
- return cache.value;
69
- },
70
- set(val) {
71
- cache.value = val;
72
- }
73
- });
74
- responseCache.set(cache, res);
75
- return res;
76
- }
77
-
78
- //#endregion
79
- //#region src/core/sse.ts
80
- /**
81
- * Transforms "messages" to W3C event stream content.
82
- * See https://html.spec.whatwg.org/multipage/server-sent-events.html
83
- * A message is an object with one or more of the following properties:
84
- * - data (String or object, which gets turned into JSON)
85
- * - event
86
- * - id
87
- * - retry
88
- * - comment
89
- *
90
- * If constructed with a HTTP Request, it will optimise the socket for streaming.
91
- * If this stream is piped to an HTTP Response, it will set appropriate headers.
92
- */
93
- var SSEStream = class extends node_stream.Transform {
94
- constructor(req) {
95
- super({ objectMode: true });
96
- req.socket.setKeepAlive(true);
97
- req.socket.setNoDelay(true);
98
- req.socket.setTimeout(0);
99
- }
100
- pipe(destination, options) {
101
- if (destination.writeHead) {
102
- destination.writeHead(200, {
103
- "Content-Type": "text/event-stream; charset=utf-8",
104
- "Transfer-Encoding": "identity",
105
- "Cache-Control": "no-cache",
106
- "Connection": "keep-alive"
107
- });
108
- destination.flushHeaders?.();
109
- }
110
- destination.write(":ok\n\n");
111
- return super.pipe(destination, options);
112
- }
113
- _transform(message, encoding, callback) {
114
- if (message.comment) this.push(`: ${message.comment}\n`);
115
- if (message.event) this.push(`event: ${message.event}\n`);
116
- if (message.id) this.push(`id: ${message.id}\n`);
117
- if (message.retry) this.push(`retry: ${message.retry}\n`);
118
- if (message.data) this.push(dataString(message.data));
119
- this.push("\n");
120
- callback();
121
- }
122
- write(message, ...args) {
123
- return super.write(message, ...args);
124
- }
125
- };
126
- function dataString(data) {
127
- if (typeof data === "object") return dataString(JSON.stringify(data));
128
- return data.split(/\r\n|\r|\n/).map((line) => `data: ${line}\n`).join("");
129
- }
130
- function createSSEStream(req, res) {
131
- const sse = new SSEStream(req);
132
- sse.pipe(res);
133
- return sse;
134
- }
135
-
136
- //#endregion
137
- exports.createDefineMock = createDefineMock;
138
- exports.createSSEStream = createSSEStream;
139
- exports.defineMock = defineMock;
140
- exports.defineMockData = defineMockData;
package/dist/helper.d.cts DELETED
@@ -1,110 +0,0 @@
1
- import { BodyParserOptions, ExtraRequest, FormidableFile, LogLevel, LogType, Method, MockHttpItem, MockMatchPriority, MockMatchSpecialPriority, MockOptions, MockRequest, MockResponse, MockServerPluginOptions, MockWebsocketItem, ResponseBody, ServerBuildOption, WebSocketSetupContext } from "./types-6lajtJPx.cjs";
2
- import { IncomingMessage, OutgoingHttpHeaders, ServerResponse } from "node:http";
3
- import { Transform } from "node:stream";
4
-
5
- //#region src/core/defineMock.d.ts
6
-
7
- /**
8
- * mock config Type helper
9
- *
10
- * mock配置 类型帮助函数
11
- * @param config see config docs:
12
- * {@link https://vite-plugin-mock-dev-server.netlify.app/en/guide/mock-config en-US DOC} |
13
- * {@link https://vite-plugin-mock-dev-server.netlify.app/guide/mock-config zh-CN DOC}
14
- *
15
- * @example
16
- * Mock Http Request
17
- * ```ts
18
- * export default defineMock({
19
- * url: '/api/example',
20
- * method: ['GET', 'POST'],
21
- * body: { a: 1 },
22
- * })
23
- * ```
24
- * ```ts
25
- * export default defineMock({
26
- * url: '/api/example',
27
- * method: 'GET',
28
- * body: ({ query }) => ({ a: 1, b: query.b }),
29
- * })
30
- * ```
31
- * @example
32
- * Mock WebSocket
33
- * ```ts
34
- * export default defineMock({
35
- * url: '/socket.io',
36
- * ws: true,
37
- * setup(wss) {
38
- * wss.on('connection', (ws) => {
39
- * ws.on('message', (rawData) => console.log(rawData))
40
- * ws.send('data')
41
- * })
42
- * },
43
- * })
44
- * ```
45
- */
46
- declare function defineMock(config: MockHttpItem): MockHttpItem;
47
- declare function defineMock(config: MockWebsocketItem): MockWebsocketItem;
48
- declare function defineMock(config: MockOptions): MockOptions;
49
- /**
50
- * Return a custom defineMock function to support preprocessing of mock config.
51
- *
52
- * 返回一个自定义的 defineMock 函数,用于支持对 mock config 的预处理。
53
- * @param transformer preprocessing function
54
- * @example
55
- * ```ts
56
- * const definePostMock = createDefineMock((mock) => {
57
- * mock.url = '/api/post/' + mock.url
58
- * })
59
- * export default definePostMock({
60
- * url: 'list',
61
- * body: [{ title: '1' }, { title: '2' }],
62
- * })
63
- * ```
64
- */
65
- declare function createDefineMock(transformer: (mock: MockHttpItem | MockWebsocketItem) => MockHttpItem | MockWebsocketItem | void): typeof defineMock;
66
- //#endregion
67
- //#region src/core/defineMockData.d.ts
68
- type MockData<T = any> = readonly [() => T, (val: T | ((val: T) => T | void)) => void] & {
69
- value: T;
70
- };
71
- declare function defineMockData<T = any>(key: string, initialData: T): MockData<T>;
72
- //#endregion
73
- //#region src/core/sse.d.ts
74
- interface SSEMessage {
75
- data?: string | object;
76
- comment?: string;
77
- event?: string;
78
- id?: string;
79
- retry?: number;
80
- }
81
- interface WriteHeaders {
82
- writeHead?: (statusCode: number, headers?: OutgoingHttpHeaders) => WriteHeaders;
83
- flushHeaders?: () => void;
84
- }
85
- type HeaderStream = NodeJS.WritableStream & WriteHeaders;
86
- /**
87
- * Transforms "messages" to W3C event stream content.
88
- * See https://html.spec.whatwg.org/multipage/server-sent-events.html
89
- * A message is an object with one or more of the following properties:
90
- * - data (String or object, which gets turned into JSON)
91
- * - event
92
- * - id
93
- * - retry
94
- * - comment
95
- *
96
- * If constructed with a HTTP Request, it will optimise the socket for streaming.
97
- * If this stream is piped to an HTTP Response, it will set appropriate headers.
98
- */
99
- declare class SSEStream extends Transform {
100
- constructor(req: IncomingMessage);
101
- pipe<T extends HeaderStream>(destination: T, options?: {
102
- end?: boolean;
103
- }): T;
104
- _transform(message: SSEMessage, encoding: string, callback: (error?: (Error | null), data?: any) => void): void;
105
- write(message: SSEMessage, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean;
106
- write(message: SSEMessage, cb?: (error: Error | null | undefined) => void): boolean;
107
- }
108
- declare function createSSEStream(req: IncomingMessage, res: ServerResponse): SSEStream;
109
- //#endregion
110
- export { BodyParserOptions, ExtraRequest, FormidableFile, HeaderStream, LogLevel, LogType, Method, MockData, MockHttpItem, MockMatchPriority, MockMatchSpecialPriority, MockOptions, MockRequest, MockResponse, MockServerPluginOptions, MockWebsocketItem, ResponseBody, SSEMessage, ServerBuildOption, WebSocketSetupContext, createDefineMock, createSSEStream, defineMock, defineMockData };
package/dist/index.cjs DELETED
@@ -1,86 +0,0 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_logger = require('./logger-C0V8Cvvd.cjs');
3
- const require_resolvePluginOptions = require('./resolvePluginOptions-Da5uqlBx.cjs');
4
- const __pengzhanbo_utils = require_chunk.__toESM(require("@pengzhanbo/utils"));
5
- const node_path = require_chunk.__toESM(require("node:path"));
6
- const node_process = require_chunk.__toESM(require("node:process"));
7
- const __rspack_core = require_chunk.__toESM(require("@rspack/core"));
8
-
9
- //#region src/rspack.ts
10
- const PLUGIN_NAME = "rspack-plugin-mock";
11
- var MockServerPlugin = class {
12
- constructor(options = {}) {
13
- this.options = options;
14
- }
15
- apply(compiler) {
16
- const compilerOptions = compiler.options;
17
- const options = resolvePluginOptions$1(compiler, this.options);
18
- if (node_process.default.env.NODE_ENV !== "production") {
19
- const mockCompiler = require_resolvePluginOptions.createMockCompiler(options);
20
- const mockMiddleware = require_resolvePluginOptions.createMockMiddleware(mockCompiler, options);
21
- const setupMiddlewares = compilerOptions.devServer?.setupMiddlewares;
22
- const waitServerForMockWebSocket = require_logger.waitingFor((server) => {
23
- require_logger.mockWebSocket(mockCompiler, server, options);
24
- });
25
- compilerOptions.devServer = {
26
- ...compilerOptions.devServer,
27
- setupMiddlewares: (middlewares, devServer) => {
28
- middlewares = setupMiddlewares?.(middlewares, devServer) || middlewares;
29
- const reload = () => {
30
- if (devServer.webSocketServer?.clients) devServer.sendMessage(devServer.webSocketServer.clients, "static-changed");
31
- };
32
- middlewares = mockMiddleware(middlewares, reload) || middlewares;
33
- /**
34
- * 在 @rspack/dev-server -> webpack-dev-server 中, setupMiddlewares 优先于 createServer
35
- * 执行,需要等待 server 启动后再注入 mock websocket
36
- */
37
- waitServerForMockWebSocket(() => devServer.server);
38
- return middlewares;
39
- }
40
- };
41
- const wsPrefix = (0, __pengzhanbo_utils.toArray)(options.wsPrefix);
42
- if (compilerOptions.devServer?.proxy?.length) {
43
- const proxy = compilerOptions.devServer.proxy;
44
- compilerOptions.devServer.proxy = proxy.filter((item) => {
45
- if (typeof item !== "function" && item.ws === true && wsPrefix.length) return !(0, __pengzhanbo_utils.toArray)(item.context).filter(__pengzhanbo_utils.isString).some((context) => wsPrefix.includes(context));
46
- return true;
47
- }).map((item) => {
48
- if (typeof item !== "function" && !item.ws) {
49
- const onProxyReq = item.onProxyReq;
50
- item.onProxyReq = (proxyReq, req, ...args) => {
51
- onProxyReq?.(proxyReq, req, ...args);
52
- require_logger.rewriteRequest(proxyReq, req);
53
- };
54
- }
55
- return item;
56
- });
57
- }
58
- compiler.hooks.watchRun.tap(PLUGIN_NAME, () => mockCompiler.run());
59
- compiler.hooks.watchClose.tap(PLUGIN_NAME, () => mockCompiler.close());
60
- } else if (options.build !== false) compiler.hooks.afterEmit.tap(PLUGIN_NAME, () => require_resolvePluginOptions.buildMockServer(options, compilerOptions.output.path || node_path.default.resolve(node_process.default.cwd(), "dist")));
61
- }
62
- };
63
- function resolvePluginOptions$1(compiler, options = {}) {
64
- const compilerOptions = compiler.options;
65
- const alias = compilerOptions.resolve?.alias || {};
66
- const context = compilerOptions.context;
67
- const definePluginInstance = compilerOptions.plugins?.find((plugin) => plugin instanceof __rspack_core.default.DefinePlugin);
68
- const proxies = (compilerOptions.devServer?.proxy || []).flatMap((item) => {
69
- if (typeof item !== "function" && item.context && !item.ws) return item.context;
70
- return [];
71
- });
72
- return require_resolvePluginOptions.resolvePluginOptions(options, {
73
- alias,
74
- context,
75
- plugins: (0, __pengzhanbo_utils.toArray)(definePluginInstance),
76
- proxies
77
- });
78
- }
79
-
80
- //#endregion
81
- exports.MockCompiler = require_resolvePluginOptions.MockCompiler;
82
- exports.MockServerPlugin = MockServerPlugin;
83
- exports.createMockCompiler = require_resolvePluginOptions.createMockCompiler;
84
- exports.createMockMiddleware = require_resolvePluginOptions.createMockMiddleware;
85
- exports.mockWebSocket = require_logger.mockWebSocket;
86
- exports.resolvePluginOptions = resolvePluginOptions$1;
package/dist/index.d.cts DELETED
@@ -1,13 +0,0 @@
1
- import { BodyParserOptions, ExtraRequest, FormidableFile, LogLevel, LogType, Method, MockHttpItem, MockMatchPriority, MockMatchSpecialPriority, MockOptions, MockRequest, MockResponse, MockServerPluginOptions, MockWebsocketItem, ResponseBody, ServerBuildOption, WebSocketSetupContext } from "./types-6lajtJPx.cjs";
2
- import { Middleware, MiddlewareOptions, MockCompiler, MockCompilerOptions, MockSocketOptions, ResolvePluginOptions, Server, createMockCompiler, createMockMiddleware, mockWebSocket } from "./mockWebsocket-DkVHpZCx.cjs";
3
- import { Compiler, RspackPluginInstance } from "@rspack/core";
4
-
5
- //#region src/rspack.d.ts
6
- declare class MockServerPlugin implements RspackPluginInstance {
7
- options: MockServerPluginOptions;
8
- constructor(options?: MockServerPluginOptions);
9
- apply(compiler: Compiler): void;
10
- }
11
- declare function resolvePluginOptions(compiler: Compiler, options?: MockServerPluginOptions): ResolvePluginOptions;
12
- //#endregion
13
- export { BodyParserOptions, ExtraRequest, FormidableFile, LogLevel, LogType, Method, Middleware, MiddlewareOptions, MockCompiler, MockCompilerOptions, MockHttpItem, MockMatchPriority, MockMatchSpecialPriority, MockOptions, MockRequest, MockResponse, MockServerPlugin, MockServerPluginOptions, MockSocketOptions, MockWebsocketItem, ResponseBody, Server, ServerBuildOption, WebSocketSetupContext, createMockCompiler, createMockMiddleware, mockWebSocket, resolvePluginOptions };
@@ -1,32 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
- const json5 = __toESM(require("json5"));
25
-
26
- //#region src/json5-loader.cts
27
- module.exports = function(content) {
28
- if (!content) return "export default {}";
29
- return `export default ${JSON.stringify(json5.default.parse(content))}`;
30
- };
31
-
32
- //#endregion