@rsbuild/core 0.3.9 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands.js +1 -1
- package/dist/cli/prepare.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/define.js +1 -3
- package/dist/plugins/html.js +1 -3
- package/dist/plugins/splitChunks.d.ts +1 -1
- package/dist/plugins/splitChunks.js +53 -55
- package/dist/provider/core/createContext.js +1 -1
- package/package.json +3 -3
package/dist/cli/commands.js
CHANGED
|
@@ -112,7 +112,7 @@ const applyServerOptions = (command) => {
|
|
|
112
112
|
command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
|
|
113
113
|
};
|
|
114
114
|
function runCli() {
|
|
115
|
-
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.3.
|
|
115
|
+
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.3.10");
|
|
116
116
|
const devCommand = import_commander.program.command("dev");
|
|
117
117
|
const buildCommand = import_commander.program.command("build");
|
|
118
118
|
const previewCommand = import_commander.program.command("preview");
|
package/dist/cli/prepare.js
CHANGED
|
@@ -34,7 +34,7 @@ function prepareCli() {
|
|
|
34
34
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js")) {
|
|
35
35
|
console.log();
|
|
36
36
|
}
|
|
37
|
-
import_rslog.logger.greet(` ${`Rsbuild v${"0.3.
|
|
37
|
+
import_rslog.logger.greet(` ${`Rsbuild v${"0.3.10"}`}
|
|
38
38
|
`);
|
|
39
39
|
}
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var import_createRsbuild = require("./createRsbuild");
|
|
|
38
38
|
var import_config = require("./cli/config");
|
|
39
39
|
var import_shared = require("@rsbuild/shared");
|
|
40
40
|
var import_constants = require("./constants");
|
|
41
|
-
const version = "0.3.
|
|
41
|
+
const version = "0.3.10";
|
|
42
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
43
|
0 && (module.exports = {
|
|
44
44
|
PLUGIN_BABEL_NAME,
|
package/dist/plugins/define.js
CHANGED
|
@@ -27,12 +27,10 @@ const pluginDefine = () => ({
|
|
|
27
27
|
setup(api) {
|
|
28
28
|
api.modifyBundlerChain((chain, { CHAIN_ID, bundler }) => {
|
|
29
29
|
const config = api.getNormalizedConfig();
|
|
30
|
-
const publicPath = chain.output.get("publicPath");
|
|
31
|
-
const assetPrefix = publicPath && typeof publicPath === "string" ? publicPath : config.output.assetPrefix;
|
|
32
30
|
const builtinVars = {
|
|
33
31
|
"process.env.NODE_ENV": JSON.stringify((0, import_shared.getNodeEnv)()),
|
|
34
32
|
"process.env.ASSET_PREFIX": JSON.stringify(
|
|
35
|
-
(0, import_shared.
|
|
33
|
+
(0, import_shared.getPublicPathFromChain)(chain, false)
|
|
36
34
|
)
|
|
37
35
|
};
|
|
38
36
|
chain.plugin(CHAIN_ID.PLUGIN.DEFINE).use(bundler.DefinePlugin, [
|
package/dist/plugins/html.js
CHANGED
|
@@ -188,9 +188,7 @@ const pluginHtml = () => ({
|
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
190
|
const minify = await (0, import_shared.getMinify)(isProd, config);
|
|
191
|
-
const assetPrefix = (0, import_shared.
|
|
192
|
-
chain.output.get("publicPath") || ""
|
|
193
|
-
);
|
|
191
|
+
const assetPrefix = (0, import_shared.getPublicPathFromChain)(chain, false);
|
|
194
192
|
const entries = chain.entryPoints.entries() || {};
|
|
195
193
|
const entryNames = Object.keys(entries);
|
|
196
194
|
const htmlPaths = api.getHTMLPaths();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { RsbuildPlugin } from '../types';
|
|
2
2
|
export declare const MODULE_PATH_REGEX: RegExp;
|
|
3
3
|
export declare function getPackageNameFromModulePath(modulePath: string): string | undefined;
|
|
4
|
-
export declare
|
|
4
|
+
export declare const pluginSplitChunks: () => RsbuildPlugin;
|
|
@@ -119,12 +119,12 @@ function splitByModule(ctx) {
|
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
function splitBySize(ctx) {
|
|
122
|
-
const { override, userDefinedCacheGroups, defaultConfig,
|
|
123
|
-
(0, import_node_assert.default)(
|
|
122
|
+
const { override, userDefinedCacheGroups, defaultConfig, userConfig } = ctx;
|
|
123
|
+
(0, import_node_assert.default)(userConfig.strategy === "split-by-size");
|
|
124
124
|
return {
|
|
125
125
|
...defaultConfig,
|
|
126
|
-
minSize:
|
|
127
|
-
maxSize:
|
|
126
|
+
minSize: userConfig.minSize ?? 0,
|
|
127
|
+
maxSize: userConfig.maxSize ?? Infinity,
|
|
128
128
|
...override,
|
|
129
129
|
cacheGroups: {
|
|
130
130
|
...defaultConfig.cacheGroups,
|
|
@@ -179,60 +179,58 @@ const SPLIT_STRATEGY_DISPATCHER = {
|
|
|
179
179
|
"all-in-one": allInOne,
|
|
180
180
|
"single-vendor": singleVendor
|
|
181
181
|
};
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const config = api.getNormalizedConfig();
|
|
200
|
-
const defaultConfig = {
|
|
201
|
-
// Optimize both `initial` and `async` chunks
|
|
202
|
-
chunks: "all",
|
|
203
|
-
// When chunk size >= 50000 bytes, split it into separate chunk
|
|
204
|
-
// @ts-expect-error Rspack type missing
|
|
205
|
-
enforceSizeThreshold: 5e4,
|
|
206
|
-
cacheGroups: {}
|
|
207
|
-
};
|
|
208
|
-
const { chunkSplit } = config.performance;
|
|
209
|
-
let userDefinedCacheGroups = {};
|
|
210
|
-
if (chunkSplit.forceSplitting) {
|
|
211
|
-
userDefinedCacheGroups = getUserDefinedCacheGroups(
|
|
212
|
-
chunkSplit.forceSplitting
|
|
213
|
-
);
|
|
182
|
+
const pluginSplitChunks = () => ({
|
|
183
|
+
name: "rsbuild:split-chunks",
|
|
184
|
+
setup(api) {
|
|
185
|
+
api.modifyBundlerChain(
|
|
186
|
+
async (chain, { isServer, isWebWorker, isServiceWorker }) => {
|
|
187
|
+
if (isServer || isWebWorker || isServiceWorker) {
|
|
188
|
+
chain.optimization.splitChunks(false);
|
|
189
|
+
if (isWebWorker || isServiceWorker) {
|
|
190
|
+
chain.module.parser.merge({
|
|
191
|
+
javascript: {
|
|
192
|
+
dynamicImportMode: "eager"
|
|
193
|
+
}
|
|
194
|
+
});
|
|
214
195
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const config = api.getNormalizedConfig();
|
|
199
|
+
const defaultConfig = {
|
|
200
|
+
// Optimize both `initial` and `async` chunks
|
|
201
|
+
chunks: "all",
|
|
202
|
+
// When chunk size >= 50000 bytes, split it into separate chunk
|
|
203
|
+
// @ts-expect-error Rspack type missing
|
|
204
|
+
enforceSizeThreshold: 5e4,
|
|
205
|
+
cacheGroups: {}
|
|
206
|
+
};
|
|
207
|
+
const { chunkSplit } = config.performance;
|
|
208
|
+
let userDefinedCacheGroups = {};
|
|
209
|
+
if (chunkSplit.forceSplitting) {
|
|
210
|
+
userDefinedCacheGroups = getUserDefinedCacheGroups(
|
|
211
|
+
chunkSplit.forceSplitting
|
|
230
212
|
);
|
|
231
213
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
214
|
+
const override = chunkSplit.strategy === "custom" ? (
|
|
215
|
+
// `chunkSplit.splitChunks` compat for Eden
|
|
216
|
+
chunkSplit.splitChunks ?? chunkSplit.override
|
|
217
|
+
) : chunkSplit.override;
|
|
218
|
+
const splitChunksOptions = await SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy || "split-by-experience"]({
|
|
219
|
+
defaultConfig,
|
|
220
|
+
override: override || {},
|
|
221
|
+
userDefinedCacheGroups,
|
|
222
|
+
userConfig: chunkSplit,
|
|
223
|
+
rootPath: api.context.rootPath,
|
|
224
|
+
polyfill: config.output.polyfill
|
|
225
|
+
});
|
|
226
|
+
chain.optimization.splitChunks(
|
|
227
|
+
// @ts-expect-error splitChunks type mismatch
|
|
228
|
+
splitChunksOptions
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
236
234
|
// Annotate the CommonJS export names for ESM import in node:
|
|
237
235
|
0 && (module.exports = {
|
|
238
236
|
MODULE_PATH_REGEX,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"types.d.ts"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@rspack/core": "0.5.
|
|
55
|
+
"@rspack/core": "0.5.3",
|
|
56
56
|
"@swc/helpers": "0.5.3",
|
|
57
57
|
"core-js": "~3.32.2",
|
|
58
58
|
"html-webpack-plugin": "npm:html-rspack-plugin@5.5.7",
|
|
59
59
|
"postcss": "^8.4.33",
|
|
60
|
-
"@rsbuild/shared": "0.3.
|
|
60
|
+
"@rsbuild/shared": "0.3.10"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "16.x",
|