@rsbuild/core 1.0.1-beta.13 → 1.0.1-beta.14
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 +20 -20
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +8 -8
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/index.cjs +122 -66
- package/dist/index.js +122 -66
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/server/devServer.d.ts +8 -3
- package/dist-types/types/config/html.d.ts +17 -1
- package/dist-types/types/config/output.d.ts +2 -1
- package/dist-types/types/rsbuild.d.ts +9 -6
- package/package.json +2 -2
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
3904: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const loader = __nccwpck_require__(
|
|
5
|
+
const loader = __nccwpck_require__(6927);
|
|
6
6
|
module.exports = loader.default;
|
|
7
7
|
module.exports.defaultGetLocalIdent =
|
|
8
|
-
__nccwpck_require__(
|
|
8
|
+
__nccwpck_require__(8737).defaultGetLocalIdent;
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
6927: (__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__(9961));
|
|
15
15
|
var _package = _interopRequireDefault(__nccwpck_require__(3357));
|
|
16
16
|
var _semver = __nccwpck_require__(938);
|
|
17
|
-
var _options = _interopRequireDefault(__nccwpck_require__(
|
|
18
|
-
var _plugins = __nccwpck_require__(
|
|
19
|
-
var _utils = __nccwpck_require__(
|
|
17
|
+
var _options = _interopRequireDefault(__nccwpck_require__(6503));
|
|
18
|
+
var _plugins = __nccwpck_require__(8503);
|
|
19
|
+
var _utils = __nccwpck_require__(8737);
|
|
20
20
|
function _interopRequireDefault(obj) {
|
|
21
21
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
22
22
|
}
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
callback(null, `${importCode}${moduleCode}${exportCode}`);
|
|
244
244
|
}
|
|
245
245
|
},
|
|
246
|
-
|
|
246
|
+
8503: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
247
247
|
"use strict";
|
|
248
248
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
249
249
|
Object.defineProperty(exports, "icssParser", {
|
|
@@ -265,22 +265,22 @@
|
|
|
265
265
|
},
|
|
266
266
|
});
|
|
267
267
|
var _postcssImportParser = _interopRequireDefault(
|
|
268
|
-
__nccwpck_require__(
|
|
268
|
+
__nccwpck_require__(2662),
|
|
269
269
|
);
|
|
270
270
|
var _postcssIcssParser = _interopRequireDefault(
|
|
271
|
-
__nccwpck_require__(
|
|
271
|
+
__nccwpck_require__(5161),
|
|
272
272
|
);
|
|
273
|
-
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(
|
|
273
|
+
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(6837));
|
|
274
274
|
function _interopRequireDefault(obj) {
|
|
275
275
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
276
276
|
}
|
|
277
277
|
},
|
|
278
|
-
|
|
278
|
+
5161: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
279
279
|
"use strict";
|
|
280
280
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
281
281
|
exports["default"] = void 0;
|
|
282
282
|
var _icssUtils = __nccwpck_require__(6370);
|
|
283
|
-
var _utils = __nccwpck_require__(
|
|
283
|
+
var _utils = __nccwpck_require__(8737);
|
|
284
284
|
const plugin = (options = {}) => ({
|
|
285
285
|
postcssPlugin: "postcss-icss-parser",
|
|
286
286
|
async OnceExit(root) {
|
|
@@ -379,14 +379,14 @@
|
|
|
379
379
|
plugin.postcss = true;
|
|
380
380
|
var _default = (exports["default"] = plugin);
|
|
381
381
|
},
|
|
382
|
-
|
|
382
|
+
2662: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
383
383
|
"use strict";
|
|
384
384
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
385
385
|
exports["default"] = void 0;
|
|
386
386
|
var _postcssValueParser = _interopRequireDefault(
|
|
387
387
|
__nccwpck_require__(7555),
|
|
388
388
|
);
|
|
389
|
-
var _utils = __nccwpck_require__(
|
|
389
|
+
var _utils = __nccwpck_require__(8737);
|
|
390
390
|
function _interopRequireDefault(obj) {
|
|
391
391
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
392
392
|
}
|
|
@@ -691,14 +691,14 @@
|
|
|
691
691
|
plugin.postcss = true;
|
|
692
692
|
var _default = (exports["default"] = plugin);
|
|
693
693
|
},
|
|
694
|
-
|
|
694
|
+
6837: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
695
695
|
"use strict";
|
|
696
696
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
697
697
|
exports["default"] = void 0;
|
|
698
698
|
var _postcssValueParser = _interopRequireDefault(
|
|
699
699
|
__nccwpck_require__(7555),
|
|
700
700
|
);
|
|
701
|
-
var _utils = __nccwpck_require__(
|
|
701
|
+
var _utils = __nccwpck_require__(8737);
|
|
702
702
|
function _interopRequireDefault(obj) {
|
|
703
703
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
704
704
|
}
|
|
@@ -1041,7 +1041,7 @@
|
|
|
1041
1041
|
plugin.postcss = true;
|
|
1042
1042
|
var _default = (exports["default"] = plugin);
|
|
1043
1043
|
},
|
|
1044
|
-
|
|
1044
|
+
8737: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
1045
1045
|
"use strict";
|
|
1046
1046
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1047
1047
|
exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
|
|
@@ -7964,7 +7964,7 @@
|
|
|
7964
7964
|
"use strict";
|
|
7965
7965
|
module.exports = require("util");
|
|
7966
7966
|
},
|
|
7967
|
-
|
|
7967
|
+
6503: (module) => {
|
|
7968
7968
|
"use strict";
|
|
7969
7969
|
module.exports = JSON.parse(
|
|
7970
7970
|
'{"title":"CSS Loader options","additionalProperties":false,"properties":{"url":{"description":"Allows to enables/disables `url()`/`image-set()` functions handling.","link":"https://github.com/webpack-contrib/css-loader#url","anyOf":[{"type":"boolean"},{"type":"object","properties":{"filter":{"instanceof":"Function"}},"additionalProperties":false}]},"import":{"description":"Allows to enables/disables `@import` at-rules handling.","link":"https://github.com/webpack-contrib/css-loader#import","anyOf":[{"type":"boolean"},{"type":"object","properties":{"filter":{"instanceof":"Function"}},"additionalProperties":false}]},"modules":{"description":"Allows to enable/disable CSS Modules or ICSS and setup configuration.","link":"https://github.com/webpack-contrib/css-loader#modules","anyOf":[{"type":"boolean"},{"enum":["local","global","pure","icss"]},{"type":"object","additionalProperties":false,"properties":{"auto":{"description":"Allows auto enable CSS modules based on filename.","link":"https://github.com/webpack-contrib/css-loader#auto","anyOf":[{"instanceof":"RegExp"},{"instanceof":"Function"},{"type":"boolean"}]},"mode":{"description":"Setup `mode` option.","link":"https://github.com/webpack-contrib/css-loader#mode","anyOf":[{"enum":["local","global","pure","icss"]},{"instanceof":"Function"}]},"localIdentName":{"description":"Allows to configure the generated local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentname","type":"string","minLength":1},"localIdentContext":{"description":"Allows to redefine basic loader context for local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentcontext","type":"string","minLength":1},"localIdentHashSalt":{"description":"Allows to add custom hash to generate more unique classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashsalt","type":"string","minLength":1},"localIdentHashFunction":{"description":"Allows to specify hash function to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashfunction","type":"string","minLength":1},"localIdentHashDigest":{"description":"Allows to specify hash digest to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashdigest","type":"string","minLength":1},"localIdentHashDigestLength":{"description":"Allows to specify hash digest length to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashdigestlength","type":"number"},"hashStrategy":{"description":"Allows to specify should localName be used when computing the hash.","link":"https://github.com/webpack-contrib/css-loader#hashstrategy","enum":["resource-path-and-local-name","minimal-subset"]},"localIdentRegExp":{"description":"Allows to specify custom RegExp for local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentregexp","anyOf":[{"type":"string","minLength":1},{"instanceof":"RegExp"}]},"getLocalIdent":{"description":"Allows to specify a function to generate the classname.","link":"https://github.com/webpack-contrib/css-loader#getlocalident","instanceof":"Function"},"namedExport":{"description":"Enables/disables ES modules named export for locals.","link":"https://github.com/webpack-contrib/css-loader#namedexport","type":"boolean"},"exportGlobals":{"description":"Allows to export names from global class or id, so you can use that as local name.","link":"https://github.com/webpack-contrib/css-loader#exportglobals","type":"boolean"},"exportLocalsConvention":{"description":"Style of exported classnames.","link":"https://github.com/webpack-contrib/css-loader#localsconvention","anyOf":[{"enum":["asIs","as-is","camelCase","camel-case","camelCaseOnly","camel-case-only","dashes","dashesOnly","dashes-only"]},{"instanceof":"Function"}]},"exportOnlyLocals":{"description":"Export only locals.","link":"https://github.com/webpack-contrib/css-loader#exportonlylocals","type":"boolean"},"getJSON":{"description":"Allows outputting of CSS modules mapping through a callback.","link":"https://github.com/webpack-contrib/css-loader#getJSON","instanceof":"Function"}}}]},"sourceMap":{"description":"Allows to enable/disable source maps.","link":"https://github.com/webpack-contrib/css-loader#sourcemap","type":"boolean"},"importLoaders":{"description":"Allows enables/disables or setups number of loaders applied before CSS loader for `@import`/CSS Modules and ICSS imports.","link":"https://github.com/webpack-contrib/css-loader#importloaders","anyOf":[{"type":"boolean"},{"type":"string"},{"type":"integer"}]},"esModule":{"description":"Use the ES modules syntax.","link":"https://github.com/webpack-contrib/css-loader#esmodule","type":"boolean"},"exportType":{"description":"Allows exporting styles as array with modules, string or constructable stylesheet (i.e. `CSSStyleSheet`).","link":"https://github.com/webpack-contrib/css-loader#exporttype","enum":["array","string","css-style-sheet"]}},"type":"object"}',
|
|
@@ -7999,6 +7999,6 @@
|
|
|
7999
7999
|
}
|
|
8000
8000
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
8001
8001
|
__nccwpck_require__.ab = __dirname + "/";
|
|
8002
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
8002
|
+
var __webpack_exports__ = __nccwpck_require__(3904);
|
|
8003
8003
|
module.exports = __webpack_exports__;
|
|
8004
8004
|
})();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
523: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { HtmlWebpackChildCompiler } = __nccwpck_require__(
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(862);
|
|
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
|
+
862: (module) => {
|
|
308
308
|
"use strict";
|
|
309
309
|
class HtmlWebpackChildCompiler {
|
|
310
310
|
constructor(templates) {
|
|
@@ -465,7 +465,7 @@
|
|
|
465
465
|
}
|
|
466
466
|
module.exports = { HtmlWebpackChildCompiler };
|
|
467
467
|
},
|
|
468
|
-
|
|
468
|
+
122: (module) => {
|
|
469
469
|
"use strict";
|
|
470
470
|
module.exports = {};
|
|
471
471
|
module.exports.none = (chunks) => chunks;
|
|
@@ -484,7 +484,7 @@
|
|
|
484
484
|
};
|
|
485
485
|
module.exports.auto = module.exports.none;
|
|
486
486
|
},
|
|
487
|
-
|
|
487
|
+
929: (module) => {
|
|
488
488
|
"use strict";
|
|
489
489
|
module.exports = function (err) {
|
|
490
490
|
return {
|
|
@@ -505,7 +505,7 @@
|
|
|
505
505
|
};
|
|
506
506
|
};
|
|
507
507
|
},
|
|
508
|
-
|
|
508
|
+
309: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
509
509
|
"use strict";
|
|
510
510
|
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(348);
|
|
511
511
|
const htmlWebpackPluginHooksMap = new WeakMap();
|
|
@@ -531,7 +531,7 @@
|
|
|
531
531
|
}
|
|
532
532
|
module.exports = { getHtmlRspackPluginHooks };
|
|
533
533
|
},
|
|
534
|
-
|
|
534
|
+
624: (module) => {
|
|
535
535
|
const voidTags = [
|
|
536
536
|
"area",
|
|
537
537
|
"base",
|
|
@@ -599,19 +599,19 @@
|
|
|
599
599
|
htmlTagObjectToString,
|
|
600
600
|
};
|
|
601
601
|
},
|
|
602
|
-
|
|
602
|
+
31: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
603
603
|
"use strict";
|
|
604
604
|
const promisify = __nccwpck_require__(837).promisify;
|
|
605
605
|
const vm = __nccwpck_require__(144);
|
|
606
606
|
const fs = __nccwpck_require__(147);
|
|
607
607
|
const path = __nccwpck_require__(17);
|
|
608
|
-
const { CachedChildCompilation } = __nccwpck_require__(
|
|
608
|
+
const { CachedChildCompilation } = __nccwpck_require__(523);
|
|
609
609
|
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
610
|
-
__nccwpck_require__(
|
|
611
|
-
const prettyError = __nccwpck_require__(
|
|
612
|
-
const chunkSorter = __nccwpck_require__(
|
|
610
|
+
__nccwpck_require__(624);
|
|
611
|
+
const prettyError = __nccwpck_require__(929);
|
|
612
|
+
const chunkSorter = __nccwpck_require__(122);
|
|
613
613
|
const getHtmlRspackPluginHooks =
|
|
614
|
-
__nccwpck_require__(
|
|
614
|
+
__nccwpck_require__(309).getHtmlRspackPluginHooks;
|
|
615
615
|
class HtmlRspackPlugin {
|
|
616
616
|
constructor(userOptions = {}) {
|
|
617
617
|
this.version = HtmlRspackPlugin.version;
|
|
@@ -1569,6 +1569,6 @@
|
|
|
1569
1569
|
}
|
|
1570
1570
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
1571
1571
|
__nccwpck_require__.ab = __dirname + "/";
|
|
1572
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
1572
|
+
var __webpack_exports__ = __nccwpck_require__(31);
|
|
1573
1573
|
module.exports = __webpack_exports__;
|
|
1574
1574
|
})();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
module.exports = __nccwpck_require__(
|
|
4
|
+
83: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
module.exports = __nccwpck_require__(71)["default"];
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
71: (__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__(17));
|
|
12
12
|
var _package = _interopRequireDefault(__nccwpck_require__(357));
|
|
13
|
-
var _options = _interopRequireDefault(__nccwpck_require__(
|
|
14
|
-
var _utils = __nccwpck_require__(
|
|
13
|
+
var _options = _interopRequireDefault(__nccwpck_require__(978));
|
|
14
|
+
var _utils = __nccwpck_require__(516);
|
|
15
15
|
function _interopRequireDefault(obj) {
|
|
16
16
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
17
17
|
}
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
callback(null, result.css, map, { ast });
|
|
190
190
|
}
|
|
191
191
|
},
|
|
192
|
-
|
|
192
|
+
516: (module, exports, __nccwpck_require__) => {
|
|
193
193
|
module = __nccwpck_require__.nmd(module);
|
|
194
194
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
195
195
|
exports.exec = exec;
|
|
@@ -694,7 +694,7 @@
|
|
|
694
694
|
310: (module) => {
|
|
695
695
|
module.exports = require("url");
|
|
696
696
|
},
|
|
697
|
-
|
|
697
|
+
978: (module) => {
|
|
698
698
|
module.exports = JSON.parse(
|
|
699
699
|
'{"title":"PostCSS Loader options","type":"object","properties":{"postcssOptions":{"description":"Options to pass through to `Postcss`.","link":"https://github.com/webpack-contrib/postcss-loader#postcssOptions","anyOf":[{"type":"object","additionalProperties":true,"properties":{"config":{"description":"Allows to specify PostCSS config path.","link":"https://github.com/webpack-contrib/postcss-loader#config","anyOf":[{"description":"Allows to specify the path to the configuration file","type":"string"},{"description":"Enables/Disables autoloading config","type":"boolean"}]}}},{"instanceof":"Function"}]},"execute":{"description":"Enables/Disables PostCSS parser support in \'CSS-in-JS\'.","link":"https://github.com/webpack-contrib/postcss-loader#execute","type":"boolean"},"sourceMap":{"description":"Enables/Disables generation of source maps.","link":"https://github.com/webpack-contrib/postcss-loader#sourcemap","type":"boolean"},"implementation":{"description":"The implementation of postcss to use, instead of the locally installed version","link":"https://github.com/webpack-contrib/postcss-loader#implementation","anyOf":[{"type":"string"},{"instanceof":"Function"}]}},"additionalProperties":false}',
|
|
700
700
|
);
|
|
@@ -739,6 +739,6 @@
|
|
|
739
739
|
})();
|
|
740
740
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
741
741
|
__nccwpck_require__.ab = __dirname + "/";
|
|
742
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
742
|
+
var __webpack_exports__ = __nccwpck_require__(83);
|
|
743
743
|
module.exports = __webpack_exports__;
|
|
744
744
|
})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
345: (__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
|
+
77: (__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__(147);
|
|
131
131
|
const path_1 = __nccwpck_require__(17);
|
|
132
132
|
const lite_tapable_1 = __nccwpck_require__(348);
|
|
133
|
-
const helpers_1 = __nccwpck_require__(
|
|
133
|
+
const helpers_1 = __nccwpck_require__(345);
|
|
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__(17);
|
|
315
|
-
const hooks_1 = __nccwpck_require__(
|
|
315
|
+
const hooks_1 = __nccwpck_require__(77);
|
|
316
316
|
Object.defineProperty(exports, "getCompilerHooks", {
|
|
317
317
|
enumerable: true,
|
|
318
318
|
get: function () {
|
package/dist/index.cjs
CHANGED
|
@@ -1174,6 +1174,7 @@ var init_config = __esm({
|
|
|
1174
1174
|
});
|
|
1175
1175
|
getDefaultOutputConfig = () => ({
|
|
1176
1176
|
target: "web",
|
|
1177
|
+
cleanDistPath: "auto",
|
|
1177
1178
|
distPath: {
|
|
1178
1179
|
root: ROOT_DIST_DIR,
|
|
1179
1180
|
css: CSS_DIST_DIR,
|
|
@@ -2282,7 +2283,7 @@ async function createContext(options, userConfig, bundlerType) {
|
|
|
2282
2283
|
const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
|
|
2283
2284
|
const cachePath = (0, import_node_path9.join)(rootPath, "node_modules", ".cache");
|
|
2284
2285
|
return {
|
|
2285
|
-
version: "1.0.1-beta.
|
|
2286
|
+
version: "1.0.1-beta.14",
|
|
2286
2287
|
rootPath,
|
|
2287
2288
|
distPath: "",
|
|
2288
2289
|
cachePath,
|
|
@@ -4857,9 +4858,6 @@ async function createDevServer(options, createDevMiddleware2, config, {
|
|
|
4857
4858
|
getPortSilently,
|
|
4858
4859
|
runCompile = true
|
|
4859
4860
|
} = {}) {
|
|
4860
|
-
if (!getNodeEnv()) {
|
|
4861
|
-
setNodeEnv("development");
|
|
4862
|
-
}
|
|
4863
4861
|
import_rslog.logger.debug("create dev server");
|
|
4864
4862
|
const { port, host, https } = await getServerConfig({
|
|
4865
4863
|
config,
|
|
@@ -5042,7 +5040,9 @@ async function createDevServer(options, createDevMiddleware2, config, {
|
|
|
5042
5040
|
environments: options.context.environments
|
|
5043
5041
|
});
|
|
5044
5042
|
},
|
|
5045
|
-
|
|
5043
|
+
connectWebSocket: ({ server: server2 }) => {
|
|
5044
|
+
server2.on("upgrade", devMiddlewares.onUpgrade);
|
|
5045
|
+
},
|
|
5046
5046
|
close: async () => {
|
|
5047
5047
|
await options.context.hooks.onCloseDevServer.call();
|
|
5048
5048
|
await devMiddlewares.close();
|
|
@@ -5086,15 +5086,11 @@ var init_build = __esm({
|
|
|
5086
5086
|
"src/provider/build.ts"() {
|
|
5087
5087
|
"use strict";
|
|
5088
5088
|
import_core4 = require("@rspack/core");
|
|
5089
|
-
init_helpers();
|
|
5090
5089
|
init_hooks();
|
|
5091
5090
|
init_logger();
|
|
5092
5091
|
init_createCompiler();
|
|
5093
5092
|
init_initConfigs();
|
|
5094
5093
|
build = async (initOptions, { watch, compiler: customCompiler } = {}) => {
|
|
5095
|
-
if (!getNodeEnv()) {
|
|
5096
|
-
setNodeEnv("production");
|
|
5097
|
-
}
|
|
5098
5094
|
const { context } = initOptions;
|
|
5099
5095
|
let compiler;
|
|
5100
5096
|
let bundlerConfigs;
|
|
@@ -6332,7 +6328,7 @@ var init_cleanOutput = __esm({
|
|
|
6332
6328
|
const config = api.getNormalizedConfig();
|
|
6333
6329
|
const cleanPath = (0, import_node_path23.join)(distPath, RSBUILD_OUTPUTS_PATH);
|
|
6334
6330
|
const { cleanDistPath } = config.output;
|
|
6335
|
-
if (cleanDistPath && isStrictSubdir(rootPath, cleanPath)) {
|
|
6331
|
+
if (cleanDistPath === true || cleanDistPath === "auto" && isStrictSubdir(rootPath, cleanPath)) {
|
|
6336
6332
|
return cleanPath;
|
|
6337
6333
|
}
|
|
6338
6334
|
return void 0;
|
|
@@ -6341,7 +6337,7 @@ var init_cleanOutput = __esm({
|
|
|
6341
6337
|
const { rootPath } = api.context;
|
|
6342
6338
|
const { config, distPath } = environment;
|
|
6343
6339
|
let { cleanDistPath } = config.output;
|
|
6344
|
-
if (cleanDistPath ===
|
|
6340
|
+
if (cleanDistPath === "auto") {
|
|
6345
6341
|
cleanDistPath = isStrictSubdir(rootPath, distPath);
|
|
6346
6342
|
if (!cleanDistPath) {
|
|
6347
6343
|
import_rslog.logger.warn(
|
|
@@ -6964,68 +6960,111 @@ var init_appIcon = __esm({
|
|
|
6964
6960
|
pluginAppIcon = () => ({
|
|
6965
6961
|
name: "rsbuild:app-icon",
|
|
6966
6962
|
setup(api) {
|
|
6967
|
-
const
|
|
6968
|
-
const
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
}
|
|
6973
|
-
const cached = cache.get(name);
|
|
6963
|
+
const htmlTagsMap = /* @__PURE__ */ new Map();
|
|
6964
|
+
const iconPathMap = /* @__PURE__ */ new Map();
|
|
6965
|
+
const formatIcon = (icon, distDir, publicPath) => {
|
|
6966
|
+
const { src, size } = icon;
|
|
6967
|
+
const cached = iconPathMap.get(src);
|
|
6968
|
+
const sizes = `${size}x${size}`;
|
|
6974
6969
|
if (cached) {
|
|
6975
|
-
|
|
6970
|
+
return {
|
|
6971
|
+
sizes,
|
|
6972
|
+
...cached,
|
|
6973
|
+
...icon
|
|
6974
|
+
};
|
|
6976
6975
|
}
|
|
6977
|
-
const
|
|
6978
|
-
const absolutePath = import_node_path27.default.isAbsolute(appIcon) ? appIcon : import_node_path27.default.join(api.context.rootPath, appIcon);
|
|
6976
|
+
const absolutePath = import_node_path27.default.isAbsolute(src) ? src : import_node_path27.default.join(api.context.rootPath, src);
|
|
6979
6977
|
const relativePath = import_node_path27.default.posix.join(
|
|
6980
6978
|
distDir,
|
|
6981
6979
|
import_node_path27.default.basename(absolutePath)
|
|
6982
6980
|
);
|
|
6981
|
+
const requestPath = ensureAssetPrefix(relativePath, publicPath);
|
|
6983
6982
|
const paths = {
|
|
6983
|
+
requestPath,
|
|
6984
6984
|
absolutePath,
|
|
6985
6985
|
relativePath
|
|
6986
6986
|
};
|
|
6987
|
-
|
|
6988
|
-
return
|
|
6987
|
+
iconPathMap.set(src, paths);
|
|
6988
|
+
return {
|
|
6989
|
+
sizes,
|
|
6990
|
+
...paths,
|
|
6991
|
+
...icon
|
|
6992
|
+
};
|
|
6989
6993
|
};
|
|
6990
6994
|
api.processAssets(
|
|
6991
6995
|
{ stage: "additional" },
|
|
6992
6996
|
async ({ compilation, environment, sources }) => {
|
|
6993
|
-
const
|
|
6994
|
-
|
|
6997
|
+
const { config } = environment;
|
|
6998
|
+
const { appIcon } = config.html;
|
|
6999
|
+
if (!appIcon) {
|
|
6995
7000
|
return;
|
|
6996
7001
|
}
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7002
|
+
const distDir = config.output.distPath.image;
|
|
7003
|
+
const publicPath = getPublicPathFromCompiler(compilation);
|
|
7004
|
+
const icons = appIcon.icons.map(
|
|
7005
|
+
(icon) => formatIcon(icon, distDir, publicPath)
|
|
7006
|
+
);
|
|
7007
|
+
const tags = [];
|
|
7008
|
+
for (const icon of icons) {
|
|
7009
|
+
if (!await isFileExists(icon.absolutePath)) {
|
|
7010
|
+
throw new Error(
|
|
7011
|
+
`[rsbuild:app-icon] Can not find the app icon, please check if the '${icon.relativePath}' file exists'.`
|
|
7012
|
+
);
|
|
7013
|
+
}
|
|
7014
|
+
const source = await import_node_fs8.default.promises.readFile(icon.absolutePath);
|
|
7015
|
+
compilation.emitAsset(
|
|
7016
|
+
icon.relativePath,
|
|
7017
|
+
new sources.RawSource(source)
|
|
7000
7018
|
);
|
|
7019
|
+
if (icon.size < 200) {
|
|
7020
|
+
tags.push({
|
|
7021
|
+
tag: "link",
|
|
7022
|
+
attrs: {
|
|
7023
|
+
rel: "apple-touch-icon",
|
|
7024
|
+
sizes: icon.sizes,
|
|
7025
|
+
href: icon.requestPath
|
|
7026
|
+
}
|
|
7027
|
+
});
|
|
7028
|
+
}
|
|
7001
7029
|
}
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7030
|
+
if (appIcon.name) {
|
|
7031
|
+
const manifestIcons = icons.map((icon) => ({
|
|
7032
|
+
src: icon.requestPath,
|
|
7033
|
+
sizes: icon.sizes
|
|
7034
|
+
}));
|
|
7035
|
+
const manifest = {
|
|
7036
|
+
name: appIcon.name,
|
|
7037
|
+
icons: manifestIcons
|
|
7038
|
+
};
|
|
7039
|
+
const manifestFile = "manifest.webmanifest";
|
|
7040
|
+
compilation.emitAsset(
|
|
7041
|
+
manifestFile,
|
|
7042
|
+
new sources.RawSource(JSON.stringify(manifest))
|
|
7043
|
+
);
|
|
7044
|
+
tags.push({
|
|
7045
|
+
tag: "link",
|
|
7046
|
+
attrs: {
|
|
7047
|
+
rel: "manifest",
|
|
7048
|
+
href: ensureAssetPrefix(manifestFile, publicPath)
|
|
7049
|
+
}
|
|
7050
|
+
});
|
|
7051
|
+
}
|
|
7052
|
+
if (tags.length) {
|
|
7053
|
+
htmlTagsMap.set(environment.name, tags);
|
|
7014
7054
|
}
|
|
7015
|
-
headTags.unshift({
|
|
7016
|
-
tag: "link",
|
|
7017
|
-
attrs: {
|
|
7018
|
-
rel: "apple-touch-icon",
|
|
7019
|
-
sizes: "180*180",
|
|
7020
|
-
href: ensureAssetPrefix(
|
|
7021
|
-
iconPath.relativePath,
|
|
7022
|
-
compilation.outputOptions.publicPath
|
|
7023
|
-
)
|
|
7024
|
-
}
|
|
7025
|
-
});
|
|
7026
|
-
return { headTags, bodyTags };
|
|
7027
7055
|
}
|
|
7028
7056
|
);
|
|
7057
|
+
api.modifyHTMLTags(({ headTags, bodyTags }, { environment }) => {
|
|
7058
|
+
const tags = htmlTagsMap.get(environment.name);
|
|
7059
|
+
if (tags) {
|
|
7060
|
+
headTags.unshift(...tags);
|
|
7061
|
+
}
|
|
7062
|
+
return { headTags, bodyTags };
|
|
7063
|
+
});
|
|
7064
|
+
api.onCloseDevServer(() => {
|
|
7065
|
+
htmlTagsMap.clear();
|
|
7066
|
+
iconPathMap.clear();
|
|
7067
|
+
});
|
|
7029
7068
|
}
|
|
7030
7069
|
});
|
|
7031
7070
|
}
|
|
@@ -9077,9 +9116,6 @@ __export(prodServer_exports, {
|
|
|
9077
9116
|
startProdServer: () => startProdServer
|
|
9078
9117
|
});
|
|
9079
9118
|
async function startProdServer(context, config, { getPortSilently } = {}) {
|
|
9080
|
-
if (!getNodeEnv()) {
|
|
9081
|
-
setNodeEnv("production");
|
|
9082
|
-
}
|
|
9083
9119
|
const { port, host, https } = await getServerConfig({
|
|
9084
9120
|
config,
|
|
9085
9121
|
getPortSilently
|
|
@@ -9148,7 +9184,6 @@ var RsbuildProdServer;
|
|
|
9148
9184
|
var init_prodServer = __esm({
|
|
9149
9185
|
"src/server/prodServer.ts"() {
|
|
9150
9186
|
"use strict";
|
|
9151
|
-
init_helpers();
|
|
9152
9187
|
init_path();
|
|
9153
9188
|
init_logger();
|
|
9154
9189
|
init_helper();
|
|
@@ -9342,11 +9377,36 @@ async function createRsbuild(options = {}) {
|
|
|
9342
9377
|
setCssExtractPlugin
|
|
9343
9378
|
});
|
|
9344
9379
|
const preview = async (options2) => {
|
|
9380
|
+
if (!getNodeEnv()) {
|
|
9381
|
+
setNodeEnv("production");
|
|
9382
|
+
}
|
|
9345
9383
|
const { startProdServer: startProdServer2 } = await Promise.resolve().then(() => (init_prodServer(), prodServer_exports));
|
|
9346
9384
|
const config = await initRsbuildConfig({ context, pluginManager });
|
|
9347
9385
|
return startProdServer2(context, config, options2);
|
|
9348
9386
|
};
|
|
9387
|
+
const build2 = (...args) => {
|
|
9388
|
+
if (!getNodeEnv()) {
|
|
9389
|
+
setNodeEnv("production");
|
|
9390
|
+
}
|
|
9391
|
+
return providerInstance.build(...args);
|
|
9392
|
+
};
|
|
9393
|
+
const startDevServer = (...args) => {
|
|
9394
|
+
if (!getNodeEnv()) {
|
|
9395
|
+
setNodeEnv("development");
|
|
9396
|
+
}
|
|
9397
|
+
return providerInstance.startDevServer(...args);
|
|
9398
|
+
};
|
|
9399
|
+
const createDevServer2 = (...args) => {
|
|
9400
|
+
if (!getNodeEnv()) {
|
|
9401
|
+
setNodeEnv("development");
|
|
9402
|
+
}
|
|
9403
|
+
return providerInstance.createDevServer(...args);
|
|
9404
|
+
};
|
|
9349
9405
|
const rsbuild = {
|
|
9406
|
+
build: build2,
|
|
9407
|
+
preview,
|
|
9408
|
+
startDevServer,
|
|
9409
|
+
createDevServer: createDevServer2,
|
|
9350
9410
|
...pick(pluginManager, [
|
|
9351
9411
|
"addPlugins",
|
|
9352
9412
|
"getPlugins",
|
|
@@ -9354,6 +9414,7 @@ async function createRsbuild(options = {}) {
|
|
|
9354
9414
|
"isPluginExists"
|
|
9355
9415
|
]),
|
|
9356
9416
|
...pick(globalPluginAPI, [
|
|
9417
|
+
"context",
|
|
9357
9418
|
"onBeforeBuild",
|
|
9358
9419
|
"onBeforeCreateCompiler",
|
|
9359
9420
|
"onBeforeStartDevServer",
|
|
@@ -9369,15 +9430,10 @@ async function createRsbuild(options = {}) {
|
|
|
9369
9430
|
"getNormalizedConfig"
|
|
9370
9431
|
]),
|
|
9371
9432
|
...pick(providerInstance, [
|
|
9372
|
-
"build",
|
|
9373
9433
|
"initConfigs",
|
|
9374
9434
|
"inspectConfig",
|
|
9375
|
-
"createCompiler"
|
|
9376
|
-
|
|
9377
|
-
"startDevServer"
|
|
9378
|
-
]),
|
|
9379
|
-
preview,
|
|
9380
|
-
context: globalPluginAPI.context
|
|
9435
|
+
"createCompiler"
|
|
9436
|
+
])
|
|
9381
9437
|
};
|
|
9382
9438
|
if (rsbuildConfig.plugins) {
|
|
9383
9439
|
const plugins = await Promise.all(rsbuildConfig.plugins);
|
|
@@ -9510,7 +9566,7 @@ var init_init = __esm({
|
|
|
9510
9566
|
|
|
9511
9567
|
// src/cli/commands.ts
|
|
9512
9568
|
function runCli() {
|
|
9513
|
-
import_commander.program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.
|
|
9569
|
+
import_commander.program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.14");
|
|
9514
9570
|
const devCommand = import_commander.program.command("dev");
|
|
9515
9571
|
const buildCommand = import_commander.program.command("build");
|
|
9516
9572
|
const previewCommand = import_commander.program.command("preview");
|
|
@@ -9633,7 +9689,7 @@ function prepareCli() {
|
|
|
9633
9689
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
9634
9690
|
console.log();
|
|
9635
9691
|
}
|
|
9636
|
-
import_rslog.logger.greet(` ${`Rsbuild v${"1.0.1-beta.
|
|
9692
|
+
import_rslog.logger.greet(` ${`Rsbuild v${"1.0.1-beta.14"}`}
|
|
9637
9693
|
`);
|
|
9638
9694
|
}
|
|
9639
9695
|
var init_prepare = __esm({
|
|
@@ -9719,7 +9775,7 @@ init_logger();
|
|
|
9719
9775
|
init_mergeConfig();
|
|
9720
9776
|
init_helpers();
|
|
9721
9777
|
init_constants();
|
|
9722
|
-
var version = "1.0.1-beta.
|
|
9778
|
+
var version = "1.0.1-beta.14";
|
|
9723
9779
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9724
9780
|
0 && (module.exports = {
|
|
9725
9781
|
PLUGIN_CSS_NAME,
|
package/dist/index.js
CHANGED
|
@@ -1207,6 +1207,7 @@ var init_config = __esm({
|
|
|
1207
1207
|
});
|
|
1208
1208
|
getDefaultOutputConfig = () => ({
|
|
1209
1209
|
target: "web",
|
|
1210
|
+
cleanDistPath: "auto",
|
|
1210
1211
|
distPath: {
|
|
1211
1212
|
root: ROOT_DIST_DIR,
|
|
1212
1213
|
css: CSS_DIST_DIR,
|
|
@@ -2320,7 +2321,7 @@ async function createContext(options, userConfig, bundlerType) {
|
|
|
2320
2321
|
const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
|
|
2321
2322
|
const cachePath = join6(rootPath, "node_modules", ".cache");
|
|
2322
2323
|
return {
|
|
2323
|
-
version: "1.0.1-beta.
|
|
2324
|
+
version: "1.0.1-beta.14",
|
|
2324
2325
|
rootPath,
|
|
2325
2326
|
distPath: "",
|
|
2326
2327
|
cachePath,
|
|
@@ -4917,9 +4918,6 @@ async function createDevServer(options, createDevMiddleware2, config, {
|
|
|
4917
4918
|
getPortSilently,
|
|
4918
4919
|
runCompile = true
|
|
4919
4920
|
} = {}) {
|
|
4920
|
-
if (!getNodeEnv()) {
|
|
4921
|
-
setNodeEnv("development");
|
|
4922
|
-
}
|
|
4923
4921
|
logger.debug("create dev server");
|
|
4924
4922
|
const { port, host, https } = await getServerConfig({
|
|
4925
4923
|
config,
|
|
@@ -5102,7 +5100,9 @@ async function createDevServer(options, createDevMiddleware2, config, {
|
|
|
5102
5100
|
environments: options.context.environments
|
|
5103
5101
|
});
|
|
5104
5102
|
},
|
|
5105
|
-
|
|
5103
|
+
connectWebSocket: ({ server: server2 }) => {
|
|
5104
|
+
server2.on("upgrade", devMiddlewares.onUpgrade);
|
|
5105
|
+
},
|
|
5106
5106
|
close: async () => {
|
|
5107
5107
|
await options.context.hooks.onCloseDevServer.call();
|
|
5108
5108
|
await devMiddlewares.close();
|
|
@@ -5147,15 +5147,11 @@ var init_build = __esm({
|
|
|
5147
5147
|
"src/provider/build.ts"() {
|
|
5148
5148
|
"use strict";
|
|
5149
5149
|
init_esm();
|
|
5150
|
-
init_helpers();
|
|
5151
5150
|
init_hooks();
|
|
5152
5151
|
init_logger();
|
|
5153
5152
|
init_createCompiler();
|
|
5154
5153
|
init_initConfigs();
|
|
5155
5154
|
build = async (initOptions, { watch, compiler: customCompiler } = {}) => {
|
|
5156
|
-
if (!getNodeEnv()) {
|
|
5157
|
-
setNodeEnv("production");
|
|
5158
|
-
}
|
|
5159
5155
|
const { context } = initOptions;
|
|
5160
5156
|
let compiler;
|
|
5161
5157
|
let bundlerConfigs;
|
|
@@ -6405,7 +6401,7 @@ var init_cleanOutput = __esm({
|
|
|
6405
6401
|
const config = api.getNormalizedConfig();
|
|
6406
6402
|
const cleanPath = join11(distPath, RSBUILD_OUTPUTS_PATH);
|
|
6407
6403
|
const { cleanDistPath } = config.output;
|
|
6408
|
-
if (cleanDistPath && isStrictSubdir(rootPath, cleanPath)) {
|
|
6404
|
+
if (cleanDistPath === true || cleanDistPath === "auto" && isStrictSubdir(rootPath, cleanPath)) {
|
|
6409
6405
|
return cleanPath;
|
|
6410
6406
|
}
|
|
6411
6407
|
return void 0;
|
|
@@ -6414,7 +6410,7 @@ var init_cleanOutput = __esm({
|
|
|
6414
6410
|
const { rootPath } = api.context;
|
|
6415
6411
|
const { config, distPath } = environment;
|
|
6416
6412
|
let { cleanDistPath } = config.output;
|
|
6417
|
-
if (cleanDistPath ===
|
|
6413
|
+
if (cleanDistPath === "auto") {
|
|
6418
6414
|
cleanDistPath = isStrictSubdir(rootPath, distPath);
|
|
6419
6415
|
if (!cleanDistPath) {
|
|
6420
6416
|
logger.warn(
|
|
@@ -7041,68 +7037,111 @@ var init_appIcon = __esm({
|
|
|
7041
7037
|
pluginAppIcon = () => ({
|
|
7042
7038
|
name: "rsbuild:app-icon",
|
|
7043
7039
|
setup(api) {
|
|
7044
|
-
const
|
|
7045
|
-
const
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
}
|
|
7050
|
-
const cached = cache.get(name);
|
|
7040
|
+
const htmlTagsMap = /* @__PURE__ */ new Map();
|
|
7041
|
+
const iconPathMap = /* @__PURE__ */ new Map();
|
|
7042
|
+
const formatIcon = (icon, distDir, publicPath) => {
|
|
7043
|
+
const { src, size } = icon;
|
|
7044
|
+
const cached = iconPathMap.get(src);
|
|
7045
|
+
const sizes = `${size}x${size}`;
|
|
7051
7046
|
if (cached) {
|
|
7052
|
-
|
|
7047
|
+
return {
|
|
7048
|
+
sizes,
|
|
7049
|
+
...cached,
|
|
7050
|
+
...icon
|
|
7051
|
+
};
|
|
7053
7052
|
}
|
|
7054
|
-
const
|
|
7055
|
-
const absolutePath = path14.isAbsolute(appIcon) ? appIcon : path14.join(api.context.rootPath, appIcon);
|
|
7053
|
+
const absolutePath = path14.isAbsolute(src) ? src : path14.join(api.context.rootPath, src);
|
|
7056
7054
|
const relativePath = path14.posix.join(
|
|
7057
7055
|
distDir,
|
|
7058
7056
|
path14.basename(absolutePath)
|
|
7059
7057
|
);
|
|
7058
|
+
const requestPath = ensureAssetPrefix(relativePath, publicPath);
|
|
7060
7059
|
const paths = {
|
|
7060
|
+
requestPath,
|
|
7061
7061
|
absolutePath,
|
|
7062
7062
|
relativePath
|
|
7063
7063
|
};
|
|
7064
|
-
|
|
7065
|
-
return
|
|
7064
|
+
iconPathMap.set(src, paths);
|
|
7065
|
+
return {
|
|
7066
|
+
sizes,
|
|
7067
|
+
...paths,
|
|
7068
|
+
...icon
|
|
7069
|
+
};
|
|
7066
7070
|
};
|
|
7067
7071
|
api.processAssets(
|
|
7068
7072
|
{ stage: "additional" },
|
|
7069
7073
|
async ({ compilation, environment, sources }) => {
|
|
7070
|
-
const
|
|
7071
|
-
|
|
7074
|
+
const { config } = environment;
|
|
7075
|
+
const { appIcon } = config.html;
|
|
7076
|
+
if (!appIcon) {
|
|
7072
7077
|
return;
|
|
7073
7078
|
}
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7079
|
+
const distDir = config.output.distPath.image;
|
|
7080
|
+
const publicPath = getPublicPathFromCompiler(compilation);
|
|
7081
|
+
const icons = appIcon.icons.map(
|
|
7082
|
+
(icon) => formatIcon(icon, distDir, publicPath)
|
|
7083
|
+
);
|
|
7084
|
+
const tags = [];
|
|
7085
|
+
for (const icon of icons) {
|
|
7086
|
+
if (!await isFileExists(icon.absolutePath)) {
|
|
7087
|
+
throw new Error(
|
|
7088
|
+
`[rsbuild:app-icon] Can not find the app icon, please check if the '${icon.relativePath}' file exists'.`
|
|
7089
|
+
);
|
|
7090
|
+
}
|
|
7091
|
+
const source = await fs8.promises.readFile(icon.absolutePath);
|
|
7092
|
+
compilation.emitAsset(
|
|
7093
|
+
icon.relativePath,
|
|
7094
|
+
new sources.RawSource(source)
|
|
7077
7095
|
);
|
|
7096
|
+
if (icon.size < 200) {
|
|
7097
|
+
tags.push({
|
|
7098
|
+
tag: "link",
|
|
7099
|
+
attrs: {
|
|
7100
|
+
rel: "apple-touch-icon",
|
|
7101
|
+
sizes: icon.sizes,
|
|
7102
|
+
href: icon.requestPath
|
|
7103
|
+
}
|
|
7104
|
+
});
|
|
7105
|
+
}
|
|
7078
7106
|
}
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7107
|
+
if (appIcon.name) {
|
|
7108
|
+
const manifestIcons = icons.map((icon) => ({
|
|
7109
|
+
src: icon.requestPath,
|
|
7110
|
+
sizes: icon.sizes
|
|
7111
|
+
}));
|
|
7112
|
+
const manifest = {
|
|
7113
|
+
name: appIcon.name,
|
|
7114
|
+
icons: manifestIcons
|
|
7115
|
+
};
|
|
7116
|
+
const manifestFile = "manifest.webmanifest";
|
|
7117
|
+
compilation.emitAsset(
|
|
7118
|
+
manifestFile,
|
|
7119
|
+
new sources.RawSource(JSON.stringify(manifest))
|
|
7120
|
+
);
|
|
7121
|
+
tags.push({
|
|
7122
|
+
tag: "link",
|
|
7123
|
+
attrs: {
|
|
7124
|
+
rel: "manifest",
|
|
7125
|
+
href: ensureAssetPrefix(manifestFile, publicPath)
|
|
7126
|
+
}
|
|
7127
|
+
});
|
|
7128
|
+
}
|
|
7129
|
+
if (tags.length) {
|
|
7130
|
+
htmlTagsMap.set(environment.name, tags);
|
|
7091
7131
|
}
|
|
7092
|
-
headTags.unshift({
|
|
7093
|
-
tag: "link",
|
|
7094
|
-
attrs: {
|
|
7095
|
-
rel: "apple-touch-icon",
|
|
7096
|
-
sizes: "180*180",
|
|
7097
|
-
href: ensureAssetPrefix(
|
|
7098
|
-
iconPath.relativePath,
|
|
7099
|
-
compilation.outputOptions.publicPath
|
|
7100
|
-
)
|
|
7101
|
-
}
|
|
7102
|
-
});
|
|
7103
|
-
return { headTags, bodyTags };
|
|
7104
7132
|
}
|
|
7105
7133
|
);
|
|
7134
|
+
api.modifyHTMLTags(({ headTags, bodyTags }, { environment }) => {
|
|
7135
|
+
const tags = htmlTagsMap.get(environment.name);
|
|
7136
|
+
if (tags) {
|
|
7137
|
+
headTags.unshift(...tags);
|
|
7138
|
+
}
|
|
7139
|
+
return { headTags, bodyTags };
|
|
7140
|
+
});
|
|
7141
|
+
api.onCloseDevServer(() => {
|
|
7142
|
+
htmlTagsMap.clear();
|
|
7143
|
+
iconPathMap.clear();
|
|
7144
|
+
});
|
|
7106
7145
|
}
|
|
7107
7146
|
});
|
|
7108
7147
|
}
|
|
@@ -9180,9 +9219,6 @@ __export(prodServer_exports, {
|
|
|
9180
9219
|
startProdServer: () => startProdServer
|
|
9181
9220
|
});
|
|
9182
9221
|
async function startProdServer(context, config, { getPortSilently } = {}) {
|
|
9183
|
-
if (!getNodeEnv()) {
|
|
9184
|
-
setNodeEnv("production");
|
|
9185
|
-
}
|
|
9186
9222
|
const { port, host, https } = await getServerConfig({
|
|
9187
9223
|
config,
|
|
9188
9224
|
getPortSilently
|
|
@@ -9252,7 +9288,6 @@ var init_prodServer = __esm({
|
|
|
9252
9288
|
"src/server/prodServer.ts"() {
|
|
9253
9289
|
"use strict";
|
|
9254
9290
|
init_esm();
|
|
9255
|
-
init_helpers();
|
|
9256
9291
|
init_path();
|
|
9257
9292
|
init_logger();
|
|
9258
9293
|
init_helper();
|
|
@@ -9446,11 +9481,36 @@ async function createRsbuild(options = {}) {
|
|
|
9446
9481
|
setCssExtractPlugin
|
|
9447
9482
|
});
|
|
9448
9483
|
const preview = async (options2) => {
|
|
9484
|
+
if (!getNodeEnv()) {
|
|
9485
|
+
setNodeEnv("production");
|
|
9486
|
+
}
|
|
9449
9487
|
const { startProdServer: startProdServer2 } = await Promise.resolve().then(() => (init_prodServer(), prodServer_exports));
|
|
9450
9488
|
const config = await initRsbuildConfig({ context, pluginManager });
|
|
9451
9489
|
return startProdServer2(context, config, options2);
|
|
9452
9490
|
};
|
|
9491
|
+
const build2 = (...args) => {
|
|
9492
|
+
if (!getNodeEnv()) {
|
|
9493
|
+
setNodeEnv("production");
|
|
9494
|
+
}
|
|
9495
|
+
return providerInstance.build(...args);
|
|
9496
|
+
};
|
|
9497
|
+
const startDevServer = (...args) => {
|
|
9498
|
+
if (!getNodeEnv()) {
|
|
9499
|
+
setNodeEnv("development");
|
|
9500
|
+
}
|
|
9501
|
+
return providerInstance.startDevServer(...args);
|
|
9502
|
+
};
|
|
9503
|
+
const createDevServer2 = (...args) => {
|
|
9504
|
+
if (!getNodeEnv()) {
|
|
9505
|
+
setNodeEnv("development");
|
|
9506
|
+
}
|
|
9507
|
+
return providerInstance.createDevServer(...args);
|
|
9508
|
+
};
|
|
9453
9509
|
const rsbuild = {
|
|
9510
|
+
build: build2,
|
|
9511
|
+
preview,
|
|
9512
|
+
startDevServer,
|
|
9513
|
+
createDevServer: createDevServer2,
|
|
9454
9514
|
...pick(pluginManager, [
|
|
9455
9515
|
"addPlugins",
|
|
9456
9516
|
"getPlugins",
|
|
@@ -9458,6 +9518,7 @@ async function createRsbuild(options = {}) {
|
|
|
9458
9518
|
"isPluginExists"
|
|
9459
9519
|
]),
|
|
9460
9520
|
...pick(globalPluginAPI, [
|
|
9521
|
+
"context",
|
|
9461
9522
|
"onBeforeBuild",
|
|
9462
9523
|
"onBeforeCreateCompiler",
|
|
9463
9524
|
"onBeforeStartDevServer",
|
|
@@ -9473,15 +9534,10 @@ async function createRsbuild(options = {}) {
|
|
|
9473
9534
|
"getNormalizedConfig"
|
|
9474
9535
|
]),
|
|
9475
9536
|
...pick(providerInstance, [
|
|
9476
|
-
"build",
|
|
9477
9537
|
"initConfigs",
|
|
9478
9538
|
"inspectConfig",
|
|
9479
|
-
"createCompiler"
|
|
9480
|
-
|
|
9481
|
-
"startDevServer"
|
|
9482
|
-
]),
|
|
9483
|
-
preview,
|
|
9484
|
-
context: globalPluginAPI.context
|
|
9539
|
+
"createCompiler"
|
|
9540
|
+
])
|
|
9485
9541
|
};
|
|
9486
9542
|
if (rsbuildConfig.plugins) {
|
|
9487
9543
|
const plugins = await Promise.all(rsbuildConfig.plugins);
|
|
@@ -9619,7 +9675,7 @@ import { existsSync } from "fs";
|
|
|
9619
9675
|
import { program } from "../compiled/commander/index.js";
|
|
9620
9676
|
import color16 from "../compiled/picocolors/index.js";
|
|
9621
9677
|
function runCli() {
|
|
9622
|
-
program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.
|
|
9678
|
+
program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.14");
|
|
9623
9679
|
const devCommand = program.command("dev");
|
|
9624
9680
|
const buildCommand = program.command("build");
|
|
9625
9681
|
const previewCommand = program.command("preview");
|
|
@@ -9740,7 +9796,7 @@ function prepareCli() {
|
|
|
9740
9796
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
9741
9797
|
console.log();
|
|
9742
9798
|
}
|
|
9743
|
-
logger.greet(` ${`Rsbuild v${"1.0.1-beta.
|
|
9799
|
+
logger.greet(` ${`Rsbuild v${"1.0.1-beta.14"}`}
|
|
9744
9800
|
`);
|
|
9745
9801
|
}
|
|
9746
9802
|
var init_prepare = __esm({
|
|
@@ -9813,7 +9869,7 @@ init_mergeConfig();
|
|
|
9813
9869
|
init_helpers();
|
|
9814
9870
|
init_constants();
|
|
9815
9871
|
import { rspack as rspack10 } from "@rspack/core";
|
|
9816
|
-
var version = "1.0.1-beta.
|
|
9872
|
+
var version = "1.0.1-beta.14";
|
|
9817
9873
|
export {
|
|
9818
9874
|
PLUGIN_CSS_NAME,
|
|
9819
9875
|
PLUGIN_SWC_NAME,
|
|
@@ -19,7 +19,7 @@ export declare const removeTailingSlash: (s: string) => string;
|
|
|
19
19
|
export declare const addTrailingSlash: (s: string) => string;
|
|
20
20
|
export declare const formatPublicPath: (publicPath: string, withSlash?: boolean) => string;
|
|
21
21
|
export declare const getPublicPathFromChain: (chain: RspackChain, withSlash?: boolean) => string;
|
|
22
|
-
export declare const getPublicPathFromCompiler: (compiler: Rspack.Compiler) => string;
|
|
22
|
+
export declare const getPublicPathFromCompiler: (compiler: Rspack.Compiler | Rspack.Compilation) => string;
|
|
23
23
|
export declare const canParse: (url: string) => boolean;
|
|
24
24
|
export declare const ensureAssetPrefix: (url: string, assetPrefix?: Rspack.PublicPath) => string;
|
|
25
25
|
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'js', isProd: boolean, isServer?: boolean): NonNullable<FilenameConfig['js']>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { Server } from 'node:http';
|
|
2
|
+
import type { Http2SecureServer } from 'node:http2';
|
|
1
3
|
import type Connect from '../../compiled/connect';
|
|
2
4
|
import type { CreateDevMiddlewareReturns } from '../provider/createCompiler';
|
|
3
5
|
import type { CreateDevServerOptions, EnvironmentAPI, InternalContext, NormalizedConfig, StartDevServerOptions } from '../types';
|
|
4
|
-
|
|
6
|
+
type HTTPServer = Server | Http2SecureServer;
|
|
5
7
|
export type RsbuildDevServer = {
|
|
6
8
|
/**
|
|
7
9
|
* Use rsbuild inner server to listen
|
|
@@ -35,11 +37,13 @@ export type RsbuildDevServer = {
|
|
|
35
37
|
*/
|
|
36
38
|
afterListen: () => Promise<void>;
|
|
37
39
|
/**
|
|
38
|
-
*
|
|
40
|
+
* Activate socket connection
|
|
39
41
|
*
|
|
40
42
|
* It will used when you use custom server
|
|
41
43
|
*/
|
|
42
|
-
|
|
44
|
+
connectWebSocket: (options: {
|
|
45
|
+
server: HTTPServer;
|
|
46
|
+
}) => void;
|
|
43
47
|
/**
|
|
44
48
|
* Close the Rsbuild server.
|
|
45
49
|
*/
|
|
@@ -48,3 +52,4 @@ export type RsbuildDevServer = {
|
|
|
48
52
|
export declare function createDevServer<Options extends {
|
|
49
53
|
context: InternalContext;
|
|
50
54
|
}>(options: Options, createDevMiddleware: (options: Options, compiler: StartDevServerOptions['compiler']) => Promise<CreateDevMiddlewareReturns>, config: NormalizedConfig, { compiler: customCompiler, getPortSilently, runCompile, }?: CreateDevServerOptions): Promise<RsbuildDevServer>;
|
|
55
|
+
export {};
|
|
@@ -40,6 +40,10 @@ export type HtmlTagDescriptor = HtmlTag | HtmlTagHandler;
|
|
|
40
40
|
type ChainedHtmlOption<O> = ConfigChainMergeContext<O, {
|
|
41
41
|
entryName: string;
|
|
42
42
|
}>;
|
|
43
|
+
export type AppIconItem = {
|
|
44
|
+
src: string;
|
|
45
|
+
size: number;
|
|
46
|
+
};
|
|
43
47
|
export interface HtmlConfig {
|
|
44
48
|
/**
|
|
45
49
|
* Configure the `<meta>` tag of the HTML.
|
|
@@ -63,8 +67,20 @@ export interface HtmlConfig {
|
|
|
63
67
|
favicon?: ChainedHtmlOption<string>;
|
|
64
68
|
/**
|
|
65
69
|
* Set the file path of the app icon, which can be a relative path or an absolute path.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* appIcon: {
|
|
73
|
+
* name: 'My Website',
|
|
74
|
+
* icons: [
|
|
75
|
+
* { src: './icon-192.png', size: 192 },
|
|
76
|
+
* { src: './icon-512.png', size: 512 },
|
|
77
|
+
* ]
|
|
78
|
+
* }
|
|
66
79
|
*/
|
|
67
|
-
appIcon?:
|
|
80
|
+
appIcon?: {
|
|
81
|
+
name?: string;
|
|
82
|
+
icons: AppIconItem[];
|
|
83
|
+
};
|
|
68
84
|
/**
|
|
69
85
|
* Set the id of root element.
|
|
70
86
|
*/
|
|
@@ -223,8 +223,9 @@ export interface OutputConfig {
|
|
|
223
223
|
legalComments?: LegalComments;
|
|
224
224
|
/**
|
|
225
225
|
* Whether to clean all files in the dist path before starting compilation.
|
|
226
|
+
* @default 'auto'
|
|
226
227
|
*/
|
|
227
|
-
cleanDistPath?: boolean;
|
|
228
|
+
cleanDistPath?: boolean | 'auto';
|
|
228
229
|
/**
|
|
229
230
|
* Allow to custom CSS Modules options.
|
|
230
231
|
*/
|
|
@@ -61,17 +61,20 @@ export type CreateRsbuildOptions = {
|
|
|
61
61
|
environment?: string[];
|
|
62
62
|
};
|
|
63
63
|
export type ResolvedCreateRsbuildOptions = CreateRsbuildOptions & Required<Omit<CreateRsbuildOptions, 'environment'>>;
|
|
64
|
+
export type CreateDevServer = (options?: CreateDevServerOptions) => Promise<RsbuildDevServer>;
|
|
65
|
+
export type StartDevServer = (options?: StartDevServerOptions) => Promise<StartServerResult>;
|
|
66
|
+
export type Build = (options?: BuildOptions) => Promise<void | {
|
|
67
|
+
close: () => Promise<void>;
|
|
68
|
+
}>;
|
|
64
69
|
export type ProviderInstance<B extends 'rspack' | 'webpack' = 'rspack'> = {
|
|
65
70
|
readonly bundler: Bundler;
|
|
66
71
|
createCompiler: CreateCompiler;
|
|
67
72
|
/**
|
|
68
|
-
* It is designed for
|
|
73
|
+
* It is designed for upper-level frameworks that require a custom server
|
|
69
74
|
*/
|
|
70
|
-
createDevServer:
|
|
71
|
-
startDevServer:
|
|
72
|
-
build:
|
|
73
|
-
close: () => Promise<void>;
|
|
74
|
-
}>;
|
|
75
|
+
createDevServer: CreateDevServer;
|
|
76
|
+
startDevServer: StartDevServer;
|
|
77
|
+
build: Build;
|
|
75
78
|
initConfigs: () => Promise<B extends 'rspack' ? Rspack.Configuration[] : WebpackConfig[]>;
|
|
76
79
|
inspectConfig: (options?: InspectConfigOptions) => Promise<InspectConfigResult<B>>;
|
|
77
80
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.14",
|
|
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.0.0-beta.
|
|
49
|
+
"@rspack/core": "1.0.0-beta.5",
|
|
50
50
|
"@rspack/lite-tapable": "1.0.0",
|
|
51
51
|
"@swc/helpers": "0.5.11",
|
|
52
52
|
"caniuse-lite": "^1.0.30001651",
|