@shuvi/service 2.0.0-dev.12 → 2.0.0-dev.13
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/lib/bundler/bundler.js +26 -30
- package/lib/core/api.js +19 -27
- package/package.json +9 -9
package/lib/bundler/bundler.js
CHANGED
|
@@ -41,6 +41,7 @@ const tsCheckerRspackPlugin_1 = __importStar(require("@shuvi/toolpack/lib/utils/
|
|
|
41
41
|
const formatWebpackMessages_1 = __importDefault(require("@shuvi/toolpack/lib/utils/formatWebpackMessages"));
|
|
42
42
|
const logger_1 = __importDefault(require("@shuvi/utils/logger"));
|
|
43
43
|
const util_1 = require("util");
|
|
44
|
+
const path = __importStar(require("path"));
|
|
44
45
|
const webpack_1 = require("@shuvi/toolpack/lib/webpack");
|
|
45
46
|
const config_1 = require("@shuvi/toolpack/lib/webpack/config");
|
|
46
47
|
const constants_1 = require("@shuvi/shared/constants");
|
|
@@ -74,23 +75,19 @@ class RspackBundler {
|
|
|
74
75
|
if (this._inited) {
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// });
|
|
91
|
-
// this._devMiddlewares.push(dynamicDll.middleware);
|
|
92
|
-
// }
|
|
93
|
-
this._compiler = yield this._getRspackCompiler( /*dynamicDll*/);
|
|
78
|
+
let dynamicDll;
|
|
79
|
+
if (this._options.preBundle) {
|
|
80
|
+
dynamicDll = new webpack_1.RspackDynamicDll({
|
|
81
|
+
cacheDir: path.join(this._cliContext.paths.cacheDir, 'dll'),
|
|
82
|
+
rootDir: this._cliContext.paths.rootDir,
|
|
83
|
+
exclude: [/react-refresh/],
|
|
84
|
+
resolveRspackModule(module) {
|
|
85
|
+
return (0, webpack_1.resolveRspackModule)(module);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
this._devMiddlewares.push(dynamicDll.middleware);
|
|
89
|
+
}
|
|
90
|
+
this._compiler = yield this._getRspackCompiler(dynamicDll);
|
|
94
91
|
this._inited = true;
|
|
95
92
|
});
|
|
96
93
|
}
|
|
@@ -167,22 +164,21 @@ class RspackBundler {
|
|
|
167
164
|
get targets() {
|
|
168
165
|
return this._targets;
|
|
169
166
|
}
|
|
170
|
-
_getRspackCompiler(
|
|
167
|
+
_getRspackCompiler(dynamicDll) {
|
|
171
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
169
|
if (!this._compiler) {
|
|
173
170
|
this._targets = yield this._getTargets();
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
// }
|
|
171
|
+
if (dynamicDll) {
|
|
172
|
+
this._compiler = (0, webpack_1.rspack)(this._targets.map(({ config }) => {
|
|
173
|
+
if (config.target === 'node') {
|
|
174
|
+
return config;
|
|
175
|
+
}
|
|
176
|
+
return dynamicDll.modifyRspack(config);
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
this._compiler = (0, webpack_1.rspack)(this._targets.map(t => t.config));
|
|
181
|
+
}
|
|
186
182
|
let isFirstSuccessfulCompile = true;
|
|
187
183
|
this._compiler.hooks.done.tap('done', (stats) => __awaiter(this, void 0, void 0, function* () {
|
|
188
184
|
const warnings = [];
|
package/lib/core/api.js
CHANGED
|
@@ -52,11 +52,7 @@ const plugin_1 = require("./plugin");
|
|
|
52
52
|
const config_1 = require("./config");
|
|
53
53
|
const paths_1 = require("./paths");
|
|
54
54
|
const getPlugins_1 = require("./getPlugins");
|
|
55
|
-
|
|
56
|
-
* @unsupported Rspack does not support WebpackWatchWaitForFileBuilderPlugin directly.
|
|
57
|
-
* TODO: Implement equivalent Rspack plugin or use Rspack's built-in watching capabilities.
|
|
58
|
-
*/
|
|
59
|
-
// import WebpackWatchWaitForFileBuilderPlugin from '../lib/webpack-watch-wait-for-file-builder-plugin';
|
|
55
|
+
const webpack_watch_wait_for_file_builder_plugin_1 = __importDefault(require("../lib/webpack-watch-wait-for-file-builder-plugin"));
|
|
60
56
|
const config_2 = require("../config");
|
|
61
57
|
const ServiceModes = ['development', 'production'];
|
|
62
58
|
class Api {
|
|
@@ -143,28 +139,24 @@ class Api {
|
|
|
143
139
|
return config;
|
|
144
140
|
}
|
|
145
141
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
// return config;
|
|
165
|
-
// }
|
|
166
|
-
// });
|
|
167
|
-
usePlugin(addIncludeToSwcLoader /*, rspackWaitPlugin*/);
|
|
142
|
+
const webpackWaitPlugin = createPlugin({
|
|
143
|
+
configWebpack: config => {
|
|
144
|
+
if (this.mode === 'development') {
|
|
145
|
+
config
|
|
146
|
+
.plugin('webpack-watch-wait-for-file-builder-plugin')
|
|
147
|
+
.use(webpack_watch_wait_for_file_builder_plugin_1.default, [
|
|
148
|
+
{
|
|
149
|
+
onBuildStart: this._projectBuilder.onBuildStart,
|
|
150
|
+
onBuildEnd: this._projectBuilder.onBuildEnd,
|
|
151
|
+
onInvalid: this._projectBuilder.onInvalid,
|
|
152
|
+
isDependency: this._projectBuilder.isDependency
|
|
153
|
+
}
|
|
154
|
+
]);
|
|
155
|
+
}
|
|
156
|
+
return config;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
usePlugin(addIncludeToSwcLoader, webpackWaitPlugin);
|
|
168
160
|
// 2. init user plugins
|
|
169
161
|
const userPlugins = (0, getPlugins_1.getPlugins)(this._cwd, {
|
|
170
162
|
presets: this._presets,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuvi/service",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.13",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/shuvijs/shuvi.git",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"@babel/generator": "7.14.5",
|
|
30
30
|
"@babel/parser": "7.14.7",
|
|
31
31
|
"@babel/traverse": "7.14.7",
|
|
32
|
-
"@shuvi/hook": "2.0.0-dev.
|
|
33
|
-
"@shuvi/router": "2.0.0-dev.
|
|
34
|
-
"@shuvi/runtime": "2.0.0-dev.
|
|
35
|
-
"@shuvi/shared": "2.0.0-dev.
|
|
36
|
-
"@shuvi/toolpack": "2.0.0-dev.
|
|
37
|
-
"@shuvi/utils": "2.0.0-dev.
|
|
38
|
-
"@shuvi/error-overlay": "2.0.0-dev.
|
|
39
|
-
"@shuvi/reporters": "2.0.0-dev.
|
|
32
|
+
"@shuvi/hook": "2.0.0-dev.13",
|
|
33
|
+
"@shuvi/router": "2.0.0-dev.13",
|
|
34
|
+
"@shuvi/runtime": "2.0.0-dev.13",
|
|
35
|
+
"@shuvi/shared": "2.0.0-dev.13",
|
|
36
|
+
"@shuvi/toolpack": "2.0.0-dev.13",
|
|
37
|
+
"@shuvi/utils": "2.0.0-dev.13",
|
|
38
|
+
"@shuvi/error-overlay": "2.0.0-dev.13",
|
|
39
|
+
"@shuvi/reporters": "2.0.0-dev.13",
|
|
40
40
|
"commander": "5.1.0",
|
|
41
41
|
"comment-json": "4.2.2",
|
|
42
42
|
"cross-spawn": "7.0.3",
|