@rsbuild/core 2.0.11 → 2.0.13

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.
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 203: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 737: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(288);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(370);
6
6
  const compilerMap = new WeakMap();
7
7
  class CachedChildCompilation {
8
8
  constructor(compiler) {
@@ -311,7 +311,7 @@
311
311
  }
312
312
  module.exports = { CachedChildCompilation };
313
313
  },
314
- 288: (module) => {
314
+ 370: (module) => {
315
315
  "use strict";
316
316
  class HtmlWebpackChildCompiler {
317
317
  constructor(templates) {
@@ -480,7 +480,7 @@
480
480
  }
481
481
  module.exports = { HtmlWebpackChildCompiler };
482
482
  },
483
- 880: (module) => {
483
+ 18: (module) => {
484
484
  "use strict";
485
485
  module.exports = {};
486
486
  module.exports.none = (chunks) => chunks;
@@ -499,7 +499,7 @@
499
499
  };
500
500
  module.exports.auto = module.exports.none;
501
501
  },
502
- 447: (module) => {
502
+ 21: (module) => {
503
503
  "use strict";
504
504
  module.exports = function (err) {
505
505
  return {
@@ -523,7 +523,7 @@
523
523
  };
524
524
  };
525
525
  },
526
- 334: (module, __unused_webpack_exports, __nccwpck_require__) => {
526
+ 212: (module, __unused_webpack_exports, __nccwpck_require__) => {
527
527
  "use strict";
528
528
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(159);
529
529
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -549,7 +549,7 @@
549
549
  }
550
550
  module.exports = { getHtmlRspackPluginHooks };
551
551
  },
552
- 619: (module) => {
552
+ 1: (module) => {
553
553
  const voidTags = [
554
554
  "area",
555
555
  "base",
@@ -617,19 +617,19 @@
617
617
  htmlTagObjectToString,
618
618
  };
619
619
  },
620
- 914: (module, __unused_webpack_exports, __nccwpck_require__) => {
620
+ 108: (module, __unused_webpack_exports, __nccwpck_require__) => {
621
621
  "use strict";
622
622
  const promisify = __nccwpck_require__(23).promisify;
623
623
  const vm = __nccwpck_require__(154);
624
624
  const fs = __nccwpck_require__(896);
625
625
  const path = __nccwpck_require__(928);
626
- const { CachedChildCompilation } = __nccwpck_require__(203);
626
+ const { CachedChildCompilation } = __nccwpck_require__(737);
627
627
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
628
- __nccwpck_require__(619);
629
- const prettyError = __nccwpck_require__(447);
630
- const chunkSorter = __nccwpck_require__(880);
628
+ __nccwpck_require__(1);
629
+ const prettyError = __nccwpck_require__(21);
630
+ const chunkSorter = __nccwpck_require__(18);
631
631
  const getHtmlRspackPluginHooks =
632
- __nccwpck_require__(334).getHtmlRspackPluginHooks;
632
+ __nccwpck_require__(212).getHtmlRspackPluginHooks;
633
633
  const WITH_PLACEHOLDER = "function __with_placeholder__";
634
634
  class HtmlRspackPlugin {
635
635
  constructor(userOptions = {}) {
@@ -2398,6 +2398,6 @@
2398
2398
  }
2399
2399
  if (typeof __nccwpck_require__ !== "undefined")
2400
2400
  __nccwpck_require__.ab = __dirname + "/";
2401
- var __webpack_exports__ = __nccwpck_require__(914);
2401
+ var __webpack_exports__ = __nccwpck_require__(108);
2402
2402
  module.exports = __webpack_exports__;
2403
2403
  })();
@@ -140,7 +140,10 @@ interface RequestHandler<TReq extends http.IncomingMessage = http.IncomingMessag
140
140
  (req: TReq, res: TRes, next?: TNext): Promise<void>;
141
141
  upgrade: (req: TReq, socket: net.Socket, head: Buffer) => void;
142
142
  }
143
- type Filter<TReq extends http.IncomingMessage = http.IncomingMessage> = string | string[] | ((pathname: string, req: TReq) => boolean);
143
+ type Filter<TReq extends http.IncomingMessage = http.IncomingMessage> = string | string[] | ((pathname: string, req: TReq) => boolean | string | RegExpMatchArray | null);
144
+ /**
145
+ * @see {@link https://github.com/chimurai/http-proxy-middleware/tree/master#defineplugin-helper `definePlugin()`} to define a http-proxy-middleware plugin.
146
+ */
144
147
  interface Plugin<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse> {
145
148
  (proxyServer: ProxyServer<TReq, TRes>, options: Options<TReq, TRes>): void;
146
149
  }
@@ -156,9 +159,13 @@ interface OnProxyEvent<TReq extends http.IncomingMessage = http.IncomingMessage,
156
159
  econnreset?: (err: Error, req: TReq, res: TRes, target: string | Partial<URL>) => void;
157
160
  }
158
161
  type Logger = Pick<Console, 'info' | 'warn' | 'error'>;
159
- type PathRewriteConfig<TReq extends http.IncomingMessage = http.IncomingMessage> = {
162
+ type PathRewriteConfig<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse> = {
160
163
  [regexp: string]: string;
161
- } | ((path: string, req: TReq) => string | undefined) | ((path: string, req: TReq) => Promise<string>);
164
+ } | ((path: string, req: TReq,
165
+ /** `res` is undefined in WebSocket upgrade flows. */
166
+ res?: TRes | undefined, options?: Options<TReq, TRes>) => string | undefined) | ((path: string, req: TReq,
167
+ /** `res` is undefined in WebSocket upgrade flows. */
168
+ res?: TRes | undefined, options?: Options<TReq, TRes>) => Promise<string | undefined>);
162
169
  interface Options<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse> extends ProxyServerOptions {
163
170
  /**
164
171
  * Narrow down requests to proxy or not.
@@ -178,9 +185,13 @@ interface Options<TReq extends http.IncomingMessage = http.IncomingMessage, TRes
178
185
  * }
179
186
  * });
180
187
  * ```
188
+ * @since v0.15.0
189
+ * @since v0.21.0 - support `async` function
190
+ * @since v4.1.0 - `res` and `options` parameters added to custom function
191
+ *
181
192
  * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/pathRewrite.md
182
193
  */
183
- pathRewrite?: PathRewriteConfig<TReq>;
194
+ pathRewrite?: PathRewriteConfig<TReq, TRes>;
184
195
  /**
185
196
  * Access the internal `httpxy` server instance to customize behavior
186
197
  *
@@ -225,17 +236,24 @@ interface Options<TReq extends http.IncomingMessage = http.IncomingMessage, TRes
225
236
  on?: OnProxyEvent<TReq, TRes>;
226
237
  /**
227
238
  * Dynamically set the {@link Options.target `options.target`}.
239
+ *
228
240
  * @example
229
241
  * ```js
230
242
  * createProxyMiddleware({
231
- * router: async (req) => {
243
+ * router: async (req, res, options) => {
232
244
  * return 'http://127:0.0.1:3000';
233
245
  * }
234
246
  * });
235
247
  * ```
248
+ *
249
+ * @since v0.16.0
250
+ * @since v4.1.0 - `res` and `options` parameters added to router function signature
251
+ *
252
+ * NOTE: `res` is undefined in WebSocket upgrade flows.
253
+ *
236
254
  * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/router.md
237
255
  */
238
- router?: Record<string, ProxyServerOptions['target']> | ((req: TReq) => ProxyServerOptions['target']) | ((req: TReq) => Promise<ProxyServerOptions['target']>);
256
+ router?: Record<string, ProxyServerOptions['target']> | ((req: TReq, res: TRes | undefined, options: Options<TReq, TRes>) => ProxyServerOptions['target']) | ((req: TReq, res: TRes | undefined, options: Options<TReq, TRes>) => Promise<ProxyServerOptions['target']>);
239
257
  /**
240
258
  * Log information from http-proxy-middleware
241
259
  * @example
@@ -331,10 +349,26 @@ declare function createProxyMiddleware<TReq extends http.IncomingMessage = http.
331
349
  type Interceptor<TReq = http.IncomingMessage, TRes = http.ServerResponse> = (buffer: Buffer, proxyRes: http.IncomingMessage, req: TReq, res: TRes) => Promise<Buffer | string>;
332
350
  /**
333
351
  * Intercept responses from upstream.
334
- * Automatically decompress (deflate, gzip, brotli).
352
+ * Automatically decompress (deflate, gzip, brotli, zstd).
335
353
  * Give developer the opportunity to modify intercepted Buffer and http.ServerResponse
336
354
  *
337
355
  * NOTE: must set options.selfHandleResponse=true (prevent automatic call of res.end())
356
+ *
357
+ * @example
358
+ *
359
+ * ```ts
360
+ * createProxyMiddleware({
361
+ * target: 'http://example.com',
362
+ * selfHandleResponse: true, // MUST set selfHandleResponse=true
363
+ * on: {
364
+ * proxyRes: responseInterceptor(async (buffer, proxyRes, req, res) => {
365
+ * // modify intercepted buffer and return modified buffer
366
+ * const modifiedBuffer = Buffer.from(buffer.toString().replace(/Example/g, 'Demo'), 'utf8');
367
+ * return modifiedBuffer;
368
+ * }),
369
+ * }
370
+ * });
371
+ * ```
338
372
  */
339
373
  declare function responseInterceptor<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse>(interceptor: Interceptor<TReq, TRes>): (proxyRes: http.IncomingMessage, req: TReq, res: TRes) => Promise<void>;
340
374
 
@@ -343,9 +377,47 @@ type BodyParserLikeRequest = http.IncomingMessage & {
343
377
  };
344
378
  /**
345
379
  * Fix proxied body if bodyParser is involved.
380
+ *
381
+ * @example
382
+ * ```ts
383
+ * createProxyMiddleware({
384
+ * target: 'http://example.com',
385
+ * on: {
386
+ * proxyReq: fixRequestBody,
387
+ * }
388
+ * });
389
+ * ```
390
+ *
391
+ * Alternative solution without using `fixRequestBody()`: put `http-proxy-middleware` before `bodyParser` in the middleware stack.
392
+ *
393
+ * @see {@link https://github.com/chimurai/http-proxy-middleware/issues/40 Github issue #40 - POST request body is not proxied}
346
394
  */
347
395
  declare function fixRequestBody<TReq extends BodyParserLikeRequest = BodyParserLikeRequest>(proxyReq: http.ClientRequest, req: TReq): void;
348
396
 
397
+ /**
398
+ * Helper function to define a http-proxy-middleware plugin
399
+ * @see proxyServer {@link ProxyServer} - proxy server instance to which the plugin is being applied
400
+ * @see options {@link Options} - options object passed to `createProxyMiddleware`
401
+ *
402
+ * @example defining a plugin
403
+ * ```js
404
+ * export const myPlugin = definePlugin((proxyServer, options) => {
405
+ * // plugin implementation
406
+ * });
407
+ * ```
408
+ *
409
+ * @example using a plugin
410
+ * ```js
411
+ * createProxyMiddleware({
412
+ * target: 'http://example.com',
413
+ * plugins: [myPlugin],
414
+ * });
415
+ * ```
416
+ *
417
+ * @since 4.1.0
418
+ */
419
+ declare function definePlugin<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse>(fn: Plugin<TReq, TRes>): Plugin<TReq, TRes>;
420
+
349
421
  /**
350
422
  * Subscribe to {@link https://github.com/unjs/httpxy#events `httpxy` error events} to prevent server from crashing.
351
423
  * Errors are logged with {@link https://www.npmjs.com/package/debug debug} library.
@@ -378,5 +450,5 @@ declare const loggerPlugin: Plugin;
378
450
  */
379
451
  declare const proxyEventsPlugin: Plugin;
380
452
 
381
- export { createProxyMiddleware, debugProxyErrorsPlugin, errorResponsePlugin, fixRequestBody, loggerPlugin, proxyEventsPlugin, responseInterceptor };
453
+ export { createProxyMiddleware, debugProxyErrorsPlugin, definePlugin, errorResponsePlugin, fixRequestBody, loggerPlugin, proxyEventsPlugin, responseInterceptor };
382
454
  export type { Filter, Options, Plugin, RequestHandler };
@@ -1 +1 @@
1
- {"name":"http-proxy-middleware","author":"Steven Chim","version":"4.0.0","license":"MIT","types":"index.d.ts","type":"module"}
1
+ {"name":"http-proxy-middleware","author":"Steven Chim","version":"4.1.0","license":"MIT","types":"index.d.ts","type":"module"}
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 501: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(495)["default"];
4
+ 339: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(821)["default"];
6
6
  },
7
- 495: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 821: (__unused_webpack_module, exports, __nccwpck_require__) => {
8
8
  var __webpack_unused_export__;
9
9
  __webpack_unused_export__ = { value: true };
10
10
  exports["default"] = loader;
11
11
  var _nodePath = _interopRequireDefault(__nccwpck_require__(760));
12
- var _utils = __nccwpck_require__(906);
12
+ var _utils = __nccwpck_require__(520);
13
13
  function _interopRequireDefault(e) {
14
14
  return e && e.__esModule ? e : { default: e };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 906: (module, exports, __nccwpck_require__) => {
182
+ 520: (module, exports, __nccwpck_require__) => {
183
183
  module = __nccwpck_require__.nmd(module);
184
184
  Object.defineProperty(exports, "__esModule", { value: true });
185
185
  exports.exec = exec;
@@ -716,6 +716,6 @@
716
716
  })();
717
717
  if (typeof __nccwpck_require__ !== "undefined")
718
718
  __nccwpck_require__.ab = __dirname + "/";
719
- var __webpack_exports__ = __nccwpck_require__(501);
719
+ var __webpack_exports__ = __nccwpck_require__(339);
720
720
  module.exports = __webpack_exports__;
721
721
  })();
@@ -1 +1 @@
1
- {"name":"rslog","version":"2.1.2","license":"MIT","types":"index.d.ts","type":"module"}
1
+ {"name":"rslog","version":"2.1.3","license":"MIT","types":"index.d.ts","type":"module"}
@@ -8,6 +8,10 @@ interface FileDescriptor {
8
8
  isModuleAsset: boolean;
9
9
  name: string;
10
10
  path: string;
11
+ /**
12
+ * Subresource Integrity (SRI) hash.
13
+ * This field is available only when the `SubresourceIntegrityPlugin` is used.
14
+ */
11
15
  integrity?: string;
12
16
  }
13
17
 
@@ -1 +1 @@
1
- {"name":"rspack-manifest-plugin","author":"Dane Thurber <dane.thurber@gmail.com>","version":"5.2.1","license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"rspack-manifest-plugin","author":"Dane Thurber <dane.thurber@gmail.com>","version":"5.2.2","license":"MIT","types":"index.d.ts","type":"commonjs"}