@rsbuild/core 1.0.1-beta.13 → 1.0.1-beta.15
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 +640 -90
- package/dist/index.js +636 -85
- package/dist-types/helpers/fs.d.ts +2 -0
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/server/devServer.d.ts +8 -3
- package/dist-types/types/config/html.d.ts +44 -2
- package/dist-types/types/config/output.d.ts +5 -4
- package/dist-types/types/rsbuild.d.ts +18 -8
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -268,6 +268,17 @@ async function pathExists(path20) {
|
|
|
268
268
|
async function isFileExists(file) {
|
|
269
269
|
return import_node_fs.default.promises.access(file, import_node_fs.default.constants.F_OK).then(() => true).catch(() => false);
|
|
270
270
|
}
|
|
271
|
+
async function fileExistsByCompilation(compilation, filePath) {
|
|
272
|
+
return new Promise((resolve2) => {
|
|
273
|
+
compilation.inputFileSystem.stat(filePath, (err, stats) => {
|
|
274
|
+
if (err) {
|
|
275
|
+
resolve2(false);
|
|
276
|
+
} else {
|
|
277
|
+
resolve2(stats.isFile());
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
}
|
|
271
282
|
async function emptyDir(dir) {
|
|
272
283
|
if (!await pathExists(dir)) {
|
|
273
284
|
return;
|
|
@@ -1174,6 +1185,7 @@ var init_config = __esm({
|
|
|
1174
1185
|
});
|
|
1175
1186
|
getDefaultOutputConfig = () => ({
|
|
1176
1187
|
target: "web",
|
|
1188
|
+
cleanDistPath: "auto",
|
|
1177
1189
|
distPath: {
|
|
1178
1190
|
root: ROOT_DIST_DIR,
|
|
1179
1191
|
css: CSS_DIST_DIR,
|
|
@@ -1186,7 +1198,7 @@ var init_config = __esm({
|
|
|
1186
1198
|
},
|
|
1187
1199
|
assetPrefix: DEFAULT_ASSET_PREFIX,
|
|
1188
1200
|
filename: {},
|
|
1189
|
-
charset: "
|
|
1201
|
+
charset: "utf8",
|
|
1190
1202
|
polyfill: "off",
|
|
1191
1203
|
dataUriLimit: {
|
|
1192
1204
|
svg: DEFAULT_DATA_URL_SIZE,
|
|
@@ -2282,7 +2294,7 @@ async function createContext(options, userConfig, bundlerType) {
|
|
|
2282
2294
|
const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
|
|
2283
2295
|
const cachePath = (0, import_node_path9.join)(rootPath, "node_modules", ".cache");
|
|
2284
2296
|
return {
|
|
2285
|
-
version: "1.0.1-beta.
|
|
2297
|
+
version: "1.0.1-beta.15",
|
|
2286
2298
|
rootPath,
|
|
2287
2299
|
distPath: "",
|
|
2288
2300
|
cachePath,
|
|
@@ -2312,7 +2324,10 @@ var init_createContext = __esm({
|
|
|
2312
2324
|
return {};
|
|
2313
2325
|
}
|
|
2314
2326
|
return Object.keys(entry).reduce((prev, key) => {
|
|
2315
|
-
|
|
2327
|
+
const entryValue = entry[key];
|
|
2328
|
+
if (typeof entryValue === "string" || Array.isArray(entryValue) || entryValue.html !== false) {
|
|
2329
|
+
prev[key] = getHTMLPathByEntry(key, config);
|
|
2330
|
+
}
|
|
2316
2331
|
return prev;
|
|
2317
2332
|
}, {});
|
|
2318
2333
|
};
|
|
@@ -3000,7 +3015,7 @@ var init_initConfigs = __esm({
|
|
|
3000
3015
|
const { assetPrefix, lazyCompilation } = dev;
|
|
3001
3016
|
const isEnvironmentEnabled = (name) => !specifiedEnvironments || specifiedEnvironments.includes(name);
|
|
3002
3017
|
const applyEnvironmentDefaultConfig = (config) => {
|
|
3003
|
-
if (!config.source.entry) {
|
|
3018
|
+
if (!config.source.entry || Object.keys(config.source.entry).length === 0) {
|
|
3004
3019
|
config.source.entry = getDefaultEntryWithMemo();
|
|
3005
3020
|
}
|
|
3006
3021
|
const isServer = config.output.target === "node";
|
|
@@ -4857,9 +4872,6 @@ async function createDevServer(options, createDevMiddleware2, config, {
|
|
|
4857
4872
|
getPortSilently,
|
|
4858
4873
|
runCompile = true
|
|
4859
4874
|
} = {}) {
|
|
4860
|
-
if (!getNodeEnv()) {
|
|
4861
|
-
setNodeEnv("development");
|
|
4862
|
-
}
|
|
4863
4875
|
import_rslog.logger.debug("create dev server");
|
|
4864
4876
|
const { port, host, https } = await getServerConfig({
|
|
4865
4877
|
config,
|
|
@@ -5042,7 +5054,9 @@ async function createDevServer(options, createDevMiddleware2, config, {
|
|
|
5042
5054
|
environments: options.context.environments
|
|
5043
5055
|
});
|
|
5044
5056
|
},
|
|
5045
|
-
|
|
5057
|
+
connectWebSocket: ({ server: server2 }) => {
|
|
5058
|
+
server2.on("upgrade", devMiddlewares.onUpgrade);
|
|
5059
|
+
},
|
|
5046
5060
|
close: async () => {
|
|
5047
5061
|
await options.context.hooks.onCloseDevServer.call();
|
|
5048
5062
|
await devMiddlewares.close();
|
|
@@ -5086,15 +5100,11 @@ var init_build = __esm({
|
|
|
5086
5100
|
"src/provider/build.ts"() {
|
|
5087
5101
|
"use strict";
|
|
5088
5102
|
import_core4 = require("@rspack/core");
|
|
5089
|
-
init_helpers();
|
|
5090
5103
|
init_hooks();
|
|
5091
5104
|
init_logger();
|
|
5092
5105
|
init_createCompiler();
|
|
5093
5106
|
init_initConfigs();
|
|
5094
5107
|
build = async (initOptions, { watch, compiler: customCompiler } = {}) => {
|
|
5095
|
-
if (!getNodeEnv()) {
|
|
5096
|
-
setNodeEnv("production");
|
|
5097
|
-
}
|
|
5098
5108
|
const { context } = initOptions;
|
|
5099
5109
|
let compiler;
|
|
5100
5110
|
let bundlerConfigs;
|
|
@@ -5303,7 +5313,12 @@ var init_entry = __esm({
|
|
|
5303
5313
|
for (const entryName of Object.keys(entry)) {
|
|
5304
5314
|
const entryPoint = chain.entry(entryName);
|
|
5305
5315
|
const addEntry = (item) => {
|
|
5306
|
-
|
|
5316
|
+
if (typeof item === "object" && "html" in item) {
|
|
5317
|
+
const { html, ...rest } = item;
|
|
5318
|
+
entryPoint.add(rest);
|
|
5319
|
+
} else {
|
|
5320
|
+
entryPoint.add(item);
|
|
5321
|
+
}
|
|
5307
5322
|
};
|
|
5308
5323
|
preEntry.forEach(addEntry);
|
|
5309
5324
|
if (injectCoreJsEntry) {
|
|
@@ -6332,7 +6347,7 @@ var init_cleanOutput = __esm({
|
|
|
6332
6347
|
const config = api.getNormalizedConfig();
|
|
6333
6348
|
const cleanPath = (0, import_node_path23.join)(distPath, RSBUILD_OUTPUTS_PATH);
|
|
6334
6349
|
const { cleanDistPath } = config.output;
|
|
6335
|
-
if (cleanDistPath && isStrictSubdir(rootPath, cleanPath)) {
|
|
6350
|
+
if (cleanDistPath === true || cleanDistPath === "auto" && isStrictSubdir(rootPath, cleanPath)) {
|
|
6336
6351
|
return cleanPath;
|
|
6337
6352
|
}
|
|
6338
6353
|
return void 0;
|
|
@@ -6341,7 +6356,7 @@ var init_cleanOutput = __esm({
|
|
|
6341
6356
|
const { rootPath } = api.context;
|
|
6342
6357
|
const { config, distPath } = environment;
|
|
6343
6358
|
let { cleanDistPath } = config.output;
|
|
6344
|
-
if (cleanDistPath ===
|
|
6359
|
+
if (cleanDistPath === "auto") {
|
|
6345
6360
|
cleanDistPath = isStrictSubdir(rootPath, distPath);
|
|
6346
6361
|
if (!cleanDistPath) {
|
|
6347
6362
|
import_rslog.logger.warn(
|
|
@@ -6848,7 +6863,9 @@ var init_html = __esm({
|
|
|
6848
6863
|
}
|
|
6849
6864
|
const assetPrefix = getPublicPathFromChain(chain, false);
|
|
6850
6865
|
const entries = chain.entryPoints.entries() || {};
|
|
6851
|
-
const entryNames = Object.keys(entries)
|
|
6866
|
+
const entryNames = Object.keys(entries).filter(
|
|
6867
|
+
(entryName) => Boolean(htmlPaths[entryName])
|
|
6868
|
+
);
|
|
6852
6869
|
const htmlInfoMap = {};
|
|
6853
6870
|
const finalOptions = await Promise.all(
|
|
6854
6871
|
entryNames.map(async (entryName) => {
|
|
@@ -6949,83 +6966,599 @@ var init_html = __esm({
|
|
|
6949
6966
|
}
|
|
6950
6967
|
});
|
|
6951
6968
|
|
|
6969
|
+
// ../../node_modules/.pnpm/mrmime@2.0.0/node_modules/mrmime/index.mjs
|
|
6970
|
+
function lookup(extn) {
|
|
6971
|
+
let tmp = ("" + extn).trim().toLowerCase();
|
|
6972
|
+
let idx = tmp.lastIndexOf(".");
|
|
6973
|
+
return mimes[!~idx ? tmp : tmp.substring(++idx)];
|
|
6974
|
+
}
|
|
6975
|
+
var mimes;
|
|
6976
|
+
var init_mrmime = __esm({
|
|
6977
|
+
"../../node_modules/.pnpm/mrmime@2.0.0/node_modules/mrmime/index.mjs"() {
|
|
6978
|
+
"use strict";
|
|
6979
|
+
mimes = {
|
|
6980
|
+
"3g2": "video/3gpp2",
|
|
6981
|
+
"3gp": "video/3gpp",
|
|
6982
|
+
"3gpp": "video/3gpp",
|
|
6983
|
+
"3mf": "model/3mf",
|
|
6984
|
+
"aac": "audio/aac",
|
|
6985
|
+
"ac": "application/pkix-attr-cert",
|
|
6986
|
+
"adp": "audio/adpcm",
|
|
6987
|
+
"adts": "audio/aac",
|
|
6988
|
+
"ai": "application/postscript",
|
|
6989
|
+
"aml": "application/automationml-aml+xml",
|
|
6990
|
+
"amlx": "application/automationml-amlx+zip",
|
|
6991
|
+
"amr": "audio/amr",
|
|
6992
|
+
"apng": "image/apng",
|
|
6993
|
+
"appcache": "text/cache-manifest",
|
|
6994
|
+
"appinstaller": "application/appinstaller",
|
|
6995
|
+
"appx": "application/appx",
|
|
6996
|
+
"appxbundle": "application/appxbundle",
|
|
6997
|
+
"asc": "application/pgp-keys",
|
|
6998
|
+
"atom": "application/atom+xml",
|
|
6999
|
+
"atomcat": "application/atomcat+xml",
|
|
7000
|
+
"atomdeleted": "application/atomdeleted+xml",
|
|
7001
|
+
"atomsvc": "application/atomsvc+xml",
|
|
7002
|
+
"au": "audio/basic",
|
|
7003
|
+
"avci": "image/avci",
|
|
7004
|
+
"avcs": "image/avcs",
|
|
7005
|
+
"avif": "image/avif",
|
|
7006
|
+
"aw": "application/applixware",
|
|
7007
|
+
"bdoc": "application/bdoc",
|
|
7008
|
+
"bin": "application/octet-stream",
|
|
7009
|
+
"bmp": "image/bmp",
|
|
7010
|
+
"bpk": "application/octet-stream",
|
|
7011
|
+
"btf": "image/prs.btif",
|
|
7012
|
+
"btif": "image/prs.btif",
|
|
7013
|
+
"buffer": "application/octet-stream",
|
|
7014
|
+
"ccxml": "application/ccxml+xml",
|
|
7015
|
+
"cdfx": "application/cdfx+xml",
|
|
7016
|
+
"cdmia": "application/cdmi-capability",
|
|
7017
|
+
"cdmic": "application/cdmi-container",
|
|
7018
|
+
"cdmid": "application/cdmi-domain",
|
|
7019
|
+
"cdmio": "application/cdmi-object",
|
|
7020
|
+
"cdmiq": "application/cdmi-queue",
|
|
7021
|
+
"cer": "application/pkix-cert",
|
|
7022
|
+
"cgm": "image/cgm",
|
|
7023
|
+
"cjs": "application/node",
|
|
7024
|
+
"class": "application/java-vm",
|
|
7025
|
+
"coffee": "text/coffeescript",
|
|
7026
|
+
"conf": "text/plain",
|
|
7027
|
+
"cpl": "application/cpl+xml",
|
|
7028
|
+
"cpt": "application/mac-compactpro",
|
|
7029
|
+
"crl": "application/pkix-crl",
|
|
7030
|
+
"css": "text/css",
|
|
7031
|
+
"csv": "text/csv",
|
|
7032
|
+
"cu": "application/cu-seeme",
|
|
7033
|
+
"cwl": "application/cwl",
|
|
7034
|
+
"cww": "application/prs.cww",
|
|
7035
|
+
"davmount": "application/davmount+xml",
|
|
7036
|
+
"dbk": "application/docbook+xml",
|
|
7037
|
+
"deb": "application/octet-stream",
|
|
7038
|
+
"def": "text/plain",
|
|
7039
|
+
"deploy": "application/octet-stream",
|
|
7040
|
+
"dib": "image/bmp",
|
|
7041
|
+
"disposition-notification": "message/disposition-notification",
|
|
7042
|
+
"dist": "application/octet-stream",
|
|
7043
|
+
"distz": "application/octet-stream",
|
|
7044
|
+
"dll": "application/octet-stream",
|
|
7045
|
+
"dmg": "application/octet-stream",
|
|
7046
|
+
"dms": "application/octet-stream",
|
|
7047
|
+
"doc": "application/msword",
|
|
7048
|
+
"dot": "application/msword",
|
|
7049
|
+
"dpx": "image/dpx",
|
|
7050
|
+
"drle": "image/dicom-rle",
|
|
7051
|
+
"dsc": "text/prs.lines.tag",
|
|
7052
|
+
"dssc": "application/dssc+der",
|
|
7053
|
+
"dtd": "application/xml-dtd",
|
|
7054
|
+
"dump": "application/octet-stream",
|
|
7055
|
+
"dwd": "application/atsc-dwd+xml",
|
|
7056
|
+
"ear": "application/java-archive",
|
|
7057
|
+
"ecma": "application/ecmascript",
|
|
7058
|
+
"elc": "application/octet-stream",
|
|
7059
|
+
"emf": "image/emf",
|
|
7060
|
+
"eml": "message/rfc822",
|
|
7061
|
+
"emma": "application/emma+xml",
|
|
7062
|
+
"emotionml": "application/emotionml+xml",
|
|
7063
|
+
"eps": "application/postscript",
|
|
7064
|
+
"epub": "application/epub+zip",
|
|
7065
|
+
"exe": "application/octet-stream",
|
|
7066
|
+
"exi": "application/exi",
|
|
7067
|
+
"exp": "application/express",
|
|
7068
|
+
"exr": "image/aces",
|
|
7069
|
+
"ez": "application/andrew-inset",
|
|
7070
|
+
"fdf": "application/fdf",
|
|
7071
|
+
"fdt": "application/fdt+xml",
|
|
7072
|
+
"fits": "image/fits",
|
|
7073
|
+
"g3": "image/g3fax",
|
|
7074
|
+
"gbr": "application/rpki-ghostbusters",
|
|
7075
|
+
"geojson": "application/geo+json",
|
|
7076
|
+
"gif": "image/gif",
|
|
7077
|
+
"glb": "model/gltf-binary",
|
|
7078
|
+
"gltf": "model/gltf+json",
|
|
7079
|
+
"gml": "application/gml+xml",
|
|
7080
|
+
"gpx": "application/gpx+xml",
|
|
7081
|
+
"gram": "application/srgs",
|
|
7082
|
+
"grxml": "application/srgs+xml",
|
|
7083
|
+
"gxf": "application/gxf",
|
|
7084
|
+
"gz": "application/gzip",
|
|
7085
|
+
"h261": "video/h261",
|
|
7086
|
+
"h263": "video/h263",
|
|
7087
|
+
"h264": "video/h264",
|
|
7088
|
+
"heic": "image/heic",
|
|
7089
|
+
"heics": "image/heic-sequence",
|
|
7090
|
+
"heif": "image/heif",
|
|
7091
|
+
"heifs": "image/heif-sequence",
|
|
7092
|
+
"hej2": "image/hej2k",
|
|
7093
|
+
"held": "application/atsc-held+xml",
|
|
7094
|
+
"hjson": "application/hjson",
|
|
7095
|
+
"hlp": "application/winhlp",
|
|
7096
|
+
"hqx": "application/mac-binhex40",
|
|
7097
|
+
"hsj2": "image/hsj2",
|
|
7098
|
+
"htm": "text/html",
|
|
7099
|
+
"html": "text/html",
|
|
7100
|
+
"ics": "text/calendar",
|
|
7101
|
+
"ief": "image/ief",
|
|
7102
|
+
"ifb": "text/calendar",
|
|
7103
|
+
"iges": "model/iges",
|
|
7104
|
+
"igs": "model/iges",
|
|
7105
|
+
"img": "application/octet-stream",
|
|
7106
|
+
"in": "text/plain",
|
|
7107
|
+
"ini": "text/plain",
|
|
7108
|
+
"ink": "application/inkml+xml",
|
|
7109
|
+
"inkml": "application/inkml+xml",
|
|
7110
|
+
"ipfix": "application/ipfix",
|
|
7111
|
+
"iso": "application/octet-stream",
|
|
7112
|
+
"its": "application/its+xml",
|
|
7113
|
+
"jade": "text/jade",
|
|
7114
|
+
"jar": "application/java-archive",
|
|
7115
|
+
"jhc": "image/jphc",
|
|
7116
|
+
"jls": "image/jls",
|
|
7117
|
+
"jp2": "image/jp2",
|
|
7118
|
+
"jpe": "image/jpeg",
|
|
7119
|
+
"jpeg": "image/jpeg",
|
|
7120
|
+
"jpf": "image/jpx",
|
|
7121
|
+
"jpg": "image/jpeg",
|
|
7122
|
+
"jpg2": "image/jp2",
|
|
7123
|
+
"jpgm": "image/jpm",
|
|
7124
|
+
"jpgv": "video/jpeg",
|
|
7125
|
+
"jph": "image/jph",
|
|
7126
|
+
"jpm": "image/jpm",
|
|
7127
|
+
"jpx": "image/jpx",
|
|
7128
|
+
"js": "text/javascript",
|
|
7129
|
+
"json": "application/json",
|
|
7130
|
+
"json5": "application/json5",
|
|
7131
|
+
"jsonld": "application/ld+json",
|
|
7132
|
+
"jsonml": "application/jsonml+json",
|
|
7133
|
+
"jsx": "text/jsx",
|
|
7134
|
+
"jt": "model/jt",
|
|
7135
|
+
"jxr": "image/jxr",
|
|
7136
|
+
"jxra": "image/jxra",
|
|
7137
|
+
"jxrs": "image/jxrs",
|
|
7138
|
+
"jxs": "image/jxs",
|
|
7139
|
+
"jxsc": "image/jxsc",
|
|
7140
|
+
"jxsi": "image/jxsi",
|
|
7141
|
+
"jxss": "image/jxss",
|
|
7142
|
+
"kar": "audio/midi",
|
|
7143
|
+
"ktx": "image/ktx",
|
|
7144
|
+
"ktx2": "image/ktx2",
|
|
7145
|
+
"less": "text/less",
|
|
7146
|
+
"lgr": "application/lgr+xml",
|
|
7147
|
+
"list": "text/plain",
|
|
7148
|
+
"litcoffee": "text/coffeescript",
|
|
7149
|
+
"log": "text/plain",
|
|
7150
|
+
"lostxml": "application/lost+xml",
|
|
7151
|
+
"lrf": "application/octet-stream",
|
|
7152
|
+
"m1v": "video/mpeg",
|
|
7153
|
+
"m21": "application/mp21",
|
|
7154
|
+
"m2a": "audio/mpeg",
|
|
7155
|
+
"m2v": "video/mpeg",
|
|
7156
|
+
"m3a": "audio/mpeg",
|
|
7157
|
+
"m4a": "audio/mp4",
|
|
7158
|
+
"m4p": "application/mp4",
|
|
7159
|
+
"m4s": "video/iso.segment",
|
|
7160
|
+
"ma": "application/mathematica",
|
|
7161
|
+
"mads": "application/mads+xml",
|
|
7162
|
+
"maei": "application/mmt-aei+xml",
|
|
7163
|
+
"man": "text/troff",
|
|
7164
|
+
"manifest": "text/cache-manifest",
|
|
7165
|
+
"map": "application/json",
|
|
7166
|
+
"mar": "application/octet-stream",
|
|
7167
|
+
"markdown": "text/markdown",
|
|
7168
|
+
"mathml": "application/mathml+xml",
|
|
7169
|
+
"mb": "application/mathematica",
|
|
7170
|
+
"mbox": "application/mbox",
|
|
7171
|
+
"md": "text/markdown",
|
|
7172
|
+
"mdx": "text/mdx",
|
|
7173
|
+
"me": "text/troff",
|
|
7174
|
+
"mesh": "model/mesh",
|
|
7175
|
+
"meta4": "application/metalink4+xml",
|
|
7176
|
+
"metalink": "application/metalink+xml",
|
|
7177
|
+
"mets": "application/mets+xml",
|
|
7178
|
+
"mft": "application/rpki-manifest",
|
|
7179
|
+
"mid": "audio/midi",
|
|
7180
|
+
"midi": "audio/midi",
|
|
7181
|
+
"mime": "message/rfc822",
|
|
7182
|
+
"mj2": "video/mj2",
|
|
7183
|
+
"mjp2": "video/mj2",
|
|
7184
|
+
"mjs": "text/javascript",
|
|
7185
|
+
"mml": "text/mathml",
|
|
7186
|
+
"mods": "application/mods+xml",
|
|
7187
|
+
"mov": "video/quicktime",
|
|
7188
|
+
"mp2": "audio/mpeg",
|
|
7189
|
+
"mp21": "application/mp21",
|
|
7190
|
+
"mp2a": "audio/mpeg",
|
|
7191
|
+
"mp3": "audio/mpeg",
|
|
7192
|
+
"mp4": "video/mp4",
|
|
7193
|
+
"mp4a": "audio/mp4",
|
|
7194
|
+
"mp4s": "application/mp4",
|
|
7195
|
+
"mp4v": "video/mp4",
|
|
7196
|
+
"mpd": "application/dash+xml",
|
|
7197
|
+
"mpe": "video/mpeg",
|
|
7198
|
+
"mpeg": "video/mpeg",
|
|
7199
|
+
"mpf": "application/media-policy-dataset+xml",
|
|
7200
|
+
"mpg": "video/mpeg",
|
|
7201
|
+
"mpg4": "video/mp4",
|
|
7202
|
+
"mpga": "audio/mpeg",
|
|
7203
|
+
"mpp": "application/dash-patch+xml",
|
|
7204
|
+
"mrc": "application/marc",
|
|
7205
|
+
"mrcx": "application/marcxml+xml",
|
|
7206
|
+
"ms": "text/troff",
|
|
7207
|
+
"mscml": "application/mediaservercontrol+xml",
|
|
7208
|
+
"msh": "model/mesh",
|
|
7209
|
+
"msi": "application/octet-stream",
|
|
7210
|
+
"msix": "application/msix",
|
|
7211
|
+
"msixbundle": "application/msixbundle",
|
|
7212
|
+
"msm": "application/octet-stream",
|
|
7213
|
+
"msp": "application/octet-stream",
|
|
7214
|
+
"mtl": "model/mtl",
|
|
7215
|
+
"musd": "application/mmt-usd+xml",
|
|
7216
|
+
"mxf": "application/mxf",
|
|
7217
|
+
"mxmf": "audio/mobile-xmf",
|
|
7218
|
+
"mxml": "application/xv+xml",
|
|
7219
|
+
"n3": "text/n3",
|
|
7220
|
+
"nb": "application/mathematica",
|
|
7221
|
+
"nq": "application/n-quads",
|
|
7222
|
+
"nt": "application/n-triples",
|
|
7223
|
+
"obj": "model/obj",
|
|
7224
|
+
"oda": "application/oda",
|
|
7225
|
+
"oga": "audio/ogg",
|
|
7226
|
+
"ogg": "audio/ogg",
|
|
7227
|
+
"ogv": "video/ogg",
|
|
7228
|
+
"ogx": "application/ogg",
|
|
7229
|
+
"omdoc": "application/omdoc+xml",
|
|
7230
|
+
"onepkg": "application/onenote",
|
|
7231
|
+
"onetmp": "application/onenote",
|
|
7232
|
+
"onetoc": "application/onenote",
|
|
7233
|
+
"onetoc2": "application/onenote",
|
|
7234
|
+
"opf": "application/oebps-package+xml",
|
|
7235
|
+
"opus": "audio/ogg",
|
|
7236
|
+
"otf": "font/otf",
|
|
7237
|
+
"owl": "application/rdf+xml",
|
|
7238
|
+
"oxps": "application/oxps",
|
|
7239
|
+
"p10": "application/pkcs10",
|
|
7240
|
+
"p7c": "application/pkcs7-mime",
|
|
7241
|
+
"p7m": "application/pkcs7-mime",
|
|
7242
|
+
"p7s": "application/pkcs7-signature",
|
|
7243
|
+
"p8": "application/pkcs8",
|
|
7244
|
+
"pdf": "application/pdf",
|
|
7245
|
+
"pfr": "application/font-tdpfr",
|
|
7246
|
+
"pgp": "application/pgp-encrypted",
|
|
7247
|
+
"pkg": "application/octet-stream",
|
|
7248
|
+
"pki": "application/pkixcmp",
|
|
7249
|
+
"pkipath": "application/pkix-pkipath",
|
|
7250
|
+
"pls": "application/pls+xml",
|
|
7251
|
+
"png": "image/png",
|
|
7252
|
+
"prc": "model/prc",
|
|
7253
|
+
"prf": "application/pics-rules",
|
|
7254
|
+
"provx": "application/provenance+xml",
|
|
7255
|
+
"ps": "application/postscript",
|
|
7256
|
+
"pskcxml": "application/pskc+xml",
|
|
7257
|
+
"pti": "image/prs.pti",
|
|
7258
|
+
"qt": "video/quicktime",
|
|
7259
|
+
"raml": "application/raml+yaml",
|
|
7260
|
+
"rapd": "application/route-apd+xml",
|
|
7261
|
+
"rdf": "application/rdf+xml",
|
|
7262
|
+
"relo": "application/p2p-overlay+xml",
|
|
7263
|
+
"rif": "application/reginfo+xml",
|
|
7264
|
+
"rl": "application/resource-lists+xml",
|
|
7265
|
+
"rld": "application/resource-lists-diff+xml",
|
|
7266
|
+
"rmi": "audio/midi",
|
|
7267
|
+
"rnc": "application/relax-ng-compact-syntax",
|
|
7268
|
+
"rng": "application/xml",
|
|
7269
|
+
"roa": "application/rpki-roa",
|
|
7270
|
+
"roff": "text/troff",
|
|
7271
|
+
"rq": "application/sparql-query",
|
|
7272
|
+
"rs": "application/rls-services+xml",
|
|
7273
|
+
"rsat": "application/atsc-rsat+xml",
|
|
7274
|
+
"rsd": "application/rsd+xml",
|
|
7275
|
+
"rsheet": "application/urc-ressheet+xml",
|
|
7276
|
+
"rss": "application/rss+xml",
|
|
7277
|
+
"rtf": "text/rtf",
|
|
7278
|
+
"rtx": "text/richtext",
|
|
7279
|
+
"rusd": "application/route-usd+xml",
|
|
7280
|
+
"s3m": "audio/s3m",
|
|
7281
|
+
"sbml": "application/sbml+xml",
|
|
7282
|
+
"scq": "application/scvp-cv-request",
|
|
7283
|
+
"scs": "application/scvp-cv-response",
|
|
7284
|
+
"sdp": "application/sdp",
|
|
7285
|
+
"senmlx": "application/senml+xml",
|
|
7286
|
+
"sensmlx": "application/sensml+xml",
|
|
7287
|
+
"ser": "application/java-serialized-object",
|
|
7288
|
+
"setpay": "application/set-payment-initiation",
|
|
7289
|
+
"setreg": "application/set-registration-initiation",
|
|
7290
|
+
"sgi": "image/sgi",
|
|
7291
|
+
"sgm": "text/sgml",
|
|
7292
|
+
"sgml": "text/sgml",
|
|
7293
|
+
"shex": "text/shex",
|
|
7294
|
+
"shf": "application/shf+xml",
|
|
7295
|
+
"shtml": "text/html",
|
|
7296
|
+
"sieve": "application/sieve",
|
|
7297
|
+
"sig": "application/pgp-signature",
|
|
7298
|
+
"sil": "audio/silk",
|
|
7299
|
+
"silo": "model/mesh",
|
|
7300
|
+
"siv": "application/sieve",
|
|
7301
|
+
"slim": "text/slim",
|
|
7302
|
+
"slm": "text/slim",
|
|
7303
|
+
"sls": "application/route-s-tsid+xml",
|
|
7304
|
+
"smi": "application/smil+xml",
|
|
7305
|
+
"smil": "application/smil+xml",
|
|
7306
|
+
"snd": "audio/basic",
|
|
7307
|
+
"so": "application/octet-stream",
|
|
7308
|
+
"spdx": "text/spdx",
|
|
7309
|
+
"spp": "application/scvp-vp-response",
|
|
7310
|
+
"spq": "application/scvp-vp-request",
|
|
7311
|
+
"spx": "audio/ogg",
|
|
7312
|
+
"sql": "application/sql",
|
|
7313
|
+
"sru": "application/sru+xml",
|
|
7314
|
+
"srx": "application/sparql-results+xml",
|
|
7315
|
+
"ssdl": "application/ssdl+xml",
|
|
7316
|
+
"ssml": "application/ssml+xml",
|
|
7317
|
+
"stk": "application/hyperstudio",
|
|
7318
|
+
"stl": "model/stl",
|
|
7319
|
+
"stpx": "model/step+xml",
|
|
7320
|
+
"stpxz": "model/step-xml+zip",
|
|
7321
|
+
"stpz": "model/step+zip",
|
|
7322
|
+
"styl": "text/stylus",
|
|
7323
|
+
"stylus": "text/stylus",
|
|
7324
|
+
"svg": "image/svg+xml",
|
|
7325
|
+
"svgz": "image/svg+xml",
|
|
7326
|
+
"swidtag": "application/swid+xml",
|
|
7327
|
+
"t": "text/troff",
|
|
7328
|
+
"t38": "image/t38",
|
|
7329
|
+
"td": "application/urc-targetdesc+xml",
|
|
7330
|
+
"tei": "application/tei+xml",
|
|
7331
|
+
"teicorpus": "application/tei+xml",
|
|
7332
|
+
"text": "text/plain",
|
|
7333
|
+
"tfi": "application/thraud+xml",
|
|
7334
|
+
"tfx": "image/tiff-fx",
|
|
7335
|
+
"tif": "image/tiff",
|
|
7336
|
+
"tiff": "image/tiff",
|
|
7337
|
+
"toml": "application/toml",
|
|
7338
|
+
"tr": "text/troff",
|
|
7339
|
+
"trig": "application/trig",
|
|
7340
|
+
"ts": "video/mp2t",
|
|
7341
|
+
"tsd": "application/timestamped-data",
|
|
7342
|
+
"tsv": "text/tab-separated-values",
|
|
7343
|
+
"ttc": "font/collection",
|
|
7344
|
+
"ttf": "font/ttf",
|
|
7345
|
+
"ttl": "text/turtle",
|
|
7346
|
+
"ttml": "application/ttml+xml",
|
|
7347
|
+
"txt": "text/plain",
|
|
7348
|
+
"u3d": "model/u3d",
|
|
7349
|
+
"u8dsn": "message/global-delivery-status",
|
|
7350
|
+
"u8hdr": "message/global-headers",
|
|
7351
|
+
"u8mdn": "message/global-disposition-notification",
|
|
7352
|
+
"u8msg": "message/global",
|
|
7353
|
+
"ubj": "application/ubjson",
|
|
7354
|
+
"uri": "text/uri-list",
|
|
7355
|
+
"uris": "text/uri-list",
|
|
7356
|
+
"urls": "text/uri-list",
|
|
7357
|
+
"vcard": "text/vcard",
|
|
7358
|
+
"vrml": "model/vrml",
|
|
7359
|
+
"vtt": "text/vtt",
|
|
7360
|
+
"vxml": "application/voicexml+xml",
|
|
7361
|
+
"war": "application/java-archive",
|
|
7362
|
+
"wasm": "application/wasm",
|
|
7363
|
+
"wav": "audio/wav",
|
|
7364
|
+
"weba": "audio/webm",
|
|
7365
|
+
"webm": "video/webm",
|
|
7366
|
+
"webmanifest": "application/manifest+json",
|
|
7367
|
+
"webp": "image/webp",
|
|
7368
|
+
"wgsl": "text/wgsl",
|
|
7369
|
+
"wgt": "application/widget",
|
|
7370
|
+
"wif": "application/watcherinfo+xml",
|
|
7371
|
+
"wmf": "image/wmf",
|
|
7372
|
+
"woff": "font/woff",
|
|
7373
|
+
"woff2": "font/woff2",
|
|
7374
|
+
"wrl": "model/vrml",
|
|
7375
|
+
"wsdl": "application/wsdl+xml",
|
|
7376
|
+
"wspolicy": "application/wspolicy+xml",
|
|
7377
|
+
"x3d": "model/x3d+xml",
|
|
7378
|
+
"x3db": "model/x3d+fastinfoset",
|
|
7379
|
+
"x3dbz": "model/x3d+binary",
|
|
7380
|
+
"x3dv": "model/x3d-vrml",
|
|
7381
|
+
"x3dvz": "model/x3d+vrml",
|
|
7382
|
+
"x3dz": "model/x3d+xml",
|
|
7383
|
+
"xaml": "application/xaml+xml",
|
|
7384
|
+
"xav": "application/xcap-att+xml",
|
|
7385
|
+
"xca": "application/xcap-caps+xml",
|
|
7386
|
+
"xcs": "application/calendar+xml",
|
|
7387
|
+
"xdf": "application/xcap-diff+xml",
|
|
7388
|
+
"xdssc": "application/dssc+xml",
|
|
7389
|
+
"xel": "application/xcap-el+xml",
|
|
7390
|
+
"xenc": "application/xenc+xml",
|
|
7391
|
+
"xer": "application/patch-ops-error+xml",
|
|
7392
|
+
"xfdf": "application/xfdf",
|
|
7393
|
+
"xht": "application/xhtml+xml",
|
|
7394
|
+
"xhtml": "application/xhtml+xml",
|
|
7395
|
+
"xhvml": "application/xv+xml",
|
|
7396
|
+
"xlf": "application/xliff+xml",
|
|
7397
|
+
"xm": "audio/xm",
|
|
7398
|
+
"xml": "text/xml",
|
|
7399
|
+
"xns": "application/xcap-ns+xml",
|
|
7400
|
+
"xop": "application/xop+xml",
|
|
7401
|
+
"xpl": "application/xproc+xml",
|
|
7402
|
+
"xsd": "application/xml",
|
|
7403
|
+
"xsf": "application/prs.xsf+xml",
|
|
7404
|
+
"xsl": "application/xml",
|
|
7405
|
+
"xslt": "application/xml",
|
|
7406
|
+
"xspf": "application/xspf+xml",
|
|
7407
|
+
"xvm": "application/xv+xml",
|
|
7408
|
+
"xvml": "application/xv+xml",
|
|
7409
|
+
"yaml": "text/yaml",
|
|
7410
|
+
"yang": "application/yang",
|
|
7411
|
+
"yin": "application/yin+xml",
|
|
7412
|
+
"yml": "text/yaml",
|
|
7413
|
+
"zip": "application/zip"
|
|
7414
|
+
};
|
|
7415
|
+
}
|
|
7416
|
+
});
|
|
7417
|
+
|
|
6952
7418
|
// src/plugins/appIcon.ts
|
|
6953
7419
|
var appIcon_exports = {};
|
|
6954
7420
|
__export(appIcon_exports, {
|
|
6955
7421
|
pluginAppIcon: () => pluginAppIcon
|
|
6956
7422
|
});
|
|
6957
|
-
var
|
|
7423
|
+
var import_node_path27, import_node_util4, pluginAppIcon;
|
|
6958
7424
|
var init_appIcon = __esm({
|
|
6959
7425
|
"src/plugins/appIcon.ts"() {
|
|
6960
7426
|
"use strict";
|
|
6961
|
-
import_node_fs8 = __toESM(require("fs"));
|
|
6962
7427
|
import_node_path27 = __toESM(require("path"));
|
|
7428
|
+
import_node_util4 = require("util");
|
|
7429
|
+
init_mrmime();
|
|
6963
7430
|
init_helpers();
|
|
6964
7431
|
pluginAppIcon = () => ({
|
|
6965
7432
|
name: "rsbuild:app-icon",
|
|
6966
7433
|
setup(api) {
|
|
6967
|
-
const
|
|
6968
|
-
const
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
}
|
|
6973
|
-
const cached = cache.get(name);
|
|
7434
|
+
const htmlTagsMap = /* @__PURE__ */ new Map();
|
|
7435
|
+
const iconFormatMap = /* @__PURE__ */ new Map();
|
|
7436
|
+
const formatIcon = (icon, distDir, publicPath) => {
|
|
7437
|
+
const { src, size } = icon;
|
|
7438
|
+
const cached = iconFormatMap.get(src);
|
|
6974
7439
|
if (cached) {
|
|
6975
|
-
cached;
|
|
7440
|
+
return { ...cached, ...icon };
|
|
7441
|
+
}
|
|
7442
|
+
const sizes = `${size}x${size}`;
|
|
7443
|
+
if (isURL(src)) {
|
|
7444
|
+
const paths2 = {
|
|
7445
|
+
sizes,
|
|
7446
|
+
isURL: true,
|
|
7447
|
+
requestPath: src,
|
|
7448
|
+
absolutePath: src,
|
|
7449
|
+
relativePath: src,
|
|
7450
|
+
mimeType: lookup(src)
|
|
7451
|
+
};
|
|
7452
|
+
iconFormatMap.set(src, paths2);
|
|
7453
|
+
return { ...paths2, ...icon };
|
|
6976
7454
|
}
|
|
6977
|
-
const
|
|
6978
|
-
const absolutePath = import_node_path27.default.isAbsolute(appIcon) ? appIcon : import_node_path27.default.join(api.context.rootPath, appIcon);
|
|
7455
|
+
const absolutePath = import_node_path27.default.isAbsolute(src) ? src : import_node_path27.default.join(api.context.rootPath, src);
|
|
6979
7456
|
const relativePath = import_node_path27.default.posix.join(
|
|
6980
7457
|
distDir,
|
|
6981
7458
|
import_node_path27.default.basename(absolutePath)
|
|
6982
7459
|
);
|
|
7460
|
+
const requestPath = ensureAssetPrefix(relativePath, publicPath);
|
|
6983
7461
|
const paths = {
|
|
7462
|
+
sizes,
|
|
7463
|
+
requestPath,
|
|
6984
7464
|
absolutePath,
|
|
6985
|
-
relativePath
|
|
7465
|
+
relativePath,
|
|
7466
|
+
mimeType: lookup(absolutePath)
|
|
6986
7467
|
};
|
|
6987
|
-
|
|
6988
|
-
return paths;
|
|
7468
|
+
iconFormatMap.set(src, paths);
|
|
7469
|
+
return { ...paths, ...icon };
|
|
6989
7470
|
};
|
|
6990
7471
|
api.processAssets(
|
|
6991
7472
|
{ stage: "additional" },
|
|
6992
7473
|
async ({ compilation, environment, sources }) => {
|
|
6993
|
-
const
|
|
6994
|
-
|
|
7474
|
+
const { config } = environment;
|
|
7475
|
+
const { appIcon } = config.html;
|
|
7476
|
+
if (!appIcon) {
|
|
6995
7477
|
return;
|
|
6996
7478
|
}
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7479
|
+
const distDir = config.output.distPath.image;
|
|
7480
|
+
const manifestFile = appIcon.filename ?? "manifest.webmanifest";
|
|
7481
|
+
const publicPath = getPublicPathFromCompiler(compilation);
|
|
7482
|
+
const icons = appIcon.icons.map(
|
|
7483
|
+
(icon) => formatIcon(icon, distDir, publicPath)
|
|
7484
|
+
);
|
|
7485
|
+
const tags = [];
|
|
7486
|
+
for (const icon of icons) {
|
|
7487
|
+
if (icon.target === "web-app-manifest" && !appIcon.name) {
|
|
7488
|
+
throw new Error(
|
|
7489
|
+
"[rsbuild:app-icon] `appIcon.name` is required when `target` is 'web-app-manifest'."
|
|
7490
|
+
);
|
|
7491
|
+
}
|
|
7492
|
+
if (!icon.isURL) {
|
|
7493
|
+
if (!await fileExistsByCompilation(compilation, icon.absolutePath)) {
|
|
7494
|
+
throw new Error(
|
|
7495
|
+
`[rsbuild:app-icon] Can not find the app icon, please check if the '${icon.relativePath}' file exists'.`
|
|
7496
|
+
);
|
|
7497
|
+
}
|
|
7498
|
+
const source = await (0, import_node_util4.promisify)(
|
|
7499
|
+
compilation.inputFileSystem.readFile
|
|
7500
|
+
)(icon.absolutePath);
|
|
7501
|
+
compilation.emitAsset(
|
|
7502
|
+
icon.relativePath,
|
|
7503
|
+
new sources.RawSource(source)
|
|
7504
|
+
);
|
|
7505
|
+
}
|
|
7506
|
+
if (icon.target === "apple-touch-icon" || !icon.target && icon.size < 200) {
|
|
7507
|
+
tags.push({
|
|
7508
|
+
tag: "link",
|
|
7509
|
+
attrs: {
|
|
7510
|
+
rel: "apple-touch-icon",
|
|
7511
|
+
sizes: icon.sizes,
|
|
7512
|
+
href: icon.requestPath
|
|
7513
|
+
}
|
|
7514
|
+
});
|
|
7515
|
+
}
|
|
7516
|
+
}
|
|
7517
|
+
if (appIcon.name) {
|
|
7518
|
+
const manifestIcons = icons.filter(
|
|
7519
|
+
(icon) => icon.target === "web-app-manifest" || !icon.target
|
|
7520
|
+
).map((icon) => {
|
|
7521
|
+
const result = {
|
|
7522
|
+
src: icon.requestPath,
|
|
7523
|
+
sizes: icon.sizes
|
|
7524
|
+
};
|
|
7525
|
+
if (icon.mimeType) {
|
|
7526
|
+
return { ...result, type: icon.mimeType };
|
|
7527
|
+
}
|
|
7528
|
+
return result;
|
|
7529
|
+
});
|
|
7530
|
+
const manifest = {
|
|
7531
|
+
name: appIcon.name,
|
|
7532
|
+
icons: manifestIcons
|
|
7533
|
+
};
|
|
7534
|
+
compilation.emitAsset(
|
|
7535
|
+
manifestFile,
|
|
7536
|
+
new sources.RawSource(JSON.stringify(manifest))
|
|
7000
7537
|
);
|
|
7538
|
+
tags.push({
|
|
7539
|
+
tag: "link",
|
|
7540
|
+
attrs: {
|
|
7541
|
+
rel: "manifest",
|
|
7542
|
+
href: ensureAssetPrefix(manifestFile, publicPath)
|
|
7543
|
+
}
|
|
7544
|
+
});
|
|
7001
7545
|
}
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
iconPath.relativePath,
|
|
7005
|
-
new sources.RawSource(source)
|
|
7006
|
-
);
|
|
7007
|
-
}
|
|
7008
|
-
);
|
|
7009
|
-
api.modifyHTMLTags(
|
|
7010
|
-
({ headTags, bodyTags }, { environment, compilation }) => {
|
|
7011
|
-
const iconPath = getIconPath(environment);
|
|
7012
|
-
if (!iconPath) {
|
|
7013
|
-
return { headTags, bodyTags };
|
|
7546
|
+
if (tags.length) {
|
|
7547
|
+
htmlTagsMap.set(environment.name, tags);
|
|
7014
7548
|
}
|
|
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
7549
|
}
|
|
7028
7550
|
);
|
|
7551
|
+
api.modifyHTMLTags(({ headTags, bodyTags }, { environment }) => {
|
|
7552
|
+
const tags = htmlTagsMap.get(environment.name);
|
|
7553
|
+
if (tags) {
|
|
7554
|
+
headTags.unshift(...tags);
|
|
7555
|
+
}
|
|
7556
|
+
return { headTags, bodyTags };
|
|
7557
|
+
});
|
|
7558
|
+
api.onCloseDevServer(() => {
|
|
7559
|
+
htmlTagsMap.clear();
|
|
7560
|
+
iconFormatMap.clear();
|
|
7561
|
+
});
|
|
7029
7562
|
}
|
|
7030
7563
|
});
|
|
7031
7564
|
}
|
|
@@ -7430,11 +7963,11 @@ function applySwcDecoratorConfig(swcConfig, config) {
|
|
|
7430
7963
|
throw new Error(`Unknown decorators version: ${version2}`);
|
|
7431
7964
|
}
|
|
7432
7965
|
}
|
|
7433
|
-
var
|
|
7966
|
+
var import_node_fs8, import_node_path30, import_deepmerge4, builtinSwcLoaderName, pluginSwc, getCoreJsVersion;
|
|
7434
7967
|
var init_swc = __esm({
|
|
7435
7968
|
"src/plugins/swc.ts"() {
|
|
7436
7969
|
"use strict";
|
|
7437
|
-
|
|
7970
|
+
import_node_fs8 = __toESM(require("fs"));
|
|
7438
7971
|
import_node_path30 = __toESM(require("path"));
|
|
7439
7972
|
import_deepmerge4 = __toESM(require_cjs());
|
|
7440
7973
|
init_dist();
|
|
@@ -7498,7 +8031,7 @@ var init_swc = __esm({
|
|
|
7498
8031
|
});
|
|
7499
8032
|
getCoreJsVersion = (corejsPkgPath) => {
|
|
7500
8033
|
try {
|
|
7501
|
-
const rawJson =
|
|
8034
|
+
const rawJson = import_node_fs8.default.readFileSync(corejsPkgPath, "utf-8");
|
|
7502
8035
|
const { version: version2 } = JSON.parse(rawJson);
|
|
7503
8036
|
const [major, minor] = version2.split(".");
|
|
7504
8037
|
return `${major}.${minor}`;
|
|
@@ -8453,11 +8986,11 @@ var server_exports = {};
|
|
|
8453
8986
|
__export(server_exports, {
|
|
8454
8987
|
pluginServer: () => pluginServer
|
|
8455
8988
|
});
|
|
8456
|
-
var
|
|
8989
|
+
var import_node_fs9, import_node_path33, pluginServer;
|
|
8457
8990
|
var init_server = __esm({
|
|
8458
8991
|
"src/plugins/server.ts"() {
|
|
8459
8992
|
"use strict";
|
|
8460
|
-
|
|
8993
|
+
import_node_fs9 = __toESM(require("fs"));
|
|
8461
8994
|
import_node_path33 = require("path");
|
|
8462
8995
|
init_config();
|
|
8463
8996
|
pluginServer = () => ({
|
|
@@ -8475,11 +9008,11 @@ var init_server = __esm({
|
|
|
8475
9008
|
continue;
|
|
8476
9009
|
}
|
|
8477
9010
|
const normalizedPath = (0, import_node_path33.isAbsolute)(name) ? name : (0, import_node_path33.join)(api.context.rootPath, name);
|
|
8478
|
-
if (!
|
|
9011
|
+
if (!import_node_fs9.default.existsSync(normalizedPath)) {
|
|
8479
9012
|
continue;
|
|
8480
9013
|
}
|
|
8481
9014
|
try {
|
|
8482
|
-
await
|
|
9015
|
+
await import_node_fs9.default.promises.cp(normalizedPath, api.context.distPath, {
|
|
8483
9016
|
recursive: true,
|
|
8484
9017
|
// dereference symlinks
|
|
8485
9018
|
dereference: true
|
|
@@ -8747,11 +9280,11 @@ var rspackProfile_exports = {};
|
|
|
8747
9280
|
__export(rspackProfile_exports, {
|
|
8748
9281
|
pluginRspackProfile: () => pluginRspackProfile
|
|
8749
9282
|
});
|
|
8750
|
-
var
|
|
9283
|
+
var import_node_fs10, import_node_inspector, import_node_path34, import_core9, stopProfiler, pluginRspackProfile;
|
|
8751
9284
|
var init_rspackProfile = __esm({
|
|
8752
9285
|
"src/plugins/rspackProfile.ts"() {
|
|
8753
9286
|
"use strict";
|
|
8754
|
-
|
|
9287
|
+
import_node_fs10 = __toESM(require("fs"));
|
|
8755
9288
|
import_node_inspector = __toESM(require("inspector"));
|
|
8756
9289
|
import_node_path34 = __toESM(require("path"));
|
|
8757
9290
|
import_core9 = __toESM(require("@rspack/core"));
|
|
@@ -8765,7 +9298,7 @@ var init_rspackProfile = __esm({
|
|
|
8765
9298
|
import_rslog.logger.error("Failed to generate JS CPU profile:", error);
|
|
8766
9299
|
return;
|
|
8767
9300
|
}
|
|
8768
|
-
|
|
9301
|
+
import_node_fs10.default.writeFileSync(output, JSON.stringify(param.profile));
|
|
8769
9302
|
});
|
|
8770
9303
|
};
|
|
8771
9304
|
pluginRspackProfile = () => ({
|
|
@@ -8787,8 +9320,8 @@ var init_rspackProfile = __esm({
|
|
|
8787
9320
|
const onStart = () => {
|
|
8788
9321
|
const profileDir = import_node_path34.default.join(api.context.distPath, profileDirName);
|
|
8789
9322
|
const traceFilePath = import_node_path34.default.join(profileDir, "trace.json");
|
|
8790
|
-
if (!
|
|
8791
|
-
|
|
9323
|
+
if (!import_node_fs10.default.existsSync(profileDir)) {
|
|
9324
|
+
import_node_fs10.default.mkdirSync(profileDir, { recursive: true });
|
|
8792
9325
|
}
|
|
8793
9326
|
if (enableProfileTrace) {
|
|
8794
9327
|
import_core9.default.experiments.globalTrace.register(
|
|
@@ -8822,7 +9355,7 @@ var init_rspackProfile = __esm({
|
|
|
8822
9355
|
logging: "verbose",
|
|
8823
9356
|
loggingTrace: true
|
|
8824
9357
|
});
|
|
8825
|
-
|
|
9358
|
+
import_node_fs10.default.writeFileSync(loggingFilePath, JSON.stringify(logging));
|
|
8826
9359
|
}
|
|
8827
9360
|
});
|
|
8828
9361
|
api.onExit(() => {
|
|
@@ -9077,9 +9610,6 @@ __export(prodServer_exports, {
|
|
|
9077
9610
|
startProdServer: () => startProdServer
|
|
9078
9611
|
});
|
|
9079
9612
|
async function startProdServer(context, config, { getPortSilently } = {}) {
|
|
9080
|
-
if (!getNodeEnv()) {
|
|
9081
|
-
setNodeEnv("production");
|
|
9082
|
-
}
|
|
9083
9613
|
const { port, host, https } = await getServerConfig({
|
|
9084
9614
|
config,
|
|
9085
9615
|
getPortSilently
|
|
@@ -9148,7 +9678,6 @@ var RsbuildProdServer;
|
|
|
9148
9678
|
var init_prodServer = __esm({
|
|
9149
9679
|
"src/server/prodServer.ts"() {
|
|
9150
9680
|
"use strict";
|
|
9151
|
-
init_helpers();
|
|
9152
9681
|
init_path();
|
|
9153
9682
|
init_logger();
|
|
9154
9683
|
init_helper();
|
|
@@ -9342,11 +9871,36 @@ async function createRsbuild(options = {}) {
|
|
|
9342
9871
|
setCssExtractPlugin
|
|
9343
9872
|
});
|
|
9344
9873
|
const preview = async (options2) => {
|
|
9874
|
+
if (!getNodeEnv()) {
|
|
9875
|
+
setNodeEnv("production");
|
|
9876
|
+
}
|
|
9345
9877
|
const { startProdServer: startProdServer2 } = await Promise.resolve().then(() => (init_prodServer(), prodServer_exports));
|
|
9346
9878
|
const config = await initRsbuildConfig({ context, pluginManager });
|
|
9347
9879
|
return startProdServer2(context, config, options2);
|
|
9348
9880
|
};
|
|
9881
|
+
const build2 = (...args) => {
|
|
9882
|
+
if (!getNodeEnv()) {
|
|
9883
|
+
setNodeEnv("production");
|
|
9884
|
+
}
|
|
9885
|
+
return providerInstance.build(...args);
|
|
9886
|
+
};
|
|
9887
|
+
const startDevServer = (...args) => {
|
|
9888
|
+
if (!getNodeEnv()) {
|
|
9889
|
+
setNodeEnv("development");
|
|
9890
|
+
}
|
|
9891
|
+
return providerInstance.startDevServer(...args);
|
|
9892
|
+
};
|
|
9893
|
+
const createDevServer2 = (...args) => {
|
|
9894
|
+
if (!getNodeEnv()) {
|
|
9895
|
+
setNodeEnv("development");
|
|
9896
|
+
}
|
|
9897
|
+
return providerInstance.createDevServer(...args);
|
|
9898
|
+
};
|
|
9349
9899
|
const rsbuild = {
|
|
9900
|
+
build: build2,
|
|
9901
|
+
preview,
|
|
9902
|
+
startDevServer,
|
|
9903
|
+
createDevServer: createDevServer2,
|
|
9350
9904
|
...pick(pluginManager, [
|
|
9351
9905
|
"addPlugins",
|
|
9352
9906
|
"getPlugins",
|
|
@@ -9354,6 +9908,7 @@ async function createRsbuild(options = {}) {
|
|
|
9354
9908
|
"isPluginExists"
|
|
9355
9909
|
]),
|
|
9356
9910
|
...pick(globalPluginAPI, [
|
|
9911
|
+
"context",
|
|
9357
9912
|
"onBeforeBuild",
|
|
9358
9913
|
"onBeforeCreateCompiler",
|
|
9359
9914
|
"onBeforeStartDevServer",
|
|
@@ -9369,15 +9924,10 @@ async function createRsbuild(options = {}) {
|
|
|
9369
9924
|
"getNormalizedConfig"
|
|
9370
9925
|
]),
|
|
9371
9926
|
...pick(providerInstance, [
|
|
9372
|
-
"build",
|
|
9373
9927
|
"initConfigs",
|
|
9374
9928
|
"inspectConfig",
|
|
9375
|
-
"createCompiler"
|
|
9376
|
-
|
|
9377
|
-
"startDevServer"
|
|
9378
|
-
]),
|
|
9379
|
-
preview,
|
|
9380
|
-
context: globalPluginAPI.context
|
|
9929
|
+
"createCompiler"
|
|
9930
|
+
])
|
|
9381
9931
|
};
|
|
9382
9932
|
if (rsbuildConfig.plugins) {
|
|
9383
9933
|
const plugins = await Promise.all(rsbuildConfig.plugins);
|
|
@@ -9510,7 +10060,7 @@ var init_init = __esm({
|
|
|
9510
10060
|
|
|
9511
10061
|
// src/cli/commands.ts
|
|
9512
10062
|
function runCli() {
|
|
9513
|
-
import_commander.program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.
|
|
10063
|
+
import_commander.program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.15");
|
|
9514
10064
|
const devCommand = import_commander.program.command("dev");
|
|
9515
10065
|
const buildCommand = import_commander.program.command("build");
|
|
9516
10066
|
const previewCommand = import_commander.program.command("preview");
|
|
@@ -9547,7 +10097,7 @@ function runCli() {
|
|
|
9547
10097
|
await rsbuild?.initConfigs();
|
|
9548
10098
|
if (rsbuild) {
|
|
9549
10099
|
const { distPath } = rsbuild.context;
|
|
9550
|
-
if (!(0,
|
|
10100
|
+
if (!(0, import_node_fs11.existsSync)(distPath)) {
|
|
9551
10101
|
throw new Error(
|
|
9552
10102
|
`The output directory ${import_picocolors16.default.yellow(
|
|
9553
10103
|
distPath
|
|
@@ -9585,11 +10135,11 @@ function runCli() {
|
|
|
9585
10135
|
});
|
|
9586
10136
|
import_commander.program.parse();
|
|
9587
10137
|
}
|
|
9588
|
-
var
|
|
10138
|
+
var import_node_fs11, import_commander, import_picocolors16, applyCommonOptions, applyServerOptions;
|
|
9589
10139
|
var init_commands = __esm({
|
|
9590
10140
|
"src/cli/commands.ts"() {
|
|
9591
10141
|
"use strict";
|
|
9592
|
-
|
|
10142
|
+
import_node_fs11 = require("fs");
|
|
9593
10143
|
import_commander = require("../compiled/commander/index.js");
|
|
9594
10144
|
import_picocolors16 = __toESM(require("../compiled/picocolors/index.js"));
|
|
9595
10145
|
init_helpers();
|
|
@@ -9633,7 +10183,7 @@ function prepareCli() {
|
|
|
9633
10183
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
9634
10184
|
console.log();
|
|
9635
10185
|
}
|
|
9636
|
-
import_rslog.logger.greet(` ${`Rsbuild v${"1.0.1-beta.
|
|
10186
|
+
import_rslog.logger.greet(` ${`Rsbuild v${"1.0.1-beta.15"}`}
|
|
9637
10187
|
`);
|
|
9638
10188
|
}
|
|
9639
10189
|
var init_prepare = __esm({
|
|
@@ -9719,7 +10269,7 @@ init_logger();
|
|
|
9719
10269
|
init_mergeConfig();
|
|
9720
10270
|
init_helpers();
|
|
9721
10271
|
init_constants();
|
|
9722
|
-
var version = "1.0.1-beta.
|
|
10272
|
+
var version = "1.0.1-beta.15";
|
|
9723
10273
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9724
10274
|
0 && (module.exports = {
|
|
9725
10275
|
PLUGIN_CSS_NAME,
|