@rsbuild/webpack 0.3.11 → 0.4.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.
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PluginManager, type CreateRsbuildOptions } from '@rsbuild/shared';
|
|
2
2
|
import { type InternalContext } from '@rsbuild/core/provider';
|
|
3
3
|
import type { WebpackConfig } from '../types';
|
|
4
4
|
export type InitConfigsOptions = {
|
|
5
5
|
context: InternalContext;
|
|
6
|
-
|
|
6
|
+
pluginManager: PluginManager;
|
|
7
7
|
rsbuildOptions: Required<CreateRsbuildOptions>;
|
|
8
8
|
};
|
|
9
|
-
export declare function initConfigs({ context,
|
|
9
|
+
export declare function initConfigs({ context, pluginManager, rsbuildOptions, }: InitConfigsOptions): Promise<{
|
|
10
10
|
webpackConfigs: WebpackConfig[];
|
|
11
11
|
}>;
|
package/dist/core/initConfigs.js
CHANGED
|
@@ -27,12 +27,12 @@ var import_inspectConfig = require("./inspectConfig");
|
|
|
27
27
|
var import_webpackConfig = require("./webpackConfig");
|
|
28
28
|
async function initConfigs({
|
|
29
29
|
context,
|
|
30
|
-
|
|
30
|
+
pluginManager,
|
|
31
31
|
rsbuildOptions
|
|
32
32
|
}) {
|
|
33
33
|
const normalizedConfig = await (0, import_provider.initRsbuildConfig)({
|
|
34
34
|
context,
|
|
35
|
-
|
|
35
|
+
pluginManager
|
|
36
36
|
});
|
|
37
37
|
const { targets } = normalizedConfig.output;
|
|
38
38
|
const webpackConfigs = await Promise.all(
|
|
@@ -46,7 +46,7 @@ async function initConfigs({
|
|
|
46
46
|
};
|
|
47
47
|
(0, import_inspectConfig.inspectConfig)({
|
|
48
48
|
context,
|
|
49
|
-
|
|
49
|
+
pluginManager,
|
|
50
50
|
inspectOptions,
|
|
51
51
|
rsbuildOptions,
|
|
52
52
|
bundlerConfigs: webpackConfigs
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type InitConfigsOptions } from './initConfigs';
|
|
2
2
|
import { type InspectConfigResult, type InspectConfigOptions } from '@rsbuild/shared';
|
|
3
3
|
import type { WebpackConfig } from '../types';
|
|
4
|
-
export declare function inspectConfig({ context,
|
|
4
|
+
export declare function inspectConfig({ context, pluginManager, rsbuildOptions, bundlerConfigs, inspectOptions, }: InitConfigsOptions & {
|
|
5
5
|
inspectOptions?: InspectConfigOptions;
|
|
6
6
|
bundlerConfigs?: WebpackConfig[];
|
|
7
7
|
}): Promise<InspectConfigResult<'webpack'>>;
|
|
@@ -26,7 +26,7 @@ var import_initConfigs = require("./initConfigs");
|
|
|
26
26
|
var import_shared = require("@rsbuild/shared");
|
|
27
27
|
async function inspectConfig({
|
|
28
28
|
context,
|
|
29
|
-
|
|
29
|
+
pluginManager,
|
|
30
30
|
rsbuildOptions,
|
|
31
31
|
bundlerConfigs,
|
|
32
32
|
inspectOptions = {}
|
|
@@ -38,12 +38,12 @@ async function inspectConfig({
|
|
|
38
38
|
}
|
|
39
39
|
const webpackConfigs = bundlerConfigs || (await (0, import_initConfigs.initConfigs)({
|
|
40
40
|
context,
|
|
41
|
-
|
|
41
|
+
pluginManager,
|
|
42
42
|
rsbuildOptions
|
|
43
43
|
})).webpackConfigs;
|
|
44
44
|
const rsbuildDebugConfig = {
|
|
45
45
|
...context.normalizedConfig,
|
|
46
|
-
pluginNames:
|
|
46
|
+
pluginNames: pluginManager.plugins.map((p) => p.name)
|
|
47
47
|
};
|
|
48
48
|
const rawRsbuildConfig = await (0, import_shared.stringifyConfig)(
|
|
49
49
|
rsbuildDebugConfig,
|
package/dist/plugins/less.js
CHANGED
|
@@ -41,7 +41,8 @@ function pluginLess() {
|
|
|
41
41
|
const { applyBaseCSSRule } = await Promise.resolve().then(() => __toESM(require("./css")));
|
|
42
42
|
const { options, excludes } = (0, import_shared.getLessLoaderOptions)(
|
|
43
43
|
config.tools.less,
|
|
44
|
-
config.output.sourceMap.css
|
|
44
|
+
config.output.sourceMap.css,
|
|
45
|
+
api.context.rootPath
|
|
45
46
|
);
|
|
46
47
|
const rule = chain.module.rule(utils.CHAIN_ID.RULE.LESS).test(import_shared.LESS_REGEX);
|
|
47
48
|
excludes.forEach((item) => {
|
package/dist/provider.js
CHANGED
|
@@ -37,18 +37,18 @@ var import_shared2 = require("./shared");
|
|
|
37
37
|
var import_initConfigs = require("./core/initConfigs");
|
|
38
38
|
const webpackProvider = async ({
|
|
39
39
|
plugins,
|
|
40
|
-
|
|
40
|
+
pluginManager,
|
|
41
41
|
rsbuildOptions
|
|
42
42
|
}) => {
|
|
43
43
|
const rsbuildConfig = (0, import_shared.pickRsbuildConfig)(rsbuildOptions.rsbuildConfig);
|
|
44
44
|
const context = await (0, import_provider.createContext)(rsbuildOptions, rsbuildConfig, "webpack");
|
|
45
|
-
const pluginAPI = (0, import_provider.getPluginAPI)({ context,
|
|
45
|
+
const pluginAPI = (0, import_provider.getPluginAPI)({ context, pluginManager });
|
|
46
46
|
context.pluginAPI = pluginAPI;
|
|
47
47
|
const createCompiler = async () => {
|
|
48
48
|
const { createCompiler: createCompiler2 } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
|
49
49
|
const { webpackConfigs } = await (0, import_initConfigs.initConfigs)({
|
|
50
50
|
context,
|
|
51
|
-
|
|
51
|
+
pluginManager,
|
|
52
52
|
rsbuildOptions
|
|
53
53
|
});
|
|
54
54
|
return createCompiler2({ context, webpackConfigs });
|
|
@@ -59,12 +59,12 @@ const webpackProvider = async ({
|
|
|
59
59
|
createCompiler,
|
|
60
60
|
publicContext: (0, import_provider.createPublicContext)(context),
|
|
61
61
|
async applyDefaultPlugins() {
|
|
62
|
-
|
|
62
|
+
pluginManager.addPlugins(await (0, import_shared2.applyDefaultPlugins)(plugins));
|
|
63
63
|
},
|
|
64
64
|
async initConfigs() {
|
|
65
65
|
const { webpackConfigs } = await (0, import_initConfigs.initConfigs)({
|
|
66
66
|
context,
|
|
67
|
-
|
|
67
|
+
pluginManager,
|
|
68
68
|
rsbuildOptions
|
|
69
69
|
});
|
|
70
70
|
return webpackConfigs;
|
|
@@ -72,9 +72,9 @@ const webpackProvider = async ({
|
|
|
72
72
|
async getServerAPIs(options) {
|
|
73
73
|
const { getServerAPIs } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/server")));
|
|
74
74
|
const { createDevMiddleware } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
|
75
|
-
await (0, import_provider.initRsbuildConfig)({ context,
|
|
75
|
+
await (0, import_provider.initRsbuildConfig)({ context, pluginManager });
|
|
76
76
|
return getServerAPIs(
|
|
77
|
-
{ context,
|
|
77
|
+
{ context, pluginManager, rsbuildOptions },
|
|
78
78
|
createDevMiddleware,
|
|
79
79
|
options
|
|
80
80
|
);
|
|
@@ -84,12 +84,12 @@ const webpackProvider = async ({
|
|
|
84
84
|
const { createDevMiddleware } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
|
85
85
|
await (0, import_provider.initRsbuildConfig)({
|
|
86
86
|
context,
|
|
87
|
-
|
|
87
|
+
pluginManager
|
|
88
88
|
});
|
|
89
89
|
return startDevServer(
|
|
90
90
|
{
|
|
91
91
|
context,
|
|
92
|
-
|
|
92
|
+
pluginManager,
|
|
93
93
|
rsbuildOptions
|
|
94
94
|
},
|
|
95
95
|
createDevMiddleware,
|
|
@@ -100,19 +100,19 @@ const webpackProvider = async ({
|
|
|
100
100
|
const { startProdServer } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/server")));
|
|
101
101
|
await (0, import_provider.initRsbuildConfig)({
|
|
102
102
|
context,
|
|
103
|
-
|
|
103
|
+
pluginManager
|
|
104
104
|
});
|
|
105
105
|
return startProdServer(context, context.config, options);
|
|
106
106
|
},
|
|
107
107
|
async build(options) {
|
|
108
108
|
const { build } = await Promise.resolve().then(() => __toESM(require("./core/build")));
|
|
109
|
-
return build({ context,
|
|
109
|
+
return build({ context, pluginManager, rsbuildOptions }, options);
|
|
110
110
|
},
|
|
111
111
|
async inspectConfig(inspectOptions) {
|
|
112
112
|
const { inspectConfig } = await Promise.resolve().then(() => __toESM(require("./core/inspectConfig")));
|
|
113
113
|
return await inspectConfig({
|
|
114
114
|
context,
|
|
115
|
-
|
|
115
|
+
pluginManager,
|
|
116
116
|
rsbuildOptions,
|
|
117
117
|
inspectOptions
|
|
118
118
|
});
|
package/dist/shared.js
CHANGED
|
@@ -66,7 +66,8 @@ const applyDefaultPlugins = (plugins) => (0, import_shared2.awaitableGetter)([
|
|
|
66
66
|
plugins.performance(),
|
|
67
67
|
plugins.networkPerformance(),
|
|
68
68
|
plugins.preloadOrPrefetch(),
|
|
69
|
-
plugins.server()
|
|
69
|
+
plugins.server(),
|
|
70
|
+
plugins.moduleFederation()
|
|
70
71
|
]);
|
|
71
72
|
const getCompiledPath = (packageName) => {
|
|
72
73
|
const providerCompilerPath = (0, import_node_path.join)(__dirname, "../../compiled", packageName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
"fast-glob": "^3.3.1",
|
|
31
31
|
"globby": "^11.1.0",
|
|
32
32
|
"html-webpack-plugin": "npm:html-rspack-plugin@5.5.7",
|
|
33
|
-
"mini-css-extract-plugin": "2.
|
|
33
|
+
"mini-css-extract-plugin": "2.8.0",
|
|
34
34
|
"postcss": "^8.4.33",
|
|
35
35
|
"terser-webpack-plugin": "5.3.10",
|
|
36
36
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
37
37
|
"webpack": "^5.89.0",
|
|
38
|
-
"@rsbuild/core": "0.
|
|
39
|
-
"@rsbuild/shared": "0.
|
|
38
|
+
"@rsbuild/core": "0.4.1",
|
|
39
|
+
"@rsbuild/shared": "0.4.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "16.x",
|
|
43
43
|
"typescript": "^5.3.0",
|
|
44
|
-
"@scripts/test-helper": "0.
|
|
44
|
+
"@scripts/test-helper": "0.4.1"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public",
|