@rsbuild/core 2.1.3 → 2.1.5

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,7 +1,7 @@
1
1
  /*! LICENSE: connect-next.js.LICENSE.txt */
2
2
  import { EventEmitter } from "node:events";
3
3
  import { createRequire } from "node:module";
4
- import * as __rspack_external_node_http_2dc67212 from "node:http";
4
+ import * as __rspack_external_node_http_e245b239 from "node:http";
5
5
  let __rspack_createRequire_require = createRequire(import.meta.url);
6
6
  var __webpack_modules__ = {}, __webpack_module_cache__ = {};
7
7
  function __nested_rspack_require_364__(moduleId) {
@@ -840,7 +840,7 @@ let proto = {
840
840
  req.originalUrl = req.originalUrl || req.url, next();
841
841
  },
842
842
  listen (...args) {
843
- return __rspack_external_node_http_2dc67212.createServer(this).listen(...args);
843
+ return __rspack_external_node_http_e245b239.createServer(this).listen(...args);
844
844
  }
845
845
  };
846
846
  function call(handle, route, err, req, res, next) {
@@ -872,6 +872,6 @@ function isConnectServer(value) {
872
872
  return 'function' == typeof value && 'handle' in value && 'function' == typeof value.handle;
873
873
  }
874
874
  function isHttpServer(value) {
875
- return value instanceof __rspack_external_node_http_2dc67212.Server;
875
+ return value instanceof __rspack_external_node_http_e245b239.Server;
876
876
  }
877
877
  export { connect };
@@ -1,5 +1,5 @@
1
1
  import node_path from "node:path";
2
- import { isCSSModules } from "./349.js";
2
+ import { isCSSModules } from "./252.js";
3
3
  let HASH_PLACEHOLDER_REGEX = /\[(?:[^:\]]+:)?(?:chunkhash|contenthash|hash|fullhash)(?::[^\]]+)?]/i, getRelativePath = (root, resourcePath)=>{
4
4
  let relativePath = node_path.relative(root, resourcePath);
5
5
  if (relativePath && !('..' === relativePath || relativePath.startsWith(`..${node_path.sep}`)) && !node_path.isAbsolute(relativePath)) return relativePath.replace(/\\/g, '/');
@@ -5,12 +5,13 @@ import node_http2 from "node:http2";
5
5
  import { EventEmitter } from "node:events";
6
6
  import "node:net";
7
7
  import "node:stream";
8
+ import { styleText } from "node:util";
8
9
  import { URL as external_node_url_URL } from "node:url";
9
10
  import { URL as external_url_URL } from "url";
10
11
  import "node:zlib";
11
12
  import "node:querystring";
12
13
  import { __webpack_require__ } from "./1~rslib-runtime.js";
13
- import "./756.js";
14
+ import "./711.js";
14
15
  __webpack_require__.add({
15
16
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js" (module, __unused_rspack_exports, __webpack_require__) {
16
17
  let stringify = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"), compile = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js"), expand = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js"), parse = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js"), braces = (input, options = {})=>{
@@ -2398,7 +2399,7 @@ let redirectStatuses = new Set([
2398
2399
  308
2399
2400
  ]), webIncomingMiddleware = [
2400
2401
  (req)=>{
2401
- "DELETE" !== req.method && "OPTIONS" !== req.method || req.headers["content-length"] || (req.headers["content-length"] = "0", delete req.headers["transfer-encoding"]);
2402
+ "DELETE" !== req.method && "OPTIONS" !== req.method || req.headers["content-length"] || req.headers["transfer-encoding"] || (req.headers["content-length"] = "0");
2402
2403
  },
2403
2404
  (req, res, options)=>{
2404
2405
  options.timeout && req.socket.setTimeout(options.timeout, ()=>{
@@ -2551,7 +2552,7 @@ let redirectStatuses = new Set([
2551
2552
  }), proxyReq.end();
2552
2553
  }
2553
2554
  ];
2554
- var ERRORS, errors_ERRORS, ProxyServer = class extends EventEmitter {
2555
+ var ProxyServer = class extends EventEmitter {
2555
2556
  _server;
2556
2557
  _webPasses = [
2557
2558
  ...webIncomingMiddleware
@@ -2640,13 +2641,31 @@ function _createProxyFn(type, server) {
2640
2641
  return callbackPromise;
2641
2642
  };
2642
2643
  }
2644
+ class errors_HttpProxyMiddlewareError extends Error {
2645
+ code;
2646
+ constructor(message, code){
2647
+ super(message), this.code = code, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
2648
+ }
2649
+ }
2643
2650
  function verifyConfig(options) {
2644
- if (!options.target && !options.router) throw Error(errors_ERRORS.ERR_CONFIG_FACTORY_TARGET_MISSING);
2651
+ if (!options.target && !options.router) throw new errors_HttpProxyMiddlewareError('[HPM] Missing "target" option. Example: {target: "http://www.example.org"}', 'ERR_CONFIG_FACTORY_TARGET_MISSING');
2652
+ }
2653
+ let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js")('http-proxy-middleware'), debug = Debug.extend('debug-proxy-errors-plugin'), BODY_PARSER_ERROR_MESSAGE = `[HPM] Connection reset (ECONNRESET) detected with non-empty "req.body" [ERR_HPM.GH40].
2654
+
2655
+ This usually means that the POST request body (req.body) was already parsed before reaching the proxy.
2656
+ When bodyParser runs first, it consumes the request stream, leaving the proxy unable to forward the body data to the target server.
2657
+
2658
+ How to fix this issue:
2659
+ - Option 1: Place the proxy middleware before the bodyParser middleware.
2660
+ - Option 2: Use 'fixRequestBody()' helper to fix this issue.
2661
+
2662
+ For more details, see: https://github.com/chimurai/http-proxy-middleware/issues/40\n`;
2663
+ function hasParsedBody(req) {
2664
+ return !!(req && 'POST' === req.method && 'body' in req && req.body);
2645
2665
  }
2646
- (ERRORS = errors_ERRORS || (errors_ERRORS = {})).ERR_CONFIG_FACTORY_TARGET_MISSING = "[HPM] Missing \"target\" option. Example: {target: \"http://www.example.org\"}", ERRORS.ERR_CONTEXT_MATCHER_GENERIC = "[HPM] Invalid pathFilter. Expecting something like: \"/api\" or [\"/api\", \"/ajax\"]", ERRORS.ERR_CONTEXT_MATCHER_INVALID_ARRAY = "[HPM] Invalid pathFilter. Plain paths (e.g. \"/api\") can not be mixed with globs (e.g. \"/api/**\"). Expecting something like: [\"/api\", \"/ajax\"] or [\"/api/**\", \"!**.html\"].", ERRORS.ERR_PATH_REWRITER_CONFIG = "[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function";
2647
- let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js")('http-proxy-middleware'), debug = Debug.extend('debug-proxy-errors-plugin'), debugProxyErrorsPlugin = (proxyServer, options)=>{
2666
+ let debugProxyErrorsPlugin = (proxyServer, options)=>{
2648
2667
  proxyServer.on('error', (error, req, res, target)=>{
2649
- debug(`httpxy error event: \n%O`, error);
2668
+ debug(`httpxy error event: \n%O`, error), 'ECONNRESET' === error.code && hasParsedBody(req) && console.error(styleText('red', BODY_PARSER_ERROR_MESSAGE));
2650
2669
  }), proxyServer.on('proxyReq', (proxyReq, req, socket)=>{
2651
2670
  socket.on('error', (error)=>{
2652
2671
  debug('Socket error in proxyReq event: \n%O', error);
@@ -2780,10 +2799,10 @@ function matchPathFilter(pathFilter = '/', uri, req) {
2780
2799
  if (Array.isArray(pathFilter)) {
2781
2800
  if (pathFilter.every(isStringPath)) return matchMultiPath(pathFilter, uri);
2782
2801
  if (pathFilter.every(isGlobPath)) return matchMultiGlobPath(pathFilter, uri);
2783
- throw Error(errors_ERRORS.ERR_CONTEXT_MATCHER_INVALID_ARRAY);
2802
+ throw new errors_HttpProxyMiddlewareError('[HPM] Invalid pathFilter. Plain paths (e.g. "/api") can not be mixed with globs (e.g. "/api/**"). Expecting something like: ["/api", "/ajax"] or ["/api/**", "!**.html"].', 'HPM_INVALID_PATH_FILTER_ARRAY_CONFIG');
2784
2803
  }
2785
2804
  if ('function' == typeof pathFilter) return !!pathFilter(getUrlPathName(uri), req);
2786
- throw Error(errors_ERRORS.ERR_CONTEXT_MATCHER_GENERIC);
2805
+ throw new errors_HttpProxyMiddlewareError('[HPM] Invalid pathFilter. Expecting something like: "/api" or ["/api", "/ajax"]', 'HPM_INVALID_PATH_FILTER_CONFIG');
2787
2806
  }
2788
2807
  function matchSingleStringPath(pathFilter, uri) {
2789
2808
  let pathname = getUrlPathName(uri);
@@ -2838,7 +2857,7 @@ function isValidRewriteConfig(rewriteConfig) {
2838
2857
  if ('function' == typeof rewriteConfig) return !0;
2839
2858
  if (isPlainObject(rewriteConfig)) return 0 !== Object.keys(rewriteConfig).length;
2840
2859
  if (null == rewriteConfig) return !1;
2841
- throw Error(errors_ERRORS.ERR_PATH_REWRITER_CONFIG);
2860
+ throw new errors_HttpProxyMiddlewareError('[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function', 'HPM_INVALID_PATH_REWRITER_CONFIG');
2842
2861
  }
2843
2862
  function parsePathRewriteRules(rewriteConfig) {
2844
2863
  let rules = [];
@@ -1,4 +1,4 @@
1
- import { isCSSModules } from "./349.js";
1
+ import { isCSSModules } from "./252.js";
2
2
  let pitch = function() {
3
3
  let { modules } = this.getOptions();
4
4
  if (!isCSSModules(modules, this)) return '';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createLogger, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, version } from "./756.js";
1
+ export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createLogger, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, version } from "./711.js";
@@ -1,5 +1,5 @@
1
1
  import { __webpack_require__ } from "./1~rslib-runtime.js";
2
- import "./756.js";
2
+ import "./711.js";
3
3
  __webpack_require__.add({
4
4
  "../../node_modules/.pnpm/launch-editor-middleware@2.14.1/node_modules/launch-editor-middleware/index.js" (module, __unused_rspack_exports, __webpack_require__) {
5
5
  let path = __webpack_require__("path?aeb1"), launch = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/index.js");
@@ -1,7 +1,7 @@
1
1
  import { __webpack_require__ } from "./1~rslib-runtime.js";
2
- import "./756.js";
2
+ import "./711.js";
3
3
  __webpack_require__.add({
4
- "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.2/node_modules/rspack-manifest-plugin/dist/helpers.js" (__unused_rspack_module, exports, __webpack_require__) {
4
+ "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.3/node_modules/rspack-manifest-plugin/dist/helpers.js" (__unused_rspack_module, exports, __webpack_require__) {
5
5
  exports.transformFiles = exports.reduceChunk = exports.reduceAssets = exports.generateManifest = void 0;
6
6
  let node_path_1 = __webpack_require__("node:path?435f");
7
7
  exports.generateManifest = (compilation, files, { generate, seed = {} })=>generate ? generate(seed, files, Array.from(compilation.entrypoints.entries()).reduce((e, [name, entrypoint])=>Object.assign(e, {
@@ -61,9 +61,9 @@ __webpack_require__.add({
61
61
  'sort'
62
62
  ].filter((fname)=>!!options[fname]).reduce((prev, fname)=>prev[fname](options[fname]), files).map(standardizeFilePaths);
63
63
  },
64
- "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.2/node_modules/rspack-manifest-plugin/dist/hooks.js" (__unused_rspack_module, exports, __webpack_require__) {
64
+ "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.3/node_modules/rspack-manifest-plugin/dist/hooks.js" (__unused_rspack_module, exports, __webpack_require__) {
65
65
  exports.getCompilerHooks = exports.emitHook = exports.beforeRunHook = void 0;
66
- let node_fs_1 = __webpack_require__("node:fs?9592"), node_path_1 = __webpack_require__("node:path?435f"), lite_tapable_1 = __webpack_require__("../../node_modules/.pnpm/@rspack+lite-tapable@1.1.0/node_modules/@rspack/lite-tapable/dist/index.cjs"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.2/node_modules/rspack-manifest-plugin/dist/helpers.js"), compilerHookMap = new WeakMap(), getCompilerHooks = (compiler)=>{
66
+ let node_fs_1 = __webpack_require__("node:fs?9592"), node_path_1 = __webpack_require__("node:path?435f"), lite_tapable_1 = __webpack_require__("../../node_modules/.pnpm/@rspack+lite-tapable@1.1.0/node_modules/@rspack/lite-tapable/dist/index.cjs"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.3/node_modules/rspack-manifest-plugin/dist/helpers.js"), compilerHookMap = new WeakMap(), getCompilerHooks = (compiler)=>{
67
67
  let hooks = compilerHookMap.get(compiler);
68
68
  return void 0 === hooks && (hooks = {
69
69
  afterEmit: new lite_tapable_1.SyncWaterfallHook([
@@ -112,9 +112,9 @@ __webpack_require__.add({
112
112
  getCompilerHooks(compiler).afterEmit.call(manifest);
113
113
  };
114
114
  },
115
- "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.2/node_modules/rspack-manifest-plugin/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
115
+ "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.3/node_modules/rspack-manifest-plugin/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
116
116
  exports.RspackManifestPlugin = void 0;
117
- let node_path_1 = __webpack_require__("node:path?435f"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.2/node_modules/rspack-manifest-plugin/dist/hooks.js"), emitCountMap = new Map(), defaults = {
117
+ let node_path_1 = __webpack_require__("node:path?435f"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.3/node_modules/rspack-manifest-plugin/dist/hooks.js"), emitCountMap = new Map(), defaults = {
118
118
  assetHookStage: 1 / 0,
119
119
  basePath: '',
120
120
  fileName: 'manifest.json',
@@ -684,5 +684,5 @@ __webpack_require__.add({
684
684
  });
685
685
  }
686
686
  });
687
- var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.2/node_modules/rspack-manifest-plugin/dist/index.js").RspackManifestPlugin;
687
+ var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.3/node_modules/rspack-manifest-plugin/dist/index.js").RspackManifestPlugin;
688
688
  export { RspackManifestPlugin };
package/dist/memfs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __webpack_require__ } from "./1~rslib-runtime.js";
2
- import "./756.js";
2
+ import "./711.js";
3
3
  __webpack_require__.add({
4
4
  "../../node_modules/.pnpm/@jsonjoy.com+base64@17.67.0_tslib@2.8.1/node_modules/@jsonjoy.com/base64/lib/constants.js" (__unused_rspack_module, exports) {
5
5
  exports.alphabet = void 0, exports.alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', 'function' == typeof Buffer && Buffer.from;
package/dist/sirv.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { join, normalize, resolve, sep } from "node:path";
2
2
  import { join as external_path_join, resolve as external_path_resolve } from "path";
3
3
  import { readdirSync, statSync } from "fs";
4
- import { mrmime_lookup } from "./756.js";
5
- import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
6
- import * as __rspack_external_node_querystring_aeb3c0b4 from "node:querystring";
4
+ import { mrmime_lookup } from "./711.js";
5
+ import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
6
+ import * as __rspack_external_node_querystring_5092a520 from "node:querystring";
7
7
  function totalist(dir, callback, pre = '') {
8
8
  let arr = readdirSync(dir = external_path_resolve('.', dir)), i = 0, abs, stats;
9
9
  for(; i < arr.length; i++)(stats = statSync(abs = external_path_join(dir, arr[i]))).isDirectory() ? totalist(abs, callback, external_path_join(pre, arr[i])) : callback(external_path_join(pre, arr[i]), abs, stats);
@@ -16,7 +16,7 @@ function parse(req) {
16
16
  let pathname = raw, search = '', query, hash;
17
17
  if (raw.length > 1) {
18
18
  let idx = raw.indexOf('#', 1);
19
- -1 !== idx && (hash = raw.substring(idx), pathname = raw.substring(0, idx)), -1 !== (idx = pathname.indexOf('?', 1)) && (search = pathname.substring(idx), pathname = pathname.substring(0, idx), search.length > 1 && (query = __rspack_external_node_querystring_aeb3c0b4.parse(search.substring(1))));
19
+ -1 !== idx && (hash = raw.substring(idx), pathname = raw.substring(0, idx)), -1 !== (idx = pathname.indexOf('?', 1)) && (search = pathname.substring(idx), pathname = pathname.substring(0, idx), search.length > 1 && (query = __rspack_external_node_querystring_5092a520.parse(search.substring(1))));
20
20
  }
21
21
  return req._parsedUrl = {
22
22
  pathname,
@@ -43,8 +43,8 @@ function viaCache(cache, uri, extns) {
43
43
  }
44
44
  function viaLocal(dir, isEtag, uri, extns) {
45
45
  let abs, stats, name, headers, i = 0, arr = toAssume(uri, extns);
46
- for(; i < arr.length; i++)if ((abs = normalize(join(dir, name = arr[i]))).startsWith(dir) && __rspack_external_node_fs_5ea92f0c.existsSync(abs)) {
47
- if ((stats = __rspack_external_node_fs_5ea92f0c.statSync(abs)).isDirectory()) continue;
46
+ for(; i < arr.length; i++)if ((abs = normalize(join(dir, name = arr[i]))).startsWith(dir) && __rspack_external_node_fs_1b05aee1.existsSync(abs)) {
47
+ if ((stats = __rspack_external_node_fs_1b05aee1.statSync(abs)).isDirectory()) continue;
48
48
  return (headers = toHeaders(name, stats, isEtag))['Cache-Control'] = isEtag ? 'no-cache' : 'no-store', {
49
49
  abs,
50
50
  stats,
@@ -66,7 +66,7 @@ function send(req, res, file, stats, headers) {
66
66
  if (end >= stats.size && (end = stats.size - 1), start >= stats.size) return res.setHeader('Content-Range', `bytes */${stats.size}`), res.statusCode = 416, res.end();
67
67
  headers['Content-Range'] = `bytes ${start}-${end}/${stats.size}`, headers['Content-Length'] = end - start + 1, headers['Accept-Ranges'] = 'bytes';
68
68
  }
69
- res.writeHead(code, headers), __rspack_external_node_fs_5ea92f0c.createReadStream(file, opts).pipe(res);
69
+ res.writeHead(code, headers), __rspack_external_node_fs_1b05aee1.createReadStream(file, opts).pipe(res);
70
70
  }
71
71
  let ENCODING = {
72
72
  '.br': 'br',
package/dist/ws.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __webpack_require__ } from "./1~rslib-runtime.js";
2
- import "./756.js";
2
+ import "./711.js";
3
3
  __webpack_require__.add({
4
4
  "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js" (module, __unused_rspack_exports, __webpack_require__) {
5
5
  let { EMPTY_BUFFER } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js"), FastBuffer = Buffer[Symbol.species];
@@ -8,6 +8,7 @@ export declare const CHAIN_ID: {
8
8
  /** Rule for JSON */ readonly JSON: 'json';
9
9
  /** Rule for images */ readonly IMAGE: 'image';
10
10
  /** Rule for media */ readonly MEDIA: 'media';
11
+ /** Rule for other built-in assets */ readonly ASSETS: 'assets';
11
12
  /** Rule for additional assets */ readonly ADDITIONAL_ASSETS: 'additional-assets';
12
13
  /** Rule for JS */ readonly JS: 'js';
13
14
  /** Rule for data uri encoded javascript */ readonly JS_DATA_URI: 'js-data-uri';
@@ -58,8 +58,10 @@ export declare const PLUGIN_SWC_NAME = 'rsbuild:swc';
58
58
  export declare const PLUGIN_CSS_NAME = 'rsbuild:css';
59
59
  // Extensions
60
60
  export declare const FONT_EXTENSIONS: string[];
61
+ export declare const ASSET_EXTENSIONS: string[];
61
62
  export declare const IMAGE_EXTENSIONS: string[];
62
63
  export declare const VIDEO_EXTENSIONS: string[];
63
64
  export declare const AUDIO_EXTENSIONS: string[];
65
+ export declare const TRACK_EXTENSIONS: string[];
64
66
  export declare const LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy';
65
67
  export declare const BROWSER_LOG_PREFIX = '[browser]';
@@ -39,11 +39,16 @@ export type LoadConfigOptions = {
39
39
  * The command passed to the config function.
40
40
  * @default process.argv[2]
41
41
  */ command?: string;
42
+ /**
43
+ * The export name to read from the config file.
44
+ * Set to `false` to execute the config file without reading exports.
45
+ * @default 'default'
46
+ */ exportName?: string | false;
42
47
  };
43
- export type LoadConfigResult = {
48
+ export type LoadConfigResult<Config = RsbuildConfig> = {
44
49
  /**
45
50
  * The loaded configuration object.
46
- */ content: RsbuildConfig;
51
+ */ content: Config;
47
52
  /**
48
53
  * The path to the loaded configuration file.
49
54
  * Return `null` if the configuration file is not found.
@@ -61,4 +66,4 @@ export declare function defineConfig(config: RsbuildConfigSyncFn): RsbuildConfig
61
66
  export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfigAsyncFn;
62
67
  export declare function defineConfig(config: RsbuildConfigDefinition): RsbuildConfigDefinition;
63
68
  export type ConfigLoader = 'auto' | 'jiti' | 'native';
64
- export declare function loadConfig({ cwd, path, configFileNames, envMode, meta, loader, command }?: LoadConfigOptions): Promise<LoadConfigResult>;
69
+ export declare function loadConfig<Config = RsbuildConfig>({ cwd, path, configFileNames, envMode, meta, loader, command, exportName }?: LoadConfigOptions): Promise<LoadConfigResult<Config>>;
@@ -543,17 +543,19 @@ export interface ResourceHintsOptions {
543
543
  /**
544
544
  * Specifies which types of resources will be included.
545
545
  * - `async-chunks`: Includes all async resources on the current page, such as async JS
546
- * chunks, and its associated CSS, images, fonts, and other static resources.
546
+ * chunks, and its associated CSS, images, and fonts.
547
547
  * - `initial`: Includes all non-async resources on the current page.
548
548
  * - `all-chunks`: Includes all async and non-async resources on the current page.
549
549
  * - `all-assets`: Includes all resources from all pages.
550
550
  * @default 'async-chunks'
551
551
  */ type?: ResourceHintsIncludeType;
552
552
  /**
553
- * A extra filter to determine which resources to include.
553
+ * An extra filter to determine which resources to include.
554
554
  */ include?: ResourceHintsFilter;
555
555
  /**
556
- * A extra filter to determine which resources to exclude.
556
+ * An extra filter to determine which resources to exclude.
557
+ *
558
+ * @default /\.(?:webmanifest|pdf|txt)$/i
557
559
  */ exclude?: ResourceHintsFilter;
558
560
  /**
559
561
  * Whether to dedupe script resources that already exist in the current HTML content.
@@ -599,7 +601,7 @@ export interface PerformanceConfig {
599
601
  *
600
602
  * When `performance.preload` is set to `true`, Rsbuild will use the following default
601
603
  * options to preload resources. This means preloading all async resources on the current
602
- * page, including async JS and its associated CSS, image, font, and other resources.
604
+ * page, including async JS and its associated CSS, image, and font resources.
603
605
  *
604
606
  * ```js
605
607
  * const defaultOptions = {
@@ -615,7 +617,7 @@ export interface PerformanceConfig {
615
617
  *
616
618
  * When `performance.prefetch` is set to `true`, Rsbuild will use the following default
617
619
  * options to prefetch resources. This means prefetching all async resources on the current
618
- * page, including async JS and its associated CSS, image, font, and other resources.
620
+ * page, including async JS and its associated CSS, image, and font resources.
619
621
  *
620
622
  * ```js
621
623
  * const defaultOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -40,13 +40,13 @@
40
40
  "registry": "https://registry.npmjs.org/"
41
41
  },
42
42
  "dependencies": {
43
- "@rspack/core": "~2.1.2",
43
+ "@rspack/core": "~2.1.3",
44
44
  "@swc/helpers": "^0.5.23"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@jridgewell/remapping": "^2.3.5",
48
48
  "@jridgewell/trace-mapping": "^0.3.31",
49
- "@rslib/core": "0.23.1",
49
+ "@rslib/core": "0.23.2",
50
50
  "@types/cors": "^2.8.19",
51
51
  "@types/node": "^24.13.2",
52
52
  "@types/on-finished": "2.3.5",
@@ -63,14 +63,14 @@
63
63
  "dotenv-expand": "^13.0.0",
64
64
  "fresh-import": "^0.2.1",
65
65
  "html-rspack-plugin": "6.1.9",
66
- "http-proxy-middleware": "4.1.1",
66
+ "http-proxy-middleware": "4.2.0",
67
67
  "jiti": "^2.7.0",
68
68
  "launch-editor-middleware": "^2.14.1",
69
69
  "memfs": "^4.57.8",
70
70
  "mrmime": "^2.0.1",
71
71
  "on-finished": "2.4.1",
72
72
  "open": "^11.0.0",
73
- "postcss": "^8.5.15",
73
+ "postcss": "^8.5.16",
74
74
  "postcss-load-config": "6.0.1",
75
75
  "postcss-loader": "8.2.1",
76
76
  "prebundle": "1.6.5",
package/types.d.ts CHANGED
@@ -152,6 +152,10 @@ declare module '*.cur' {
152
152
  const src: string;
153
153
  export default src;
154
154
  }
155
+ declare module '*.jxl' {
156
+ const src: string;
157
+ export default src;
158
+ }
155
159
 
156
160
  /**
157
161
  * Font assets
@@ -224,6 +228,26 @@ declare module '*.opus' {
224
228
  const src: string;
225
229
  export default src;
226
230
  }
231
+ declare module '*.vtt' {
232
+ const src: string;
233
+ export default src;
234
+ }
235
+
236
+ /**
237
+ * Other assets
238
+ */
239
+ declare module '*.webmanifest' {
240
+ const src: string;
241
+ export default src;
242
+ }
243
+ declare module '*.pdf' {
244
+ const src: string;
245
+ export default src;
246
+ }
247
+ declare module '*.txt' {
248
+ const src: string;
249
+ export default src;
250
+ }
227
251
 
228
252
  /**
229
253
  * @requires [@rsbuild/plugin-yaml](https://npmjs.com/package/@rsbuild/plugin-yaml)
File without changes
File without changes
File without changes