@rsbuild/webpack 0.2.2 → 0.2.4
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/core/build.d.ts +1 -1
- package/dist/core/createCompiler.d.ts +4 -4
- package/dist/plugins/css.js +3 -2
- package/dist/provider.d.ts +2 -6
- package/dist/provider.js +83 -89
- package/package.json +4 -4
package/dist/core/build.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InitConfigsOptions } from './initConfigs';
|
|
2
2
|
import { type Stats, type BuildOptions } from '@rsbuild/shared';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Compiler, MultiStats, MultiCompiler } from 'webpack';
|
|
4
4
|
export interface BuildExecuter {
|
|
5
5
|
(compiler: Compiler): Promise<{
|
|
6
6
|
stats: Stats;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { type Rspack } from '@rsbuild/shared';
|
|
1
2
|
import type { Context } from '@rsbuild/core/provider';
|
|
2
3
|
import type { WebpackConfig } from '../types';
|
|
3
4
|
import { InitConfigsOptions } from './initConfigs';
|
|
4
|
-
import type { Compiler, MultiCompiler } from 'webpack';
|
|
5
5
|
export declare function createCompiler({
|
|
6
6
|
context,
|
|
7
7
|
webpackConfigs
|
|
8
8
|
}: {
|
|
9
9
|
context: Context;
|
|
10
10
|
webpackConfigs: WebpackConfig[];
|
|
11
|
-
}): Promise<Compiler | MultiCompiler>;
|
|
12
|
-
export declare function createDevMiddleware(options: InitConfigsOptions, customCompiler?: Compiler | MultiCompiler): Promise<{
|
|
11
|
+
}): Promise<Rspack.Compiler | Rspack.MultiCompiler>;
|
|
12
|
+
export declare function createDevMiddleware(options: InitConfigsOptions, customCompiler?: Rspack.Compiler | Rspack.MultiCompiler): Promise<{
|
|
13
13
|
devMiddleware: import("@rsbuild/shared").DevMiddleware;
|
|
14
|
-
compiler: Compiler | MultiCompiler;
|
|
14
|
+
compiler: Rspack.Compiler | Rspack.MultiCompiler;
|
|
15
15
|
}>;
|
package/dist/plugins/css.js
CHANGED
|
@@ -84,9 +84,10 @@ async function applyBaseCSSRule({
|
|
|
84
84
|
}
|
|
85
85
|
rule.use(CHAIN_ID.USE.CSS).loader((0, import_shared.getSharedPkgCompiledPath)("css-loader")).options(cssLoaderOptions).end();
|
|
86
86
|
if (!isServer && !isWebWorker) {
|
|
87
|
-
const postcssLoaderOptions = (0, import_shared.
|
|
87
|
+
const postcssLoaderOptions = await (0, import_shared.getPostcssLoaderOptions)({
|
|
88
88
|
browserslist,
|
|
89
|
-
config
|
|
89
|
+
config,
|
|
90
|
+
root: context.rootPath
|
|
90
91
|
});
|
|
91
92
|
rule.use(CHAIN_ID.USE.POSTCSS).loader((0, import_shared.getSharedPkgCompiledPath)("postcss-loader")).options(postcssLoaderOptions).end();
|
|
92
93
|
}
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare
|
|
3
|
-
rsbuildConfig: originalRsbuildConfig
|
|
4
|
-
}: {
|
|
5
|
-
rsbuildConfig: RsbuildConfig;
|
|
6
|
-
}): RsbuildProvider;
|
|
1
|
+
import { type RsbuildProvider } from '@rsbuild/shared';
|
|
2
|
+
export declare const webpackProvider: RsbuildProvider<'webpack'>;
|
package/dist/provider.js
CHANGED
|
@@ -35,99 +35,93 @@ var import_shared = require("@rsbuild/shared");
|
|
|
35
35
|
var import_provider = require("@rsbuild/core/provider");
|
|
36
36
|
var import_shared2 = require("./shared");
|
|
37
37
|
var import_initConfigs = require("./core/initConfigs");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
38
|
+
const webpackProvider = async ({
|
|
39
|
+
plugins,
|
|
40
|
+
pluginStore,
|
|
41
|
+
rsbuildOptions
|
|
42
|
+
}) => {
|
|
43
|
+
const rsbuildConfig = (0, import_shared.pickRsbuildConfig)(rsbuildOptions.rsbuildConfig);
|
|
44
|
+
const context = await (0, import_provider.createContext)(rsbuildOptions, rsbuildConfig, "webpack");
|
|
45
|
+
const pluginAPI = (0, import_provider.getPluginAPI)({ context, pluginStore });
|
|
46
|
+
context.pluginAPI = pluginAPI;
|
|
47
|
+
return {
|
|
48
|
+
bundler: "webpack",
|
|
49
|
+
pluginAPI,
|
|
50
|
+
publicContext: (0, import_provider.createPublicContext)(context),
|
|
51
|
+
async applyDefaultPlugins() {
|
|
52
|
+
pluginStore.addPlugins(await (0, import_shared2.applyDefaultPlugins)(plugins));
|
|
53
|
+
},
|
|
54
|
+
async initConfigs() {
|
|
55
|
+
const { webpackConfigs } = await (0, import_initConfigs.initConfigs)({
|
|
56
|
+
context,
|
|
57
|
+
pluginStore,
|
|
58
|
+
rsbuildOptions
|
|
59
|
+
});
|
|
60
|
+
return webpackConfigs;
|
|
61
|
+
},
|
|
62
|
+
async createCompiler() {
|
|
63
|
+
const { createCompiler } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
|
64
|
+
const { webpackConfigs } = await (0, import_initConfigs.initConfigs)({
|
|
65
|
+
context,
|
|
66
|
+
pluginStore,
|
|
67
|
+
rsbuildOptions
|
|
68
|
+
});
|
|
69
|
+
return createCompiler({ context, webpackConfigs });
|
|
70
|
+
},
|
|
71
|
+
async getServerAPIs(options) {
|
|
72
|
+
const { getServerAPIs } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/server")));
|
|
73
|
+
const { createDevMiddleware } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
|
74
|
+
await (0, import_provider.initRsbuildConfig)({ context, pluginStore });
|
|
75
|
+
return getServerAPIs(
|
|
76
|
+
{ context, pluginStore, rsbuildOptions },
|
|
77
|
+
createDevMiddleware,
|
|
78
|
+
options
|
|
79
|
+
);
|
|
80
|
+
},
|
|
81
|
+
async startDevServer(options) {
|
|
82
|
+
const { startDevServer } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/server")));
|
|
83
|
+
const { createDevMiddleware } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
|
84
|
+
await (0, import_provider.initRsbuildConfig)({
|
|
85
|
+
context,
|
|
86
|
+
pluginStore
|
|
87
|
+
});
|
|
88
|
+
return startDevServer(
|
|
89
|
+
{
|
|
59
90
|
context,
|
|
60
91
|
pluginStore,
|
|
61
92
|
rsbuildOptions
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return startDevServer(
|
|
93
|
-
{
|
|
94
|
-
context,
|
|
95
|
-
pluginStore,
|
|
96
|
-
rsbuildOptions
|
|
97
|
-
},
|
|
98
|
-
// @ts-expect-error compile type mismatch
|
|
99
|
-
createDevMiddleware,
|
|
100
|
-
options
|
|
101
|
-
);
|
|
102
|
-
},
|
|
103
|
-
async preview(options) {
|
|
104
|
-
const { startProdServer } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/server")));
|
|
105
|
-
await (0, import_provider.initRsbuildConfig)({
|
|
106
|
-
context,
|
|
107
|
-
pluginStore
|
|
108
|
-
});
|
|
109
|
-
return startProdServer(context, context.config, options);
|
|
110
|
-
},
|
|
111
|
-
async build(options) {
|
|
112
|
-
const { build: buildImpl, webpackBuild } = await Promise.resolve().then(() => __toESM(require("./core/build")));
|
|
113
|
-
return buildImpl(
|
|
114
|
-
{ context, pluginStore, rsbuildOptions },
|
|
115
|
-
options,
|
|
116
|
-
webpackBuild
|
|
117
|
-
);
|
|
118
|
-
},
|
|
119
|
-
async inspectConfig(inspectOptions) {
|
|
120
|
-
const { inspectConfig } = await Promise.resolve().then(() => __toESM(require("./core/inspectConfig")));
|
|
121
|
-
return await inspectConfig({
|
|
122
|
-
context,
|
|
123
|
-
pluginStore,
|
|
124
|
-
rsbuildOptions,
|
|
125
|
-
inspectOptions
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
};
|
|
93
|
+
},
|
|
94
|
+
createDevMiddleware,
|
|
95
|
+
options
|
|
96
|
+
);
|
|
97
|
+
},
|
|
98
|
+
async preview(options) {
|
|
99
|
+
const { startProdServer } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/server")));
|
|
100
|
+
await (0, import_provider.initRsbuildConfig)({
|
|
101
|
+
context,
|
|
102
|
+
pluginStore
|
|
103
|
+
});
|
|
104
|
+
return startProdServer(context, context.config, options);
|
|
105
|
+
},
|
|
106
|
+
async build(options) {
|
|
107
|
+
const { build: buildImpl, webpackBuild } = await Promise.resolve().then(() => __toESM(require("./core/build")));
|
|
108
|
+
return buildImpl(
|
|
109
|
+
{ context, pluginStore, rsbuildOptions },
|
|
110
|
+
options,
|
|
111
|
+
webpackBuild
|
|
112
|
+
);
|
|
113
|
+
},
|
|
114
|
+
async inspectConfig(inspectOptions) {
|
|
115
|
+
const { inspectConfig } = await Promise.resolve().then(() => __toESM(require("./core/inspectConfig")));
|
|
116
|
+
return await inspectConfig({
|
|
117
|
+
context,
|
|
118
|
+
pluginStore,
|
|
119
|
+
rsbuildOptions,
|
|
120
|
+
inspectOptions
|
|
121
|
+
});
|
|
122
|
+
}
|
|
129
123
|
};
|
|
130
|
-
}
|
|
124
|
+
};
|
|
131
125
|
// Annotate the CommonJS export names for ESM import in node:
|
|
132
126
|
0 && (module.exports = {
|
|
133
127
|
webpackProvider
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"terser-webpack-plugin": "5.3.9",
|
|
37
37
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
38
38
|
"webpack": "^5.89.0",
|
|
39
|
-
"@rsbuild/
|
|
40
|
-
"@rsbuild/
|
|
39
|
+
"@rsbuild/core": "0.2.4",
|
|
40
|
+
"@rsbuild/shared": "0.2.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "16.x",
|
|
44
44
|
"typescript": "^5.3.0",
|
|
45
|
-
"@rsbuild/test-helper": "0.2.
|
|
45
|
+
"@rsbuild/test-helper": "0.2.4"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public",
|