@rsbuild/core 1.4.0-beta.0 → 1.4.0-beta.2

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,19 +1,19 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 9155: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 1148: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(2077);
5
+ const loader = __nccwpck_require__(7266);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(8568).defaultGetLocalIdent;
8
+ __nccwpck_require__(9347).defaultGetLocalIdent;
9
9
  },
10
- 2077: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 7266: (__unused_webpack_module, exports, __nccwpck_require__) => {
11
11
  "use strict";
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports["default"] = loader;
14
14
  var _postcss = _interopRequireDefault(__nccwpck_require__(9409));
15
- var _plugins = __nccwpck_require__(5458);
16
- var _utils = __nccwpck_require__(8568);
15
+ var _plugins = __nccwpck_require__(4785);
16
+ var _utils = __nccwpck_require__(9347);
17
17
  function _interopRequireDefault(obj) {
18
18
  return obj && obj.__esModule ? obj : { default: obj };
19
19
  }
@@ -236,7 +236,7 @@
236
236
  callback(null, `${importCode}${moduleCode}${exportCode}`);
237
237
  }
238
238
  },
239
- 5458: (__unused_webpack_module, exports, __nccwpck_require__) => {
239
+ 4785: (__unused_webpack_module, exports, __nccwpck_require__) => {
240
240
  "use strict";
241
241
  Object.defineProperty(exports, "__esModule", { value: true });
242
242
  Object.defineProperty(exports, "icssParser", {
@@ -258,22 +258,22 @@
258
258
  },
259
259
  });
260
260
  var _postcssImportParser = _interopRequireDefault(
261
- __nccwpck_require__(5697),
261
+ __nccwpck_require__(6714),
262
262
  );
263
263
  var _postcssIcssParser = _interopRequireDefault(
264
- __nccwpck_require__(6504),
264
+ __nccwpck_require__(8003),
265
265
  );
266
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(6399));
266
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(646));
267
267
  function _interopRequireDefault(obj) {
268
268
  return obj && obj.__esModule ? obj : { default: obj };
269
269
  }
270
270
  },
271
- 6504: (__unused_webpack_module, exports, __nccwpck_require__) => {
271
+ 8003: (__unused_webpack_module, exports, __nccwpck_require__) => {
272
272
  "use strict";
273
273
  Object.defineProperty(exports, "__esModule", { value: true });
274
274
  exports["default"] = void 0;
275
275
  var _icssUtils = __nccwpck_require__(8930);
276
- var _utils = __nccwpck_require__(8568);
276
+ var _utils = __nccwpck_require__(9347);
277
277
  const plugin = (options = {}) => ({
278
278
  postcssPlugin: "postcss-icss-parser",
279
279
  async OnceExit(root) {
@@ -372,14 +372,14 @@
372
372
  plugin.postcss = true;
373
373
  var _default = (exports["default"] = plugin);
374
374
  },
375
- 5697: (__unused_webpack_module, exports, __nccwpck_require__) => {
375
+ 6714: (__unused_webpack_module, exports, __nccwpck_require__) => {
376
376
  "use strict";
377
377
  Object.defineProperty(exports, "__esModule", { value: true });
378
378
  exports["default"] = void 0;
379
379
  var _postcssValueParser = _interopRequireDefault(
380
380
  __nccwpck_require__(2948),
381
381
  );
382
- var _utils = __nccwpck_require__(8568);
382
+ var _utils = __nccwpck_require__(9347);
383
383
  function _interopRequireDefault(obj) {
384
384
  return obj && obj.__esModule ? obj : { default: obj };
385
385
  }
@@ -684,14 +684,14 @@
684
684
  plugin.postcss = true;
685
685
  var _default = (exports["default"] = plugin);
686
686
  },
687
- 6399: (__unused_webpack_module, exports, __nccwpck_require__) => {
687
+ 646: (__unused_webpack_module, exports, __nccwpck_require__) => {
688
688
  "use strict";
689
689
  Object.defineProperty(exports, "__esModule", { value: true });
690
690
  exports["default"] = void 0;
691
691
  var _postcssValueParser = _interopRequireDefault(
692
692
  __nccwpck_require__(2948),
693
693
  );
694
- var _utils = __nccwpck_require__(8568);
694
+ var _utils = __nccwpck_require__(9347);
695
695
  function _interopRequireDefault(obj) {
696
696
  return obj && obj.__esModule ? obj : { default: obj };
697
697
  }
@@ -1034,7 +1034,7 @@
1034
1034
  plugin.postcss = true;
1035
1035
  var _default = (exports["default"] = plugin);
1036
1036
  },
1037
- 8568: (__unused_webpack_module, exports, __nccwpck_require__) => {
1037
+ 9347: (__unused_webpack_module, exports, __nccwpck_require__) => {
1038
1038
  "use strict";
1039
1039
  Object.defineProperty(exports, "__esModule", { value: true });
1040
1040
  exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
@@ -3740,7 +3740,7 @@
3740
3740
  var _attribute = _interopRequireWildcard(__nccwpck_require__(7966));
3741
3741
  var _universal = _interopRequireDefault(__nccwpck_require__(815));
3742
3742
  var _combinator = _interopRequireDefault(__nccwpck_require__(3998));
3743
- var _nesting = _interopRequireDefault(__nccwpck_require__(6187));
3743
+ var _nesting = _interopRequireDefault(__nccwpck_require__(8568));
3744
3744
  var _sortAscending = _interopRequireDefault(__nccwpck_require__(6713));
3745
3745
  var _tokenize = _interopRequireWildcard(__nccwpck_require__(8966));
3746
3746
  var tokens = _interopRequireWildcard(__nccwpck_require__(1885));
@@ -5710,7 +5710,7 @@
5710
5710
  var _combinator = _interopRequireDefault(__nccwpck_require__(3998));
5711
5711
  var _comment = _interopRequireDefault(__nccwpck_require__(8983));
5712
5712
  var _id = _interopRequireDefault(__nccwpck_require__(8453));
5713
- var _nesting = _interopRequireDefault(__nccwpck_require__(6187));
5713
+ var _nesting = _interopRequireDefault(__nccwpck_require__(8568));
5714
5714
  var _pseudo = _interopRequireDefault(__nccwpck_require__(7250));
5715
5715
  var _root = _interopRequireDefault(__nccwpck_require__(9608));
5716
5716
  var _selector = _interopRequireDefault(__nccwpck_require__(5297));
@@ -6468,7 +6468,7 @@
6468
6468
  exports["default"] = Namespace;
6469
6469
  module.exports = exports.default;
6470
6470
  },
6471
- 6187: (module, exports, __nccwpck_require__) => {
6471
+ 8568: (module, exports, __nccwpck_require__) => {
6472
6472
  "use strict";
6473
6473
  exports.__esModule = true;
6474
6474
  exports["default"] = void 0;
@@ -8098,6 +8098,6 @@
8098
8098
  }
8099
8099
  if (typeof __nccwpck_require__ !== "undefined")
8100
8100
  __nccwpck_require__.ab = __dirname + "/";
8101
- var __webpack_exports__ = __nccwpck_require__(9155);
8101
+ var __webpack_exports__ = __nccwpck_require__(1148);
8102
8102
  module.exports = __webpack_exports__;
8103
8103
  })();
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 727: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 817: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(452);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(218);
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
- 452: (module) => {
314
+ 218: (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
- 596: (module) => {
483
+ 986: (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
- 755: (module) => {
502
+ 573: (module) => {
503
503
  "use strict";
504
504
  module.exports = function (err) {
505
505
  return {
@@ -520,7 +520,7 @@
520
520
  };
521
521
  };
522
522
  },
523
- 346: (module, __unused_webpack_exports, __nccwpck_require__) => {
523
+ 756: (module, __unused_webpack_exports, __nccwpck_require__) => {
524
524
  "use strict";
525
525
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
526
526
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -546,7 +546,7 @@
546
546
  }
547
547
  module.exports = { getHtmlRspackPluginHooks };
548
548
  },
549
- 439: (module) => {
549
+ 289: (module) => {
550
550
  const voidTags = [
551
551
  "area",
552
552
  "base",
@@ -614,19 +614,19 @@
614
614
  htmlTagObjectToString,
615
615
  };
616
616
  },
617
- 502: (module, __unused_webpack_exports, __nccwpck_require__) => {
617
+ 300: (module, __unused_webpack_exports, __nccwpck_require__) => {
618
618
  "use strict";
619
619
  const promisify = __nccwpck_require__(23).promisify;
620
620
  const vm = __nccwpck_require__(154);
621
621
  const fs = __nccwpck_require__(896);
622
622
  const path = __nccwpck_require__(928);
623
- const { CachedChildCompilation } = __nccwpck_require__(727);
623
+ const { CachedChildCompilation } = __nccwpck_require__(817);
624
624
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
625
- __nccwpck_require__(439);
626
- const prettyError = __nccwpck_require__(755);
627
- const chunkSorter = __nccwpck_require__(596);
625
+ __nccwpck_require__(289);
626
+ const prettyError = __nccwpck_require__(573);
627
+ const chunkSorter = __nccwpck_require__(986);
628
628
  const getHtmlRspackPluginHooks =
629
- __nccwpck_require__(346).getHtmlRspackPluginHooks;
629
+ __nccwpck_require__(756).getHtmlRspackPluginHooks;
630
630
  const WITH_PLACEHOLDER = "function __with_placeholder__";
631
631
  class HtmlRspackPlugin {
632
632
  constructor(userOptions = {}) {
@@ -1597,6 +1597,6 @@
1597
1597
  }
1598
1598
  if (typeof __nccwpck_require__ !== "undefined")
1599
1599
  __nccwpck_require__.ab = __dirname + "/";
1600
- var __webpack_exports__ = __nccwpck_require__(502);
1600
+ var __webpack_exports__ = __nccwpck_require__(300);
1601
1601
  module.exports = __webpack_exports__;
1602
1602
  })();
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 139: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(501)["default"];
4
+ 712: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(174)["default"];
6
6
  },
7
- 501: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 174: (__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 _path = _interopRequireDefault(__nccwpck_require__(928));
12
- var _utils = __nccwpck_require__(184);
12
+ var _utils = __nccwpck_require__(647);
13
13
  function _interopRequireDefault(obj) {
14
14
  return obj && obj.__esModule ? obj : { default: obj };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 184: (module, exports, __nccwpck_require__) => {
182
+ 647: (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__(139);
719
+ var __webpack_exports__ = __nccwpck_require__(712);
720
720
  module.exports = __webpack_exports__;
721
721
  })();
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 751: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 833: (__unused_webpack_module, exports, __nccwpck_require__) => {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.transformFiles =
7
7
  exports.reduceChunk =
@@ -120,7 +120,7 @@
120
120
  .map(standardizeFilePaths);
121
121
  exports.transformFiles = transformFiles;
122
122
  },
123
- 338: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 900: (__unused_webpack_module, exports, __nccwpck_require__) => {
124
124
  Object.defineProperty(exports, "__esModule", { value: true });
125
125
  exports.normalModuleLoaderHook =
126
126
  exports.getCompilerHooks =
@@ -130,7 +130,7 @@
130
130
  const fs_1 = __nccwpck_require__(896);
131
131
  const path_1 = __nccwpck_require__(928);
132
132
  const lite_tapable_1 = __nccwpck_require__(408);
133
- const helpers_1 = __nccwpck_require__(751);
133
+ const helpers_1 = __nccwpck_require__(833);
134
134
  const compilerHookMap = new WeakMap();
135
135
  const getCompilerHooks = (compiler) => {
136
136
  let hooks = compilerHookMap.get(compiler);
@@ -312,7 +312,7 @@
312
312
  exports.getCompilerHooks =
313
313
  void 0;
314
314
  const path_1 = __nccwpck_require__(928);
315
- const hooks_1 = __nccwpck_require__(338);
315
+ const hooks_1 = __nccwpck_require__(900);
316
316
  Object.defineProperty(exports, "getCompilerHooks", {
317
317
  enumerable: true,
318
318
  get: function () {
package/dist/index.cjs CHANGED
@@ -2153,7 +2153,7 @@ for(var __webpack_i__ in (()=>{
2153
2153
  async function createContext(options, userConfig) {
2154
2154
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(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, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
2155
2155
  return {
2156
- version: "1.4.0-beta.0",
2156
+ version: "1.4.0-beta.2",
2157
2157
  rootPath,
2158
2158
  distPath: '',
2159
2159
  cachePath,
@@ -2313,6 +2313,7 @@ for(var __webpack_i__ in (()=>{
2313
2313
  MEDIA: 'media',
2314
2314
  ADDITIONAL_ASSETS: 'additional-assets',
2315
2315
  JS: 'js',
2316
+ JS_RAW: 'js-raw',
2316
2317
  JS_DATA_URI: 'js-data-uri',
2317
2318
  TS: 'ts',
2318
2319
  CSS: 'css',
@@ -3953,21 +3954,22 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3953
3954
  let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync : isServer ? jsPath : jsPath ? `${jsPath}/async` : 'async', pluginOutput = ()=>({
3954
3955
  name: 'rsbuild:output',
3955
3956
  setup (api) {
3956
- api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd, isServer, environment })=>{
3957
- let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
3957
+ api.modifyBundlerChain(async (chain, { CHAIN_ID, isDev, isProd, isServer, environment })=>{
3958
+ let { distPath, config } = environment, publicPath = function({ isDev, config, context }) {
3958
3959
  var _context_devServer, _context_devServer1, _context_devServer2;
3959
3960
  let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX;
3960
- if (isProd) 'string' == typeof output.assetPrefix && (publicPath = output.assetPrefix);
3961
- else if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
3962
- else if (!0 === dev.assetPrefix) {
3963
- let protocol = (null == (_context_devServer1 = context.devServer) ? void 0 : _context_devServer1.https) ? 'https' : 'http', hostname = (null == (_context_devServer2 = context.devServer) ? void 0 : _context_devServer2.hostname) || DEFAULT_DEV_HOST;
3964
- publicPath = hostname === DEFAULT_DEV_HOST ? `${protocol}://localhost:<port>/` : `${protocol}://${hostname}:<port>/`, server.base && '/' !== server.base && (publicPath = urlJoin(publicPath, server.base));
3965
- }
3961
+ if (isDev) {
3962
+ if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
3963
+ else if (!0 === dev.assetPrefix) {
3964
+ let protocol = (null == (_context_devServer1 = context.devServer) ? void 0 : _context_devServer1.https) ? 'https' : 'http', hostname = (null == (_context_devServer2 = context.devServer) ? void 0 : _context_devServer2.hostname) || DEFAULT_DEV_HOST;
3965
+ publicPath = hostname === DEFAULT_DEV_HOST ? `${protocol}://localhost:<port>/` : `${protocol}://${hostname}:<port>/`, server.base && '/' !== server.base && (publicPath = urlJoin(publicPath, server.base));
3966
+ }
3967
+ } else 'string' == typeof output.assetPrefix && (publicPath = output.assetPrefix);
3966
3968
  let defaultPort = server.port ?? 3000;
3967
- return formatPublicPath(replacePortPlaceholder(publicPath, isProd ? defaultPort : (null == (_context_devServer = context.devServer) ? void 0 : _context_devServer.port) ?? defaultPort));
3969
+ return formatPublicPath(replacePortPlaceholder(publicPath, isDev ? (null == (_context_devServer = context.devServer) ? void 0 : _context_devServer.port) ?? defaultPort : defaultPort));
3968
3970
  }({
3969
3971
  config,
3970
- isProd,
3972
+ isDev,
3971
3973
  context: api.context
3972
3974
  }), jsPath = config.output.distPath.js, jsAsyncPath = getJsAsyncPath(jsPath, isServer, config.output.distPath.jsAsync), jsFilename = getFilename(config, 'js', isProd, isServer), isJsFilenameFn = 'function' == typeof jsFilename;
3973
3975
  if (chain.output.path(distPath).filename(isJsFilenameFn ? (...args)=>{
@@ -4553,7 +4555,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4553
4555
  var browserslist, target1;
4554
4556
  let { config, browserslist: browserslist1 } = environment, cacheRoot = external_node_path_default().join(api.context.cachePath, '.swc'), rule = chain.module.rule(CHAIN_ID.RULE.JS).test(SCRIPT_REGEX).type("javascript/auto").dependency({
4555
4557
  not: 'url'
4556
- }), dataUriRule = chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
4558
+ }).resourceQuery({
4559
+ not: /raw|inline/
4560
+ });
4561
+ chain.module.rule(CHAIN_ID.RULE.JS_RAW).test(SCRIPT_REGEX).type('asset/source').resourceQuery(/raw/);
4562
+ let dataUriRule = chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
4557
4563
  or: [
4558
4564
  "text/javascript",
4559
4565
  "application/javascript"
@@ -7604,11 +7610,11 @@ ${section.body}` : section.body).join("\n\n"));
7604
7610
  }
7605
7611
  process.title = 'rsbuild-node';
7606
7612
  let { npm_execpath } = process.env;
7607
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0-beta.0\n`);
7613
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0-beta.2\n`);
7608
7614
  try {
7609
7615
  !function() {
7610
7616
  let cli = cac_dist('rsbuild');
7611
- cli.help(), cli.version("1.4.0-beta.0"), applyCommonOptions(cli);
7617
+ cli.help(), cli.version("1.4.0-beta.2"), applyCommonOptions(cli);
7612
7618
  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');
7613
7619
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
7614
7620
  try {
@@ -7659,7 +7665,7 @@ ${section.body}` : section.body).join("\n\n"));
7659
7665
  rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
7660
7666
  }
7661
7667
  }
7662
- let src_version = "1.4.0-beta.0";
7668
+ let src_version = "1.4.0-beta.2";
7663
7669
  })(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defaultAllowedOrigins = __webpack_exports__.defaultAllowedOrigins, 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 === [
7664
7670
  "PLUGIN_CSS_NAME",
7665
7671
  "PLUGIN_SWC_NAME",
package/dist/index.js CHANGED
@@ -1969,7 +1969,7 @@ async function updateEnvironmentContext(context, configs) {
1969
1969
  async function createContext(options, userConfig) {
1970
1970
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
1971
1971
  return {
1972
- version: "1.4.0-beta.0",
1972
+ version: "1.4.0-beta.2",
1973
1973
  rootPath,
1974
1974
  distPath: '',
1975
1975
  cachePath,
@@ -2128,6 +2128,7 @@ let configChain_CHAIN_ID = {
2128
2128
  MEDIA: 'media',
2129
2129
  ADDITIONAL_ASSETS: 'additional-assets',
2130
2130
  JS: 'js',
2131
+ JS_RAW: 'js-raw',
2131
2132
  JS_DATA_URI: 'js-data-uri',
2132
2133
  TS: 'ts',
2133
2134
  CSS: 'css',
@@ -3764,21 +3765,22 @@ async function open_open({ https, port, routes, config, clearCache }) {
3764
3765
  let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync : isServer ? jsPath : jsPath ? `${jsPath}/async` : 'async', pluginOutput = ()=>({
3765
3766
  name: 'rsbuild:output',
3766
3767
  setup (api) {
3767
- api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd, isServer, environment })=>{
3768
- let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
3768
+ api.modifyBundlerChain(async (chain, { CHAIN_ID, isDev, isProd, isServer, environment })=>{
3769
+ let { distPath, config } = environment, publicPath = function({ isDev, config, context }) {
3769
3770
  var _context_devServer, _context_devServer1, _context_devServer2;
3770
3771
  let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX;
3771
- if (isProd) 'string' == typeof output.assetPrefix && (publicPath = output.assetPrefix);
3772
- else if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
3773
- else if (!0 === dev.assetPrefix) {
3774
- let protocol = (null == (_context_devServer1 = context.devServer) ? void 0 : _context_devServer1.https) ? 'https' : 'http', hostname = (null == (_context_devServer2 = context.devServer) ? void 0 : _context_devServer2.hostname) || DEFAULT_DEV_HOST;
3775
- publicPath = hostname === DEFAULT_DEV_HOST ? `${protocol}://localhost:<port>/` : `${protocol}://${hostname}:<port>/`, server.base && '/' !== server.base && (publicPath = urlJoin(publicPath, server.base));
3776
- }
3772
+ if (isDev) {
3773
+ if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
3774
+ else if (!0 === dev.assetPrefix) {
3775
+ let protocol = (null == (_context_devServer1 = context.devServer) ? void 0 : _context_devServer1.https) ? 'https' : 'http', hostname = (null == (_context_devServer2 = context.devServer) ? void 0 : _context_devServer2.hostname) || DEFAULT_DEV_HOST;
3776
+ publicPath = hostname === DEFAULT_DEV_HOST ? `${protocol}://localhost:<port>/` : `${protocol}://${hostname}:<port>/`, server.base && '/' !== server.base && (publicPath = urlJoin(publicPath, server.base));
3777
+ }
3778
+ } else 'string' == typeof output.assetPrefix && (publicPath = output.assetPrefix);
3777
3779
  let defaultPort = server.port ?? 3000;
3778
- return formatPublicPath(replacePortPlaceholder(publicPath, isProd ? defaultPort : (null == (_context_devServer = context.devServer) ? void 0 : _context_devServer.port) ?? defaultPort));
3780
+ return formatPublicPath(replacePortPlaceholder(publicPath, isDev ? (null == (_context_devServer = context.devServer) ? void 0 : _context_devServer.port) ?? defaultPort : defaultPort));
3779
3781
  }({
3780
3782
  config,
3781
- isProd,
3783
+ isDev,
3782
3784
  context: api.context
3783
3785
  }), jsPath = config.output.distPath.js, jsAsyncPath = getJsAsyncPath(jsPath, isServer, config.output.distPath.jsAsync), jsFilename = getFilename(config, 'js', isProd, isServer), isJsFilenameFn = 'function' == typeof jsFilename;
3784
3786
  if (chain.output.path(distPath).filename(isJsFilenameFn ? (...args)=>{
@@ -4361,7 +4363,11 @@ let pluginRspackProfile = ()=>({
4361
4363
  handler: async (chain, { CHAIN_ID, isDev, target, environment })=>{
4362
4364
  let { config, browserslist } = environment, cacheRoot = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(api.context.cachePath, '.swc'), rule = chain.module.rule(CHAIN_ID.RULE.JS).test(SCRIPT_REGEX).type("javascript/auto").dependency({
4363
4365
  not: 'url'
4364
- }), dataUriRule = chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
4366
+ }).resourceQuery({
4367
+ not: /raw|inline/
4368
+ });
4369
+ chain.module.rule(CHAIN_ID.RULE.JS_RAW).test(SCRIPT_REGEX).type('asset/source').resourceQuery(/raw/);
4370
+ let dataUriRule = chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
4365
4371
  or: [
4366
4372
  "text/javascript",
4367
4373
  "application/javascript"
@@ -7405,11 +7411,11 @@ async function runCLI() {
7405
7411
  }
7406
7412
  process.title = 'rsbuild-node';
7407
7413
  let { npm_execpath } = process.env;
7408
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.4.0-beta.0\n`);
7414
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.4.0-beta.2\n`);
7409
7415
  try {
7410
7416
  !function() {
7411
7417
  let cli = cac_dist('rsbuild');
7412
- cli.help(), cli.version("1.4.0-beta.0"), applyCommonOptions(cli);
7418
+ cli.help(), cli.version("1.4.0-beta.2"), applyCommonOptions(cli);
7413
7419
  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');
7414
7420
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
7415
7421
  try {
@@ -7460,6 +7466,6 @@ async function runCLI() {
7460
7466
  __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
7461
7467
  }
7462
7468
  }
7463
- let src_version = "1.4.0-beta.0";
7469
+ let src_version = "1.4.0-beta.2";
7464
7470
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
7465
7471
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
@@ -16,6 +16,8 @@ export declare const CHAIN_ID: {
16
16
  readonly ADDITIONAL_ASSETS: "additional-assets";
17
17
  /** Rule for js */
18
18
  readonly JS: "js";
19
+ /** Rule for raw js */
20
+ readonly JS_RAW: "js-raw";
19
21
  /** Rule for data uri encoded javascript */
20
22
  readonly JS_DATA_URI: "js-data-uri";
21
23
  /** Rule for ts */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.4.0-beta.0",
3
+ "version": "1.4.0-beta.2",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -46,7 +46,7 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.3.13",
49
+ "@rspack/core": "1.3.15",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.17",
52
52
  "core-js": "~3.42.0",
@@ -56,7 +56,7 @@
56
56
  "@rslib/core": "0.9.1",
57
57
  "@types/connect": "3.4.38",
58
58
  "@types/cors": "^2.8.18",
59
- "@types/node": "^22.15.29",
59
+ "@types/node": "^22.15.30",
60
60
  "@types/on-finished": "2.3.4",
61
61
  "@types/webpack-bundle-analyzer": "4.7.0",
62
62
  "@types/ws": "^8.18.1",