@rsbuild/core 1.3.8 → 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.8",
2261
+ version: "1.3.10",
2222
2262
  rootPath,
2223
2263
  distPath: '',
2224
2264
  cachePath,
@@ -2781,7 +2821,8 @@ for(var __webpack_i__ in (()=>{
2781
2821
  }
2782
2822
  }), getCSSModulesLocalIdentName = (config, isProd)=>config.output.cssModules.localIdentName || (isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'), getLightningCSSLoaderOptions = (config, targets, minify)=>{
2783
2823
  let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
2784
- targets
2824
+ targets,
2825
+ errorRecovery: !0
2785
2826
  };
2786
2827
  return minify && (initialOptions.minify = !0), reduceConfigs({
2787
2828
  initial: initialOptions,
@@ -3446,13 +3487,19 @@ for(var __webpack_i__ in (()=>{
3446
3487
  }
3447
3488
  return source;
3448
3489
  }
3449
- function matchTests(name, source, tests) {
3490
+ function matchTests(name, asset, tests) {
3450
3491
  return tests.some((test)=>isFunction(test) ? test({
3451
3492
  name,
3452
- size: source.length
3493
+ size: asset.size()
3453
3494
  }) : test.exec(name));
3454
3495
  }
3455
- 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 = ()=>({
3456
3503
  name: 'rsbuild:inline-chunk',
3457
3504
  setup (api) {
3458
3505
  let inlinedAssets = new Set(), getInlinedScriptTag = (publicPath, tag, compilation, scriptTests, config)=>{
@@ -3460,13 +3507,11 @@ for(var __webpack_i__ in (()=>{
3460
3507
  let { assets } = compilation;
3461
3508
  if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.src) && 'string' == typeof tag.attrs.src)) return tag;
3462
3509
  let { src, ...otherAttrs } = tag.attrs, scriptName = publicPath ? src.replace(publicPath, '') : src, asset = assets[scriptName];
3463
- if (null == asset) return tag;
3464
- let source = asset.source().toString();
3465
- if (!matchTests(scriptName, source, scriptTests)) return tag;
3510
+ if (null == asset || !matchTests(scriptName, asset, scriptTests)) return tag;
3466
3511
  let ret = {
3467
3512
  tag: "script",
3468
3513
  children: updateSourceMappingURL({
3469
- source,
3514
+ source: asset.source().toString(),
3470
3515
  compilation,
3471
3516
  publicPath,
3472
3517
  type: 'js',
@@ -3482,13 +3527,11 @@ for(var __webpack_i__ in (()=>{
3482
3527
  let { assets } = compilation;
3483
3528
  if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.href) && 'string' == typeof tag.attrs.href)) return tag;
3484
3529
  let linkName = publicPath ? tag.attrs.href.replace(publicPath, '') : tag.attrs.href, asset = assets[linkName];
3485
- if (null == asset) return tag;
3486
- let source = asset.source().toString();
3487
- if (!matchTests(linkName, source, styleTests)) return tag;
3530
+ if (null == asset || !matchTests(linkName, asset, styleTests)) return tag;
3488
3531
  let ret = {
3489
3532
  tag: 'style',
3490
3533
  children: updateSourceMappingURL({
3491
- source,
3534
+ source: asset.source().toString(),
3492
3535
  compilation,
3493
3536
  publicPath,
3494
3537
  type: 'css',
@@ -3510,8 +3553,8 @@ for(var __webpack_i__ in (()=>{
3510
3553
  headTags,
3511
3554
  bodyTags
3512
3555
  };
3513
- let { inlineStyles, inlineScripts } = config.output, scriptTests = [], styleTests = [], isProdMode = 'production' === environment.config.mode;
3514
- 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 {
3515
3558
  headTags,
3516
3559
  bodyTags
3517
3560
  };
@@ -3523,9 +3566,6 @@ for(var __webpack_i__ in (()=>{
3523
3566
  });
3524
3567
  }
3525
3568
  });
3526
- function isAsync(chunk) {
3527
- return 'canBeInitial' in chunk ? !chunk.canBeInitial() : 'isInitial' in chunk && !chunk.isInitial();
3528
- }
3529
3569
  function recursiveChunkEntryNames(chunk) {
3530
3570
  let [...chunkGroups] = chunk.groupsIterable;
3531
3571
  return [
@@ -4105,7 +4145,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4105
4145
  });
4106
4146
  }
4107
4147
  });
4108
- 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) {
4109
4152
  return key in obj ? Object.defineProperty(obj, key, {
4110
4153
  value: value,
4111
4154
  enumerable: !0,
@@ -4113,20 +4156,35 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4113
4156
  writable: !0
4114
4157
  }) : obj[key] = value, obj;
4115
4158
  }
4116
- let HtmlPreloadOrPrefetchPlugin_defaultOptions = {
4159
+ let HtmlResourceHintsPlugin_defaultOptions = {
4117
4160
  type: 'async-chunks',
4118
- 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
+ });
4119
4176
  };
4120
- class HtmlPreloadOrPrefetchPlugin {
4177
+ class HtmlResourceHintsPlugin {
4121
4178
  apply(compiler) {
4122
4179
  compiler.hooks.compilation.tap(this.name, (compilation)=>{
4123
- getHTMLPlugin().getHooks(compilation).beforeAssetTagGeneration.tap(`HTML${upperFirst(this.type)}Plugin`, (htmlPluginData)=>(this.resourceHints = function(options, type, compilation, htmlPluginData, HTMLCount) {
4124
- 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) {
4125
4183
  let chunks = [
4126
4184
  ...compilation.chunks
4127
4185
  ];
4128
- if (void 0 === includeType || 'async-chunks' === includeType) return chunks.filter(isAsync);
4129
- 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));
4130
4188
  if ('all-chunks' === includeType) return chunks;
4131
4189
  if ('all-assets' === includeType) {
4132
4190
  var _compilation_assetsInfo;
@@ -4143,10 +4201,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4143
4201
  ];
4144
4202
  }
4145
4203
  return chunks;
4146
- }({
4147
- compilation,
4148
- includeType: options.type
4149
- }), sortedFilteredFiles = [
4204
+ }(compilation, options.type), sortedFilteredFiles = applyFilter([
4150
4205
  ...new Set(('all-assets' === options.type || 1 === HTMLCount ? extractedChunks : extractedChunks.filter((chunk)=>(function({ chunk, htmlPluginData }) {
4151
4206
  let { options } = htmlPluginData.plugin;
4152
4207
  return recursiveChunkEntryNames(chunk).some((chunkName)=>{
@@ -4156,15 +4211,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4156
4211
  })({
4157
4212
  chunk: chunk,
4158
4213
  compilation,
4159
- htmlPluginData,
4214
+ htmlPluginData: data,
4160
4215
  pluginOptions: options
4161
4216
  }))).reduce((accumulated, chunk)=>accumulated.concat([
4162
4217
  ...chunk.files,
4163
4218
  ...chunk.auxiliaryFiles || []
4164
4219
  ]), []))
4165
- ].filter((file)=>[
4166
- /.map$/
4167
- ].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;
4168
4221
  for (let file of sortedFilteredFiles){
4169
4222
  let href = ensureAssetPrefix(file, publicPath), attributes = {
4170
4223
  href,
@@ -4188,19 +4241,19 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4188
4241
  });
4189
4242
  }
4190
4243
  return links;
4191
- }(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)=>{
4192
4245
  var resourceHints, scripts;
4193
- return this.resourceHints && (htmlPluginData.assetTags.styles = [
4194
- ...this.options.dedupe ? (resourceHints = this.resourceHints, scripts = htmlPluginData.assetTags.scripts, resourceHints.filter((resourceHint)=>!scripts.find((script)=>script.attributes.src === resourceHint.attributes.href))) : this.resourceHints,
4195
- ...htmlPluginData.assetTags.styles
4196
- ]), 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;
4197
4250
  });
4198
4251
  });
4199
4252
  }
4200
4253
  constructor(options, type, HTMLCount){
4201
- 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 = {
4202
- ...HtmlPreloadOrPrefetchPlugin_defaultOptions,
4203
- ...'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
4204
4257
  }, this.type = type, this.HTMLCount = HTMLCount;
4205
4258
  }
4206
4259
  }
@@ -4210,7 +4263,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4210
4263
  rel,
4211
4264
  ...option
4212
4265
  }
4213
- })), 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 = ()=>({
4214
4273
  name: 'rsbuild:resource-hints',
4215
4274
  setup (api) {
4216
4275
  api.modifyHTMLTags(({ headTags, bodyTags }, { environment })=>{
@@ -4234,16 +4293,29 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4234
4293
  }), api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
4235
4294
  let { config, htmlPaths } = environment;
4236
4295
  if (0 === Object.keys(htmlPaths).length) return;
4237
- let { performance: { preload, prefetch } } = config, HTMLCount = chain.entryPoints.values().length;
4238
- prefetch && chain.plugin(CHAIN_ID.PLUGIN.HTML_PREFETCH).use(HtmlPreloadOrPrefetchPlugin, [
4239
- prefetch,
4240
- 'prefetch',
4241
- HTMLCount
4242
- ]), preload && chain.plugin(CHAIN_ID.PLUGIN.HTML_PRELOAD).use(HtmlPreloadOrPrefetchPlugin, [
4243
- preload,
4244
- 'preload',
4245
- HTMLCount
4246
- ]);
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
+ }
4247
4319
  });
4248
4320
  }
4249
4321
  }), rsdoctor_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), pluginRsdoctor = ()=>({
@@ -7417,11 +7489,11 @@ ${section.body}` : section.body).join("\n\n"));
7417
7489
  }
7418
7490
  process.title = 'rsbuild-node';
7419
7491
  let { npm_execpath } = process.env;
7420
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.8\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`);
7421
7493
  try {
7422
7494
  !function() {
7423
7495
  let cli = cac_dist('rsbuild');
7424
- cli.help(), cli.version("1.3.8"), applyCommonOptions(cli);
7496
+ cli.help(), cli.version("1.3.10"), applyCommonOptions(cli);
7425
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');
7426
7498
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
7427
7499
  try {
@@ -7472,7 +7544,7 @@ ${section.body}` : section.body).join("\n\n"));
7472
7544
  rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
7473
7545
  }
7474
7546
  }
7475
- let src_version = "1.3.8";
7547
+ let src_version = "1.3.10";
7476
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 === [
7477
7549
  "PLUGIN_CSS_NAME",
7478
7550
  "PLUGIN_SWC_NAME",