@rsbuild/core 2.0.0-alpha.0 → 2.0.0-alpha.1
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/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +8 -59
- package/dist/131.js +90 -144
- package/dist/manifest-plugin.js +8 -13
- package/dist-types/configChain.d.ts +2 -9
- package/dist-types/index.d.ts +1 -1
- package/dist-types/types/config.d.ts +11 -19
- package/dist-types/types/rspack.d.ts +1 -7
- package/package.json +6 -6
- package/dist-types/plugins/moment.d.ts +0 -2
package/dist/131.js
CHANGED
|
@@ -1695,69 +1695,6 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1695
1695
|
constructor(...args){
|
|
1696
1696
|
super(...args), this.store = new Set();
|
|
1697
1697
|
}
|
|
1698
|
-
}), Orderable = (Class)=>class extends Class {
|
|
1699
|
-
before(name) {
|
|
1700
|
-
if (this.__after) throw Error(`Unable to set .before(${JSON.stringify(name)}) with existing value for .after()`);
|
|
1701
|
-
return this.__before = name, this;
|
|
1702
|
-
}
|
|
1703
|
-
after(name) {
|
|
1704
|
-
if (this.__before) throw Error(`Unable to set .after(${JSON.stringify(name)}) with existing value for .before()`);
|
|
1705
|
-
return this.__after = name, this;
|
|
1706
|
-
}
|
|
1707
|
-
merge(obj, omit = []) {
|
|
1708
|
-
return obj.before && this.before(obj.before), obj.after && this.after(obj.after), super.merge(obj, [
|
|
1709
|
-
...omit,
|
|
1710
|
-
'before',
|
|
1711
|
-
'after'
|
|
1712
|
-
]);
|
|
1713
|
-
}
|
|
1714
|
-
}, src_Plugin = Orderable(class extends ChainedMap {
|
|
1715
|
-
use(plugin, args = []) {
|
|
1716
|
-
return this.set('plugin', plugin).set('args', args);
|
|
1717
|
-
}
|
|
1718
|
-
tap(f) {
|
|
1719
|
-
if (!this.has('plugin')) throw Error(`Cannot call .tap() on a plugin that has not yet been defined. Call ${this.type}('${this.name}').use(<Plugin>) first.`);
|
|
1720
|
-
return this.set('args', f(this.get('args') || [])), this;
|
|
1721
|
-
}
|
|
1722
|
-
set(key, value) {
|
|
1723
|
-
if ('args' === key && !Array.isArray(value)) throw Error('args must be an array of arguments');
|
|
1724
|
-
return super.set(key, value);
|
|
1725
|
-
}
|
|
1726
|
-
merge(obj, omit = []) {
|
|
1727
|
-
return 'plugin' in obj && this.set('plugin', obj.plugin), 'args' in obj && this.set('args', obj.args), super.merge(obj, [
|
|
1728
|
-
...omit,
|
|
1729
|
-
'args',
|
|
1730
|
-
'plugin'
|
|
1731
|
-
]);
|
|
1732
|
-
}
|
|
1733
|
-
toConfig() {
|
|
1734
|
-
let init = this.get('init'), plugin = this.get('plugin'), args = this.get('args'), pluginPath = null;
|
|
1735
|
-
if (void 0 === plugin) throw Error(`Invalid ${this.type} configuration: ${this.type}('${this.name}').use(<Plugin>) was not called to specify the plugin`);
|
|
1736
|
-
'string' == typeof plugin && (plugin = require(pluginPath = plugin));
|
|
1737
|
-
let constructorName = plugin.__expression ? `(${plugin.__expression})` : plugin.name, config = init(plugin, args);
|
|
1738
|
-
return Object.defineProperties(config, {
|
|
1739
|
-
__pluginName: {
|
|
1740
|
-
value: this.name
|
|
1741
|
-
},
|
|
1742
|
-
__pluginType: {
|
|
1743
|
-
value: this.type
|
|
1744
|
-
},
|
|
1745
|
-
__pluginArgs: {
|
|
1746
|
-
value: args
|
|
1747
|
-
},
|
|
1748
|
-
__pluginConstructorName: {
|
|
1749
|
-
value: constructorName
|
|
1750
|
-
},
|
|
1751
|
-
__pluginPath: {
|
|
1752
|
-
value: pluginPath
|
|
1753
|
-
}
|
|
1754
|
-
}), config;
|
|
1755
|
-
}
|
|
1756
|
-
constructor(parent, name, type = 'plugin'){
|
|
1757
|
-
super(parent), this.name = name, this.type = type, this.extend([
|
|
1758
|
-
'init'
|
|
1759
|
-
]), this.init((Plugin, args = [])=>'function' == typeof Plugin ? new Plugin(...args) : Plugin);
|
|
1760
|
-
}
|
|
1761
1698
|
}), childMaps = [
|
|
1762
1699
|
'alias',
|
|
1763
1700
|
'fallback',
|
|
@@ -1777,16 +1714,11 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1777
1714
|
'modules'
|
|
1778
1715
|
];
|
|
1779
1716
|
class Resolve_class extends ChainedMap {
|
|
1780
|
-
plugin(name) {
|
|
1781
|
-
return this.plugins.getOrCompute(name, ()=>new src_Plugin(this, name, 'resolve.plugin'));
|
|
1782
|
-
}
|
|
1783
1717
|
get(key) {
|
|
1784
1718
|
return childMaps.includes(key) ? this[key].entries() : childSets.includes(key) ? this[key].values() : super.get(key);
|
|
1785
1719
|
}
|
|
1786
1720
|
toConfig() {
|
|
1787
|
-
let config = Object.assign(this.entries() || {}
|
|
1788
|
-
plugins: this.plugins.values().map((plugin)=>plugin.toConfig())
|
|
1789
|
-
});
|
|
1721
|
+
let config = Object.assign(this.entries() || {});
|
|
1790
1722
|
return childMaps.forEach((key)=>{
|
|
1791
1723
|
config[key] = this[key].entries();
|
|
1792
1724
|
}), childSets.forEach((key)=>{
|
|
@@ -1794,7 +1726,6 @@ class Resolve_class extends ChainedMap {
|
|
|
1794
1726
|
}), this.clean(config);
|
|
1795
1727
|
}
|
|
1796
1728
|
merge(obj, omit = []) {
|
|
1797
|
-
!omit.includes('plugin') && 'plugin' in obj && Object.keys(obj.plugin).forEach((name)=>this.plugin(name).merge(obj.plugin[name]));
|
|
1798
1729
|
let omissions = [
|
|
1799
1730
|
...childMaps,
|
|
1800
1731
|
...childSets
|
|
@@ -1803,8 +1734,7 @@ class Resolve_class extends ChainedMap {
|
|
|
1803
1734
|
!omit.includes(key) && key in obj && this[key].merge(obj[key]);
|
|
1804
1735
|
}), super.merge(obj, [
|
|
1805
1736
|
...omit,
|
|
1806
|
-
...omissions
|
|
1807
|
-
'plugin'
|
|
1737
|
+
...omissions
|
|
1808
1738
|
]);
|
|
1809
1739
|
}
|
|
1810
1740
|
constructor(parent){
|
|
@@ -1812,12 +1742,9 @@ class Resolve_class extends ChainedMap {
|
|
|
1812
1742
|
this[key] = new ChainedMap(this);
|
|
1813
1743
|
}), childSets.forEach((key)=>{
|
|
1814
1744
|
this[key] = new ChainedSet(this);
|
|
1815
|
-
}), this.
|
|
1816
|
-
'cachePredicate',
|
|
1817
|
-
'cacheWithContext',
|
|
1745
|
+
}), this.extend([
|
|
1818
1746
|
'enforceExtension',
|
|
1819
1747
|
'symlinks',
|
|
1820
|
-
'unsafeCache',
|
|
1821
1748
|
'preferRelative',
|
|
1822
1749
|
'preferAbsolute',
|
|
1823
1750
|
'tsConfig'
|
|
@@ -1853,8 +1780,8 @@ class ResolveLoader_class extends Resolve_class {
|
|
|
1853
1780
|
class Output_class extends ChainedMap {
|
|
1854
1781
|
constructor(parent){
|
|
1855
1782
|
super(parent), this.extend([
|
|
1856
|
-
'
|
|
1857
|
-
'
|
|
1783
|
+
'assetModuleFilename',
|
|
1784
|
+
'bundlerInfo',
|
|
1858
1785
|
'chunkFilename',
|
|
1859
1786
|
'chunkLoadTimeout',
|
|
1860
1787
|
'chunkLoadingGlobal',
|
|
@@ -1866,7 +1793,6 @@ class Output_class extends ChainedMap {
|
|
|
1866
1793
|
'devtoolModuleFilenameTemplate',
|
|
1867
1794
|
'devtoolNamespace',
|
|
1868
1795
|
'filename',
|
|
1869
|
-
'assetModuleFilename',
|
|
1870
1796
|
'globalObject',
|
|
1871
1797
|
'uniqueName',
|
|
1872
1798
|
'hashDigest',
|
|
@@ -1877,18 +1803,14 @@ class Output_class extends ChainedMap {
|
|
|
1877
1803
|
'hotUpdateGlobal',
|
|
1878
1804
|
'hotUpdateMainFilename',
|
|
1879
1805
|
'library',
|
|
1880
|
-
'libraryExport',
|
|
1881
|
-
'libraryTarget',
|
|
1882
1806
|
'importFunctionName',
|
|
1883
1807
|
'path',
|
|
1884
1808
|
'pathinfo',
|
|
1885
1809
|
'publicPath',
|
|
1886
1810
|
"scriptType",
|
|
1887
1811
|
'sourceMapFilename',
|
|
1888
|
-
'sourcePrefix',
|
|
1889
1812
|
'strictModuleErrorHandling',
|
|
1890
1813
|
'strictModuleExceptionHandling',
|
|
1891
|
-
'umdNamedDefine',
|
|
1892
1814
|
'workerChunkLoading',
|
|
1893
1815
|
'enabledLibraryTypes',
|
|
1894
1816
|
'environment',
|
|
@@ -1969,7 +1891,70 @@ class DevServer_class extends ChainedMap {
|
|
|
1969
1891
|
]);
|
|
1970
1892
|
}
|
|
1971
1893
|
}
|
|
1972
|
-
let
|
|
1894
|
+
let Orderable = (Class)=>class extends Class {
|
|
1895
|
+
before(name) {
|
|
1896
|
+
if (this.__after) throw Error(`Unable to set .before(${JSON.stringify(name)}) with existing value for .after()`);
|
|
1897
|
+
return this.__before = name, this;
|
|
1898
|
+
}
|
|
1899
|
+
after(name) {
|
|
1900
|
+
if (this.__before) throw Error(`Unable to set .after(${JSON.stringify(name)}) with existing value for .before()`);
|
|
1901
|
+
return this.__after = name, this;
|
|
1902
|
+
}
|
|
1903
|
+
merge(obj, omit = []) {
|
|
1904
|
+
return obj.before && this.before(obj.before), obj.after && this.after(obj.after), super.merge(obj, [
|
|
1905
|
+
...omit,
|
|
1906
|
+
'before',
|
|
1907
|
+
'after'
|
|
1908
|
+
]);
|
|
1909
|
+
}
|
|
1910
|
+
}, src_Plugin = Orderable(class extends ChainedMap {
|
|
1911
|
+
use(plugin, args = []) {
|
|
1912
|
+
return this.set('plugin', plugin).set('args', args);
|
|
1913
|
+
}
|
|
1914
|
+
tap(f) {
|
|
1915
|
+
if (!this.has('plugin')) throw Error(`Cannot call .tap() on a plugin that has not yet been defined. Call ${this.type}('${this.name}').use(<Plugin>) first.`);
|
|
1916
|
+
return this.set('args', f(this.get('args') || [])), this;
|
|
1917
|
+
}
|
|
1918
|
+
set(key, value) {
|
|
1919
|
+
if ('args' === key && !Array.isArray(value)) throw Error('args must be an array of arguments');
|
|
1920
|
+
return super.set(key, value);
|
|
1921
|
+
}
|
|
1922
|
+
merge(obj, omit = []) {
|
|
1923
|
+
return 'plugin' in obj && this.set('plugin', obj.plugin), 'args' in obj && this.set('args', obj.args), super.merge(obj, [
|
|
1924
|
+
...omit,
|
|
1925
|
+
'args',
|
|
1926
|
+
'plugin'
|
|
1927
|
+
]);
|
|
1928
|
+
}
|
|
1929
|
+
toConfig() {
|
|
1930
|
+
let init = this.get('init'), plugin = this.get('plugin'), args = this.get('args'), pluginPath = null;
|
|
1931
|
+
if (void 0 === plugin) throw Error(`Invalid ${this.type} configuration: ${this.type}('${this.name}').use(<Plugin>) was not called to specify the plugin`);
|
|
1932
|
+
'string' == typeof plugin && (plugin = require(pluginPath = plugin));
|
|
1933
|
+
let constructorName = plugin.__expression ? `(${plugin.__expression})` : plugin.name, config = init(plugin, args);
|
|
1934
|
+
return Object.defineProperties(config, {
|
|
1935
|
+
__pluginName: {
|
|
1936
|
+
value: this.name
|
|
1937
|
+
},
|
|
1938
|
+
__pluginType: {
|
|
1939
|
+
value: this.type
|
|
1940
|
+
},
|
|
1941
|
+
__pluginArgs: {
|
|
1942
|
+
value: args
|
|
1943
|
+
},
|
|
1944
|
+
__pluginConstructorName: {
|
|
1945
|
+
value: constructorName
|
|
1946
|
+
},
|
|
1947
|
+
__pluginPath: {
|
|
1948
|
+
value: pluginPath
|
|
1949
|
+
}
|
|
1950
|
+
}), config;
|
|
1951
|
+
}
|
|
1952
|
+
constructor(parent, name, type = 'plugin'){
|
|
1953
|
+
super(parent), this.name = name, this.type = type, this.extend([
|
|
1954
|
+
'init'
|
|
1955
|
+
]), this.init((Plugin, args = [])=>'function' == typeof Plugin ? new Plugin(...args) : Plugin);
|
|
1956
|
+
}
|
|
1957
|
+
}), Use = Orderable(class extends ChainedMap {
|
|
1973
1958
|
tap(f) {
|
|
1974
1959
|
return this.options(f(this.get('options'))), this;
|
|
1975
1960
|
}
|
|
@@ -2102,12 +2087,7 @@ class Module_class extends ChainedMap {
|
|
|
2102
2087
|
constructor(parent){
|
|
2103
2088
|
super(parent), this.rules = new ChainedMap(this), this.defaultRules = new ChainedMap(this), this.generator = new ChainedMap(this), this.parser = new ChainedMap(this), this.extend([
|
|
2104
2089
|
'noParse',
|
|
2105
|
-
'unsafeCache'
|
|
2106
|
-
'wrappedContextCritical',
|
|
2107
|
-
'exprContextRegExp',
|
|
2108
|
-
'wrappedContextRecursive',
|
|
2109
|
-
'strictExportPresence',
|
|
2110
|
-
'wrappedContextRegExp'
|
|
2090
|
+
'unsafeCache'
|
|
2111
2091
|
]);
|
|
2112
2092
|
}
|
|
2113
2093
|
}
|
|
@@ -2136,16 +2116,13 @@ class Optimization_class extends ChainedMap {
|
|
|
2136
2116
|
'moduleIds',
|
|
2137
2117
|
'chunkIds',
|
|
2138
2118
|
'nodeEnv',
|
|
2139
|
-
'mangleWasmImports',
|
|
2140
2119
|
'removeAvailableModules',
|
|
2141
2120
|
'removeEmptyChunks',
|
|
2142
2121
|
'mergeDuplicateChunks',
|
|
2143
|
-
'flagIncludedChunks',
|
|
2144
2122
|
'providedExports',
|
|
2145
2123
|
'usedExports',
|
|
2146
2124
|
'concatenateModules',
|
|
2147
2125
|
'sideEffects',
|
|
2148
|
-
'portableRecords',
|
|
2149
2126
|
'mangleExports',
|
|
2150
2127
|
'innerGraph',
|
|
2151
2128
|
'inlineExports',
|
|
@@ -2269,11 +2246,7 @@ class src_class extends ChainedMap {
|
|
|
2269
2246
|
'dependencies',
|
|
2270
2247
|
'ignoreWarnings',
|
|
2271
2248
|
'loader',
|
|
2272
|
-
'parallelism',
|
|
2273
2249
|
'profile',
|
|
2274
|
-
'recordsPath',
|
|
2275
|
-
'recordsInputPath',
|
|
2276
|
-
'recordsOutputPath',
|
|
2277
2250
|
'name',
|
|
2278
2251
|
'infrastructureLogging',
|
|
2279
2252
|
'snapshot',
|
|
@@ -3022,7 +2995,6 @@ let OVERRIDE_PATHS = new Set([
|
|
|
3022
2995
|
performance: {
|
|
3023
2996
|
printFileSize: !0,
|
|
3024
2997
|
removeConsole: !1,
|
|
3025
|
-
removeMomentLocale: !1,
|
|
3026
2998
|
chunkSplit: {
|
|
3027
2999
|
strategy: 'split-by-experience'
|
|
3028
3000
|
}
|
|
@@ -3474,7 +3446,7 @@ function createPublicContext(context) {
|
|
|
3474
3446
|
async function createContext(options, userConfig) {
|
|
3475
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;
|
|
3476
3448
|
return {
|
|
3477
|
-
version: "2.0.0-alpha.
|
|
3449
|
+
version: "2.0.0-alpha.1",
|
|
3478
3450
|
rootPath,
|
|
3479
3451
|
distPath: '',
|
|
3480
3452
|
cachePath,
|
|
@@ -3686,7 +3658,6 @@ let configChain_CHAIN_ID = {
|
|
|
3686
3658
|
POSTCSS: 'postcss',
|
|
3687
3659
|
LIGHTNINGCSS: 'lightningcss',
|
|
3688
3660
|
IGNORE_CSS: 'ignore-css',
|
|
3689
|
-
CSS_MODULES_TS: "css-modules-typescript",
|
|
3690
3661
|
MINI_CSS_EXTRACT: 'mini-css-extract',
|
|
3691
3662
|
RESOLVE_URL: 'resolve-url-loader'
|
|
3692
3663
|
},
|
|
@@ -3696,7 +3667,7 @@ let configChain_CHAIN_ID = {
|
|
|
3696
3667
|
HTML: 'html',
|
|
3697
3668
|
DEFINE: 'define',
|
|
3698
3669
|
PROGRESS: 'progress',
|
|
3699
|
-
MANIFEST: '
|
|
3670
|
+
MANIFEST: 'rspack-manifest',
|
|
3700
3671
|
TS_CHECKER: 'ts-checker',
|
|
3701
3672
|
MODULE_FEDERATION: 'module-federation',
|
|
3702
3673
|
HTML_PREFETCH: 'html-prefetch-plugin',
|
|
@@ -3709,9 +3680,6 @@ let configChain_CHAIN_ID = {
|
|
|
3709
3680
|
MINIMIZER: {
|
|
3710
3681
|
JS: 'js',
|
|
3711
3682
|
CSS: 'css'
|
|
3712
|
-
},
|
|
3713
|
-
RESOLVE_PLUGIN: {
|
|
3714
|
-
TS_CONFIG_PATHS: 'ts-config-paths'
|
|
3715
3683
|
}
|
|
3716
3684
|
}, vendors_require = (0, external_node_module_.createRequire)(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`);
|
|
3717
3685
|
function pluginHelper_getHTMLPlugin(config) {
|
|
@@ -3879,7 +3847,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3879
3847
|
let defaultEntry, { environments, dev, server: _server, ...baseConfig } = normalizedConfig, isEnvironmentEnabled = (name)=>!specifiedEnvironments || specifiedEnvironments.includes(name), applyEnvironmentDefaultConfig = (config)=>{
|
|
3880
3848
|
config.source.entry && 0 !== Object.keys(config.source.entry).length || (config.source.entry = (defaultEntry || (defaultEntry = getDefaultEntry(rootPath)), defaultEntry));
|
|
3881
3849
|
let isServer = 'node' === config.output.target;
|
|
3882
|
-
return void 0 === config.output.distPath.js && (config.output.distPath.js = isServer ? '' : 'static/js'), void 0 === config.output.module && (config.output.module = isServer), config;
|
|
3850
|
+
return void 0 === config.output.distPath.js && (config.output.distPath.js = isServer ? '' : 'static/js'), void 0 === config.output.module && (config.output.module = isServer), void 0 === config.output.minify && (config.output.minify = !isServer), config;
|
|
3883
3851
|
};
|
|
3884
3852
|
if (environments && Object.keys(environments).length > 0) {
|
|
3885
3853
|
let resolvedEnvironments = Object.fromEntries(Object.entries(environments).filter(([name])=>isEnvironmentEnabled(name)).map(([name, config])=>[
|
|
@@ -4355,7 +4323,7 @@ function getSwcMinimizerOptions(config, jsOptions) {
|
|
|
4355
4323
|
return (options.minimizerOptions.format.asciiOnly = 'ascii' === config.output.charset, jsOptions) ? cjs_default()(options, jsOptions) : options;
|
|
4356
4324
|
}
|
|
4357
4325
|
function parseMinifyOptions(config) {
|
|
4358
|
-
let isProd = 'production' === config.mode, { minify =
|
|
4326
|
+
let isProd = 'production' === config.mode, { minify = !0 } = config.output;
|
|
4359
4327
|
if ('boolean' == typeof minify) {
|
|
4360
4328
|
let shouldMinify = minify && isProd;
|
|
4361
4329
|
return {
|
|
@@ -7583,13 +7551,6 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7583
7551
|
javascript: {
|
|
7584
7552
|
typeReexportsPresence: 'tolerant'
|
|
7585
7553
|
}
|
|
7586
|
-
}), chain.experiments({
|
|
7587
|
-
...chain.get('experiments'),
|
|
7588
|
-
rspackFuture: {
|
|
7589
|
-
bundlerInfo: {
|
|
7590
|
-
force: !1
|
|
7591
|
-
}
|
|
7592
|
-
}
|
|
7593
7554
|
});
|
|
7594
7555
|
});
|
|
7595
7556
|
}
|
|
@@ -7650,17 +7611,14 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7650
7611
|
if (!1 === buildCache) return;
|
|
7651
7612
|
cacheEnabled = !0;
|
|
7652
7613
|
let { context } = api, cacheConfig = 'boolean' == typeof buildCache ? {} : buildCache, cacheDirectory = getCacheDirectory(cacheConfig, context), buildDependencies = await getBuildDependencies(context, config, environment, cacheConfig.buildDependencies), cacheVersion = Array.isArray(cacheConfig.cacheDigest) && cacheConfig.cacheDigest.length ? `${environment.name}-${env}-${await helpers_hash(JSON.stringify(cacheConfig.cacheDigest))}` : `${environment.name}-${env}`;
|
|
7653
|
-
chain.cache(
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
},
|
|
7662
|
-
buildDependencies: Object.values(buildDependencies).flat()
|
|
7663
|
-
}
|
|
7614
|
+
chain.cache({
|
|
7615
|
+
type: 'persistent',
|
|
7616
|
+
version: cacheVersion,
|
|
7617
|
+
storage: {
|
|
7618
|
+
type: 'filesystem',
|
|
7619
|
+
directory: cacheDirectory
|
|
7620
|
+
},
|
|
7621
|
+
buildDependencies: Object.values(buildDependencies).flat()
|
|
7664
7622
|
});
|
|
7665
7623
|
}), api.onAfterCreateCompiler(()=>{
|
|
7666
7624
|
cacheEnabled && src_logger.debug('Rspack persistent cache enabled');
|
|
@@ -7707,7 +7665,9 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7707
7665
|
} : external_node_path_.posix.join(jsPath, jsFilename)).chunkFilename(isJsFilenameFn ? (...args)=>{
|
|
7708
7666
|
let name = jsFilename(...args);
|
|
7709
7667
|
return external_node_path_.posix.join(jsAsyncPath, name);
|
|
7710
|
-
} : external_node_path_.posix.join(jsAsyncPath, jsFilename)).publicPath(publicPath)
|
|
7668
|
+
} : external_node_path_.posix.join(jsAsyncPath, jsFilename)).publicPath(publicPath).bundlerInfo({
|
|
7669
|
+
force: !1
|
|
7670
|
+
}), isServer && chain.output.library({
|
|
7711
7671
|
type: 'commonjs2',
|
|
7712
7672
|
...chain.output.get('library') || {}
|
|
7713
7673
|
}), config.output.copy) {
|
|
@@ -8071,20 +8031,6 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8071
8031
|
});
|
|
8072
8032
|
}
|
|
8073
8033
|
},
|
|
8074
|
-
{
|
|
8075
|
-
name: 'rsbuild:moment',
|
|
8076
|
-
setup (api) {
|
|
8077
|
-
api.modifyBundlerChain((chain, { environment, bundler })=>{
|
|
8078
|
-
let { config } = environment;
|
|
8079
|
-
config.performance.removeMomentLocale && chain.plugin('remove-moment-locale').use(bundler.IgnorePlugin, [
|
|
8080
|
-
{
|
|
8081
|
-
resourceRegExp: /^\.\/locale$/,
|
|
8082
|
-
contextRegExp: /moment$/
|
|
8083
|
-
}
|
|
8084
|
-
]);
|
|
8085
|
-
});
|
|
8086
|
-
}
|
|
8087
|
-
},
|
|
8088
8034
|
{
|
|
8089
8035
|
name: 'rsbuild:node-addons',
|
|
8090
8036
|
setup (api) {
|
|
@@ -8294,7 +8240,7 @@ try {
|
|
|
8294
8240
|
minimizerOptions: {
|
|
8295
8241
|
targets: isPlainObject(loaderOptions.targets) ? environment.browserslist : loaderOptions.targets,
|
|
8296
8242
|
...pick(loaderOptions, [
|
|
8297
|
-
'
|
|
8243
|
+
'drafts',
|
|
8298
8244
|
'include',
|
|
8299
8245
|
'exclude',
|
|
8300
8246
|
'nonStandard',
|
|
@@ -8637,7 +8583,7 @@ try {
|
|
|
8637
8583
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
|
|
8638
8584
|
let { output: { manifest }, dev: { writeToDisk } } = environment.config;
|
|
8639
8585
|
if (!1 === manifest) return;
|
|
8640
|
-
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.
|
|
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'));
|
|
8641
8587
|
manifestFilenames.set(environment.name, manifestOptions.filename);
|
|
8642
8588
|
let pluginOptions = {
|
|
8643
8589
|
fileName: manifestOptions.filename,
|
|
@@ -9146,7 +9092,7 @@ let applyServerOptions = (command)=>{
|
|
|
9146
9092
|
};
|
|
9147
9093
|
function setupCommands() {
|
|
9148
9094
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9149
|
-
cli.version("2.0.0-alpha.
|
|
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)', {
|
|
9150
9096
|
default: 'auto'
|
|
9151
9097
|
}).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', {
|
|
9152
9098
|
type: [
|
|
@@ -9215,7 +9161,7 @@ function initNodeEnv() {
|
|
|
9215
9161
|
}
|
|
9216
9162
|
function showGreeting() {
|
|
9217
9163
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
9218
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.0-alpha.
|
|
9164
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.0-alpha.1\n`);
|
|
9219
9165
|
}
|
|
9220
9166
|
function setupLogLevel() {
|
|
9221
9167
|
let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
@@ -9236,5 +9182,5 @@ function runCLI() {
|
|
|
9236
9182
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err);
|
|
9237
9183
|
}
|
|
9238
9184
|
}
|
|
9239
|
-
let src_version = "2.0.0-alpha.
|
|
9185
|
+
let src_version = "2.0.0-alpha.1";
|
|
9240
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 };
|
package/dist/manifest-plugin.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as __rspack_external__rspack_lite_tapable_c6bdf810 from "@rspack/lite-t
|
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
3
|
import "./131.js";
|
|
4
4
|
__webpack_require__.add({
|
|
5
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.
|
|
5
|
+
"../../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/helpers.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: !0
|
|
8
8
|
}), exports.transformFiles = exports.reduceChunk = exports.reduceAssets = exports.generateManifest = void 0;
|
|
@@ -64,11 +64,11 @@ __webpack_require__.add({
|
|
|
64
64
|
'sort'
|
|
65
65
|
].filter((fname)=>!!options[fname]).reduce((prev, fname)=>prev[fname](options[fname]), files).map(standardizeFilePaths);
|
|
66
66
|
},
|
|
67
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.
|
|
67
|
+
"../../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/hooks.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
68
68
|
Object.defineProperty(exports, "__esModule", {
|
|
69
69
|
value: !0
|
|
70
70
|
}), exports.normalModuleLoaderHook = exports.getCompilerHooks = exports.emitHook = exports.beforeRunHook = void 0;
|
|
71
|
-
let node_fs_1 = __webpack_require__("node:fs"), node_path_1 = __webpack_require__("node:path"), lite_tapable_1 = __webpack_require__("@rspack/lite-tapable"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.
|
|
71
|
+
let node_fs_1 = __webpack_require__("node:fs"), node_path_1 = __webpack_require__("node:path"), lite_tapable_1 = __webpack_require__("@rspack/lite-tapable"), helpers_1 = __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/helpers.js"), compilerHookMap = new WeakMap(), getCompilerHooks = (compiler)=>{
|
|
72
72
|
let hooks = compilerHookMap.get(compiler);
|
|
73
73
|
return void 0 === hooks && (hooks = {
|
|
74
74
|
afterEmit: new lite_tapable_1.SyncWaterfallHook([
|
|
@@ -83,7 +83,6 @@ __webpack_require__.add({
|
|
|
83
83
|
let emitCount = emitCountMap.get(manifestFileName) || 0;
|
|
84
84
|
emitCountMap.set(manifestFileName, emitCount + 1), callback && callback();
|
|
85
85
|
}, exports.emitHook = function emit({ compiler, emitCountMap, manifestAssetId, manifestFileName, moduleAssets, options }, compilation) {
|
|
86
|
-
var _a;
|
|
87
86
|
let emitCount = emitCountMap.get(manifestFileName) - 1, stats = compilation.getStats().toJson({
|
|
88
87
|
all: !1,
|
|
89
88
|
assets: !0,
|
|
@@ -93,16 +92,13 @@ __webpack_require__.add({
|
|
|
93
92
|
}), resolvedPublicPath = null !== options.publicPath ? options.publicPath : stats.publicPath, publicPath = 'auto' === resolvedPublicPath ? '' : resolvedPublicPath, { basePath, removeKeyHash } = options;
|
|
94
93
|
emitCountMap.set(manifestFileName, emitCount);
|
|
95
94
|
let auxiliaryFiles = {}, files = Array.from(compilation.chunks).reduce((prev, chunk)=>(0, helpers_1.reduceChunk)(prev, chunk, options, auxiliaryFiles), []);
|
|
96
|
-
(files = (files = stats.assets.reduce((prev, asset)=>(0, helpers_1.reduceAssets)(prev, asset, moduleAssets), files)).filter(({ name, path })=>{
|
|
97
|
-
var _a;
|
|
98
|
-
return !path.includes('hot-update') && void 0 === emitCountMap.get((0, node_path_1.join)((null == (_a = compiler.options.output) ? void 0 : _a.path) || '<unknown>', name));
|
|
99
|
-
})).forEach((file)=>{
|
|
95
|
+
(files = (files = stats.assets.reduce((prev, asset)=>(0, helpers_1.reduceAssets)(prev, asset, moduleAssets), files)).filter(({ name, path })=>!path.includes('hot-update') && void 0 === emitCountMap.get((0, node_path_1.join)(compiler.options.output?.path || '<unknown>', name)))).forEach((file)=>{
|
|
100
96
|
delete auxiliaryFiles[file.path];
|
|
101
97
|
}), Object.keys(auxiliaryFiles).forEach((auxiliaryFile)=>{
|
|
102
98
|
files = files.concat(auxiliaryFiles[auxiliaryFile]);
|
|
103
99
|
});
|
|
104
100
|
let integrityMap = {};
|
|
105
|
-
|
|
101
|
+
stats.assets?.forEach((asset)=>{
|
|
106
102
|
asset.integrity && (integrityMap[asset.name] = asset.integrity);
|
|
107
103
|
}), files = files.map((file)=>{
|
|
108
104
|
let normalizePath = (path)=>path.endsWith('/') ? path : `${path}/`, changes = {
|
|
@@ -126,9 +122,9 @@ __webpack_require__.add({
|
|
|
126
122
|
}), emitFile.call(module, file, content, sourceMap));
|
|
127
123
|
};
|
|
128
124
|
},
|
|
129
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.
|
|
125
|
+
"../../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" (__unused_rspack_module, exports, __webpack_require__) {
|
|
130
126
|
exports.RspackManifestPlugin = void 0;
|
|
131
|
-
let node_path_1 = __webpack_require__("node:path"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.
|
|
127
|
+
let node_path_1 = __webpack_require__("node:path"), hooks_1 = __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/hooks.js"), emitCountMap = new Map(), defaults = {
|
|
132
128
|
assetHookStage: 1 / 0,
|
|
133
129
|
basePath: '',
|
|
134
130
|
fileName: 'manifest.json',
|
|
@@ -150,8 +146,7 @@ __webpack_require__.add({
|
|
|
150
146
|
this.options = Object.assign({}, defaults, opts);
|
|
151
147
|
}
|
|
152
148
|
apply(compiler) {
|
|
153
|
-
|
|
154
|
-
let manifestFileName = (0, node_path_1.resolve)((null == (_a = compiler.options.output) ? void 0 : _a.path) || './', this.options.fileName), manifestAssetId = (0, node_path_1.relative)((null == (_b = compiler.options.output) ? void 0 : _b.path) || './', manifestFileName), beforeRun = hooks_1.beforeRunHook.bind(this, {
|
|
149
|
+
let manifestFileName = (0, node_path_1.resolve)(compiler.options.output?.path || './', this.options.fileName), manifestAssetId = (0, node_path_1.relative)(compiler.options.output?.path || './', manifestFileName), beforeRun = hooks_1.beforeRunHook.bind(this, {
|
|
155
150
|
emitCountMap,
|
|
156
151
|
manifestFileName
|
|
157
152
|
}), emit = hooks_1.emitHook.bind(this, {
|
|
@@ -98,8 +98,6 @@ export declare const CHAIN_ID: {
|
|
|
98
98
|
readonly LIGHTNINGCSS: "lightningcss";
|
|
99
99
|
/** ignore-css-loader */
|
|
100
100
|
readonly IGNORE_CSS: "ignore-css";
|
|
101
|
-
/** css-modules-typescript-loader */
|
|
102
|
-
readonly CSS_MODULES_TS: "css-modules-typescript";
|
|
103
101
|
/** CssExtractRspackPlugin.loader */
|
|
104
102
|
readonly MINI_CSS_EXTRACT: "mini-css-extract";
|
|
105
103
|
/** resolve-url-loader */
|
|
@@ -117,8 +115,8 @@ export declare const CHAIN_ID: {
|
|
|
117
115
|
readonly DEFINE: "define";
|
|
118
116
|
/** ProgressPlugin */
|
|
119
117
|
readonly PROGRESS: "progress";
|
|
120
|
-
/**
|
|
121
|
-
readonly MANIFEST: "
|
|
118
|
+
/** RspackManifestPlugin */
|
|
119
|
+
readonly MANIFEST: "rspack-manifest";
|
|
122
120
|
/** ForkTsCheckerWebpackPlugin */
|
|
123
121
|
readonly TS_CHECKER: "ts-checker";
|
|
124
122
|
/** ModuleFederationPlugin */
|
|
@@ -143,10 +141,5 @@ export declare const CHAIN_ID: {
|
|
|
143
141
|
/** LightningCssMinimizerRspackPlugin */
|
|
144
142
|
readonly CSS: "css";
|
|
145
143
|
};
|
|
146
|
-
/** Predefined resolve plugins */
|
|
147
|
-
readonly RESOLVE_PLUGIN: {
|
|
148
|
-
/** TsConfigPathsPlugin */
|
|
149
|
-
readonly TS_CONFIG_PATHS: "ts-config-paths";
|
|
150
|
-
};
|
|
151
144
|
};
|
|
152
145
|
export type ChainIdentifier = typeof CHAIN_ID;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -19,4 +19,4 @@ export { type Logger, logger } from './logger';
|
|
|
19
19
|
export { mergeRsbuildConfig } from './mergeConfig';
|
|
20
20
|
export type { RsbuildDevServer } from './server/devServer';
|
|
21
21
|
export type { StartServerResult } from './server/helper';
|
|
22
|
-
export type { AliasStrategy, AppIcon, AppIconItem, Build, BuildOptions, BuildResult,
|
|
22
|
+
export type { AliasStrategy, AppIcon, AppIconItem, Build, BuildOptions, BuildResult, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, Connect, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTag, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InitConfigsOptions, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedResolveConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolveConfig, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SplitChunks, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFiles, } from './types';
|