@rsbuild/core 2.0.0-alpha.1 → 2.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 992: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 595: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(381);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(232);
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
- 381: (module) => {
314
+ 232: (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
- 3: (module) => {
483
+ 528: (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
- 438: (module) => {
502
+ 655: (module) => {
503
503
  "use strict";
504
504
  module.exports = function (err) {
505
505
  return {
@@ -513,14 +513,17 @@
513
513
  },
514
514
  toString: function () {
515
515
  if (err.message) {
516
- return `[html-rspack-plugin]: ` + err.message;
516
+ return (
517
+ `[html-rspack-plugin]: ` +
518
+ (err.stack || `${err.name}: ${err.message}`)
519
+ );
517
520
  }
518
521
  return err;
519
522
  },
520
523
  };
521
524
  };
522
525
  },
523
- 573: (module, __unused_webpack_exports, __nccwpck_require__) => {
526
+ 334: (module, __unused_webpack_exports, __nccwpck_require__) => {
524
527
  "use strict";
525
528
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
526
529
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -546,7 +549,7 @@
546
549
  }
547
550
  module.exports = { getHtmlRspackPluginHooks };
548
551
  },
549
- 956: (module) => {
552
+ 915: (module) => {
550
553
  const voidTags = [
551
554
  "area",
552
555
  "base",
@@ -614,19 +617,19 @@
614
617
  htmlTagObjectToString,
615
618
  };
616
619
  },
617
- 249: (module, __unused_webpack_exports, __nccwpck_require__) => {
620
+ 802: (module, __unused_webpack_exports, __nccwpck_require__) => {
618
621
  "use strict";
619
622
  const promisify = __nccwpck_require__(23).promisify;
620
623
  const vm = __nccwpck_require__(154);
621
624
  const fs = __nccwpck_require__(896);
622
625
  const path = __nccwpck_require__(928);
623
- const { CachedChildCompilation } = __nccwpck_require__(992);
626
+ const { CachedChildCompilation } = __nccwpck_require__(595);
624
627
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
625
- __nccwpck_require__(956);
626
- const prettyError = __nccwpck_require__(438);
627
- const chunkSorter = __nccwpck_require__(3);
628
+ __nccwpck_require__(915);
629
+ const prettyError = __nccwpck_require__(655);
630
+ const chunkSorter = __nccwpck_require__(528);
628
631
  const getHtmlRspackPluginHooks =
629
- __nccwpck_require__(573).getHtmlRspackPluginHooks;
632
+ __nccwpck_require__(334).getHtmlRspackPluginHooks;
630
633
  const WITH_PLACEHOLDER = "function __with_placeholder__";
631
634
  class HtmlRspackPlugin {
632
635
  constructor(userOptions = {}) {
@@ -1597,6 +1600,6 @@
1597
1600
  }
1598
1601
  if (typeof __nccwpck_require__ !== "undefined")
1599
1602
  __nccwpck_require__.ab = __dirname + "/";
1600
- var __webpack_exports__ = __nccwpck_require__(249);
1603
+ var __webpack_exports__ = __nccwpck_require__(802);
1601
1604
  module.exports = __webpack_exports__;
1602
1605
  })();
@@ -1 +1 @@
1
- {"name":"html-rspack-plugin","author":"Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)","version":"6.1.4","funding":{"type":"opencollective","url":"https://opencollective.com/html-webpack-plugin"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"html-rspack-plugin","author":"Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)","version":"6.1.6","funding":{"type":"opencollective","url":"https://opencollective.com/html-webpack-plugin"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 396: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(586)["default"];
4
+ 254: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(684)["default"];
6
6
  },
7
- 586: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 684: (__unused_webpack_module, exports, __nccwpck_require__) => {
8
8
  var __webpack_unused_export__;
9
9
  __webpack_unused_export__ = { value: true };
10
10
  exports["default"] = loader;
11
11
  var _nodePath = _interopRequireDefault(__nccwpck_require__(760));
12
- var _utils = __nccwpck_require__(179);
12
+ var _utils = __nccwpck_require__(277);
13
13
  function _interopRequireDefault(e) {
14
14
  return e && e.__esModule ? e : { default: e };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 179: (module, exports, __nccwpck_require__) => {
182
+ 277: (module, exports, __nccwpck_require__) => {
183
183
  module = __nccwpck_require__.nmd(module);
184
184
  Object.defineProperty(exports, "__esModule", { value: true });
185
185
  exports.exec = exec;
@@ -715,6 +715,6 @@
715
715
  })();
716
716
  if (typeof __nccwpck_require__ !== "undefined")
717
717
  __nccwpck_require__.ab = __dirname + "/";
718
- var __webpack_exports__ = __nccwpck_require__(396);
718
+ var __webpack_exports__ = __nccwpck_require__(254);
719
719
  module.exports = __webpack_exports__;
720
720
  })();
@@ -1 +1 @@
1
- {"name":"rslog","version":"1.3.2","license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"rslog","version":"1.3.2","license":"MIT","types":"index.d.ts","type":"module"}
@@ -1 +1 @@
1
- {"name":"rspack-chain","version":"2.0.0-alpha.0","license":"MIT","types":"types/index.d.ts","type":"module"}
1
+ {"name":"rspack-chain","version":"2.0.0-alpha.0","license":"MIT","types":"types/index.d.ts","type":"module"}
package/dist/131.js CHANGED
@@ -15,7 +15,7 @@ import * as __rspack_external_path from "path";
15
15
  import * as __rspack_external_url from "url";
16
16
  import { __webpack_require__ } from "./rslib-runtime.js";
17
17
  import node_process from "node:process";
18
- import node_os, { constants as external_node_os_constants } from "node:os";
18
+ import node_os, { constants as external_node_os_constants, type as external_node_os_type } from "node:os";
19
19
  import node_tty from "node:tty";
20
20
  import { promisify as external_node_util_promisify, stripVTControlCharacters } from "node:util";
21
21
  import { isPromise, isRegExp } from "node:util/types";
@@ -3446,7 +3446,7 @@ function createPublicContext(context) {
3446
3446
  async function createContext(options, userConfig) {
3447
3447
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
3448
3448
  return {
3449
- version: "2.0.0-alpha.1",
3449
+ version: "2.0.0-alpha.3",
3450
3450
  rootPath,
3451
3451
  distPath: '',
3452
3452
  cachePath,
@@ -3614,27 +3614,31 @@ let configChain_CHAIN_ID = {
3614
3614
  MEDIA: 'media',
3615
3615
  ADDITIONAL_ASSETS: 'additional-assets',
3616
3616
  JS: 'js',
3617
- JS_RAW: 'js-raw',
3618
3617
  JS_DATA_URI: 'js-data-uri',
3619
- TS: 'ts',
3620
3618
  CSS: 'css',
3621
- CSS_RAW: 'css-raw',
3622
- CSS_INLINE: 'css-inline',
3623
3619
  LESS: 'less',
3624
- LESS_RAW: 'less-raw',
3625
- LESS_INLINE: 'less-inline',
3626
3620
  SASS: 'sass',
3627
- SASS_RAW: 'sass-raw',
3628
- SASS_INLINE: 'sass-inline',
3629
3621
  STYLUS: 'stylus',
3630
- STYLUS_RAW: 'stylus-raw',
3631
- STYLUS_INLINE: 'stylus-inline',
3632
3622
  SVG: 'svg',
3633
3623
  VUE: 'vue',
3634
3624
  WASM: 'wasm',
3635
3625
  SVELTE: 'svelte'
3636
3626
  },
3637
3627
  ONE_OF: {
3628
+ JS_MAIN: 'js-main',
3629
+ JS_RAW: 'js-raw',
3630
+ CSS_MAIN: 'css-main',
3631
+ CSS_RAW: 'css-raw',
3632
+ CSS_INLINE: 'css-inline',
3633
+ LESS_MAIN: 'less-main',
3634
+ LESS_RAW: 'less-raw',
3635
+ LESS_INLINE: 'less-inline',
3636
+ SASS_MAIN: 'sass-main',
3637
+ SASS_RAW: 'sass-raw',
3638
+ SASS_INLINE: 'sass-inline',
3639
+ STYLUS_MAIN: 'stylus-main',
3640
+ STYLUS_RAW: 'stylus-raw',
3641
+ STYLUS_INLINE: 'stylus-inline',
3638
3642
  SVG: 'svg',
3639
3643
  SVG_RAW: 'svg-asset-raw',
3640
3644
  SVG_URL: 'svg-asset-url',
@@ -3823,7 +3827,8 @@ async function initRsbuildConfig({ context, pluginManager }) {
3823
3827
  let defaultConfig = {
3824
3828
  name: (0, external_node_path_.join)(rootPath, 'public'),
3825
3829
  copyOnBuild: 'auto',
3826
- watch: !1
3830
+ watch: !1,
3831
+ ignore: []
3827
3832
  };
3828
3833
  if (void 0 === publicDir) return [
3829
3834
  defaultConfig
@@ -5935,7 +5940,7 @@ function createMiddleware(context, ready, outputFileSystem) {
5935
5940
  }
5936
5941
  async function setupOutputFileSystem(writeToDisk, compilers) {
5937
5942
  if (!0 !== writeToDisk) {
5938
- let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.51.1/node_modules/memfs/lib/index.js", 23)), outputFileSystem = createFsFromVolume(new Volume());
5943
+ let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.56.10_tslib@2.8.1/node_modules/memfs/lib/index.js", 23)), outputFileSystem = createFsFromVolume(new Volume());
5939
5944
  for (let compiler of compilers)compiler.outputFileSystem = outputFileSystem;
5940
5945
  }
5941
5946
  let compiler = compilers.find((compiler)=>!!compiler.outputFileSystem);
@@ -6736,7 +6741,7 @@ function createProxyMiddleware(proxyOptions) {
6736
6741
  let applyDefaultMiddlewares = async ({ config, buildManager, context, devServerAPI, middlewares, postCallbacks })=>{
6737
6742
  let upgradeEvents = [], { server } = config;
6738
6743
  if (server.cors) {
6739
- let { default: corsMiddleware } = await import("./cors.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/cors@2.8.5/node_modules/cors/lib/index.js", 23));
6744
+ let { default: corsMiddleware } = await import("./cors.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/cors@2.8.6/node_modules/cors/lib/index.js", 23));
6740
6745
  middlewares.push(corsMiddleware('boolean' == typeof server.cors ? {} : server.cors));
6741
6746
  }
6742
6747
  let { headers } = server;
@@ -7214,7 +7219,9 @@ function prepareWatchOptions(paths, options = {}, type) {
7214
7219
  }
7215
7220
  let GLOB_REGEX = /[*?{}[\]()!+|]/;
7216
7221
  async function createChokidar(pathOrGlobs, root, options) {
7217
- let chokidar = requireCompiledPackage('chokidar'), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!GLOB_REGEX.test(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
7222
+ let { default: chokidar } = await import("./chokidar.js").then((mod)=>({
7223
+ default: mod.chokidar
7224
+ })), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!GLOB_REGEX.test(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
7218
7225
  if (globPatterns.length) {
7219
7226
  let { glob } = await import("./tinyglobby.js").then((mod)=>({
7220
7227
  glob: mod.glob
@@ -7417,7 +7424,7 @@ class RsbuildProdServer {
7417
7424
  async applyDefaultMiddlewares() {
7418
7425
  let { headers, proxy, historyApiFallback, compress, base, cors } = this.options.serverConfig;
7419
7426
  if (isVerbose() && this.middlewares.use(getRequestLoggerMiddleware()), cors) {
7420
- let { default: corsMiddleware } = await import("./cors.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/cors@2.8.5/node_modules/cors/lib/index.js", 23));
7427
+ let { default: corsMiddleware } = await import("./cors.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/cors@2.8.6/node_modules/cors/lib/index.js", 23));
7421
7428
  this.middlewares.use(corsMiddleware('boolean' == typeof cors ? {} : cors));
7422
7429
  }
7423
7430
  if (headers && this.middlewares.use((_req, res, next)=>{
@@ -8106,29 +8113,26 @@ try {
8106
8113
  api.modifyBundlerChain({
8107
8114
  order: 'pre',
8108
8115
  handler: async (chain, { target, isProd, CHAIN_ID, environment, environments })=>{
8109
- let rule = chain.module.rule(CHAIN_ID.RULE.CSS), inlineRule = chain.module.rule(CHAIN_ID.RULE.CSS_INLINE), { config } = environment;
8110
- rule.test(CSS_REGEX).type("javascript/auto").dependency({
8116
+ let cssRule = chain.module.rule(CHAIN_ID.RULE.CSS), { config } = environment;
8117
+ cssRule.test(CSS_REGEX).dependency({
8111
8118
  not: 'url'
8112
- }).resourceQuery({
8113
- not: [
8114
- RAW_QUERY_REGEX,
8115
- INLINE_QUERY_REGEX
8116
- ]
8117
- }), inlineRule.test(CSS_REGEX).type("javascript/auto").resourceQuery(INLINE_QUERY_REGEX), chain.module.rule(CHAIN_ID.RULE.CSS_RAW).test(CSS_REGEX).type('asset/source').resourceQuery(RAW_QUERY_REGEX);
8118
- let emitCss = config.output.emitCss ?? 'web' === target;
8119
+ });
8120
+ let inlineRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_INLINE).type("javascript/auto").resourceQuery(INLINE_QUERY_REGEX);
8121
+ cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_RAW).type('asset/source').resourceQuery(RAW_QUERY_REGEX);
8122
+ let mainRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_MAIN).type("javascript/auto"), emitCss = config.output.emitCss ?? 'web' === target;
8119
8123
  if (emitCss) if (config.output.injectStyles) {
8120
8124
  let styleLoaderOptions = reduceConfigs({
8121
8125
  initial: {},
8122
8126
  config: config.tools.styleLoader
8123
8127
  });
8124
- rule.use(CHAIN_ID.USE.STYLE).loader(getCompiledPath('style-loader')).options(styleLoaderOptions);
8125
- } else rule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader((cssExtractPlugin || rspack_rspack.CssExtractRspackPlugin).loader).options(config.tools.cssExtract.loaderOptions);
8126
- else rule.use(CHAIN_ID.USE.IGNORE_CSS).loader(external_node_path_.default.join(dirname, 'ignoreCssLoader.mjs'));
8128
+ mainRule.use(CHAIN_ID.USE.STYLE).loader(getCompiledPath('style-loader')).options(styleLoaderOptions);
8129
+ } else mainRule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader((cssExtractPlugin || rspack_rspack.CssExtractRspackPlugin).loader).options(config.tools.cssExtract.loaderOptions);
8130
+ else mainRule.use(CHAIN_ID.USE.IGNORE_CSS).loader(external_node_path_.default.join(dirname, 'ignoreCssLoader.mjs'));
8127
8131
  let importLoaders = {
8128
8132
  normal: 0,
8129
8133
  inline: 0
8130
8134
  }, updateRules = (callback, options = {})=>{
8131
- options.skipNormal || callback(rule, 'normal'), callback(inlineRule, 'inline');
8135
+ options.skipMain || callback(mainRule, 'main'), callback(inlineRule, 'inline');
8132
8136
  }, cssLoaderPath = getCompiledPath('css-loader');
8133
8137
  if (updateRules((rule)=>{
8134
8138
  rule.use(CHAIN_ID.USE.CSS).loader(cssLoaderPath);
@@ -8143,7 +8147,7 @@ try {
8143
8147
  let minify = ('inline' === type || config.output.injectStyles) && minifyCss, lightningcssOptions = getLightningCSSLoaderOptions(config, browserslist, minify);
8144
8148
  rule.use(CHAIN_ID.USE.LIGHTNINGCSS).loader('builtin:lightningcss-loader').options(lightningcssOptions);
8145
8149
  }, {
8146
- skipNormal: !emitCss
8150
+ skipMain: !emitCss
8147
8151
  });
8148
8152
  }
8149
8153
  let postcssLoaderOptions = await getPostcssLoaderOptions({
@@ -8157,7 +8161,7 @@ try {
8157
8161
  updateRules((rule)=>{
8158
8162
  rule.use(CHAIN_ID.USE.POSTCSS).loader(postcssLoaderPath).options(postcssLoaderOptions);
8159
8163
  }, {
8160
- skipNormal: !emitCss
8164
+ skipMain: !emitCss
8161
8165
  });
8162
8166
  }
8163
8167
  let localIdentName = config.output.cssModules.localIdentName || (isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'), cssLoaderOptions = (({ config, localIdentName, emitCss })=>{
@@ -8208,7 +8212,7 @@ try {
8208
8212
  }, rule.use(CHAIN_ID.USE.CSS).options(finalOptions), rule.sideEffects(!0), rule.resolve.preferRelative(!0);
8209
8213
  });
8210
8214
  let isStringExport = 'string' === cssLoaderOptions.exportType;
8211
- if (isStringExport && rule.uses.has(CHAIN_ID.USE.MINI_CSS_EXTRACT) && rule.uses.delete(CHAIN_ID.USE.MINI_CSS_EXTRACT), emitCss && !config.output.injectStyles && !isStringExport) {
8215
+ if (isStringExport && mainRule.uses.has(CHAIN_ID.USE.MINI_CSS_EXTRACT) && mainRule.uses.delete(CHAIN_ID.USE.MINI_CSS_EXTRACT), emitCss && !config.output.injectStyles && !isStringExport) {
8212
8216
  let extractPluginOptions = config.tools.cssExtract.pluginOptions, cssPath = config.output.distPath.css, cssFilename = getFilename(config, 'css', isProd), isCssFilenameFn = 'function' == typeof cssFilename, cssAsyncPath = config.output.distPath.cssAsync ?? (cssPath ? `${cssPath}/async` : 'async');
8213
8217
  chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(cssExtractPlugin || rspack_rspack.CssExtractRspackPlugin, [
8214
8218
  {
@@ -8279,13 +8283,11 @@ try {
8279
8283
  api.modifyBundlerChain({
8280
8284
  order: 'pre',
8281
8285
  handler: (chain, { CHAIN_ID, isDev, isProd, target, environment })=>{
8282
- let { config, browserslist } = 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({
8286
+ let { config, browserslist } = environment, cacheRoot = external_node_path_.default.join(api.context.cachePath, '.swc'), rule = chain.module.rule(CHAIN_ID.RULE.JS).test(SCRIPT_REGEX).dependency({
8283
8287
  not: 'url'
8284
- }).resourceQuery({
8285
- not: RAW_QUERY_REGEX
8286
8288
  });
8287
- chain.module.rule(CHAIN_ID.RULE.JS_RAW).test(SCRIPT_REGEX).type('asset/source').resourceQuery(RAW_QUERY_REGEX);
8288
- let dataUriRule = chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
8289
+ rule.oneOf(CHAIN_ID.ONE_OF.JS_RAW).resourceQuery(RAW_QUERY_REGEX).type('asset/source');
8290
+ let mainRule = rule.oneOf(CHAIN_ID.ONE_OF.JS_MAIN).type("javascript/auto"), dataUriRule = chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
8289
8291
  or: [
8290
8292
  "text/javascript",
8291
8293
  "application/javascript"
@@ -8309,7 +8311,7 @@ try {
8309
8311
  swcConfig.env.mode = polyfill;
8310
8312
  let coreJsDir = applyCoreJs(swcConfig, polyfill, api.context.rootPath);
8311
8313
  if (coreJsDir) for (let item of [
8312
- rule,
8314
+ mainRule,
8313
8315
  dataUriRule
8314
8316
  ])item.resolve.alias.set('core-js', coreJsDir);
8315
8317
  }
@@ -8319,7 +8321,7 @@ try {
8319
8321
  config: config.tools.swc,
8320
8322
  mergeFn: cjs_default()
8321
8323
  });
8322
- mergedConfig.jsc?.target !== void 0 && mergedConfig.env?.targets !== void 0 && 1 === Object.keys(mergedConfig.env).length && delete mergedConfig.env, rule.use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options(mergedConfig), dataUriRule.resolve.set('fullySpecified', !1).end().use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options(cloneDeep(mergedConfig));
8324
+ mergedConfig.jsc?.target !== void 0 && mergedConfig.env?.targets !== void 0 && 1 === Object.keys(mergedConfig.env).length && delete mergedConfig.env, mainRule.use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options(mergedConfig), dataUriRule.resolve.set('fullySpecified', !1).end().use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options(cloneDeep(mergedConfig));
8323
8325
  }
8324
8326
  });
8325
8327
  }
@@ -8555,9 +8557,26 @@ try {
8555
8557
  });
8556
8558
  };
8557
8559
  api.onAfterStartDevServer(onStartServer), api.onAfterStartProdServer(onStartServer), api.onBeforeBuild(async ({ isFirstCompile, environments })=>{
8558
- if (isFirstCompile) for (let { name: publicDir, copyOnBuild } of api.getNormalizedConfig().server.publicDir){
8560
+ if (isFirstCompile) for (let { name: publicDir, copyOnBuild, ignore } of api.getNormalizedConfig().server.publicDir){
8561
+ let shouldCopy;
8559
8562
  if (!1 === copyOnBuild || !external_node_fs_.default.existsSync(publicDir)) continue;
8560
8563
  let distPaths = dedupeNestedPaths(Object.values(environments).filter(({ config })=>!0 === copyOnBuild || 'auto' === copyOnBuild && 'node' !== config.output.target).map(({ distPath })=>distPath));
8564
+ if (ignore?.length) {
8565
+ let { globSync } = await import("./tinyglobby.js").then((mod)=>({
8566
+ globSync: mod.globSync
8567
+ })), ignoredSet = new Set(globSync(ignore, {
8568
+ cwd: publicDir,
8569
+ absolute: !1,
8570
+ dot: !0,
8571
+ onlyFiles: !1
8572
+ }).map((item)=>item.replace(/\\/g, '/').replace(/\/$/, '')));
8573
+ shouldCopy = (source)=>{
8574
+ let relativePath = external_node_path_.default.relative(publicDir, source);
8575
+ if (!relativePath) return !0;
8576
+ let normalizedPath = relativePath.replace(/\\/g, '/');
8577
+ return !ignoredSet.has(normalizedPath);
8578
+ };
8579
+ }
8561
8580
  try {
8562
8581
  await Promise.all(distPaths.map(async (distPath)=>{
8563
8582
  isDeno && external_node_fs_.default.existsSync(distPath) && await external_node_fs_.default.promises.rm(distPath, {
@@ -8566,7 +8585,8 @@ try {
8566
8585
  }), await external_node_fs_.default.promises.cp(publicDir, distPath, {
8567
8586
  recursive: !0,
8568
8587
  dereference: !0,
8569
- mode: external_node_fs_.default.constants.COPYFILE_FICLONE
8588
+ mode: external_node_fs_.default.constants.COPYFILE_FICLONE,
8589
+ filter: shouldCopy
8570
8590
  });
8571
8591
  }));
8572
8592
  } catch (err) {
@@ -8583,7 +8603,7 @@ try {
8583
8603
  api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
8584
8604
  let { output: { manifest }, dev: { writeToDisk } } = environment.config;
8585
8605
  if (!1 === manifest) return;
8586
- let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-canary.20260120_@module-federation+runt_861eb0fd4793784f895b612a1bbe4031/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
8606
+ let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-alpha.0_@module-federation+runtime-tools@0.23.0_@swc+helpers@0.5.18_/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
8587
8607
  manifestFilenames.set(environment.name, manifestOptions.filename);
8588
8608
  let pluginOptions = {
8589
8609
  fileName: manifestOptions.filename,
@@ -8918,7 +8938,7 @@ async function createRsbuild(options = {}) {
8918
8938
  function defineConfig(config) {
8919
8939
  return config;
8920
8940
  }
8921
- async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta, loader = 'jiti' } = {}) {
8941
+ async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta, loader = 'auto' } = {}) {
8922
8942
  let configExport, configFilePath = ((root, customConfig)=>{
8923
8943
  if (customConfig) {
8924
8944
  let customConfigPath = (0, external_node_path_.isAbsolute)(customConfig) ? customConfig : (0, external_node_path_.join)(root, customConfig);
@@ -9092,7 +9112,7 @@ let applyServerOptions = (command)=>{
9092
9112
  };
9093
9113
  function setupCommands() {
9094
9114
  let cli = ((name = "")=>new CAC(name))('rsbuild');
9095
- cli.version("2.0.0-alpha.1"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
9115
+ cli.version("2.0.0-alpha.3"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
9096
9116
  default: 'auto'
9097
9117
  }).option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
9098
9118
  type: [
@@ -9161,7 +9181,7 @@ function initNodeEnv() {
9161
9181
  }
9162
9182
  function showGreeting() {
9163
9183
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
9164
- src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.0-alpha.1\n`);
9184
+ src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.0-alpha.3\n`);
9165
9185
  }
9166
9186
  function setupLogLevel() {
9167
9187
  let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
@@ -9179,8 +9199,8 @@ function runCLI() {
9179
9199
  try {
9180
9200
  setupCommands();
9181
9201
  } catch (err) {
9182
- src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err);
9202
+ src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
9183
9203
  }
9184
9204
  }
9185
- let src_version = "2.0.0-alpha.1";
9186
- export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, external_node_util_promisify, loadConfig_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, node_os, node_process, rspack_rspack as rspack, runCLI, src_logger as logger, src_version as version };
9205
+ let src_version = "2.0.0-alpha.3";
9206
+ export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, external_node_os_type, external_node_util_promisify, loadConfig_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, node_os, node_process, rspack_rspack as rspack, runCLI, src_logger as logger, src_version as version };
package/dist/397.js ADDED
@@ -0,0 +1,11 @@
1
+ import * as __rspack_external_node_events_0a6aefe7 from "node:events";
2
+ import * as __rspack_external_node_stream_444d1c2b from "node:stream";
3
+ import { __webpack_require__ } from "./rslib-runtime.js";
4
+ __webpack_require__.add({
5
+ "node:events" (module) {
6
+ module.exports = __rspack_external_node_events_0a6aefe7;
7
+ },
8
+ "node:stream" (module) {
9
+ module.exports = __rspack_external_node_stream_444d1c2b;
10
+ }
11
+ });
package/dist/7.js ADDED
@@ -0,0 +1 @@
1
+ export { constants, default as promises, lstat, open as promises_open, readdir, realpath, stat } from "node:fs/promises";