@rsbuild/core 1.3.9 → 1.3.10

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/index.cjs CHANGED
@@ -71,7 +71,7 @@ var __webpack_modules__ = {
71
71
  }, {});
72
72
  }, module.exports = deepmerge;
73
73
  },
74
- "../../node_modules/.pnpm/dotenv-expand@12.0.1/node_modules/dotenv-expand/lib/main.js": function(module) {
74
+ "../../node_modules/.pnpm/dotenv-expand@12.0.2/node_modules/dotenv-expand/lib/main.js": function(module) {
75
75
  "use strict";
76
76
  function _resolveEscapeSequences(value) {
77
77
  return value.replace(/\\\$/g, '$');
@@ -885,79 +885,117 @@ var __webpack_modules__ = {
885
885
  },
886
886
  "../../compiled/chokidar/index.js": function(module) {
887
887
  "use strict";
888
- module.exports = import("../compiled/chokidar/index.js");
888
+ module.exports = import("../compiled/chokidar/index.js").then(function(module) {
889
+ return module;
890
+ });
889
891
  },
890
892
  "../../compiled/connect-history-api-fallback/index.js": function(module) {
891
893
  "use strict";
892
- module.exports = import("../compiled/connect-history-api-fallback/index.js");
894
+ module.exports = import("../compiled/connect-history-api-fallback/index.js").then(function(module) {
895
+ return module;
896
+ });
893
897
  },
894
898
  "../../compiled/connect/index.js": function(module) {
895
899
  "use strict";
896
- module.exports = import("../compiled/connect/index.js");
900
+ module.exports = import("../compiled/connect/index.js").then(function(module) {
901
+ return module;
902
+ });
897
903
  },
898
904
  "../../compiled/cors/index.js": function(module) {
899
905
  "use strict";
900
- module.exports = import("../compiled/cors/index.js");
906
+ module.exports = import("../compiled/cors/index.js").then(function(module) {
907
+ return module;
908
+ });
901
909
  },
902
910
  "../../compiled/http-proxy-middleware/index.js": function(module) {
903
911
  "use strict";
904
- module.exports = import("../compiled/http-proxy-middleware/index.js");
912
+ module.exports = import("../compiled/http-proxy-middleware/index.js").then(function(module) {
913
+ return module;
914
+ });
905
915
  },
906
916
  "../../compiled/launch-editor-middleware/index.js": function(module) {
907
917
  "use strict";
908
- module.exports = import("../compiled/launch-editor-middleware/index.js");
918
+ module.exports = import("../compiled/launch-editor-middleware/index.js").then(function(module) {
919
+ return module;
920
+ });
909
921
  },
910
922
  "../../compiled/on-finished/index.js": function(module) {
911
923
  "use strict";
912
- module.exports = import("../compiled/on-finished/index.js");
924
+ module.exports = import("../compiled/on-finished/index.js").then(function(module) {
925
+ return module;
926
+ });
913
927
  },
914
928
  "../../compiled/open/index.js": function(module) {
915
929
  "use strict";
916
- module.exports = import("../compiled/open/index.js");
930
+ module.exports = import("../compiled/open/index.js").then(function(module) {
931
+ return module;
932
+ });
917
933
  },
918
934
  "../../compiled/postcss-load-config/index.js": function(module) {
919
935
  "use strict";
920
- module.exports = import("../compiled/postcss-load-config/index.js");
936
+ module.exports = import("../compiled/postcss-load-config/index.js").then(function(module) {
937
+ return module;
938
+ });
921
939
  },
922
940
  "../../compiled/rsbuild-dev-middleware/index.js": function(module) {
923
941
  "use strict";
924
- module.exports = import("../compiled/rsbuild-dev-middleware/index.js");
942
+ module.exports = import("../compiled/rsbuild-dev-middleware/index.js").then(function(module) {
943
+ return module;
944
+ });
925
945
  },
926
946
  "../../compiled/rspack-manifest-plugin/index.js": function(module) {
927
947
  "use strict";
928
- module.exports = import("../compiled/rspack-manifest-plugin/index.js");
948
+ module.exports = import("../compiled/rspack-manifest-plugin/index.js").then(function(module) {
949
+ return module;
950
+ });
929
951
  },
930
952
  "../../compiled/sirv/index.js": function(module) {
931
953
  "use strict";
932
- module.exports = import("../compiled/sirv/index.js");
954
+ module.exports = import("../compiled/sirv/index.js").then(function(module) {
955
+ return module;
956
+ });
933
957
  },
934
958
  "../../compiled/tinyglobby/index.js": function(module) {
935
959
  "use strict";
936
- module.exports = import("../compiled/tinyglobby/index.js");
960
+ module.exports = import("../compiled/tinyglobby/index.js").then(function(module) {
961
+ return module;
962
+ });
937
963
  },
938
964
  "../../compiled/webpack-bundle-analyzer/index.js": function(module) {
939
965
  "use strict";
940
- module.exports = import("../compiled/webpack-bundle-analyzer/index.js");
966
+ module.exports = import("../compiled/webpack-bundle-analyzer/index.js").then(function(module) {
967
+ return module;
968
+ });
941
969
  },
942
970
  "../../compiled/ws/index.js": function(module) {
943
971
  "use strict";
944
- module.exports = import("../compiled/ws/index.js");
972
+ module.exports = import("../compiled/ws/index.js").then(function(module) {
973
+ return module;
974
+ });
945
975
  },
946
976
  jiti: function(module) {
947
977
  "use strict";
948
- module.exports = import("jiti");
978
+ module.exports = import("jiti").then(function(module) {
979
+ return module;
980
+ });
949
981
  },
950
982
  "node:http": function(module) {
951
983
  "use strict";
952
- module.exports = import("node:http");
984
+ module.exports = import("node:http").then(function(module) {
985
+ return module;
986
+ });
953
987
  },
954
988
  "node:http2": function(module) {
955
989
  "use strict";
956
- module.exports = import("node:http2");
990
+ module.exports = import("node:http2").then(function(module) {
991
+ return module;
992
+ });
957
993
  },
958
994
  "node:https": function(module) {
959
995
  "use strict";
960
- module.exports = import("node:https");
996
+ module.exports = import("node:https").then(function(module) {
997
+ return module;
998
+ });
961
999
  },
962
1000
  "../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/package.json": function(module) {
963
1001
  "use strict";
@@ -1031,7 +1069,7 @@ for(var __webpack_i__ in (()=>{
1031
1069
  let external_node_fs_namespaceObject = require("node:fs");
1032
1070
  var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
1033
1071
  let external_node_path_namespaceObject = require("node:path");
1034
- var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject), main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js"), lib_main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@12.0.1/node_modules/dotenv-expand/lib/main.js");
1072
+ var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject), main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js"), lib_main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@12.0.2/node_modules/dotenv-expand/lib/main.js");
1035
1073
  let external_node_url_namespaceObject = require("node:url");
1036
1074
  var cjs = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"), cjs_default = __webpack_require__.n(cjs);
1037
1075
  let index_js_namespaceObject = require("../compiled/picocolors/index.js");
@@ -1150,13 +1188,15 @@ for(var __webpack_i__ in (()=>{
1150
1188
  rslog_index_js_namespaceObject.logger.debug(`failed to empty dir: ${dir}`), rslog_index_js_namespaceObject.logger.debug(err);
1151
1189
  }
1152
1190
  }
1153
- let formatFileName = (fileName)=>/:\d+:\d+/.test(fileName) ? `File: ${index_js_default().cyan(fileName)}\n` : `File: ${index_js_default().cyan(fileName)}:1:1\n`, hintNodePolyfill = (message)=>{
1191
+ let formatFileName = (fileName)=>/:\d+:\d+/.test(fileName) ? `File: ${index_js_default().cyan(fileName)}\n` : `File: ${index_js_default().cyan(`${fileName}:1:1`)}\n`, hintNodePolyfill = (message)=>{
1154
1192
  let getTips = (moduleName)=>{
1155
1193
  let tips = [
1156
- `Tip: "${moduleName}" is a built-in Node.js module. It cannot be imported in client-side code.`,
1157
- `Check if you need to import Node.js module. If needed, you can use "${index_js_default().cyan('@rsbuild/plugin-node-polyfill')}" to polyfill it.`
1194
+ `Error: "${moduleName}" is a built-in Node.js module and cannot be imported in client-side code.\n`,
1195
+ 'Solution: Check if you need to import Node.js module.',
1196
+ ' - If not needed, remove the import.',
1197
+ ` - If needed, use "${index_js_default().yellow('@rsbuild/plugin-node-polyfill')}" to polyfill it. (See ${index_js_default().yellow('https://npmjs.com/package/@rsbuild/plugin-node-polyfill')})`
1158
1198
  ];
1159
- return `${message}\n\n${index_js_default().yellow(tips.join('\n'))}`;
1199
+ return `${message}\n\n${index_js_default().red(tips.join('\n'))}`;
1160
1200
  };
1161
1201
  if (message.includes('need an additional plugin to handle "node:" URIs')) return getTips('node:*');
1162
1202
  if (!message.includes("Can't resolve")) return message;
@@ -2218,7 +2258,7 @@ for(var __webpack_i__ in (()=>{
2218
2258
  async function createContext(options, userConfig) {
2219
2259
  let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
2220
2260
  return {
2221
- version: "1.3.9",
2261
+ version: "1.3.10",
2222
2262
  rootPath,
2223
2263
  distPath: '',
2224
2264
  cachePath,
@@ -3447,13 +3487,19 @@ for(var __webpack_i__ in (()=>{
3447
3487
  }
3448
3488
  return source;
3449
3489
  }
3450
- function matchTests(name, source, tests) {
3490
+ function matchTests(name, asset, tests) {
3451
3491
  return tests.some((test)=>isFunction(test) ? test({
3452
3492
  name,
3453
- size: source.length
3493
+ size: asset.size()
3454
3494
  }) : test.exec(name));
3455
3495
  }
3456
- let pluginInlineChunk = ()=>({
3496
+ let getInlineTests = (config)=>{
3497
+ let isProd = 'production' === config.mode, { inlineStyles, inlineScripts } = config.output, scriptTests = [], styleTests = [];
3498
+ return inlineScripts && (!0 === inlineScripts ? isProd && scriptTests.push(JS_REGEX) : (0, types_namespaceObject.isRegExp)(inlineScripts) || isFunction(inlineScripts) ? isProd && scriptTests.push(inlineScripts) : ('auto' === inlineScripts.enable ? isProd : inlineScripts.enable) && scriptTests.push(inlineScripts.test)), inlineStyles && (!0 === inlineStyles ? isProd && styleTests.push(CSS_REGEX) : (0, types_namespaceObject.isRegExp)(inlineStyles) || isFunction(inlineStyles) ? isProd && styleTests.push(inlineStyles) : ('auto' === inlineStyles.enable ? isProd : inlineStyles.enable) && styleTests.push(inlineStyles.test)), {
3499
+ scriptTests,
3500
+ styleTests
3501
+ };
3502
+ }, pluginInlineChunk = ()=>({
3457
3503
  name: 'rsbuild:inline-chunk',
3458
3504
  setup (api) {
3459
3505
  let inlinedAssets = new Set(), getInlinedScriptTag = (publicPath, tag, compilation, scriptTests, config)=>{
@@ -3461,13 +3507,11 @@ for(var __webpack_i__ in (()=>{
3461
3507
  let { assets } = compilation;
3462
3508
  if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.src) && 'string' == typeof tag.attrs.src)) return tag;
3463
3509
  let { src, ...otherAttrs } = tag.attrs, scriptName = publicPath ? src.replace(publicPath, '') : src, asset = assets[scriptName];
3464
- if (null == asset) return tag;
3465
- let source = asset.source().toString();
3466
- if (!matchTests(scriptName, source, scriptTests)) return tag;
3510
+ if (null == asset || !matchTests(scriptName, asset, scriptTests)) return tag;
3467
3511
  let ret = {
3468
3512
  tag: "script",
3469
3513
  children: updateSourceMappingURL({
3470
- source,
3514
+ source: asset.source().toString(),
3471
3515
  compilation,
3472
3516
  publicPath,
3473
3517
  type: 'js',
@@ -3483,13 +3527,11 @@ for(var __webpack_i__ in (()=>{
3483
3527
  let { assets } = compilation;
3484
3528
  if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.href) && 'string' == typeof tag.attrs.href)) return tag;
3485
3529
  let linkName = publicPath ? tag.attrs.href.replace(publicPath, '') : tag.attrs.href, asset = assets[linkName];
3486
- if (null == asset) return tag;
3487
- let source = asset.source().toString();
3488
- if (!matchTests(linkName, source, styleTests)) return tag;
3530
+ if (null == asset || !matchTests(linkName, asset, styleTests)) return tag;
3489
3531
  let ret = {
3490
3532
  tag: 'style',
3491
3533
  children: updateSourceMappingURL({
3492
- source,
3534
+ source: asset.source().toString(),
3493
3535
  compilation,
3494
3536
  publicPath,
3495
3537
  type: 'css',
@@ -3511,8 +3553,8 @@ for(var __webpack_i__ in (()=>{
3511
3553
  headTags,
3512
3554
  bodyTags
3513
3555
  };
3514
- let { inlineStyles, inlineScripts } = config.output, scriptTests = [], styleTests = [], isProdMode = 'production' === environment.config.mode;
3515
- if (inlineScripts && (!0 === inlineScripts ? isProdMode && scriptTests.push(JS_REGEX) : (0, types_namespaceObject.isRegExp)(inlineScripts) || isFunction(inlineScripts) ? isProdMode && scriptTests.push(inlineScripts) : ('auto' === inlineScripts.enable ? isProdMode : inlineScripts.enable) && scriptTests.push(inlineScripts.test)), inlineStyles && (!0 === inlineStyles ? isProdMode && styleTests.push(CSS_REGEX) : (0, types_namespaceObject.isRegExp)(inlineStyles) || isFunction(inlineStyles) ? isProdMode && styleTests.push(inlineStyles) : ('auto' === inlineStyles.enable ? isProdMode : inlineStyles.enable) && styleTests.push(inlineStyles.test)), !scriptTests.length && !styleTests.length) return {
3556
+ let { scriptTests, styleTests } = getInlineTests(config);
3557
+ if (!scriptTests.length && !styleTests.length) return {
3516
3558
  headTags,
3517
3559
  bodyTags
3518
3560
  };
@@ -3524,9 +3566,6 @@ for(var __webpack_i__ in (()=>{
3524
3566
  });
3525
3567
  }
3526
3568
  });
3527
- function isAsync(chunk) {
3528
- return 'canBeInitial' in chunk ? !chunk.canBeInitial() : 'isInitial' in chunk && !chunk.isInitial();
3529
- }
3530
3569
  function recursiveChunkEntryNames(chunk) {
3531
3570
  let [...chunkGroups] = chunk.groupsIterable;
3532
3571
  return [
@@ -4106,7 +4145,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4106
4145
  });
4107
4146
  }
4108
4147
  });
4109
- function HtmlPreloadOrPrefetchPlugin_define_property(obj, key, value) {
4148
+ function isAsyncChunk(chunk) {
4149
+ return 'canBeInitial' in chunk ? !chunk.canBeInitial() : 'isInitial' in chunk && !chunk.isInitial();
4150
+ }
4151
+ function HtmlResourceHintsPlugin_define_property(obj, key, value) {
4110
4152
  return key in obj ? Object.defineProperty(obj, key, {
4111
4153
  value: value,
4112
4154
  enumerable: !0,
@@ -4114,20 +4156,35 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4114
4156
  writable: !0
4115
4157
  }) : obj[key] = value, obj;
4116
4158
  }
4117
- let HtmlPreloadOrPrefetchPlugin_defaultOptions = {
4159
+ let HtmlResourceHintsPlugin_defaultOptions = {
4118
4160
  type: 'async-chunks',
4119
- dedupe: !0
4161
+ dedupe: !0,
4162
+ exclude: /.map$/
4163
+ }, applyFilter = (files, include, exclude)=>{
4164
+ let includeRegExp = [], excludeRegExp = [], includeFn = [], excludeFn = [];
4165
+ if (include) for (let item of castArray(include))'string' == typeof item ? includeRegExp.push(new RegExp(item)) : isFunction(item) ? includeFn.push(item) : includeRegExp.push(item);
4166
+ if (exclude) for (let item of castArray(exclude))'string' == typeof item ? excludeRegExp.push(new RegExp(item)) : isFunction(item) ? excludeFn.push(item) : excludeRegExp.push(item);
4167
+ return files.filter((file)=>{
4168
+ let includeMatched = !1;
4169
+ for (let item of includeRegExp)item.test(file) && (includeMatched = !0);
4170
+ for (let item of includeFn)item(file) && (includeMatched = !0);
4171
+ if (includeRegExp.length + includeFn.length > 0 && !includeMatched) return !1;
4172
+ for (let item of excludeRegExp)if (item.test(file)) return !1;
4173
+ for (let item of excludeFn)if (item(file)) return !1;
4174
+ return !0;
4175
+ });
4120
4176
  };
4121
- class HtmlPreloadOrPrefetchPlugin {
4177
+ class HtmlResourceHintsPlugin {
4122
4178
  apply(compiler) {
4123
4179
  compiler.hooks.compilation.tap(this.name, (compilation)=>{
4124
- getHTMLPlugin().getHooks(compilation).beforeAssetTagGeneration.tap(`HTML${upperFirst(this.type)}Plugin`, (htmlPluginData)=>(this.resourceHints = function(options, type, compilation, htmlPluginData, HTMLCount) {
4125
- let extractedChunks = function({ compilation, includeType }) {
4180
+ let pluginHooks = getHTMLPlugin().getCompilationHooks(compilation), pluginName = `HTML${upperFirst(this.type)}Plugin`;
4181
+ pluginHooks.beforeAssetTagGeneration.tap(pluginName, (data)=>(this.resourceHints = function(options, type, compilation, data, HTMLCount) {
4182
+ let extractedChunks = function(compilation, includeType) {
4126
4183
  let chunks = [
4127
4184
  ...compilation.chunks
4128
4185
  ];
4129
- if (void 0 === includeType || 'async-chunks' === includeType) return chunks.filter(isAsync);
4130
- if ('initial' === includeType) return chunks.filter((chunk)=>!isAsync(chunk));
4186
+ if (void 0 === includeType || 'async-chunks' === includeType) return chunks.filter(isAsyncChunk);
4187
+ if ('initial' === includeType) return chunks.filter((chunk)=>!isAsyncChunk(chunk));
4131
4188
  if ('all-chunks' === includeType) return chunks;
4132
4189
  if ('all-assets' === includeType) {
4133
4190
  var _compilation_assetsInfo;
@@ -4144,10 +4201,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4144
4201
  ];
4145
4202
  }
4146
4203
  return chunks;
4147
- }({
4148
- compilation,
4149
- includeType: options.type
4150
- }), sortedFilteredFiles = [
4204
+ }(compilation, options.type), sortedFilteredFiles = applyFilter([
4151
4205
  ...new Set(('all-assets' === options.type || 1 === HTMLCount ? extractedChunks : extractedChunks.filter((chunk)=>(function({ chunk, htmlPluginData }) {
4152
4206
  let { options } = htmlPluginData.plugin;
4153
4207
  return recursiveChunkEntryNames(chunk).some((chunkName)=>{
@@ -4157,15 +4211,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4157
4211
  })({
4158
4212
  chunk: chunk,
4159
4213
  compilation,
4160
- htmlPluginData,
4214
+ htmlPluginData: data,
4161
4215
  pluginOptions: options
4162
4216
  }))).reduce((accumulated, chunk)=>accumulated.concat([
4163
4217
  ...chunk.files,
4164
4218
  ...chunk.auxiliaryFiles || []
4165
4219
  ]), []))
4166
- ].filter((file)=>[
4167
- /.map$/
4168
- ].every((regex)=>!regex.test(file))).filter((file)=>!options.include || ('function' == typeof options.include ? options.include(file) : options.include.some((regex)=>new RegExp(regex).test(file)))).filter((file)=>!options.exclude || ('function' == typeof options.exclude ? !options.exclude(file) : options.exclude.every((regex)=>!new RegExp(regex).test(file)))).sort(), links = [], { publicPath, crossOriginLoading } = compilation.outputOptions;
4220
+ ], options.include, options.exclude).sort(), links = [], { publicPath, crossOriginLoading } = compilation.outputOptions;
4169
4221
  for (let file of sortedFilteredFiles){
4170
4222
  let href = ensureAssetPrefix(file, publicPath), attributes = {
4171
4223
  href,
@@ -4189,19 +4241,19 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4189
4241
  });
4190
4242
  }
4191
4243
  return links;
4192
- }(this.options, this.type, compilation, htmlPluginData, this.HTMLCount), htmlPluginData)), getHTMLPlugin().getHooks(compilation).alterAssetTags.tap(`HTML${upperFirst(this.type)}Plugin`, (htmlPluginData)=>{
4244
+ }(this.options, this.type, compilation, data, this.HTMLCount), data)), pluginHooks.alterAssetTags.tap(pluginName, (data)=>{
4193
4245
  var resourceHints, scripts;
4194
- return this.resourceHints && (htmlPluginData.assetTags.styles = [
4195
- ...this.options.dedupe ? (resourceHints = this.resourceHints, scripts = htmlPluginData.assetTags.scripts, resourceHints.filter((resourceHint)=>!scripts.find((script)=>script.attributes.src === resourceHint.attributes.href))) : this.resourceHints,
4196
- ...htmlPluginData.assetTags.styles
4197
- ]), htmlPluginData;
4246
+ return this.resourceHints && (data.assetTags.styles = [
4247
+ ...this.options.dedupe ? (resourceHints = this.resourceHints, scripts = data.assetTags.scripts, resourceHints.filter((resourceHint)=>!scripts.find((script)=>script.attributes.src === resourceHint.attributes.href))) : this.resourceHints,
4248
+ ...data.assetTags.styles
4249
+ ]), data;
4198
4250
  });
4199
4251
  });
4200
4252
  }
4201
4253
  constructor(options, type, HTMLCount){
4202
- HtmlPreloadOrPrefetchPlugin_define_property(this, "options", void 0), HtmlPreloadOrPrefetchPlugin_define_property(this, "name", 'HtmlPreloadOrPrefetchPlugin'), HtmlPreloadOrPrefetchPlugin_define_property(this, "resourceHints", []), HtmlPreloadOrPrefetchPlugin_define_property(this, "type", void 0), HtmlPreloadOrPrefetchPlugin_define_property(this, "HTMLCount", void 0), this.options = {
4203
- ...HtmlPreloadOrPrefetchPlugin_defaultOptions,
4204
- ...'boolean' == typeof options ? {} : options
4254
+ HtmlResourceHintsPlugin_define_property(this, "options", void 0), HtmlResourceHintsPlugin_define_property(this, "name", 'HtmlResourceHintsPlugin'), HtmlResourceHintsPlugin_define_property(this, "resourceHints", []), HtmlResourceHintsPlugin_define_property(this, "type", void 0), HtmlResourceHintsPlugin_define_property(this, "HTMLCount", void 0), this.options = {
4255
+ ...HtmlResourceHintsPlugin_defaultOptions,
4256
+ ...options
4205
4257
  }, this.type = type, this.HTMLCount = HTMLCount;
4206
4258
  }
4207
4259
  }
@@ -4211,7 +4263,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4211
4263
  rel,
4212
4264
  ...option
4213
4265
  }
4214
- })), pluginResourceHints = ()=>({
4266
+ })), getInlineExcludes = (config)=>{
4267
+ let { scriptTests, styleTests } = getInlineTests(config);
4268
+ return [
4269
+ ...scriptTests,
4270
+ ...styleTests
4271
+ ].filter((item)=>(0, types_namespaceObject.isRegExp)(item));
4272
+ }, pluginResourceHints = ()=>({
4215
4273
  name: 'rsbuild:resource-hints',
4216
4274
  setup (api) {
4217
4275
  api.modifyHTMLTags(({ headTags, bodyTags }, { environment })=>{
@@ -4235,16 +4293,29 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4235
4293
  }), api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
4236
4294
  let { config, htmlPaths } = environment;
4237
4295
  if (0 === Object.keys(htmlPaths).length) return;
4238
- let { performance: { preload, prefetch } } = config, HTMLCount = chain.entryPoints.values().length;
4239
- prefetch && chain.plugin(CHAIN_ID.PLUGIN.HTML_PREFETCH).use(HtmlPreloadOrPrefetchPlugin, [
4240
- prefetch,
4241
- 'prefetch',
4242
- HTMLCount
4243
- ]), preload && chain.plugin(CHAIN_ID.PLUGIN.HTML_PRELOAD).use(HtmlPreloadOrPrefetchPlugin, [
4244
- preload,
4245
- 'preload',
4246
- HTMLCount
4247
- ]);
4296
+ let { performance: { preload, prefetch } } = config, HTMLCount = chain.entryPoints.values().length, excludes = getInlineExcludes(config);
4297
+ if (prefetch) {
4298
+ let options = !0 === prefetch ? {} : prefetch;
4299
+ excludes.length && (options.exclude = options.exclude ? [
4300
+ ...castArray(options.exclude),
4301
+ ...excludes
4302
+ ] : excludes), chain.plugin(CHAIN_ID.PLUGIN.HTML_PREFETCH).use(HtmlResourceHintsPlugin, [
4303
+ options,
4304
+ 'prefetch',
4305
+ HTMLCount
4306
+ ]);
4307
+ }
4308
+ if (preload) {
4309
+ let options = !0 === preload ? {} : preload;
4310
+ excludes.length && (options.exclude = options.exclude ? [
4311
+ ...castArray(options.exclude),
4312
+ ...excludes
4313
+ ] : excludes), chain.plugin(CHAIN_ID.PLUGIN.HTML_PRELOAD).use(HtmlResourceHintsPlugin, [
4314
+ options,
4315
+ 'preload',
4316
+ HTMLCount
4317
+ ]);
4318
+ }
4248
4319
  });
4249
4320
  }
4250
4321
  }), rsdoctor_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), pluginRsdoctor = ()=>({
@@ -7418,11 +7489,11 @@ ${section.body}` : section.body).join("\n\n"));
7418
7489
  }
7419
7490
  process.title = 'rsbuild-node';
7420
7491
  let { npm_execpath } = process.env;
7421
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.9\n`);
7492
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.10\n`);
7422
7493
  try {
7423
7494
  !function() {
7424
7495
  let cli = cac_dist('rsbuild');
7425
- cli.help(), cli.version("1.3.9"), applyCommonOptions(cli);
7496
+ cli.help(), cli.version("1.3.10"), applyCommonOptions(cli);
7426
7497
  let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
7427
7498
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
7428
7499
  try {
@@ -7473,7 +7544,7 @@ ${section.body}` : section.body).join("\n\n"));
7473
7544
  rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
7474
7545
  }
7475
7546
  }
7476
- let src_version = "1.3.9";
7547
+ let src_version = "1.3.10";
7477
7548
  })(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defineConfig = __webpack_exports__.defineConfig, exports.ensureAssetPrefix = __webpack_exports__.ensureAssetPrefix, exports.loadConfig = __webpack_exports__.loadConfig, exports.loadEnv = __webpack_exports__.loadEnv, exports.logger = __webpack_exports__.logger, exports.mergeRsbuildConfig = __webpack_exports__.mergeRsbuildConfig, exports.rspack = __webpack_exports__.rspack, exports.runCLI = __webpack_exports__.runCLI, exports.version = __webpack_exports__.version, __webpack_exports__)-1 === [
7478
7549
  "PLUGIN_CSS_NAME",
7479
7550
  "PLUGIN_SWC_NAME",