@rsbuild/core 1.0.13 → 1.0.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/rspack-chain/index.d.ts +8 -3
- package/compiled/sirv/index.js +14 -6
- package/compiled/sirv/package.json +1 -1
- package/dist/index.cjs +46 -31
- package/dist/index.js +49 -34
- package/dist-types/constants.d.ts +1 -0
- package/dist-types/types/config.d.ts +10 -0
- package/package.json +2 -2
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Configuration,
|
|
3
|
+
Compiler,
|
|
4
|
+
RuleSetRule,
|
|
5
|
+
ResolveOptions,
|
|
6
|
+
} from '@rspack/core';
|
|
2
7
|
import * as https from 'https';
|
|
3
8
|
|
|
9
|
+
export = Config;
|
|
10
|
+
|
|
4
11
|
// The compiler type of Rspack / webpack are mismatch,
|
|
5
12
|
// so we use a loose type here to allow using webpack plugins.
|
|
6
13
|
interface PluginInstance {
|
|
@@ -599,5 +606,3 @@ declare namespace Config {
|
|
|
599
606
|
after(name: string): this;
|
|
600
607
|
}
|
|
601
608
|
}
|
|
602
|
-
|
|
603
|
-
export { Config as default };
|
package/compiled/sirv/index.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
exports.parse = parse;
|
|
26
26
|
},
|
|
27
|
-
|
|
27
|
+
486: (__unused_webpack_module, exports) => {
|
|
28
28
|
const mimes = {
|
|
29
29
|
"3g2": "video/3gpp2",
|
|
30
30
|
"3gp": "video/3gpp",
|
|
@@ -469,12 +469,12 @@
|
|
|
469
469
|
exports.mimes = mimes;
|
|
470
470
|
exports.lookup = lookup;
|
|
471
471
|
},
|
|
472
|
-
|
|
473
|
-
const fs = __nccwpck_require__(
|
|
474
|
-
const { join, normalize, resolve } = __nccwpck_require__(
|
|
472
|
+
761: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
473
|
+
const fs = __nccwpck_require__(561);
|
|
474
|
+
const { join, normalize, resolve } = __nccwpck_require__(411);
|
|
475
475
|
const { totalist } = __nccwpck_require__(190);
|
|
476
476
|
const { parse } = __nccwpck_require__(665);
|
|
477
|
-
const { lookup } = __nccwpck_require__(
|
|
477
|
+
const { lookup } = __nccwpck_require__(486);
|
|
478
478
|
const noop = () => {};
|
|
479
479
|
function isMatch(uri, arr) {
|
|
480
480
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -665,6 +665,14 @@
|
|
|
665
665
|
"use strict";
|
|
666
666
|
module.exports = require("fs");
|
|
667
667
|
},
|
|
668
|
+
561: (module) => {
|
|
669
|
+
"use strict";
|
|
670
|
+
module.exports = require("node:fs");
|
|
671
|
+
},
|
|
672
|
+
411: (module) => {
|
|
673
|
+
"use strict";
|
|
674
|
+
module.exports = require("node:path");
|
|
675
|
+
},
|
|
668
676
|
17: (module) => {
|
|
669
677
|
"use strict";
|
|
670
678
|
module.exports = require("path");
|
|
@@ -696,6 +704,6 @@
|
|
|
696
704
|
}
|
|
697
705
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
698
706
|
__nccwpck_require__.ab = __dirname + "/";
|
|
699
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
707
|
+
var __webpack_exports__ = __nccwpck_require__(761);
|
|
700
708
|
module.exports = __webpack_exports__;
|
|
701
709
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"sirv","author":{"name":"Luke Edwards","email":"luke@lukeed.com","url":"https://lukeed.com"},"version":"
|
|
1
|
+
{"name":"sirv","author":{"name":"Luke Edwards","email":"luke@lukeed.com","url":"https://lukeed.com"},"version":"3.0.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
package/dist/index.cjs
CHANGED
|
@@ -3138,7 +3138,7 @@ var init_logger = __esm({
|
|
|
3138
3138
|
});
|
|
3139
3139
|
|
|
3140
3140
|
// src/constants.ts
|
|
3141
|
-
var import_node_path, ROOT_DIST_DIR, HTML_DIST_DIR, JS_DIST_DIR, CSS_DIST_DIR, SVG_DIST_DIR, FONT_DIST_DIR, WASM_DIST_DIR, IMAGE_DIST_DIR, MEDIA_DIST_DIR, LOADER_PATH, STATIC_PATH, COMPILED_PATH, TS_CONFIG_FILE, HMR_SOCKET_PATH, RSBUILD_OUTPUTS_PATH, DEFAULT_PORT, DEFAULT_DATA_URL_SIZE, DEFAULT_MOUNT_ID, DEFAULT_DEV_HOST, DEFAULT_ASSET_PREFIX, DEFAULT_WEB_BROWSERSLIST, DEFAULT_BROWSERSLIST, HTML_REGEX, JS_REGEX, SCRIPT_REGEX, CSS_REGEX, NODE_MODULES_REGEX, PLUGIN_SWC_NAME, PLUGIN_CSS_NAME, FONT_EXTENSIONS, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS;
|
|
3141
|
+
var import_node_path, ROOT_DIST_DIR, HTML_DIST_DIR, JS_DIST_DIR, CSS_DIST_DIR, SVG_DIST_DIR, FONT_DIST_DIR, WASM_DIST_DIR, IMAGE_DIST_DIR, MEDIA_DIST_DIR, ASSETS_DIST_DIR, LOADER_PATH, STATIC_PATH, COMPILED_PATH, TS_CONFIG_FILE, HMR_SOCKET_PATH, RSBUILD_OUTPUTS_PATH, DEFAULT_PORT, DEFAULT_DATA_URL_SIZE, DEFAULT_MOUNT_ID, DEFAULT_DEV_HOST, DEFAULT_ASSET_PREFIX, DEFAULT_WEB_BROWSERSLIST, DEFAULT_BROWSERSLIST, HTML_REGEX, JS_REGEX, SCRIPT_REGEX, CSS_REGEX, NODE_MODULES_REGEX, PLUGIN_SWC_NAME, PLUGIN_CSS_NAME, FONT_EXTENSIONS, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS;
|
|
3142
3142
|
var init_constants = __esm({
|
|
3143
3143
|
"src/constants.ts"() {
|
|
3144
3144
|
"use strict";
|
|
@@ -3152,6 +3152,7 @@ var init_constants = __esm({
|
|
|
3152
3152
|
WASM_DIST_DIR = "static/wasm";
|
|
3153
3153
|
IMAGE_DIST_DIR = "static/image";
|
|
3154
3154
|
MEDIA_DIST_DIR = "static/media";
|
|
3155
|
+
ASSETS_DIST_DIR = "static/assets";
|
|
3155
3156
|
LOADER_PATH = (0, import_node_path.join)(__dirname);
|
|
3156
3157
|
STATIC_PATH = (0, import_node_path.join)(__dirname, "../static");
|
|
3157
3158
|
COMPILED_PATH = (0, import_node_path.join)(__dirname, "../compiled");
|
|
@@ -3689,6 +3690,8 @@ function getFilename(config, type, isProd, isServer) {
|
|
|
3689
3690
|
return filename.image ?? `[name]${hash}[ext]`;
|
|
3690
3691
|
case "media":
|
|
3691
3692
|
return filename.media ?? `[name]${hash}[ext]`;
|
|
3693
|
+
case "assets":
|
|
3694
|
+
return filename.assets ?? `[name]${hash}[ext]`;
|
|
3692
3695
|
default:
|
|
3693
3696
|
throw new Error(`unknown key ${type} in "output.filename"`);
|
|
3694
3697
|
}
|
|
@@ -4186,7 +4189,7 @@ function stringifyConfig(config, verbose) {
|
|
|
4186
4189
|
const stringify = import_rspack_chain.default.toString;
|
|
4187
4190
|
return stringify(config, { verbose });
|
|
4188
4191
|
}
|
|
4189
|
-
var import_node_fs2, import_node_path6, import_picocolors5, import_rspack_chain, getDefaultDevConfig, getDefaultServerConfig, getDefaultSourceConfig, getDefaultHtmlConfig, getDefaultSecurityConfig, getDefaultToolsConfig, getDefaultPerformanceConfig, getDefaultOutputConfig, createDefaultConfig, withDefaultConfig, normalizeConfig, resolveConfigPath, getRsbuildInspectConfig, normalizePublicDirs;
|
|
4192
|
+
var import_node_fs2, import_node_path6, import_picocolors5, import_rspack_chain, getDefaultDevConfig, getDefaultServerConfig, swcHelpersPath, getDefaultSourceConfig, getDefaultHtmlConfig, getDefaultSecurityConfig, getDefaultToolsConfig, getDefaultPerformanceConfig, getDefaultOutputConfig, createDefaultConfig, withDefaultConfig, normalizeConfig, resolveConfigPath, getRsbuildInspectConfig, normalizePublicDirs;
|
|
4190
4193
|
var init_config = __esm({
|
|
4191
4194
|
"src/config.ts"() {
|
|
4192
4195
|
"use strict";
|
|
@@ -4224,15 +4227,22 @@ var init_config = __esm({
|
|
|
4224
4227
|
printUrls: true,
|
|
4225
4228
|
strictPort: false
|
|
4226
4229
|
});
|
|
4227
|
-
getDefaultSourceConfig = () =>
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
aliasStrategy: "prefer-tsconfig",
|
|
4231
|
-
preEntry: [],
|
|
4232
|
-
decorators: {
|
|
4233
|
-
version: "2022-03"
|
|
4230
|
+
getDefaultSourceConfig = () => {
|
|
4231
|
+
if (!swcHelpersPath) {
|
|
4232
|
+
swcHelpersPath = (0, import_node_path6.dirname)(require.resolve("@swc/helpers/package.json"));
|
|
4234
4233
|
}
|
|
4235
|
-
|
|
4234
|
+
return {
|
|
4235
|
+
alias: {
|
|
4236
|
+
"@swc/helpers": swcHelpersPath
|
|
4237
|
+
},
|
|
4238
|
+
define: {},
|
|
4239
|
+
aliasStrategy: "prefer-tsconfig",
|
|
4240
|
+
preEntry: [],
|
|
4241
|
+
decorators: {
|
|
4242
|
+
version: "2022-03"
|
|
4243
|
+
}
|
|
4244
|
+
};
|
|
4245
|
+
};
|
|
4236
4246
|
getDefaultHtmlConfig = () => ({
|
|
4237
4247
|
meta: {
|
|
4238
4248
|
charset: { charset: "UTF-8" },
|
|
@@ -4280,7 +4290,8 @@ var init_config = __esm({
|
|
|
4280
4290
|
html: HTML_DIST_DIR,
|
|
4281
4291
|
wasm: WASM_DIST_DIR,
|
|
4282
4292
|
image: IMAGE_DIST_DIR,
|
|
4283
|
-
media: MEDIA_DIST_DIR
|
|
4293
|
+
media: MEDIA_DIST_DIR,
|
|
4294
|
+
assets: ASSETS_DIST_DIR
|
|
4284
4295
|
},
|
|
4285
4296
|
// Temporary placeholder, default: `${server.base}`
|
|
4286
4297
|
assetPrefix: DEFAULT_ASSET_PREFIX,
|
|
@@ -6004,7 +6015,7 @@ async function createContext(options, userConfig, bundlerType) {
|
|
|
6004
6015
|
const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
|
|
6005
6016
|
const cachePath = (0, import_node_path10.join)(rootPath, "node_modules", ".cache");
|
|
6006
6017
|
return {
|
|
6007
|
-
version: "1.0.
|
|
6018
|
+
version: "1.0.14",
|
|
6008
6019
|
rootPath,
|
|
6009
6020
|
distPath: "",
|
|
6010
6021
|
cachePath,
|
|
@@ -10279,10 +10290,13 @@ var init_asset = __esm({
|
|
|
10279
10290
|
setup(api) {
|
|
10280
10291
|
api.modifyBundlerChain((chain, { isProd, environment }) => {
|
|
10281
10292
|
const { config } = environment;
|
|
10282
|
-
const
|
|
10283
|
-
const regExp = getRegExpForExts(exts);
|
|
10293
|
+
const getMergedFilename = (assetType) => {
|
|
10284
10294
|
const distDir = config.output.distPath[assetType];
|
|
10285
10295
|
const filename = getFilename(config, assetType, isProd);
|
|
10296
|
+
return import_node_path25.default.posix.join(distDir, filename);
|
|
10297
|
+
};
|
|
10298
|
+
const createAssetRule = (assetType, exts, emit) => {
|
|
10299
|
+
const regExp = getRegExpForExts(exts);
|
|
10286
10300
|
const { dataUriLimit } = config.output;
|
|
10287
10301
|
const maxSize = typeof dataUriLimit === "number" ? dataUriLimit : dataUriLimit[assetType];
|
|
10288
10302
|
const rule = chain.module.rule(assetType).test(regExp);
|
|
@@ -10290,7 +10304,7 @@ var init_asset = __esm({
|
|
|
10290
10304
|
emit,
|
|
10291
10305
|
rule,
|
|
10292
10306
|
maxSize,
|
|
10293
|
-
filename:
|
|
10307
|
+
filename: getMergedFilename(assetType),
|
|
10294
10308
|
assetType
|
|
10295
10309
|
});
|
|
10296
10310
|
};
|
|
@@ -10303,6 +10317,11 @@ var init_asset = __esm({
|
|
|
10303
10317
|
emitAssets
|
|
10304
10318
|
);
|
|
10305
10319
|
createAssetRule("font", FONT_EXTENSIONS, emitAssets);
|
|
10320
|
+
const assetsFilename = getMergedFilename("assets");
|
|
10321
|
+
chain.output.assetModuleFilename(assetsFilename);
|
|
10322
|
+
if (!emitAssets) {
|
|
10323
|
+
chain.module.generator.merge({ "asset/resource": { emit: false } });
|
|
10324
|
+
}
|
|
10306
10325
|
});
|
|
10307
10326
|
}
|
|
10308
10327
|
});
|
|
@@ -10451,13 +10470,15 @@ var init_RsbuildHtmlPlugin = __esm({
|
|
|
10451
10470
|
return data;
|
|
10452
10471
|
};
|
|
10453
10472
|
addTitleTag = (headTags, title = "") => {
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10473
|
+
if (title !== "" && title !== void 0) {
|
|
10474
|
+
headTags.unshift({
|
|
10475
|
+
tagName: "title",
|
|
10476
|
+
innerHTML: title,
|
|
10477
|
+
attributes: {},
|
|
10478
|
+
voidTag: false,
|
|
10479
|
+
meta: {}
|
|
10480
|
+
});
|
|
10481
|
+
}
|
|
10461
10482
|
};
|
|
10462
10483
|
RsbuildHtmlPlugin = class {
|
|
10463
10484
|
constructor(options, getEnvironment, modifyTagsFn) {
|
|
@@ -11378,12 +11399,6 @@ var init_swc = __esm({
|
|
|
11378
11399
|
const swcConfig = getDefaultSwcConfig(browserslist, cacheRoot);
|
|
11379
11400
|
applyTransformImport(swcConfig, config.source.transformImport);
|
|
11380
11401
|
applySwcDecoratorConfig(swcConfig, config);
|
|
11381
|
-
if (swcConfig.jsc?.externalHelpers) {
|
|
11382
|
-
chain.resolve.alias.set(
|
|
11383
|
-
"@swc/helpers",
|
|
11384
|
-
import_node_path31.default.dirname(require.resolve("@swc/helpers/package.json"))
|
|
11385
|
-
);
|
|
11386
|
-
}
|
|
11387
11402
|
if (isWebTarget(target)) {
|
|
11388
11403
|
const polyfillMode = config.output.polyfill;
|
|
11389
11404
|
if (polyfillMode === "off") {
|
|
@@ -13541,7 +13556,7 @@ var init_init = __esm({
|
|
|
13541
13556
|
|
|
13542
13557
|
// src/cli/commands.ts
|
|
13543
13558
|
function runCli() {
|
|
13544
|
-
program.name("rsbuild").usage("<command> [options]").version("1.0.
|
|
13559
|
+
program.name("rsbuild").usage("<command> [options]").version("1.0.14");
|
|
13545
13560
|
const devCommand = program.command("dev");
|
|
13546
13561
|
const buildCommand = program.command("build");
|
|
13547
13562
|
const previewCommand = program.command("preview");
|
|
@@ -13650,7 +13665,7 @@ function prepareCli() {
|
|
|
13650
13665
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
13651
13666
|
console.log();
|
|
13652
13667
|
}
|
|
13653
|
-
import_rslog.logger.greet(` ${`Rsbuild v${"1.0.
|
|
13668
|
+
import_rslog.logger.greet(` ${`Rsbuild v${"1.0.14"}`}
|
|
13654
13669
|
`);
|
|
13655
13670
|
}
|
|
13656
13671
|
var import_node_module;
|
|
@@ -13736,7 +13751,7 @@ init_logger();
|
|
|
13736
13751
|
init_mergeConfig();
|
|
13737
13752
|
init_helpers();
|
|
13738
13753
|
init_constants();
|
|
13739
|
-
var version = "1.0.
|
|
13754
|
+
var version = "1.0.14";
|
|
13740
13755
|
// Annotate the CommonJS export names for ESM import in node:
|
|
13741
13756
|
0 && (module.exports = {
|
|
13742
13757
|
PLUGIN_CSS_NAME,
|
package/dist/index.js
CHANGED
|
@@ -46,12 +46,12 @@ var __publicField = (obj, key, value) => {
|
|
|
46
46
|
return value;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
// ../../node_modules/.pnpm/@modern-js+module-tools@2.60.
|
|
49
|
+
// ../../node_modules/.pnpm/@modern-js+module-tools@2.60.3_typescript@5.6.3/node_modules/@modern-js/module-tools/shims/esm.js
|
|
50
50
|
import path from "path";
|
|
51
51
|
import { fileURLToPath } from "url";
|
|
52
52
|
var getFilename, getDirname, __dirname, __filename;
|
|
53
53
|
var init_esm = __esm({
|
|
54
|
-
"../../node_modules/.pnpm/@modern-js+module-tools@2.60.
|
|
54
|
+
"../../node_modules/.pnpm/@modern-js+module-tools@2.60.3_typescript@5.6.3/node_modules/@modern-js/module-tools/shims/esm.js"() {
|
|
55
55
|
"use strict";
|
|
56
56
|
getFilename = () => fileURLToPath(import.meta.url);
|
|
57
57
|
getDirname = () => path.dirname(getFilename());
|
|
@@ -3170,7 +3170,7 @@ var init_logger = __esm({
|
|
|
3170
3170
|
|
|
3171
3171
|
// src/constants.ts
|
|
3172
3172
|
import { join } from "path";
|
|
3173
|
-
var ROOT_DIST_DIR, HTML_DIST_DIR, JS_DIST_DIR, CSS_DIST_DIR, SVG_DIST_DIR, FONT_DIST_DIR, WASM_DIST_DIR, IMAGE_DIST_DIR, MEDIA_DIST_DIR, LOADER_PATH, STATIC_PATH, COMPILED_PATH, TS_CONFIG_FILE, HMR_SOCKET_PATH, RSBUILD_OUTPUTS_PATH, DEFAULT_PORT, DEFAULT_DATA_URL_SIZE, DEFAULT_MOUNT_ID, DEFAULT_DEV_HOST, DEFAULT_ASSET_PREFIX, DEFAULT_WEB_BROWSERSLIST, DEFAULT_BROWSERSLIST, HTML_REGEX, JS_REGEX, SCRIPT_REGEX, CSS_REGEX, NODE_MODULES_REGEX, PLUGIN_SWC_NAME, PLUGIN_CSS_NAME, FONT_EXTENSIONS, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS;
|
|
3173
|
+
var ROOT_DIST_DIR, HTML_DIST_DIR, JS_DIST_DIR, CSS_DIST_DIR, SVG_DIST_DIR, FONT_DIST_DIR, WASM_DIST_DIR, IMAGE_DIST_DIR, MEDIA_DIST_DIR, ASSETS_DIST_DIR, LOADER_PATH, STATIC_PATH, COMPILED_PATH, TS_CONFIG_FILE, HMR_SOCKET_PATH, RSBUILD_OUTPUTS_PATH, DEFAULT_PORT, DEFAULT_DATA_URL_SIZE, DEFAULT_MOUNT_ID, DEFAULT_DEV_HOST, DEFAULT_ASSET_PREFIX, DEFAULT_WEB_BROWSERSLIST, DEFAULT_BROWSERSLIST, HTML_REGEX, JS_REGEX, SCRIPT_REGEX, CSS_REGEX, NODE_MODULES_REGEX, PLUGIN_SWC_NAME, PLUGIN_CSS_NAME, FONT_EXTENSIONS, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS;
|
|
3174
3174
|
var init_constants = __esm({
|
|
3175
3175
|
"src/constants.ts"() {
|
|
3176
3176
|
"use strict";
|
|
@@ -3184,6 +3184,7 @@ var init_constants = __esm({
|
|
|
3184
3184
|
WASM_DIST_DIR = "static/wasm";
|
|
3185
3185
|
IMAGE_DIST_DIR = "static/image";
|
|
3186
3186
|
MEDIA_DIST_DIR = "static/media";
|
|
3187
|
+
ASSETS_DIST_DIR = "static/assets";
|
|
3187
3188
|
LOADER_PATH = join(__dirname);
|
|
3188
3189
|
STATIC_PATH = join(__dirname, "../static");
|
|
3189
3190
|
COMPILED_PATH = join(__dirname, "../compiled");
|
|
@@ -3728,6 +3729,8 @@ function getFilename2(config, type, isProd, isServer) {
|
|
|
3728
3729
|
return filename.image ?? `[name]${hash}[ext]`;
|
|
3729
3730
|
case "media":
|
|
3730
3731
|
return filename.media ?? `[name]${hash}[ext]`;
|
|
3732
|
+
case "assets":
|
|
3733
|
+
return filename.assets ?? `[name]${hash}[ext]`;
|
|
3731
3734
|
default:
|
|
3732
3735
|
throw new Error(`unknown key ${type} in "output.filename"`);
|
|
3733
3736
|
}
|
|
@@ -4049,7 +4052,7 @@ var init_restart = __esm({
|
|
|
4049
4052
|
|
|
4050
4053
|
// src/config.ts
|
|
4051
4054
|
import fs2 from "fs";
|
|
4052
|
-
import { isAbsolute as isAbsolute2, join as join3 } from "path";
|
|
4055
|
+
import { dirname, isAbsolute as isAbsolute2, join as join3 } from "path";
|
|
4053
4056
|
import color5 from "../compiled/picocolors/index.js";
|
|
4054
4057
|
import RspackChain from "../compiled/rspack-chain/index.js";
|
|
4055
4058
|
function getDefaultEntry(root) {
|
|
@@ -4230,7 +4233,7 @@ function stringifyConfig(config, verbose) {
|
|
|
4230
4233
|
const stringify = RspackChain.toString;
|
|
4231
4234
|
return stringify(config, { verbose });
|
|
4232
4235
|
}
|
|
4233
|
-
var getDefaultDevConfig, getDefaultServerConfig, getDefaultSourceConfig, getDefaultHtmlConfig, getDefaultSecurityConfig, getDefaultToolsConfig, getDefaultPerformanceConfig, getDefaultOutputConfig, createDefaultConfig, withDefaultConfig, normalizeConfig, resolveConfigPath, getRsbuildInspectConfig, normalizePublicDirs;
|
|
4236
|
+
var getDefaultDevConfig, getDefaultServerConfig, swcHelpersPath, getDefaultSourceConfig, getDefaultHtmlConfig, getDefaultSecurityConfig, getDefaultToolsConfig, getDefaultPerformanceConfig, getDefaultOutputConfig, createDefaultConfig, withDefaultConfig, normalizeConfig, resolveConfigPath, getRsbuildInspectConfig, normalizePublicDirs;
|
|
4234
4237
|
var init_config = __esm({
|
|
4235
4238
|
"src/config.ts"() {
|
|
4236
4239
|
"use strict";
|
|
@@ -4265,15 +4268,22 @@ var init_config = __esm({
|
|
|
4265
4268
|
printUrls: true,
|
|
4266
4269
|
strictPort: false
|
|
4267
4270
|
});
|
|
4268
|
-
getDefaultSourceConfig = () =>
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
aliasStrategy: "prefer-tsconfig",
|
|
4272
|
-
preEntry: [],
|
|
4273
|
-
decorators: {
|
|
4274
|
-
version: "2022-03"
|
|
4271
|
+
getDefaultSourceConfig = () => {
|
|
4272
|
+
if (!swcHelpersPath) {
|
|
4273
|
+
swcHelpersPath = dirname(__require.resolve("@swc/helpers/package.json"));
|
|
4275
4274
|
}
|
|
4276
|
-
|
|
4275
|
+
return {
|
|
4276
|
+
alias: {
|
|
4277
|
+
"@swc/helpers": swcHelpersPath
|
|
4278
|
+
},
|
|
4279
|
+
define: {},
|
|
4280
|
+
aliasStrategy: "prefer-tsconfig",
|
|
4281
|
+
preEntry: [],
|
|
4282
|
+
decorators: {
|
|
4283
|
+
version: "2022-03"
|
|
4284
|
+
}
|
|
4285
|
+
};
|
|
4286
|
+
};
|
|
4277
4287
|
getDefaultHtmlConfig = () => ({
|
|
4278
4288
|
meta: {
|
|
4279
4289
|
charset: { charset: "UTF-8" },
|
|
@@ -4321,7 +4331,8 @@ var init_config = __esm({
|
|
|
4321
4331
|
html: HTML_DIST_DIR,
|
|
4322
4332
|
wasm: WASM_DIST_DIR,
|
|
4323
4333
|
image: IMAGE_DIST_DIR,
|
|
4324
|
-
media: MEDIA_DIST_DIR
|
|
4334
|
+
media: MEDIA_DIST_DIR,
|
|
4335
|
+
assets: ASSETS_DIST_DIR
|
|
4325
4336
|
},
|
|
4326
4337
|
// Temporary placeholder, default: `${server.base}`
|
|
4327
4338
|
assetPrefix: DEFAULT_ASSET_PREFIX,
|
|
@@ -6053,7 +6064,7 @@ async function createContext(options, userConfig, bundlerType) {
|
|
|
6053
6064
|
const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
|
|
6054
6065
|
const cachePath = join6(rootPath, "node_modules", ".cache");
|
|
6055
6066
|
return {
|
|
6056
|
-
version: "1.0.
|
|
6067
|
+
version: "1.0.14",
|
|
6057
6068
|
rootPath,
|
|
6058
6069
|
distPath: "",
|
|
6059
6070
|
cachePath,
|
|
@@ -10365,10 +10376,13 @@ var init_asset = __esm({
|
|
|
10365
10376
|
setup(api) {
|
|
10366
10377
|
api.modifyBundlerChain((chain, { isProd, environment }) => {
|
|
10367
10378
|
const { config } = environment;
|
|
10368
|
-
const
|
|
10369
|
-
const regExp = getRegExpForExts(exts);
|
|
10379
|
+
const getMergedFilename = (assetType) => {
|
|
10370
10380
|
const distDir = config.output.distPath[assetType];
|
|
10371
10381
|
const filename = getFilename2(config, assetType, isProd);
|
|
10382
|
+
return path12.posix.join(distDir, filename);
|
|
10383
|
+
};
|
|
10384
|
+
const createAssetRule = (assetType, exts, emit) => {
|
|
10385
|
+
const regExp = getRegExpForExts(exts);
|
|
10372
10386
|
const { dataUriLimit } = config.output;
|
|
10373
10387
|
const maxSize = typeof dataUriLimit === "number" ? dataUriLimit : dataUriLimit[assetType];
|
|
10374
10388
|
const rule = chain.module.rule(assetType).test(regExp);
|
|
@@ -10376,7 +10390,7 @@ var init_asset = __esm({
|
|
|
10376
10390
|
emit,
|
|
10377
10391
|
rule,
|
|
10378
10392
|
maxSize,
|
|
10379
|
-
filename:
|
|
10393
|
+
filename: getMergedFilename(assetType),
|
|
10380
10394
|
assetType
|
|
10381
10395
|
});
|
|
10382
10396
|
};
|
|
@@ -10389,6 +10403,11 @@ var init_asset = __esm({
|
|
|
10389
10403
|
emitAssets
|
|
10390
10404
|
);
|
|
10391
10405
|
createAssetRule("font", FONT_EXTENSIONS, emitAssets);
|
|
10406
|
+
const assetsFilename = getMergedFilename("assets");
|
|
10407
|
+
chain.output.assetModuleFilename(assetsFilename);
|
|
10408
|
+
if (!emitAssets) {
|
|
10409
|
+
chain.module.generator.merge({ "asset/resource": { emit: false } });
|
|
10410
|
+
}
|
|
10392
10411
|
});
|
|
10393
10412
|
}
|
|
10394
10413
|
});
|
|
@@ -10538,13 +10557,15 @@ var init_RsbuildHtmlPlugin = __esm({
|
|
|
10538
10557
|
return data;
|
|
10539
10558
|
};
|
|
10540
10559
|
addTitleTag = (headTags, title = "") => {
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10560
|
+
if (title !== "" && title !== void 0) {
|
|
10561
|
+
headTags.unshift({
|
|
10562
|
+
tagName: "title",
|
|
10563
|
+
innerHTML: title,
|
|
10564
|
+
attributes: {},
|
|
10565
|
+
voidTag: false,
|
|
10566
|
+
meta: {}
|
|
10567
|
+
});
|
|
10568
|
+
}
|
|
10548
10569
|
};
|
|
10549
10570
|
RsbuildHtmlPlugin = class {
|
|
10550
10571
|
constructor(options, getEnvironment, modifyTagsFn) {
|
|
@@ -11474,12 +11495,6 @@ var init_swc = __esm({
|
|
|
11474
11495
|
const swcConfig = getDefaultSwcConfig(browserslist, cacheRoot);
|
|
11475
11496
|
applyTransformImport(swcConfig, config.source.transformImport);
|
|
11476
11497
|
applySwcDecoratorConfig(swcConfig, config);
|
|
11477
|
-
if (swcConfig.jsc?.externalHelpers) {
|
|
11478
|
-
chain.resolve.alias.set(
|
|
11479
|
-
"@swc/helpers",
|
|
11480
|
-
path17.dirname(__require.resolve("@swc/helpers/package.json"))
|
|
11481
|
-
);
|
|
11482
|
-
}
|
|
11483
11498
|
if (isWebTarget(target)) {
|
|
11484
11499
|
const polyfillMode = config.output.polyfill;
|
|
11485
11500
|
if (polyfillMode === "off") {
|
|
@@ -13659,7 +13674,7 @@ var init_init = __esm({
|
|
|
13659
13674
|
|
|
13660
13675
|
// src/cli/commands.ts
|
|
13661
13676
|
function runCli() {
|
|
13662
|
-
program.name("rsbuild").usage("<command> [options]").version("1.0.
|
|
13677
|
+
program.name("rsbuild").usage("<command> [options]").version("1.0.14");
|
|
13663
13678
|
const devCommand = program.command("dev");
|
|
13664
13679
|
const buildCommand = program.command("build");
|
|
13665
13680
|
const previewCommand = program.command("preview");
|
|
@@ -13770,7 +13785,7 @@ function prepareCli() {
|
|
|
13770
13785
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
13771
13786
|
console.log();
|
|
13772
13787
|
}
|
|
13773
|
-
logger.greet(` ${`Rsbuild v${"1.0.
|
|
13788
|
+
logger.greet(` ${`Rsbuild v${"1.0.14"}`}
|
|
13774
13789
|
`);
|
|
13775
13790
|
}
|
|
13776
13791
|
var init_prepare = __esm({
|
|
@@ -13841,7 +13856,7 @@ init_mergeConfig();
|
|
|
13841
13856
|
init_helpers();
|
|
13842
13857
|
init_constants();
|
|
13843
13858
|
import { rspack as rspack10 } from "@rspack/core";
|
|
13844
|
-
var version = "1.0.
|
|
13859
|
+
var version = "1.0.14";
|
|
13845
13860
|
export {
|
|
13846
13861
|
PLUGIN_CSS_NAME,
|
|
13847
13862
|
PLUGIN_SWC_NAME,
|
|
@@ -7,6 +7,7 @@ export declare const FONT_DIST_DIR = "static/font";
|
|
|
7
7
|
export declare const WASM_DIST_DIR = "static/wasm";
|
|
8
8
|
export declare const IMAGE_DIST_DIR = "static/image";
|
|
9
9
|
export declare const MEDIA_DIST_DIR = "static/media";
|
|
10
|
+
export declare const ASSETS_DIST_DIR = "static/assets";
|
|
10
11
|
export declare const LOADER_PATH: string;
|
|
11
12
|
export declare const STATIC_PATH: string;
|
|
12
13
|
export declare const COMPILED_PATH: string;
|
|
@@ -475,6 +475,11 @@ export type DistPathConfig = {
|
|
|
475
475
|
* @default 'static/media'
|
|
476
476
|
*/
|
|
477
477
|
media?: string;
|
|
478
|
+
/**
|
|
479
|
+
* The output directory of assets, except for above (image, svg, font, html, wasm...)
|
|
480
|
+
* @default 'static/assets'
|
|
481
|
+
*/
|
|
482
|
+
assets?: string;
|
|
478
483
|
};
|
|
479
484
|
export type FilenameConfig = {
|
|
480
485
|
/**
|
|
@@ -516,6 +521,11 @@ export type FilenameConfig = {
|
|
|
516
521
|
* @default '[name].[contenthash:8][ext]'
|
|
517
522
|
*/
|
|
518
523
|
media?: string;
|
|
524
|
+
/**
|
|
525
|
+
* the name of other assets, except for above (image, svg, font, html, wasm...)
|
|
526
|
+
* @default '[name].[contenthash:8][ext]'
|
|
527
|
+
*/
|
|
528
|
+
assets?: string;
|
|
519
529
|
};
|
|
520
530
|
export type DataUriLimit = {
|
|
521
531
|
/** The data URI limit of the SVG image. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"rslog": "^1.2.3",
|
|
86
86
|
"rspack-chain": "^1.0.3",
|
|
87
87
|
"rspack-manifest-plugin": "5.0.1",
|
|
88
|
-
"sirv": "^
|
|
88
|
+
"sirv": "^3.0.0",
|
|
89
89
|
"style-loader": "3.3.4",
|
|
90
90
|
"tsc-alias": "^1.8.10",
|
|
91
91
|
"typescript": "^5.6.3",
|