@rsbuild/core 1.2.1 → 1.2.3
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 +18 -18
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/index.cjs +19 -19
- package/dist/index.js +19 -19
- package/dist/transformLoader.mjs +3 -1
- package/dist/transformRawLoader.mjs +3 -1
- package/dist-types/types/plugin.d.ts +9 -0
- package/package.json +2 -2
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
8529: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const loader = __nccwpck_require__(
|
|
5
|
+
const loader = __nccwpck_require__(243);
|
|
6
6
|
module.exports = loader.default;
|
|
7
7
|
module.exports.defaultGetLocalIdent =
|
|
8
|
-
__nccwpck_require__(
|
|
8
|
+
__nccwpck_require__(4478).defaultGetLocalIdent;
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
243: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11
11
|
"use strict";
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports["default"] = loader;
|
|
14
14
|
var _postcss = _interopRequireDefault(__nccwpck_require__(9409));
|
|
15
|
-
var _plugins = __nccwpck_require__(
|
|
16
|
-
var _utils = __nccwpck_require__(
|
|
15
|
+
var _plugins = __nccwpck_require__(5456);
|
|
16
|
+
var _utils = __nccwpck_require__(4478);
|
|
17
17
|
function _interopRequireDefault(obj) {
|
|
18
18
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
19
19
|
}
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
callback(null, `${importCode}${moduleCode}${exportCode}`);
|
|
237
237
|
}
|
|
238
238
|
},
|
|
239
|
-
|
|
239
|
+
5456: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
240
240
|
"use strict";
|
|
241
241
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
242
242
|
Object.defineProperty(exports, "icssParser", {
|
|
@@ -258,22 +258,22 @@
|
|
|
258
258
|
},
|
|
259
259
|
});
|
|
260
260
|
var _postcssImportParser = _interopRequireDefault(
|
|
261
|
-
__nccwpck_require__(
|
|
261
|
+
__nccwpck_require__(5971),
|
|
262
262
|
);
|
|
263
263
|
var _postcssIcssParser = _interopRequireDefault(
|
|
264
|
-
__nccwpck_require__(
|
|
264
|
+
__nccwpck_require__(2142),
|
|
265
265
|
);
|
|
266
|
-
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(
|
|
266
|
+
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(9113));
|
|
267
267
|
function _interopRequireDefault(obj) {
|
|
268
268
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
269
269
|
}
|
|
270
270
|
},
|
|
271
|
-
|
|
271
|
+
2142: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
272
272
|
"use strict";
|
|
273
273
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
274
274
|
exports["default"] = void 0;
|
|
275
275
|
var _icssUtils = __nccwpck_require__(7937);
|
|
276
|
-
var _utils = __nccwpck_require__(
|
|
276
|
+
var _utils = __nccwpck_require__(4478);
|
|
277
277
|
const plugin = (options = {}) => ({
|
|
278
278
|
postcssPlugin: "postcss-icss-parser",
|
|
279
279
|
async OnceExit(root) {
|
|
@@ -372,14 +372,14 @@
|
|
|
372
372
|
plugin.postcss = true;
|
|
373
373
|
var _default = (exports["default"] = plugin);
|
|
374
374
|
},
|
|
375
|
-
|
|
375
|
+
5971: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
376
376
|
"use strict";
|
|
377
377
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
378
378
|
exports["default"] = void 0;
|
|
379
379
|
var _postcssValueParser = _interopRequireDefault(
|
|
380
380
|
__nccwpck_require__(2948),
|
|
381
381
|
);
|
|
382
|
-
var _utils = __nccwpck_require__(
|
|
382
|
+
var _utils = __nccwpck_require__(4478);
|
|
383
383
|
function _interopRequireDefault(obj) {
|
|
384
384
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
385
385
|
}
|
|
@@ -684,14 +684,14 @@
|
|
|
684
684
|
plugin.postcss = true;
|
|
685
685
|
var _default = (exports["default"] = plugin);
|
|
686
686
|
},
|
|
687
|
-
|
|
687
|
+
9113: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
688
688
|
"use strict";
|
|
689
689
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
690
690
|
exports["default"] = void 0;
|
|
691
691
|
var _postcssValueParser = _interopRequireDefault(
|
|
692
692
|
__nccwpck_require__(2948),
|
|
693
693
|
);
|
|
694
|
-
var _utils = __nccwpck_require__(
|
|
694
|
+
var _utils = __nccwpck_require__(4478);
|
|
695
695
|
function _interopRequireDefault(obj) {
|
|
696
696
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
697
697
|
}
|
|
@@ -1034,7 +1034,7 @@
|
|
|
1034
1034
|
plugin.postcss = true;
|
|
1035
1035
|
var _default = (exports["default"] = plugin);
|
|
1036
1036
|
},
|
|
1037
|
-
|
|
1037
|
+
4478: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
1038
1038
|
"use strict";
|
|
1039
1039
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1040
1040
|
exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
|
|
@@ -7984,6 +7984,6 @@
|
|
|
7984
7984
|
}
|
|
7985
7985
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
7986
7986
|
__nccwpck_require__.ab = __dirname + "/";
|
|
7987
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
7987
|
+
var __webpack_exports__ = __nccwpck_require__(8529);
|
|
7988
7988
|
module.exports = __webpack_exports__;
|
|
7989
7989
|
})();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
945: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { HtmlWebpackChildCompiler } = __nccwpck_require__(
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(210);
|
|
6
6
|
const compilerMap = new WeakMap();
|
|
7
7
|
class CachedChildCompilation {
|
|
8
8
|
constructor(compiler) {
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
}
|
|
305
305
|
module.exports = { CachedChildCompilation };
|
|
306
306
|
},
|
|
307
|
-
|
|
307
|
+
210: (module) => {
|
|
308
308
|
"use strict";
|
|
309
309
|
class HtmlWebpackChildCompiler {
|
|
310
310
|
constructor(templates) {
|
|
@@ -473,7 +473,7 @@
|
|
|
473
473
|
}
|
|
474
474
|
module.exports = { HtmlWebpackChildCompiler };
|
|
475
475
|
},
|
|
476
|
-
|
|
476
|
+
306: (module) => {
|
|
477
477
|
"use strict";
|
|
478
478
|
module.exports = {};
|
|
479
479
|
module.exports.none = (chunks) => chunks;
|
|
@@ -492,7 +492,7 @@
|
|
|
492
492
|
};
|
|
493
493
|
module.exports.auto = module.exports.none;
|
|
494
494
|
},
|
|
495
|
-
|
|
495
|
+
461: (module) => {
|
|
496
496
|
"use strict";
|
|
497
497
|
module.exports = function (err) {
|
|
498
498
|
return {
|
|
@@ -513,7 +513,7 @@
|
|
|
513
513
|
};
|
|
514
514
|
};
|
|
515
515
|
},
|
|
516
|
-
|
|
516
|
+
652: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
517
517
|
"use strict";
|
|
518
518
|
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
|
|
519
519
|
const htmlWebpackPluginHooksMap = new WeakMap();
|
|
@@ -539,7 +539,7 @@
|
|
|
539
539
|
}
|
|
540
540
|
module.exports = { getHtmlRspackPluginHooks };
|
|
541
541
|
},
|
|
542
|
-
|
|
542
|
+
401: (module) => {
|
|
543
543
|
const voidTags = [
|
|
544
544
|
"area",
|
|
545
545
|
"base",
|
|
@@ -607,19 +607,19 @@
|
|
|
607
607
|
htmlTagObjectToString,
|
|
608
608
|
};
|
|
609
609
|
},
|
|
610
|
-
|
|
610
|
+
148: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
611
611
|
"use strict";
|
|
612
612
|
const promisify = __nccwpck_require__(23).promisify;
|
|
613
613
|
const vm = __nccwpck_require__(154);
|
|
614
614
|
const fs = __nccwpck_require__(896);
|
|
615
615
|
const path = __nccwpck_require__(928);
|
|
616
|
-
const { CachedChildCompilation } = __nccwpck_require__(
|
|
616
|
+
const { CachedChildCompilation } = __nccwpck_require__(945);
|
|
617
617
|
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
618
|
-
__nccwpck_require__(
|
|
619
|
-
const prettyError = __nccwpck_require__(
|
|
620
|
-
const chunkSorter = __nccwpck_require__(
|
|
618
|
+
__nccwpck_require__(401);
|
|
619
|
+
const prettyError = __nccwpck_require__(461);
|
|
620
|
+
const chunkSorter = __nccwpck_require__(306);
|
|
621
621
|
const getHtmlRspackPluginHooks =
|
|
622
|
-
__nccwpck_require__(
|
|
622
|
+
__nccwpck_require__(652).getHtmlRspackPluginHooks;
|
|
623
623
|
class HtmlRspackPlugin {
|
|
624
624
|
constructor(userOptions = {}) {
|
|
625
625
|
this.version = HtmlRspackPlugin.version;
|
|
@@ -1578,6 +1578,6 @@
|
|
|
1578
1578
|
}
|
|
1579
1579
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
1580
1580
|
__nccwpck_require__.ab = __dirname + "/";
|
|
1581
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
1581
|
+
var __webpack_exports__ = __nccwpck_require__(148);
|
|
1582
1582
|
module.exports = __webpack_exports__;
|
|
1583
1583
|
})();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
module.exports = __nccwpck_require__(
|
|
4
|
+
13: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
module.exports = __nccwpck_require__(879)["default"];
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
879: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
8
8
|
var __webpack_unused_export__;
|
|
9
9
|
__webpack_unused_export__ = { value: true };
|
|
10
10
|
exports["default"] = loader;
|
|
11
11
|
var _path = _interopRequireDefault(__nccwpck_require__(928));
|
|
12
|
-
var _utils = __nccwpck_require__(
|
|
12
|
+
var _utils = __nccwpck_require__(554);
|
|
13
13
|
function _interopRequireDefault(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
15
15
|
}
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
callback(null, result.css, map, { ast });
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
554: (module, exports, __nccwpck_require__) => {
|
|
183
183
|
module = __nccwpck_require__.nmd(module);
|
|
184
184
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
185
185
|
exports.exec = exec;
|
|
@@ -716,6 +716,6 @@
|
|
|
716
716
|
})();
|
|
717
717
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
718
718
|
__nccwpck_require__.ab = __dirname + "/";
|
|
719
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
719
|
+
var __webpack_exports__ = __nccwpck_require__(13);
|
|
720
720
|
module.exports = __webpack_exports__;
|
|
721
721
|
})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
22: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.transformFiles =
|
|
7
7
|
exports.reduceChunk =
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
.map(standardizeFilePaths);
|
|
121
121
|
exports.transformFiles = transformFiles;
|
|
122
122
|
},
|
|
123
|
-
|
|
123
|
+
279: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
124
124
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
125
125
|
exports.normalModuleLoaderHook =
|
|
126
126
|
exports.getCompilerHooks =
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
const fs_1 = __nccwpck_require__(896);
|
|
131
131
|
const path_1 = __nccwpck_require__(928);
|
|
132
132
|
const lite_tapable_1 = __nccwpck_require__(408);
|
|
133
|
-
const helpers_1 = __nccwpck_require__(
|
|
133
|
+
const helpers_1 = __nccwpck_require__(22);
|
|
134
134
|
const compilerHookMap = new WeakMap();
|
|
135
135
|
const getCompilerHooks = (compiler) => {
|
|
136
136
|
let hooks = compilerHookMap.get(compiler);
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
exports.getCompilerHooks =
|
|
313
313
|
void 0;
|
|
314
314
|
const path_1 = __nccwpck_require__(928);
|
|
315
|
-
const hooks_1 = __nccwpck_require__(
|
|
315
|
+
const hooks_1 = __nccwpck_require__(279);
|
|
316
316
|
Object.defineProperty(exports, "getCompilerHooks", {
|
|
317
317
|
enumerable: true,
|
|
318
318
|
get: function () {
|
package/dist/index.cjs
CHANGED
|
@@ -1703,7 +1703,7 @@ var __webpack_exports__ = {};
|
|
|
1703
1703
|
async function createContext(options, userConfig, bundlerType) {
|
|
1704
1704
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
1705
1705
|
return {
|
|
1706
|
-
version: "1.2.
|
|
1706
|
+
version: "1.2.3",
|
|
1707
1707
|
rootPath,
|
|
1708
1708
|
distPath: '',
|
|
1709
1709
|
cachePath,
|
|
@@ -4237,13 +4237,15 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4237
4237
|
HotModuleReplacementPlugin
|
|
4238
4238
|
}
|
|
4239
4239
|
}));
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
let
|
|
4243
|
-
|
|
4240
|
+
return !function(config) {
|
|
4241
|
+
if (config.plugins) {
|
|
4242
|
+
for (let plugin of config.plugins)if (plugin && void 0 === plugin.apply && 'name' in plugin && 'setup' in plugin) {
|
|
4243
|
+
let name = index_js_default().bold(index_js_default().yellow(plugin.name));
|
|
4244
|
+
throw Error(`[rsbuild:plugin] "${name}" appears to be an Rsbuild plugin. It cannot be used as an Rspack plugin.`);
|
|
4245
|
+
}
|
|
4244
4246
|
}
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
+
config.devServer && rslog_index_js_namespaceObject.logger.warn(`[rsbuild:config] Find invalid Rspack config: "${index_js_default().yellow('devServer')}". Note that Rspack's "devServer" config is not supported by Rsbuild. You can use Rsbuild's "dev" config to configure the Rsbuild dev server.`);
|
|
4248
|
+
}(rspackConfig = await modifyRspackConfig(context, rspackConfig, await getConfigUtils(rspackConfig, chainUtils))), rspackConfig;
|
|
4247
4249
|
}
|
|
4248
4250
|
async function modifyRsbuildConfig(context) {
|
|
4249
4251
|
rslog_index_js_namespaceObject.logger.debug('modify Rsbuild config');
|
|
@@ -4871,13 +4873,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4871
4873
|
writeToDisk: devConfig.writeToDisk,
|
|
4872
4874
|
serverSideRender: !0,
|
|
4873
4875
|
etag: 'weak'
|
|
4874
|
-
}), assetPrefixes = publicPaths.map(pathnameParse).map((prefix)=>base && '/' !== base ? stripBase(prefix, base) : prefix),
|
|
4876
|
+
}), assetPrefixes = publicPaths.map(pathnameParse).map((prefix)=>base && '/' !== base ? stripBase(prefix, base) : prefix), wrapper = async (req, res, next)=>{
|
|
4875
4877
|
let { url } = req, assetPrefix = url && assetPrefixes.find((prefix)=>url.startsWith(prefix));
|
|
4876
4878
|
assetPrefix && '/' !== assetPrefix ? (req.url = url.slice(assetPrefix.length - 1), middleware(req, res, (...args)=>{
|
|
4877
4879
|
req.url = url, next(...args);
|
|
4878
4880
|
})) : middleware(req, res, next);
|
|
4879
4881
|
};
|
|
4880
|
-
return
|
|
4882
|
+
return wrapper.close = middleware.close, wrapper;
|
|
4881
4883
|
}
|
|
4882
4884
|
constructor({ dev, server, compiler, publicPaths, environments }){
|
|
4883
4885
|
compilerDevMiddleware_define_property(this, "middleware", void 0), compilerDevMiddleware_define_property(this, "devConfig", void 0), compilerDevMiddleware_define_property(this, "serverConfig", void 0), compilerDevMiddleware_define_property(this, "compiler", void 0), compilerDevMiddleware_define_property(this, "publicPaths", void 0), compilerDevMiddleware_define_property(this, "socketServer", void 0), this.devConfig = formatDevConfig(dev, environments), this.serverConfig = server, this.compiler = compiler, this.publicPaths = publicPaths, this.socketServer = new SocketServer(dev);
|
|
@@ -6253,13 +6255,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6253
6255
|
rsbuild.addPlugins(plugins);
|
|
6254
6256
|
}
|
|
6255
6257
|
return rsbuildConfig.environments && await Promise.all(Object.entries(rsbuildConfig.environments).map(async ([name, config])=>{
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
});
|
|
6262
|
-
}
|
|
6258
|
+
if (!config.plugins || context.specifiedEnvironments && !context.specifiedEnvironments.includes(name)) return;
|
|
6259
|
+
let plugins = await getFlattenedPlugins(config.plugins);
|
|
6260
|
+
rsbuild.addPlugins(plugins, {
|
|
6261
|
+
environment: name
|
|
6262
|
+
});
|
|
6263
6263
|
})), rsbuild;
|
|
6264
6264
|
}
|
|
6265
6265
|
let external_events_namespaceObject = require("events");
|
|
@@ -6588,12 +6588,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6588
6588
|
}
|
|
6589
6589
|
}(), process.title = 'rsbuild-node';
|
|
6590
6590
|
let { npm_execpath } = process.env;
|
|
6591
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.
|
|
6591
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.3\n`);
|
|
6592
6592
|
}();
|
|
6593
6593
|
try {
|
|
6594
6594
|
!function() {
|
|
6595
6595
|
let cli = cac_dist('rsbuild');
|
|
6596
|
-
cli.help(), cli.version("1.2.
|
|
6596
|
+
cli.help(), cli.version("1.2.3"), applyCommonOptions(cli);
|
|
6597
6597
|
let devCommand = cli.command('dev', 'starting the dev server'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
6598
6598
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6599
6599
|
try {
|
|
@@ -6644,7 +6644,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6644
6644
|
rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
|
|
6645
6645
|
}
|
|
6646
6646
|
}
|
|
6647
|
-
let src_rslib_entry_version = "1.2.
|
|
6647
|
+
let src_rslib_entry_version = "1.2.3";
|
|
6648
6648
|
})();
|
|
6649
6649
|
var __webpack_export_target__ = exports;
|
|
6650
6650
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
package/dist/index.js
CHANGED
|
@@ -1611,7 +1611,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
1611
1611
|
async function createContext(options, userConfig, bundlerType) {
|
|
1612
1612
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
1613
1613
|
return {
|
|
1614
|
-
version: "1.2.
|
|
1614
|
+
version: "1.2.3",
|
|
1615
1615
|
rootPath,
|
|
1616
1616
|
distPath: '',
|
|
1617
1617
|
cachePath,
|
|
@@ -4133,13 +4133,15 @@ async function generateRspackConfig({ target, context, environment }) {
|
|
|
4133
4133
|
HotModuleReplacementPlugin
|
|
4134
4134
|
}
|
|
4135
4135
|
}));
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
let
|
|
4139
|
-
|
|
4136
|
+
return !function(config) {
|
|
4137
|
+
if (config.plugins) {
|
|
4138
|
+
for (let plugin of config.plugins)if (plugin && void 0 === plugin.apply && 'name' in plugin && 'setup' in plugin) {
|
|
4139
|
+
let name = __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.bold(__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow(plugin.name));
|
|
4140
|
+
throw Error(`[rsbuild:plugin] "${name}" appears to be an Rsbuild plugin. It cannot be used as an Rspack plugin.`);
|
|
4141
|
+
}
|
|
4140
4142
|
}
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
+
config.devServer && __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`[rsbuild:config] Find invalid Rspack config: "${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow('devServer')}". Note that Rspack's "devServer" config is not supported by Rsbuild. You can use Rsbuild's "dev" config to configure the Rsbuild dev server.`);
|
|
4144
|
+
}(rspackConfig = await modifyRspackConfig(context, rspackConfig, await getConfigUtils(rspackConfig, chainUtils))), rspackConfig;
|
|
4143
4145
|
}
|
|
4144
4146
|
async function modifyRsbuildConfig(context) {
|
|
4145
4147
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('modify Rsbuild config');
|
|
@@ -4765,13 +4767,13 @@ class CompilerDevMiddleware {
|
|
|
4765
4767
|
writeToDisk: devConfig.writeToDisk,
|
|
4766
4768
|
serverSideRender: !0,
|
|
4767
4769
|
etag: 'weak'
|
|
4768
|
-
}), assetPrefixes = publicPaths.map(pathnameParse).map((prefix)=>base && '/' !== base ? stripBase(prefix, base) : prefix),
|
|
4770
|
+
}), assetPrefixes = publicPaths.map(pathnameParse).map((prefix)=>base && '/' !== base ? stripBase(prefix, base) : prefix), wrapper = async (req, res, next)=>{
|
|
4769
4771
|
let { url } = req, assetPrefix = url && assetPrefixes.find((prefix)=>url.startsWith(prefix));
|
|
4770
4772
|
assetPrefix && '/' !== assetPrefix ? (req.url = url.slice(assetPrefix.length - 1), middleware(req, res, (...args)=>{
|
|
4771
4773
|
req.url = url, next(...args);
|
|
4772
4774
|
})) : middleware(req, res, next);
|
|
4773
4775
|
};
|
|
4774
|
-
return
|
|
4776
|
+
return wrapper.close = middleware.close, wrapper;
|
|
4775
4777
|
}
|
|
4776
4778
|
constructor({ dev, server, compiler, publicPaths, environments }){
|
|
4777
4779
|
compilerDevMiddleware_define_property(this, "middleware", void 0), compilerDevMiddleware_define_property(this, "devConfig", void 0), compilerDevMiddleware_define_property(this, "serverConfig", void 0), compilerDevMiddleware_define_property(this, "compiler", void 0), compilerDevMiddleware_define_property(this, "publicPaths", void 0), compilerDevMiddleware_define_property(this, "socketServer", void 0), this.devConfig = formatDevConfig(dev, environments), this.serverConfig = server, this.compiler = compiler, this.publicPaths = publicPaths, this.socketServer = new SocketServer(dev);
|
|
@@ -6142,13 +6144,11 @@ async function createRsbuild(options = {}) {
|
|
|
6142
6144
|
rsbuild.addPlugins(plugins);
|
|
6143
6145
|
}
|
|
6144
6146
|
return rsbuildConfig.environments && await Promise.all(Object.entries(rsbuildConfig.environments).map(async ([name, config])=>{
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
});
|
|
6151
|
-
}
|
|
6147
|
+
if (!config.plugins || context.specifiedEnvironments && !context.specifiedEnvironments.includes(name)) return;
|
|
6148
|
+
let plugins = await getFlattenedPlugins(config.plugins);
|
|
6149
|
+
rsbuild.addPlugins(plugins, {
|
|
6150
|
+
environment: name
|
|
6151
|
+
});
|
|
6152
6152
|
})), rsbuild;
|
|
6153
6153
|
}
|
|
6154
6154
|
function toArr(any) {
|
|
@@ -6476,12 +6476,12 @@ async function runCLI() {
|
|
|
6476
6476
|
}
|
|
6477
6477
|
}(), process.title = 'rsbuild-node';
|
|
6478
6478
|
let { npm_execpath } = process.env;
|
|
6479
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.
|
|
6479
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.3\n`);
|
|
6480
6480
|
}();
|
|
6481
6481
|
try {
|
|
6482
6482
|
!function() {
|
|
6483
6483
|
let cli = cac_dist('rsbuild');
|
|
6484
|
-
cli.help(), cli.version("1.2.
|
|
6484
|
+
cli.help(), cli.version("1.2.3"), applyCommonOptions(cli);
|
|
6485
6485
|
let devCommand = cli.command('dev', 'starting the dev server'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
6486
6486
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6487
6487
|
try {
|
|
@@ -6532,6 +6532,6 @@ async function runCLI() {
|
|
|
6532
6532
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
6533
6533
|
}
|
|
6534
6534
|
}
|
|
6535
|
-
let src_version = "1.2.
|
|
6535
|
+
let src_version = "1.2.3";
|
|
6536
6536
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
|
|
6537
6537
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
|
package/dist/transformLoader.mjs
CHANGED
|
@@ -6,13 +6,15 @@ async function transformLoader_rslib_entry_transform(source, map) {
|
|
|
6
6
|
if (!transform) return bypass();
|
|
7
7
|
let result = await transform({
|
|
8
8
|
code: source,
|
|
9
|
+
context: this.context,
|
|
9
10
|
resource: this.resource,
|
|
10
11
|
resourcePath: this.resourcePath,
|
|
11
12
|
resourceQuery: this.resourceQuery,
|
|
12
13
|
environment: getEnvironment(),
|
|
13
14
|
addDependency: this.addDependency.bind(this),
|
|
14
15
|
emitFile: this.emitFile.bind(this),
|
|
15
|
-
importModule: this.importModule.bind(this)
|
|
16
|
+
importModule: this.importModule.bind(this),
|
|
17
|
+
resolve: this.resolve.bind(this)
|
|
16
18
|
});
|
|
17
19
|
if (null == result) return bypass();
|
|
18
20
|
if ('string' == typeof result) return callback(null, result, map);
|
|
@@ -6,13 +6,15 @@ let transformRawLoader_rslib_entry_ = async function(source, map) {
|
|
|
6
6
|
if (!transform) return bypass();
|
|
7
7
|
let result = await transform({
|
|
8
8
|
code: source,
|
|
9
|
+
context: this.context,
|
|
9
10
|
resource: this.resource,
|
|
10
11
|
resourcePath: this.resourcePath,
|
|
11
12
|
resourceQuery: this.resourceQuery,
|
|
12
13
|
environment: getEnvironment(),
|
|
13
14
|
addDependency: this.addDependency.bind(this),
|
|
14
15
|
emitFile: this.emitFile.bind(this),
|
|
15
|
-
importModule: this.importModule.bind(this)
|
|
16
|
+
importModule: this.importModule.bind(this),
|
|
17
|
+
resolve: this.resolve.bind(this)
|
|
16
18
|
});
|
|
17
19
|
if (null == result) return bypass();
|
|
18
20
|
if ('string' == typeof result) return callback(null, result, map);
|
|
@@ -148,6 +148,11 @@ export type TransformContext = {
|
|
|
148
148
|
* The code of the module.
|
|
149
149
|
*/
|
|
150
150
|
code: string;
|
|
151
|
+
/**
|
|
152
|
+
* The directory path of the currently processed module,
|
|
153
|
+
* which changes with the location of each processed module.
|
|
154
|
+
*/
|
|
155
|
+
context: string | null;
|
|
151
156
|
/**
|
|
152
157
|
* The absolute path of the module, including the query.
|
|
153
158
|
* @example '/home/user/project/src/index.js?foo=123'
|
|
@@ -185,6 +190,10 @@ export type TransformContext = {
|
|
|
185
190
|
* Compile and execute a module at the build time.
|
|
186
191
|
*/
|
|
187
192
|
importModule: Rspack.LoaderContext['importModule'];
|
|
193
|
+
/**
|
|
194
|
+
* Resolve a module specifier.
|
|
195
|
+
*/
|
|
196
|
+
resolve: Rspack.LoaderContext['resolve'];
|
|
188
197
|
};
|
|
189
198
|
export type TransformHandler = (context: TransformContext) => MaybePromise<TransformResult>;
|
|
190
199
|
export type TransformDescriptor = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.2.
|
|
49
|
+
"@rspack/core": "1.2.2",
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.1",
|
|
51
51
|
"@swc/helpers": "^0.5.15",
|
|
52
52
|
"core-js": "~3.40.0"
|