@rsbuild/core 1.2.0-beta.1 → 1.2.0

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.js CHANGED
@@ -379,6 +379,9 @@ let constants_filename = (0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileU
379
379
  '*'
380
380
  ].some((key)=>values.includes(key));
381
381
  };
382
+ function getAbsolutePath(base, filepath) {
383
+ return (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(filepath) ? filepath : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(base, filepath);
384
+ }
382
385
  isDebug() && (__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.level = 'verbose'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.override({
383
386
  debug: (message, ...args)=>{
384
387
  if ('verbose' !== __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.level) return;
@@ -389,7 +392,13 @@ isDebug() && (__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logg
389
392
  console.log(` ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.magenta('rsbuild')} ${time} ${message}`, ...args);
390
393
  }
391
394
  });
392
- let isFileSync = (filePath)=>{
395
+ let getCompiledPath = (packageName)=>(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(COMPILED_PATH, packageName, 'index.js'), ensureAbsolutePath = (base, filePath)=>(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(filePath) ? filePath : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(base, filePath), pathnameParse = (publicPath)=>{
396
+ try {
397
+ return publicPath ? new URL(publicPath).pathname : publicPath;
398
+ } catch (err) {
399
+ return publicPath;
400
+ }
401
+ }, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.find((p)=>curr.startsWith(p) || curr === p) ? prev : prev.concat(curr), []), toPosixPath = (filepath)=>'/' === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep ? filepath : filepath.replace(/\\/g, '/'), isFileSync = (filePath)=>{
393
402
  try {
394
403
  var _fs_statSync;
395
404
  return null === (_fs_statSync = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.statSync(filePath, {
@@ -426,22 +435,13 @@ async function emptyDir(dir, keep = [], checkExists = !0) {
426
435
  });
427
436
  await Promise.all(entries.map(async (entry)=>{
428
437
  let fullPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.resolve(dir, entry.name);
429
- !keep.some((reg)=>reg.test(fullPath)) && (entry.isDirectory() ? (await emptyDir(fullPath, keep, !1), keep.length || await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.rmdir(fullPath)) : await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.unlink(fullPath));
438
+ !keep.some((reg)=>reg.test(toPosixPath(fullPath))) && (entry.isDirectory() ? (await emptyDir(fullPath, keep, !1), keep.length || await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.rmdir(fullPath)) : await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.unlink(fullPath));
430
439
  }));
431
440
  } catch (err) {
432
441
  __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`Failed to empty dir: ${dir}`), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(err);
433
442
  }
434
443
  }
435
- function getAbsolutePath(base, filepath) {
436
- return (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(filepath) ? filepath : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(base, filepath);
437
- }
438
- let getCompiledPath = (packageName)=>(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(COMPILED_PATH, packageName, 'index.js'), ensureAbsolutePath = (base, filePath)=>(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(filePath) ? filePath : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(base, filePath), pathnameParse = (publicPath)=>{
439
- try {
440
- return publicPath ? new URL(publicPath).pathname : publicPath;
441
- } catch (err) {
442
- return publicPath;
443
- }
444
- }, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.find((p)=>curr.startsWith(p) || curr === p) ? prev : prev.concat(curr), []), hintNodePolyfill = (message)=>{
444
+ let hintNodePolyfill = (message)=>{
445
445
  let getTips = (moduleName)=>{
446
446
  let tips = [
447
447
  `Tip: "${moduleName}" is a built-in Node.js module. It cannot be imported in client-side code.`,
@@ -977,7 +977,7 @@ let config_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.create
977
977
  compress: !0,
978
978
  printUrls: !0,
979
979
  strictPort: !1,
980
- cors: !0
980
+ cors: !1
981
981
  }), getDefaultSourceConfig = ()=>({
982
982
  alias: {},
983
983
  define: {},
@@ -1611,7 +1611,7 @@ async function updateEnvironmentContext(context, configs) {
1611
1611
  async function createContext(options, userConfig, bundlerType) {
1612
1612
  let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(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;
1613
1613
  return {
1614
- version: "1.2.0-beta.1",
1614
+ version: "1.2.0",
1615
1615
  rootPath,
1616
1616
  distPath: '',
1617
1617
  cachePath,
@@ -1740,7 +1740,114 @@ let pluginAppIcon = ()=>({
1740
1740
  htmlTagsMap.clear(), iconFormatMap.clear();
1741
1741
  });
1742
1742
  }
1743
- }), chainStaticAssetRule = ({ emit, rule, maxSize, filename, assetType })=>{
1743
+ });
1744
+ async function modifyBundlerChain(context, utils) {
1745
+ var _utils_environment_config_tools;
1746
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('modify bundler chain');
1747
+ let bundlerChain = new __WEBPACK_EXTERNAL_MODULE__compiled_rspack_chain_index_js_b67fefbd__.default(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.callInEnvironment({
1748
+ environment: utils.environment.name,
1749
+ args: [
1750
+ bundlerChain,
1751
+ utils
1752
+ ]
1753
+ });
1754
+ if (null === (_utils_environment_config_tools = utils.environment.config.tools) || void 0 === _utils_environment_config_tools ? void 0 : _utils_environment_config_tools.bundlerChain) for (let item of castArray(utils.environment.config.tools.bundlerChain))await item(modifiedBundlerChain, utils);
1755
+ return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('modify bundler chain done'), modifiedBundlerChain;
1756
+ }
1757
+ function chainToConfig(chain) {
1758
+ let config = chain.toConfig(), { entry } = config;
1759
+ if (!isPlainObject(entry)) return config;
1760
+ let formattedEntry = {};
1761
+ for (let [entryName, entryValue] of Object.entries(entry)){
1762
+ let entryImport = [], entryDescription = null;
1763
+ for (let item of castArray(entryValue)){
1764
+ if ('string' == typeof item) {
1765
+ entryImport.push(item);
1766
+ continue;
1767
+ }
1768
+ item.import && entryImport.push(...castArray(item.import)), entryDescription ? Object.assign(entryDescription, item) : entryDescription = item;
1769
+ }
1770
+ formattedEntry[entryName] = entryDescription ? {
1771
+ ...entryDescription,
1772
+ import: entryImport
1773
+ } : entryImport;
1774
+ }
1775
+ return config.entry = formattedEntry, config;
1776
+ }
1777
+ let configChain_CHAIN_ID = {
1778
+ RULE: {
1779
+ MJS: 'mjs',
1780
+ FONT: 'font',
1781
+ IMAGE: 'image',
1782
+ MEDIA: 'media',
1783
+ ADDITIONAL_ASSETS: 'additional-assets',
1784
+ JS: 'js',
1785
+ JS_DATA_URI: 'js-data-uri',
1786
+ TS: 'ts',
1787
+ CSS: 'css',
1788
+ LESS: 'less',
1789
+ SASS: 'sass',
1790
+ STYLUS: 'stylus',
1791
+ SVG: 'svg',
1792
+ PUG: 'pug',
1793
+ VUE: 'vue',
1794
+ WASM: 'wasm',
1795
+ SVELTE: 'svelte'
1796
+ },
1797
+ ONE_OF: {
1798
+ SVG: 'svg',
1799
+ SVG_URL: 'svg-asset-url',
1800
+ SVG_ASSET: 'svg-asset',
1801
+ SVG_REACT: 'svg-react',
1802
+ SVG_INLINE: 'svg-asset-inline'
1803
+ },
1804
+ USE: {
1805
+ TS: 'ts',
1806
+ CSS: 'css',
1807
+ SASS: 'sass',
1808
+ LESS: 'less',
1809
+ STYLUS: 'stylus',
1810
+ URL: 'url',
1811
+ PUG: 'pug',
1812
+ VUE: 'vue',
1813
+ SWC: 'swc',
1814
+ SVGR: 'svgr',
1815
+ BABEL: 'babel',
1816
+ STYLE: 'style-loader',
1817
+ SVELTE: 'svelte',
1818
+ POSTCSS: 'postcss',
1819
+ LIGHTNINGCSS: 'lightningcss',
1820
+ IGNORE_CSS: 'ignore-css',
1821
+ CSS_MODULES_TS: "css-modules-typescript",
1822
+ MINI_CSS_EXTRACT: 'mini-css-extract',
1823
+ RESOLVE_URL: 'resolve-url-loader'
1824
+ },
1825
+ PLUGIN: {
1826
+ HMR: 'hmr',
1827
+ COPY: 'copy',
1828
+ HTML: 'html',
1829
+ DEFINE: 'define',
1830
+ PROGRESS: 'progress',
1831
+ MANIFEST: 'webpack-manifest',
1832
+ TS_CHECKER: 'ts-checker',
1833
+ BUNDLE_ANALYZER: 'bundle-analyze',
1834
+ MODULE_FEDERATION: 'module-federation',
1835
+ HTML_PREFETCH: 'html-prefetch-plugin',
1836
+ HTML_PRELOAD: 'html-preload-plugin',
1837
+ MINI_CSS_EXTRACT: 'mini-css-extract',
1838
+ VUE_LOADER_PLUGIN: 'vue-loader-plugin',
1839
+ REACT_FAST_REFRESH: 'react-fast-refresh',
1840
+ SUBRESOURCE_INTEGRITY: 'subresource-integrity',
1841
+ AUTO_SET_ROOT_SIZE: 'auto-set-root-size'
1842
+ },
1843
+ MINIMIZER: {
1844
+ JS: 'js',
1845
+ CSS: 'css'
1846
+ },
1847
+ RESOLVE_PLUGIN: {
1848
+ TS_CONFIG_PATHS: 'ts-config-paths'
1849
+ }
1850
+ }, chainStaticAssetRule = ({ emit, rule, maxSize, filename, assetType })=>{
1744
1851
  let generatorOptions = {
1745
1852
  filename
1746
1853
  };
@@ -1769,12 +1876,12 @@ let pluginAppIcon = ()=>({
1769
1876
  assetType
1770
1877
  });
1771
1878
  }, { emitAssets } = config.output;
1772
- createAssetRule('image', IMAGE_EXTENSIONS, emitAssets), createAssetRule('svg', [
1879
+ createAssetRule(configChain_CHAIN_ID.RULE.IMAGE, IMAGE_EXTENSIONS, emitAssets), createAssetRule(configChain_CHAIN_ID.RULE.SVG, [
1773
1880
  'svg'
1774
- ], emitAssets), createAssetRule('media', [
1881
+ ], emitAssets), createAssetRule(configChain_CHAIN_ID.RULE.MEDIA, [
1775
1882
  ...VIDEO_EXTENSIONS,
1776
1883
  ...AUDIO_EXTENSIONS
1777
- ], emitAssets), createAssetRule('font', FONT_EXTENSIONS, emitAssets);
1884
+ ], emitAssets), createAssetRule(configChain_CHAIN_ID.RULE.FONT, FONT_EXTENSIONS, emitAssets);
1778
1885
  let assetsFilename = getMergedFilename('assets');
1779
1886
  chain.output.assetModuleFilename(assetsFilename), emitAssets || chain.module.generator.merge({
1780
1887
  'asset/resource': {
@@ -1786,10 +1893,10 @@ let pluginAppIcon = ()=>({
1786
1893
  let { dataUriLimit } = config.output;
1787
1894
  chainStaticAssetRule({
1788
1895
  emit: emitAssets,
1789
- rule: chain.module.rule('additional-assets').test(assetsInclude),
1896
+ rule: chain.module.rule(configChain_CHAIN_ID.RULE.ADDITIONAL_ASSETS).test(assetsInclude),
1790
1897
  maxSize: 'number' == typeof dataUriLimit ? dataUriLimit : dataUriLimit.assets,
1791
1898
  filename: assetsFilename,
1792
- assetType: 'additional'
1899
+ assetType: 'additional-assets'
1793
1900
  });
1794
1901
  }
1795
1902
  });
@@ -1813,7 +1920,7 @@ let pluginAppIcon = ()=>({
1813
1920
  javascript: {
1814
1921
  exportsPresence: 'error'
1815
1922
  }
1816
- }), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.resolve(info.absoluteResourcePath).replace(/\\/g, '/')), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys', process.env.WATCHPACK_WATCHER_LIMIT ||= '20', process.env.EXPERIMENTAL_RSPACK_INCREMENTAL && chain.experiments({
1923
+ }), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.resolve(info.absoluteResourcePath))), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys', process.env.WATCHPACK_WATCHER_LIMIT ||= '20', process.env.EXPERIMENTAL_RSPACK_INCREMENTAL && chain.experiments({
1817
1924
  ...chain.get('experiments'),
1818
1925
  incremental: isDev
1819
1926
  });
@@ -1965,7 +2072,15 @@ let pluginHelper_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.
1965
2072
  plugin && (pluginHelper_htmlPlugin = plugin);
1966
2073
  }, getHTMLPlugin = ()=>(pluginHelper_htmlPlugin || (pluginHelper_htmlPlugin = pluginHelper_require('../compiled/html-rspack-plugin/index.js')), pluginHelper_htmlPlugin), setCssExtractPlugin = (plugin)=>{
1967
2074
  cssExtractPlugin = plugin;
1968
- }, getCssExtractPlugin = ()=>cssExtractPlugin || __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.default.CssExtractRspackPlugin, getCSSModulesLocalIdentName = (config, isProd)=>config.output.cssModules.localIdentName || (isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'), normalizeCssLoaderOptions = (options, exportOnlyLocals)=>{
2075
+ }, getCssExtractPlugin = ()=>cssExtractPlugin || __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.default.CssExtractRspackPlugin, getCSSModulesLocalIdentName = (config, isProd)=>config.output.cssModules.localIdentName || (isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'), getLightningCSSLoaderOptions = (config, targets)=>{
2076
+ let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
2077
+ targets
2078
+ };
2079
+ return 'production' === config.mode && config.output.injectStyles && (initialOptions.minify = !0), reduceConfigs({
2080
+ initial: initialOptions,
2081
+ config: userOptions
2082
+ });
2083
+ }, normalizeCssLoaderOptions = (options, exportOnlyLocals)=>{
1969
2084
  if (options.modules && exportOnlyLocals) {
1970
2085
  let { modules } = options;
1971
2086
  return modules = !0 === modules ? {
@@ -2077,15 +2192,8 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
2077
2192
  var _postcssLoaderOptions_postcssOptions_plugins, _postcssLoaderOptions_postcssOptions;
2078
2193
  if ('rspack' === api.context.bundlerType && !1 !== config.tools.lightningcssLoader) {
2079
2194
  importLoaders++;
2080
- let userOptions = !0 === config.tools.lightningcssLoader ? {} : config.tools.lightningcssLoader, initialOptions = {
2081
- targets: environment.browserslist
2082
- };
2083
- 'production' === config.mode && config.output.injectStyles && (initialOptions.minify = !0);
2084
- let loaderOptions = reduceConfigs({
2085
- initial: initialOptions,
2086
- config: userOptions
2087
- });
2088
- rule.use(CHAIN_ID.USE.LIGHTNINGCSS).loader('builtin:lightningcss-loader').options(loaderOptions);
2195
+ let lightningcssOptions = getLightningCSSLoaderOptions(config, environment.browserslist);
2196
+ rule.use(CHAIN_ID.USE.LIGHTNINGCSS).loader('builtin:lightningcss-loader').options(lightningcssOptions);
2089
2197
  }
2090
2198
  let postcssLoaderOptions = await getPostcssLoaderOptions({
2091
2199
  config,
@@ -2797,9 +2905,18 @@ let generateManifest = (htmlPaths, manifestOptions)=>(_seed, files)=>{
2797
2905
  if (chain.optimization.minimize(minifyJs || minifyCss), minifyJs && isRspack && chain.optimization.minimizer(CHAIN_ID.MINIMIZER.JS).use(__WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack.SwcJsMinimizerRspackPlugin, [
2798
2906
  getSwcMinimizerOptions(config, jsOptions)
2799
2907
  ]).end(), minifyCss && isRspack) {
2800
- let defaultOptions = {
2908
+ let loaderOptions = getLightningCSSLoaderOptions(config, environment.browserslist), defaultOptions = {
2801
2909
  minimizerOptions: {
2802
- targets: environment.browserslist
2910
+ targets: isPlainObject(loaderOptions.targets) ? environment.browserslist : loaderOptions.targets,
2911
+ ...pick(loaderOptions, [
2912
+ 'draft',
2913
+ 'include',
2914
+ 'exclude',
2915
+ 'nonStandard',
2916
+ 'pseudoClasses',
2917
+ 'unusedSymbols',
2918
+ 'errorRecovery'
2919
+ ])
2803
2920
  }
2804
2921
  }, mergedOptions = cssOptions ? cjs_default()(defaultOptions, cssOptions) : defaultOptions;
2805
2922
  chain.optimization.minimizer(CHAIN_ID.MINIMIZER.CSS).use(__WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack.LightningCssMinimizerRspackPlugin, [
@@ -3948,112 +4065,6 @@ async function inspectConfig({ context, pluginManager, rsbuildOptions, bundlerCo
3948
4065
  }
3949
4066
  };
3950
4067
  }
3951
- async function modifyBundlerChain(context, utils) {
3952
- var _utils_environment_config_tools;
3953
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('modify bundler chain');
3954
- let bundlerChain = new __WEBPACK_EXTERNAL_MODULE__compiled_rspack_chain_index_js_b67fefbd__.default(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.callInEnvironment({
3955
- environment: utils.environment.name,
3956
- args: [
3957
- bundlerChain,
3958
- utils
3959
- ]
3960
- });
3961
- if (null === (_utils_environment_config_tools = utils.environment.config.tools) || void 0 === _utils_environment_config_tools ? void 0 : _utils_environment_config_tools.bundlerChain) for (let item of castArray(utils.environment.config.tools.bundlerChain))await item(modifiedBundlerChain, utils);
3962
- return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('modify bundler chain done'), modifiedBundlerChain;
3963
- }
3964
- function chainToConfig(chain) {
3965
- let config = chain.toConfig(), { entry } = config;
3966
- if (!isPlainObject(entry)) return config;
3967
- let formattedEntry = {};
3968
- for (let [entryName, entryValue] of Object.entries(entry)){
3969
- let entryImport = [], entryDescription = null;
3970
- for (let item of castArray(entryValue)){
3971
- if ('string' == typeof item) {
3972
- entryImport.push(item);
3973
- continue;
3974
- }
3975
- item.import && entryImport.push(...castArray(item.import)), entryDescription ? Object.assign(entryDescription, item) : entryDescription = item;
3976
- }
3977
- formattedEntry[entryName] = entryDescription ? {
3978
- ...entryDescription,
3979
- import: entryImport
3980
- } : entryImport;
3981
- }
3982
- return config.entry = formattedEntry, config;
3983
- }
3984
- let configChain_CHAIN_ID = {
3985
- RULE: {
3986
- MJS: 'mjs',
3987
- FONT: 'font',
3988
- IMAGE: 'image',
3989
- MEDIA: 'media',
3990
- JS: 'js',
3991
- JS_DATA_URI: 'js-data-uri',
3992
- TS: 'ts',
3993
- CSS: 'css',
3994
- LESS: 'less',
3995
- SASS: 'sass',
3996
- STYLUS: 'stylus',
3997
- SVG: 'svg',
3998
- PUG: 'pug',
3999
- VUE: 'vue',
4000
- WASM: 'wasm',
4001
- SVELTE: 'svelte'
4002
- },
4003
- ONE_OF: {
4004
- SVG: 'svg',
4005
- SVG_URL: 'svg-asset-url',
4006
- SVG_ASSET: 'svg-asset',
4007
- SVG_REACT: 'svg-react',
4008
- SVG_INLINE: 'svg-asset-inline'
4009
- },
4010
- USE: {
4011
- TS: 'ts',
4012
- CSS: 'css',
4013
- SASS: 'sass',
4014
- LESS: 'less',
4015
- STYLUS: 'stylus',
4016
- URL: 'url',
4017
- PUG: 'pug',
4018
- VUE: 'vue',
4019
- SWC: 'swc',
4020
- SVGR: 'svgr',
4021
- BABEL: 'babel',
4022
- STYLE: 'style-loader',
4023
- SVELTE: 'svelte',
4024
- POSTCSS: 'postcss',
4025
- LIGHTNINGCSS: 'lightningcss',
4026
- IGNORE_CSS: 'ignore-css',
4027
- CSS_MODULES_TS: "css-modules-typescript",
4028
- MINI_CSS_EXTRACT: 'mini-css-extract',
4029
- RESOLVE_URL: 'resolve-url-loader'
4030
- },
4031
- PLUGIN: {
4032
- HMR: 'hmr',
4033
- COPY: 'copy',
4034
- HTML: 'html',
4035
- DEFINE: 'define',
4036
- PROGRESS: 'progress',
4037
- MANIFEST: 'webpack-manifest',
4038
- TS_CHECKER: 'ts-checker',
4039
- BUNDLE_ANALYZER: 'bundle-analyze',
4040
- MODULE_FEDERATION: 'module-federation',
4041
- HTML_PREFETCH: 'html-prefetch-plugin',
4042
- HTML_PRELOAD: 'html-preload-plugin',
4043
- MINI_CSS_EXTRACT: 'mini-css-extract',
4044
- VUE_LOADER_PLUGIN: 'vue-loader-plugin',
4045
- REACT_FAST_REFRESH: 'react-fast-refresh',
4046
- SUBRESOURCE_INTEGRITY: 'subresource-integrity',
4047
- AUTO_SET_ROOT_SIZE: 'auto-set-root-size'
4048
- },
4049
- MINIMIZER: {
4050
- JS: 'js',
4051
- CSS: 'css'
4052
- },
4053
- RESOLVE_PLUGIN: {
4054
- TS_CONFIG_PATHS: 'ts-config-paths'
4055
- }
4056
- };
4057
4068
  async function modifyRspackConfig(context, rspackConfig, utils) {
4058
4069
  var _utils_environment_config_tools;
4059
4070
  __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('modify Rspack config');
@@ -6463,12 +6474,12 @@ async function runCLI() {
6463
6474
  }
6464
6475
  }(), process.title = 'rsbuild-node';
6465
6476
  let { npm_execpath } = process.env;
6466
- (!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.2.0-beta.1\n`);
6477
+ (!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.2.0\n`);
6467
6478
  }();
6468
6479
  try {
6469
6480
  !function() {
6470
6481
  let cli = cac_dist('rsbuild');
6471
- cli.help(), cli.version("1.2.0-beta.1"), applyCommonOptions(cli);
6482
+ cli.help(), cli.version("1.2.0"), applyCommonOptions(cli);
6472
6483
  let devCommand = cli.command('dev', 'starting the dev server'), 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');
6473
6484
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
6474
6485
  try {
@@ -6519,6 +6530,6 @@ async function runCLI() {
6519
6530
  __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);
6520
6531
  }
6521
6532
  }
6522
- let src_version = "1.2.0-beta.1";
6533
+ let src_version = "1.2.0";
6523
6534
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
6524
6535
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
@@ -14,6 +14,8 @@ export declare const CHAIN_ID: {
14
14
  readonly IMAGE: "image";
15
15
  /** Rule for media */
16
16
  readonly MEDIA: "media";
17
+ /** Rule for additional assets */
18
+ readonly ADDITIONAL_ASSETS: "additional-assets";
17
19
  /** Rule for js */
18
20
  readonly JS: "js";
19
21
  /** Rule for data uri encoded javascript */
@@ -11,3 +11,9 @@ export declare const ensureAbsolutePath: (base: string, filePath: string) => str
11
11
  export declare const pathnameParse: (publicPath: string) => string;
12
12
  /** dedupe and remove nested paths */
13
13
  export declare const dedupeNestedPaths: (paths: string[]) => string[];
14
+ /**
15
+ * Convert Windows backslash paths to posix forward slashes
16
+ * @example
17
+ * toPosixPath('foo\\bar') // returns 'foo/bar'
18
+ */
19
+ export declare const toPosixPath: (filepath: string) => string;
@@ -1,3 +1,4 @@
1
- import type { CSSLoaderOptions, RsbuildPlugin } from '../types';
1
+ import type { CSSLoaderOptions, NormalizedEnvironmentConfig, RsbuildPlugin, Rspack } from '../types';
2
+ export declare const getLightningCSSLoaderOptions: (config: NormalizedEnvironmentConfig, targets: string[]) => Rspack.LightningcssLoaderOptions;
2
3
  export declare const normalizeCssLoaderOptions: (options: CSSLoaderOptions, exportOnlyLocals: boolean) => CSSLoaderOptions;
3
4
  export declare const pluginCss: () => RsbuildPlugin;
@@ -285,7 +285,7 @@ export interface ServerConfig {
285
285
  * - true: enable CORS with default options.
286
286
  * - false: disable CORS.
287
287
  * - object: enable CORS with the specified options.
288
- * @default true
288
+ * @default false
289
289
  * @link https://github.com/expressjs/cors
290
290
  */
291
291
  cors?: boolean | cors.CorsOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.2.0-beta.1",
3
+ "version": "1.2.0",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -46,15 +46,15 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.2.0-beta.0",
49
+ "@rspack/core": "1.2.0",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.15",
52
52
  "core-js": "~3.40.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@rslib/core": "0.3.1",
55
+ "@rslib/core": "0.3.2",
56
56
  "@types/connect": "3.4.38",
57
- "@types/node": "^22.10.5",
57
+ "@types/node": "^22.10.7",
58
58
  "@types/on-finished": "2.3.4",
59
59
  "@types/webpack-bundle-analyzer": "4.7.0",
60
60
  "@types/ws": "^8.5.13",
@@ -79,7 +79,7 @@
79
79
  "postcss": "^8.5.1",
80
80
  "postcss-load-config": "6.0.1",
81
81
  "postcss-loader": "8.1.1",
82
- "prebundle": "1.2.5",
82
+ "prebundle": "1.2.7",
83
83
  "reduce-configs": "^1.1.0",
84
84
  "rsbuild-dev-middleware": "0.1.2",
85
85
  "rslog": "^1.2.3",