@rsbuild/core 1.0.1-beta.14 → 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/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;
@@ -1187,7 +1198,7 @@ var init_config = __esm({
1187
1198
  },
1188
1199
  assetPrefix: DEFAULT_ASSET_PREFIX,
1189
1200
  filename: {},
1190
- charset: "ascii",
1201
+ charset: "utf8",
1191
1202
  polyfill: "off",
1192
1203
  dataUriLimit: {
1193
1204
  svg: DEFAULT_DATA_URL_SIZE,
@@ -2283,7 +2294,7 @@ async function createContext(options, userConfig, bundlerType) {
2283
2294
  const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
2284
2295
  const cachePath = (0, import_node_path9.join)(rootPath, "node_modules", ".cache");
2285
2296
  return {
2286
- version: "1.0.1-beta.14",
2297
+ version: "1.0.1-beta.15",
2287
2298
  rootPath,
2288
2299
  distPath: "",
2289
2300
  cachePath,
@@ -2313,7 +2324,10 @@ var init_createContext = __esm({
2313
2324
  return {};
2314
2325
  }
2315
2326
  return Object.keys(entry).reduce((prev, key) => {
2316
- prev[key] = getHTMLPathByEntry(key, config);
2327
+ const entryValue = entry[key];
2328
+ if (typeof entryValue === "string" || Array.isArray(entryValue) || entryValue.html !== false) {
2329
+ prev[key] = getHTMLPathByEntry(key, config);
2330
+ }
2317
2331
  return prev;
2318
2332
  }, {});
2319
2333
  };
@@ -3001,7 +3015,7 @@ var init_initConfigs = __esm({
3001
3015
  const { assetPrefix, lazyCompilation } = dev;
3002
3016
  const isEnvironmentEnabled = (name) => !specifiedEnvironments || specifiedEnvironments.includes(name);
3003
3017
  const applyEnvironmentDefaultConfig = (config) => {
3004
- if (!config.source.entry) {
3018
+ if (!config.source.entry || Object.keys(config.source.entry).length === 0) {
3005
3019
  config.source.entry = getDefaultEntryWithMemo();
3006
3020
  }
3007
3021
  const isServer = config.output.target === "node";
@@ -5299,7 +5313,12 @@ var init_entry = __esm({
5299
5313
  for (const entryName of Object.keys(entry)) {
5300
5314
  const entryPoint = chain.entry(entryName);
5301
5315
  const addEntry = (item) => {
5302
- entryPoint.add(item);
5316
+ if (typeof item === "object" && "html" in item) {
5317
+ const { html, ...rest } = item;
5318
+ entryPoint.add(rest);
5319
+ } else {
5320
+ entryPoint.add(item);
5321
+ }
5303
5322
  };
5304
5323
  preEntry.forEach(addEntry);
5305
5324
  if (injectCoreJsEntry) {
@@ -6844,7 +6863,9 @@ var init_html = __esm({
6844
6863
  }
6845
6864
  const assetPrefix = getPublicPathFromChain(chain, false);
6846
6865
  const entries = chain.entryPoints.entries() || {};
6847
- const entryNames = Object.keys(entries);
6866
+ const entryNames = Object.keys(entries).filter(
6867
+ (entryName) => Boolean(htmlPaths[entryName])
6868
+ );
6848
6869
  const htmlInfoMap = {};
6849
6870
  const finalOptions = await Promise.all(
6850
6871
  entryNames.map(async (entryName) => {
@@ -6945,33 +6966,491 @@ var init_html = __esm({
6945
6966
  }
6946
6967
  });
6947
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
+
6948
7418
  // src/plugins/appIcon.ts
6949
7419
  var appIcon_exports = {};
6950
7420
  __export(appIcon_exports, {
6951
7421
  pluginAppIcon: () => pluginAppIcon
6952
7422
  });
6953
- var import_node_fs8, import_node_path27, pluginAppIcon;
7423
+ var import_node_path27, import_node_util4, pluginAppIcon;
6954
7424
  var init_appIcon = __esm({
6955
7425
  "src/plugins/appIcon.ts"() {
6956
7426
  "use strict";
6957
- import_node_fs8 = __toESM(require("fs"));
6958
7427
  import_node_path27 = __toESM(require("path"));
7428
+ import_node_util4 = require("util");
7429
+ init_mrmime();
6959
7430
  init_helpers();
6960
7431
  pluginAppIcon = () => ({
6961
7432
  name: "rsbuild:app-icon",
6962
7433
  setup(api) {
6963
7434
  const htmlTagsMap = /* @__PURE__ */ new Map();
6964
- const iconPathMap = /* @__PURE__ */ new Map();
7435
+ const iconFormatMap = /* @__PURE__ */ new Map();
6965
7436
  const formatIcon = (icon, distDir, publicPath) => {
6966
7437
  const { src, size } = icon;
6967
- const cached = iconPathMap.get(src);
6968
- const sizes = `${size}x${size}`;
7438
+ const cached = iconFormatMap.get(src);
6969
7439
  if (cached) {
6970
- return {
7440
+ return { ...cached, ...icon };
7441
+ }
7442
+ const sizes = `${size}x${size}`;
7443
+ if (isURL(src)) {
7444
+ const paths2 = {
6971
7445
  sizes,
6972
- ...cached,
6973
- ...icon
7446
+ isURL: true,
7447
+ requestPath: src,
7448
+ absolutePath: src,
7449
+ relativePath: src,
7450
+ mimeType: lookup(src)
6974
7451
  };
7452
+ iconFormatMap.set(src, paths2);
7453
+ return { ...paths2, ...icon };
6975
7454
  }
6976
7455
  const absolutePath = import_node_path27.default.isAbsolute(src) ? src : import_node_path27.default.join(api.context.rootPath, src);
6977
7456
  const relativePath = import_node_path27.default.posix.join(
@@ -6980,16 +7459,14 @@ var init_appIcon = __esm({
6980
7459
  );
6981
7460
  const requestPath = ensureAssetPrefix(relativePath, publicPath);
6982
7461
  const paths = {
7462
+ sizes,
6983
7463
  requestPath,
6984
7464
  absolutePath,
6985
- relativePath
6986
- };
6987
- iconPathMap.set(src, paths);
6988
- return {
6989
- sizes,
6990
- ...paths,
6991
- ...icon
7465
+ relativePath,
7466
+ mimeType: lookup(absolutePath)
6992
7467
  };
7468
+ iconFormatMap.set(src, paths);
7469
+ return { ...paths, ...icon };
6993
7470
  };
6994
7471
  api.processAssets(
6995
7472
  { stage: "additional" },
@@ -7000,23 +7477,33 @@ var init_appIcon = __esm({
7000
7477
  return;
7001
7478
  }
7002
7479
  const distDir = config.output.distPath.image;
7480
+ const manifestFile = appIcon.filename ?? "manifest.webmanifest";
7003
7481
  const publicPath = getPublicPathFromCompiler(compilation);
7004
7482
  const icons = appIcon.icons.map(
7005
7483
  (icon) => formatIcon(icon, distDir, publicPath)
7006
7484
  );
7007
7485
  const tags = [];
7008
7486
  for (const icon of icons) {
7009
- if (!await isFileExists(icon.absolutePath)) {
7487
+ if (icon.target === "web-app-manifest" && !appIcon.name) {
7010
7488
  throw new Error(
7011
- `[rsbuild:app-icon] Can not find the app icon, please check if the '${icon.relativePath}' file exists'.`
7489
+ "[rsbuild:app-icon] `appIcon.name` is required when `target` is 'web-app-manifest'."
7012
7490
  );
7013
7491
  }
7014
- const source = await import_node_fs8.default.promises.readFile(icon.absolutePath);
7015
- compilation.emitAsset(
7016
- icon.relativePath,
7017
- new sources.RawSource(source)
7018
- );
7019
- if (icon.size < 200) {
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) {
7020
7507
  tags.push({
7021
7508
  tag: "link",
7022
7509
  attrs: {
@@ -7028,15 +7515,22 @@ var init_appIcon = __esm({
7028
7515
  }
7029
7516
  }
7030
7517
  if (appIcon.name) {
7031
- const manifestIcons = icons.map((icon) => ({
7032
- src: icon.requestPath,
7033
- sizes: icon.sizes
7034
- }));
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
+ });
7035
7530
  const manifest = {
7036
7531
  name: appIcon.name,
7037
7532
  icons: manifestIcons
7038
7533
  };
7039
- const manifestFile = "manifest.webmanifest";
7040
7534
  compilation.emitAsset(
7041
7535
  manifestFile,
7042
7536
  new sources.RawSource(JSON.stringify(manifest))
@@ -7063,7 +7557,7 @@ var init_appIcon = __esm({
7063
7557
  });
7064
7558
  api.onCloseDevServer(() => {
7065
7559
  htmlTagsMap.clear();
7066
- iconPathMap.clear();
7560
+ iconFormatMap.clear();
7067
7561
  });
7068
7562
  }
7069
7563
  });
@@ -7469,11 +7963,11 @@ function applySwcDecoratorConfig(swcConfig, config) {
7469
7963
  throw new Error(`Unknown decorators version: ${version2}`);
7470
7964
  }
7471
7965
  }
7472
- var import_node_fs9, import_node_path30, import_deepmerge4, builtinSwcLoaderName, pluginSwc, getCoreJsVersion;
7966
+ var import_node_fs8, import_node_path30, import_deepmerge4, builtinSwcLoaderName, pluginSwc, getCoreJsVersion;
7473
7967
  var init_swc = __esm({
7474
7968
  "src/plugins/swc.ts"() {
7475
7969
  "use strict";
7476
- import_node_fs9 = __toESM(require("fs"));
7970
+ import_node_fs8 = __toESM(require("fs"));
7477
7971
  import_node_path30 = __toESM(require("path"));
7478
7972
  import_deepmerge4 = __toESM(require_cjs());
7479
7973
  init_dist();
@@ -7537,7 +8031,7 @@ var init_swc = __esm({
7537
8031
  });
7538
8032
  getCoreJsVersion = (corejsPkgPath) => {
7539
8033
  try {
7540
- const rawJson = import_node_fs9.default.readFileSync(corejsPkgPath, "utf-8");
8034
+ const rawJson = import_node_fs8.default.readFileSync(corejsPkgPath, "utf-8");
7541
8035
  const { version: version2 } = JSON.parse(rawJson);
7542
8036
  const [major, minor] = version2.split(".");
7543
8037
  return `${major}.${minor}`;
@@ -8492,11 +8986,11 @@ var server_exports = {};
8492
8986
  __export(server_exports, {
8493
8987
  pluginServer: () => pluginServer
8494
8988
  });
8495
- var import_node_fs10, import_node_path33, pluginServer;
8989
+ var import_node_fs9, import_node_path33, pluginServer;
8496
8990
  var init_server = __esm({
8497
8991
  "src/plugins/server.ts"() {
8498
8992
  "use strict";
8499
- import_node_fs10 = __toESM(require("fs"));
8993
+ import_node_fs9 = __toESM(require("fs"));
8500
8994
  import_node_path33 = require("path");
8501
8995
  init_config();
8502
8996
  pluginServer = () => ({
@@ -8514,11 +9008,11 @@ var init_server = __esm({
8514
9008
  continue;
8515
9009
  }
8516
9010
  const normalizedPath = (0, import_node_path33.isAbsolute)(name) ? name : (0, import_node_path33.join)(api.context.rootPath, name);
8517
- if (!import_node_fs10.default.existsSync(normalizedPath)) {
9011
+ if (!import_node_fs9.default.existsSync(normalizedPath)) {
8518
9012
  continue;
8519
9013
  }
8520
9014
  try {
8521
- await import_node_fs10.default.promises.cp(normalizedPath, api.context.distPath, {
9015
+ await import_node_fs9.default.promises.cp(normalizedPath, api.context.distPath, {
8522
9016
  recursive: true,
8523
9017
  // dereference symlinks
8524
9018
  dereference: true
@@ -8786,11 +9280,11 @@ var rspackProfile_exports = {};
8786
9280
  __export(rspackProfile_exports, {
8787
9281
  pluginRspackProfile: () => pluginRspackProfile
8788
9282
  });
8789
- var import_node_fs11, import_node_inspector, import_node_path34, import_core9, stopProfiler, pluginRspackProfile;
9283
+ var import_node_fs10, import_node_inspector, import_node_path34, import_core9, stopProfiler, pluginRspackProfile;
8790
9284
  var init_rspackProfile = __esm({
8791
9285
  "src/plugins/rspackProfile.ts"() {
8792
9286
  "use strict";
8793
- import_node_fs11 = __toESM(require("fs"));
9287
+ import_node_fs10 = __toESM(require("fs"));
8794
9288
  import_node_inspector = __toESM(require("inspector"));
8795
9289
  import_node_path34 = __toESM(require("path"));
8796
9290
  import_core9 = __toESM(require("@rspack/core"));
@@ -8804,7 +9298,7 @@ var init_rspackProfile = __esm({
8804
9298
  import_rslog.logger.error("Failed to generate JS CPU profile:", error);
8805
9299
  return;
8806
9300
  }
8807
- import_node_fs11.default.writeFileSync(output, JSON.stringify(param.profile));
9301
+ import_node_fs10.default.writeFileSync(output, JSON.stringify(param.profile));
8808
9302
  });
8809
9303
  };
8810
9304
  pluginRspackProfile = () => ({
@@ -8826,8 +9320,8 @@ var init_rspackProfile = __esm({
8826
9320
  const onStart = () => {
8827
9321
  const profileDir = import_node_path34.default.join(api.context.distPath, profileDirName);
8828
9322
  const traceFilePath = import_node_path34.default.join(profileDir, "trace.json");
8829
- if (!import_node_fs11.default.existsSync(profileDir)) {
8830
- import_node_fs11.default.mkdirSync(profileDir, { recursive: true });
9323
+ if (!import_node_fs10.default.existsSync(profileDir)) {
9324
+ import_node_fs10.default.mkdirSync(profileDir, { recursive: true });
8831
9325
  }
8832
9326
  if (enableProfileTrace) {
8833
9327
  import_core9.default.experiments.globalTrace.register(
@@ -8861,7 +9355,7 @@ var init_rspackProfile = __esm({
8861
9355
  logging: "verbose",
8862
9356
  loggingTrace: true
8863
9357
  });
8864
- import_node_fs11.default.writeFileSync(loggingFilePath, JSON.stringify(logging));
9358
+ import_node_fs10.default.writeFileSync(loggingFilePath, JSON.stringify(logging));
8865
9359
  }
8866
9360
  });
8867
9361
  api.onExit(() => {
@@ -9566,7 +10060,7 @@ var init_init = __esm({
9566
10060
 
9567
10061
  // src/cli/commands.ts
9568
10062
  function runCli() {
9569
- import_commander.program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.14");
10063
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("1.0.1-beta.15");
9570
10064
  const devCommand = import_commander.program.command("dev");
9571
10065
  const buildCommand = import_commander.program.command("build");
9572
10066
  const previewCommand = import_commander.program.command("preview");
@@ -9603,7 +10097,7 @@ function runCli() {
9603
10097
  await rsbuild?.initConfigs();
9604
10098
  if (rsbuild) {
9605
10099
  const { distPath } = rsbuild.context;
9606
- if (!(0, import_node_fs12.existsSync)(distPath)) {
10100
+ if (!(0, import_node_fs11.existsSync)(distPath)) {
9607
10101
  throw new Error(
9608
10102
  `The output directory ${import_picocolors16.default.yellow(
9609
10103
  distPath
@@ -9641,11 +10135,11 @@ function runCli() {
9641
10135
  });
9642
10136
  import_commander.program.parse();
9643
10137
  }
9644
- var import_node_fs12, import_commander, import_picocolors16, applyCommonOptions, applyServerOptions;
10138
+ var import_node_fs11, import_commander, import_picocolors16, applyCommonOptions, applyServerOptions;
9645
10139
  var init_commands = __esm({
9646
10140
  "src/cli/commands.ts"() {
9647
10141
  "use strict";
9648
- import_node_fs12 = require("fs");
10142
+ import_node_fs11 = require("fs");
9649
10143
  import_commander = require("../compiled/commander/index.js");
9650
10144
  import_picocolors16 = __toESM(require("../compiled/picocolors/index.js"));
9651
10145
  init_helpers();
@@ -9689,7 +10183,7 @@ function prepareCli() {
9689
10183
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
9690
10184
  console.log();
9691
10185
  }
9692
- import_rslog.logger.greet(` ${`Rsbuild v${"1.0.1-beta.14"}`}
10186
+ import_rslog.logger.greet(` ${`Rsbuild v${"1.0.1-beta.15"}`}
9693
10187
  `);
9694
10188
  }
9695
10189
  var init_prepare = __esm({
@@ -9775,7 +10269,7 @@ init_logger();
9775
10269
  init_mergeConfig();
9776
10270
  init_helpers();
9777
10271
  init_constants();
9778
- var version = "1.0.1-beta.14";
10272
+ var version = "1.0.1-beta.15";
9779
10273
  // Annotate the CommonJS export names for ESM import in node:
9780
10274
  0 && (module.exports = {
9781
10275
  PLUGIN_CSS_NAME,