@rsbuild/core 0.7.7 → 0.7.8
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 +3 -3
- package/compiled/jiti/index.d.ts +1 -0
- package/compiled/jiti/index.js +391 -0
- package/compiled/jiti/license +21 -0
- package/compiled/jiti/package.json +1 -0
- package/compiled/postcss-load-config/index.js +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/semver/index.d.ts +1 -0
- package/compiled/semver/index.js +2585 -0
- package/compiled/semver/license +15 -0
- package/compiled/semver/package.json +1 -0
- package/compiled/webpack-dev-middleware/index.js +280 -10
- package/compiled/ws/index.js +80 -57
- package/compiled/ws/package.json +1 -1
- package/dist/index.cjs +579 -530
- package/dist/index.js +340 -304
- package/dist-types/helpers.d.ts +2 -0
- package/dist-types/index.d.ts +1 -0
- package/dist-types/internal.d.ts +1 -1
- package/dist-types/server/helper.d.ts +1 -0
- package/dist-types/types.d.ts +1 -2
- package/package.json +5 -3
- package/dist-types/server/index.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -23,12 +23,12 @@ var __publicField = (obj, key, value) => {
|
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
// ../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.
|
|
26
|
+
// ../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.5.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
|
|
27
27
|
import { fileURLToPath } from "url";
|
|
28
28
|
import path from "path";
|
|
29
29
|
var getFilename, getDirname, __dirname, __filename;
|
|
30
30
|
var init_esm = __esm({
|
|
31
|
-
"../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.
|
|
31
|
+
"../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.5.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js"() {
|
|
32
32
|
"use strict";
|
|
33
33
|
getFilename = () => fileURLToPath(import.meta.url);
|
|
34
34
|
getDirname = () => path.dirname(getFilename());
|
|
@@ -173,7 +173,7 @@ var init_constants = __esm({
|
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
// src/helpers.ts
|
|
176
|
-
import path2 from "path";
|
|
176
|
+
import path2, { posix } from "path";
|
|
177
177
|
import {
|
|
178
178
|
DEFAULT_ASSET_PREFIX,
|
|
179
179
|
addTrailingSlash,
|
|
@@ -252,7 +252,7 @@ function isEmptyDir(path14) {
|
|
|
252
252
|
async function isFileExists(file) {
|
|
253
253
|
return fse.promises.access(file, fse.constants.F_OK).then(() => true).catch(() => false);
|
|
254
254
|
}
|
|
255
|
-
var rspackMinVersion, compareSemver, isSatisfyRspackVersion, getCompiledPath, hintNodePolyfill, getAllStatsErrors, getAllStatsWarnings, formatPublicPath, getPublicPathFromChain, ensureAbsolutePath, isFileSync, findExists;
|
|
255
|
+
var rspackMinVersion, compareSemver, isSatisfyRspackVersion, getCompiledPath, hintNodePolyfill, getAllStatsErrors, getAllStatsWarnings, formatPublicPath, getPublicPathFromChain, ensureAbsolutePath, isFileSync, findExists, urlJoin, canParse, ensureAssetPrefix;
|
|
256
256
|
var init_helpers = __esm({
|
|
257
257
|
"src/helpers.ts"() {
|
|
258
258
|
"use strict";
|
|
@@ -394,6 +394,34 @@ ${color.yellow(tips.join("\n"))}`;
|
|
|
394
394
|
}
|
|
395
395
|
return false;
|
|
396
396
|
};
|
|
397
|
+
urlJoin = (base, path14) => {
|
|
398
|
+
const fullUrl = new URL(base);
|
|
399
|
+
fullUrl.pathname = posix.join(fullUrl.pathname, path14);
|
|
400
|
+
return fullUrl.toString();
|
|
401
|
+
};
|
|
402
|
+
canParse = (url2) => {
|
|
403
|
+
try {
|
|
404
|
+
new URL(url2);
|
|
405
|
+
return true;
|
|
406
|
+
} catch {
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
ensureAssetPrefix = (url2, assetPrefix) => {
|
|
411
|
+
if (url2.startsWith("//")) {
|
|
412
|
+
return url2;
|
|
413
|
+
}
|
|
414
|
+
if (canParse(url2)) {
|
|
415
|
+
return url2;
|
|
416
|
+
}
|
|
417
|
+
if (assetPrefix.startsWith("http")) {
|
|
418
|
+
return urlJoin(assetPrefix, url2);
|
|
419
|
+
}
|
|
420
|
+
if (assetPrefix.startsWith("//")) {
|
|
421
|
+
return urlJoin(`https:${assetPrefix}`, url2).replace("https:", "");
|
|
422
|
+
}
|
|
423
|
+
return posix.join(assetPrefix, url2);
|
|
424
|
+
};
|
|
397
425
|
}
|
|
398
426
|
});
|
|
399
427
|
|
|
@@ -576,7 +604,7 @@ async function loadConfig({
|
|
|
576
604
|
return config;
|
|
577
605
|
};
|
|
578
606
|
try {
|
|
579
|
-
const { default: jiti } = await import("
|
|
607
|
+
const { default: jiti } = await import("../compiled/jiti/index.js");
|
|
580
608
|
const loadConfig2 = jiti(__filename, {
|
|
581
609
|
esmResolve: true,
|
|
582
610
|
// disable require cache to support restart CLI and read the new config
|
|
@@ -1073,7 +1101,7 @@ async function createContextByConfig(options, bundlerType, config = {}) {
|
|
|
1073
1101
|
return {
|
|
1074
1102
|
entry: getEntryObject(config, "web"),
|
|
1075
1103
|
targets: config.output?.targets || [],
|
|
1076
|
-
version: "0.7.
|
|
1104
|
+
version: "0.7.8",
|
|
1077
1105
|
rootPath,
|
|
1078
1106
|
distPath,
|
|
1079
1107
|
cachePath,
|
|
@@ -2295,13 +2323,7 @@ var init_getDevMiddlewares = __esm({
|
|
|
2295
2323
|
// src/server/helper.ts
|
|
2296
2324
|
import net from "net";
|
|
2297
2325
|
import os from "os";
|
|
2298
|
-
import {
|
|
2299
|
-
color as color8,
|
|
2300
|
-
deepmerge,
|
|
2301
|
-
isFunction as isFunction4,
|
|
2302
|
-
logger as logger8,
|
|
2303
|
-
normalizeUrl
|
|
2304
|
-
} from "@rsbuild/shared";
|
|
2326
|
+
import { color as color8, deepmerge, isFunction as isFunction4, logger as logger8 } from "@rsbuild/shared";
|
|
2305
2327
|
function getURLMessages(urls, routes) {
|
|
2306
2328
|
if (routes.length === 1) {
|
|
2307
2329
|
return urls.map(
|
|
@@ -2366,12 +2388,13 @@ function printServerURLs({
|
|
|
2366
2388
|
logger8.log(message);
|
|
2367
2389
|
return message;
|
|
2368
2390
|
}
|
|
2369
|
-
var formatPrefix, formatRoutes, HMR_SOCK_PATH, getPort, getServerConfig, getDevConfig, getIpv4Interfaces, isLoopbackHost, getHostInUrl, concatUrl, LOCAL_LABEL, NETWORK_LABEL, getUrlLabel, getAddressUrls;
|
|
2391
|
+
var normalizeUrl, formatPrefix, formatRoutes, HMR_SOCK_PATH, getPort, getServerConfig, getDevConfig, getIpv4Interfaces, isLoopbackHost, getHostInUrl, concatUrl, LOCAL_LABEL, NETWORK_LABEL, getUrlLabel, getAddressUrls;
|
|
2370
2392
|
var init_helper = __esm({
|
|
2371
2393
|
"src/server/helper.ts"() {
|
|
2372
2394
|
"use strict";
|
|
2373
2395
|
init_esm();
|
|
2374
2396
|
init_constants();
|
|
2397
|
+
normalizeUrl = (url2) => url2.replace(/([^:]\/)\/+/g, "$1");
|
|
2375
2398
|
formatPrefix = (prefix) => {
|
|
2376
2399
|
if (!prefix) {
|
|
2377
2400
|
return "/";
|
|
@@ -3085,189 +3108,12 @@ var init_devServer = __esm({
|
|
|
3085
3108
|
}
|
|
3086
3109
|
});
|
|
3087
3110
|
|
|
3088
|
-
// src/server/prodServer.ts
|
|
3089
|
-
var prodServer_exports = {};
|
|
3090
|
-
__export(prodServer_exports, {
|
|
3091
|
-
RsbuildProdServer: () => RsbuildProdServer,
|
|
3092
|
-
startProdServer: () => startProdServer
|
|
3093
|
-
});
|
|
3094
|
-
import { join as join8 } from "path";
|
|
3095
|
-
import {
|
|
3096
|
-
getNodeEnv as getNodeEnv6,
|
|
3097
|
-
isDebug as isDebug5,
|
|
3098
|
-
setNodeEnv as setNodeEnv3
|
|
3099
|
-
} from "@rsbuild/shared";
|
|
3100
|
-
async function startProdServer(context, config, { getPortSilently } = {}) {
|
|
3101
|
-
if (!getNodeEnv6()) {
|
|
3102
|
-
setNodeEnv3("production");
|
|
3103
|
-
}
|
|
3104
|
-
const { port, host, https } = await getServerConfig({
|
|
3105
|
-
config,
|
|
3106
|
-
getPortSilently
|
|
3107
|
-
});
|
|
3108
|
-
const { default: connect } = await import("../compiled/connect/index.js");
|
|
3109
|
-
const middlewares = connect();
|
|
3110
|
-
const serverConfig = config.server;
|
|
3111
|
-
const server = new RsbuildProdServer(
|
|
3112
|
-
{
|
|
3113
|
-
pwd: context.rootPath,
|
|
3114
|
-
output: {
|
|
3115
|
-
path: config.output.distPath.root || ROOT_DIST_DIR,
|
|
3116
|
-
assetPrefix: config.output.assetPrefix
|
|
3117
|
-
},
|
|
3118
|
-
serverConfig
|
|
3119
|
-
},
|
|
3120
|
-
middlewares
|
|
3121
|
-
);
|
|
3122
|
-
await context.hooks.onBeforeStartProdServer.call();
|
|
3123
|
-
const httpServer = await createHttpServer({
|
|
3124
|
-
serverConfig,
|
|
3125
|
-
middlewares: server.middlewares
|
|
3126
|
-
});
|
|
3127
|
-
await server.onInit(httpServer);
|
|
3128
|
-
return new Promise((resolve) => {
|
|
3129
|
-
httpServer.listen(
|
|
3130
|
-
{
|
|
3131
|
-
host,
|
|
3132
|
-
port
|
|
3133
|
-
},
|
|
3134
|
-
async () => {
|
|
3135
|
-
const routes = formatRoutes(
|
|
3136
|
-
context.entry,
|
|
3137
|
-
config.output.distPath.html,
|
|
3138
|
-
config.html.outputStructure
|
|
3139
|
-
);
|
|
3140
|
-
await context.hooks.onAfterStartProdServer.call({
|
|
3141
|
-
port,
|
|
3142
|
-
routes
|
|
3143
|
-
});
|
|
3144
|
-
const protocol = https ? "https" : "http";
|
|
3145
|
-
const urls = getAddressUrls({ protocol, port, host });
|
|
3146
|
-
printServerURLs({
|
|
3147
|
-
urls,
|
|
3148
|
-
port,
|
|
3149
|
-
routes,
|
|
3150
|
-
protocol,
|
|
3151
|
-
printUrls: serverConfig.printUrls
|
|
3152
|
-
});
|
|
3153
|
-
const onClose = () => {
|
|
3154
|
-
server.close();
|
|
3155
|
-
httpServer.close();
|
|
3156
|
-
};
|
|
3157
|
-
resolve({
|
|
3158
|
-
port,
|
|
3159
|
-
urls: urls.map((item) => item.url),
|
|
3160
|
-
server: {
|
|
3161
|
-
close: async () => {
|
|
3162
|
-
onClose();
|
|
3163
|
-
}
|
|
3164
|
-
}
|
|
3165
|
-
});
|
|
3166
|
-
}
|
|
3167
|
-
);
|
|
3168
|
-
});
|
|
3169
|
-
}
|
|
3170
|
-
var RsbuildProdServer;
|
|
3171
|
-
var init_prodServer = __esm({
|
|
3172
|
-
"src/server/prodServer.ts"() {
|
|
3173
|
-
"use strict";
|
|
3174
|
-
init_esm();
|
|
3175
|
-
init_constants();
|
|
3176
|
-
init_helper();
|
|
3177
|
-
init_httpServer();
|
|
3178
|
-
init_middlewares();
|
|
3179
|
-
RsbuildProdServer = class {
|
|
3180
|
-
constructor(options, middlewares) {
|
|
3181
|
-
__publicField(this, "app");
|
|
3182
|
-
__publicField(this, "options");
|
|
3183
|
-
__publicField(this, "middlewares");
|
|
3184
|
-
this.options = options;
|
|
3185
|
-
this.middlewares = middlewares;
|
|
3186
|
-
}
|
|
3187
|
-
// Complete the preparation of services
|
|
3188
|
-
async onInit(app) {
|
|
3189
|
-
this.app = app;
|
|
3190
|
-
await this.applyDefaultMiddlewares();
|
|
3191
|
-
}
|
|
3192
|
-
async applyDefaultMiddlewares() {
|
|
3193
|
-
const { headers, proxy, historyApiFallback, compress } = this.options.serverConfig;
|
|
3194
|
-
if (isDebug5()) {
|
|
3195
|
-
this.middlewares.use(await getRequestLoggerMiddleware());
|
|
3196
|
-
}
|
|
3197
|
-
if (compress) {
|
|
3198
|
-
const { default: compression } = await import("../compiled/http-compression/index.js");
|
|
3199
|
-
this.middlewares.use((req, res, next) => {
|
|
3200
|
-
compression({
|
|
3201
|
-
gzip: true,
|
|
3202
|
-
brotli: false
|
|
3203
|
-
})(req, res, next);
|
|
3204
|
-
});
|
|
3205
|
-
}
|
|
3206
|
-
if (headers) {
|
|
3207
|
-
this.middlewares.use((_req, res, next) => {
|
|
3208
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
3209
|
-
res.setHeader(key, value);
|
|
3210
|
-
}
|
|
3211
|
-
next();
|
|
3212
|
-
});
|
|
3213
|
-
}
|
|
3214
|
-
if (proxy) {
|
|
3215
|
-
const { createProxyMiddleware: createProxyMiddleware2 } = await Promise.resolve().then(() => (init_proxy(), proxy_exports));
|
|
3216
|
-
const { middlewares, upgrade } = createProxyMiddleware2(proxy);
|
|
3217
|
-
for (const middleware of middlewares) {
|
|
3218
|
-
this.middlewares.use(middleware);
|
|
3219
|
-
}
|
|
3220
|
-
this.app.on("upgrade", upgrade);
|
|
3221
|
-
}
|
|
3222
|
-
this.applyStaticAssetMiddleware();
|
|
3223
|
-
if (historyApiFallback) {
|
|
3224
|
-
const { default: connectHistoryApiFallback } = await import("../compiled/connect-history-api-fallback/index.js");
|
|
3225
|
-
const historyApiFallbackMiddleware = connectHistoryApiFallback(
|
|
3226
|
-
historyApiFallback === true ? {} : historyApiFallback
|
|
3227
|
-
);
|
|
3228
|
-
this.middlewares.use(historyApiFallbackMiddleware);
|
|
3229
|
-
await this.applyStaticAssetMiddleware();
|
|
3230
|
-
}
|
|
3231
|
-
this.middlewares.use(faviconFallbackMiddleware);
|
|
3232
|
-
}
|
|
3233
|
-
async applyStaticAssetMiddleware() {
|
|
3234
|
-
const {
|
|
3235
|
-
output: { path: path14, assetPrefix },
|
|
3236
|
-
serverConfig: { htmlFallback },
|
|
3237
|
-
pwd
|
|
3238
|
-
} = this.options;
|
|
3239
|
-
const { default: sirv } = await import("../compiled/sirv/index.js");
|
|
3240
|
-
const assetMiddleware = sirv(join8(pwd, path14), {
|
|
3241
|
-
etag: true,
|
|
3242
|
-
dev: true,
|
|
3243
|
-
ignores: ["favicon.ico"],
|
|
3244
|
-
single: htmlFallback === "index"
|
|
3245
|
-
});
|
|
3246
|
-
this.middlewares.use((req, res, next) => {
|
|
3247
|
-
const url2 = req.url;
|
|
3248
|
-
if (assetPrefix && url2?.startsWith(assetPrefix)) {
|
|
3249
|
-
req.url = url2.slice(assetPrefix.length);
|
|
3250
|
-
assetMiddleware(req, res, (...args) => {
|
|
3251
|
-
req.url = url2;
|
|
3252
|
-
next(...args);
|
|
3253
|
-
});
|
|
3254
|
-
} else {
|
|
3255
|
-
assetMiddleware(req, res, next);
|
|
3256
|
-
}
|
|
3257
|
-
});
|
|
3258
|
-
}
|
|
3259
|
-
close() {
|
|
3260
|
-
}
|
|
3261
|
-
};
|
|
3262
|
-
}
|
|
3263
|
-
});
|
|
3264
|
-
|
|
3265
3111
|
// src/provider/build.ts
|
|
3266
3112
|
var build_exports = {};
|
|
3267
3113
|
__export(build_exports, {
|
|
3268
3114
|
build: () => build
|
|
3269
3115
|
});
|
|
3270
|
-
import { getNodeEnv as
|
|
3116
|
+
import { getNodeEnv as getNodeEnv6, logger as logger10, onCompileDone as onCompileDone2, setNodeEnv as setNodeEnv3 } from "@rsbuild/shared";
|
|
3271
3117
|
import { rspack as rspack4 } from "@rspack/core";
|
|
3272
3118
|
var build;
|
|
3273
3119
|
var init_build = __esm({
|
|
@@ -3277,8 +3123,8 @@ var init_build = __esm({
|
|
|
3277
3123
|
init_createCompiler();
|
|
3278
3124
|
init_initConfigs();
|
|
3279
3125
|
build = async (initOptions, { mode = "production", watch, compiler: customCompiler } = {}) => {
|
|
3280
|
-
if (!
|
|
3281
|
-
|
|
3126
|
+
if (!getNodeEnv6()) {
|
|
3127
|
+
setNodeEnv3(mode);
|
|
3282
3128
|
}
|
|
3283
3129
|
const { context } = initOptions;
|
|
3284
3130
|
let compiler;
|
|
@@ -3389,11 +3235,6 @@ var init_provider = __esm({
|
|
|
3389
3235
|
);
|
|
3390
3236
|
return server.listen();
|
|
3391
3237
|
},
|
|
3392
|
-
async preview(options) {
|
|
3393
|
-
const { startProdServer: startProdServer2 } = await Promise.resolve().then(() => (init_prodServer(), prodServer_exports));
|
|
3394
|
-
const config = await initRsbuildConfig({ context, pluginManager });
|
|
3395
|
-
return startProdServer2(context, config, options);
|
|
3396
|
-
},
|
|
3397
3238
|
async build(options) {
|
|
3398
3239
|
const { build: build2 } = await Promise.resolve().then(() => (init_build(), build_exports));
|
|
3399
3240
|
return build2({ context, pluginManager, rsbuildOptions }, options);
|
|
@@ -3480,10 +3321,10 @@ __export(cache_exports, {
|
|
|
3480
3321
|
pluginCache: () => pluginCache
|
|
3481
3322
|
});
|
|
3482
3323
|
import crypto from "crypto";
|
|
3483
|
-
import { isAbsolute as isAbsolute5, join as
|
|
3324
|
+
import { isAbsolute as isAbsolute5, join as join8 } from "path";
|
|
3484
3325
|
import { fse as fse3 } from "@rsbuild/shared";
|
|
3485
3326
|
async function validateCache(cacheDirectory, buildDependencies) {
|
|
3486
|
-
const configFile =
|
|
3327
|
+
const configFile = join8(cacheDirectory, "buildDependencies.json");
|
|
3487
3328
|
if (await isFileExists(configFile)) {
|
|
3488
3329
|
const prevBuildDependencies = await fse3.readJSON(configFile);
|
|
3489
3330
|
if (JSON.stringify(prevBuildDependencies) === JSON.stringify(buildDependencies)) {
|
|
@@ -3500,13 +3341,13 @@ function getDigestHash(digest) {
|
|
|
3500
3341
|
}
|
|
3501
3342
|
function getCacheDirectory({ cacheDirectory }, context) {
|
|
3502
3343
|
if (cacheDirectory) {
|
|
3503
|
-
return isAbsolute5(cacheDirectory) ? cacheDirectory :
|
|
3344
|
+
return isAbsolute5(cacheDirectory) ? cacheDirectory : join8(context.rootPath, cacheDirectory);
|
|
3504
3345
|
}
|
|
3505
|
-
return
|
|
3346
|
+
return join8(context.cachePath, context.bundlerType);
|
|
3506
3347
|
}
|
|
3507
3348
|
async function getBuildDependencies(context, config) {
|
|
3508
|
-
const rootPackageJson =
|
|
3509
|
-
const browserslistConfig =
|
|
3349
|
+
const rootPackageJson = join8(context.rootPath, "package.json");
|
|
3350
|
+
const browserslistConfig = join8(context.rootPath, ".browserslistrc");
|
|
3510
3351
|
const buildDependencies = {};
|
|
3511
3352
|
if (await isFileExists(rootPackageJson)) {
|
|
3512
3353
|
buildDependencies.packageJson = [rootPackageJson];
|
|
@@ -3522,7 +3363,7 @@ async function getBuildDependencies(context, config) {
|
|
|
3522
3363
|
}
|
|
3523
3364
|
const tailwindExts = ["ts", "js", "cjs", "mjs"];
|
|
3524
3365
|
const configs = tailwindExts.map(
|
|
3525
|
-
(ext) =>
|
|
3366
|
+
(ext) => join8(context.rootPath, `tailwind.config.${ext}`)
|
|
3526
3367
|
);
|
|
3527
3368
|
const tailwindConfig = findExists(configs);
|
|
3528
3369
|
if (tailwindConfig) {
|
|
@@ -3850,7 +3691,7 @@ var output_exports = {};
|
|
|
3850
3691
|
__export(output_exports, {
|
|
3851
3692
|
pluginOutput: () => pluginOutput
|
|
3852
3693
|
});
|
|
3853
|
-
import { posix } from "path";
|
|
3694
|
+
import { posix as posix2 } from "path";
|
|
3854
3695
|
import {
|
|
3855
3696
|
DEFAULT_ASSET_PREFIX as DEFAULT_ASSET_PREFIX3,
|
|
3856
3697
|
getDistPath as getDistPath3,
|
|
@@ -3910,24 +3751,24 @@ var init_output = __esm({
|
|
|
3910
3751
|
chain.output.path(api.context.distPath).filename(
|
|
3911
3752
|
isJsFilenameFn ? (...args) => {
|
|
3912
3753
|
const name = jsFilename(...args);
|
|
3913
|
-
return
|
|
3914
|
-
} :
|
|
3754
|
+
return posix2.join(jsPath, name);
|
|
3755
|
+
} : posix2.join(jsPath, jsFilename)
|
|
3915
3756
|
).chunkFilename(
|
|
3916
3757
|
isJsFilenameFn ? (...args) => {
|
|
3917
3758
|
const name = jsFilename(...args);
|
|
3918
|
-
return
|
|
3919
|
-
} :
|
|
3759
|
+
return posix2.join(jsAsyncPath, name);
|
|
3760
|
+
} : posix2.join(jsAsyncPath, jsFilename)
|
|
3920
3761
|
).publicPath(publicPath).pathinfo(false).hashFunction("xxhash64");
|
|
3921
3762
|
if (isServer) {
|
|
3922
3763
|
const serverPath = getDistPath3(config, "server");
|
|
3923
|
-
chain.output.path(
|
|
3764
|
+
chain.output.path(posix2.join(api.context.distPath, serverPath)).filename("[name].js").chunkFilename("[name].js").library({
|
|
3924
3765
|
...chain.output.get("library") || {},
|
|
3925
3766
|
type: "commonjs2"
|
|
3926
3767
|
});
|
|
3927
3768
|
}
|
|
3928
3769
|
if (isServiceWorker) {
|
|
3929
3770
|
const workerPath = getDistPath3(config, "worker");
|
|
3930
|
-
const filename =
|
|
3771
|
+
const filename = posix2.join(workerPath, "[name].js");
|
|
3931
3772
|
chain.output.filename(filename).chunkFilename(filename);
|
|
3932
3773
|
}
|
|
3933
3774
|
if (config.output.copy && api.context.bundlerType === "rspack") {
|
|
@@ -3942,8 +3783,8 @@ var init_output = __esm({
|
|
|
3942
3783
|
const cssAsyncPath = getDistPath3(config, "cssAsync");
|
|
3943
3784
|
chain.plugin(CHAIN_ID3.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
|
|
3944
3785
|
{
|
|
3945
|
-
filename:
|
|
3946
|
-
chunkFilename:
|
|
3786
|
+
filename: posix2.join(cssPath, cssFilename),
|
|
3787
|
+
chunkFilename: posix2.join(cssAsyncPath, cssFilename),
|
|
3947
3788
|
...extractPluginOptions
|
|
3948
3789
|
}
|
|
3949
3790
|
]);
|
|
@@ -4474,14 +4315,14 @@ __export(HtmlBasicPlugin_exports, {
|
|
|
4474
4315
|
});
|
|
4475
4316
|
import {
|
|
4476
4317
|
isFunction as isFunction6,
|
|
4477
|
-
partition
|
|
4478
|
-
withPublicPath
|
|
4318
|
+
partition
|
|
4479
4319
|
} from "@rsbuild/shared";
|
|
4480
4320
|
var VOID_TAGS, HEAD_TAGS, FILE_ATTRS, hasTitle, getTagPriority, formatBasicTag, fromBasicTag, formatTags, applyTagConfig, addTitleTag, addFavicon, HtmlBasicPlugin;
|
|
4481
4321
|
var init_HtmlBasicPlugin = __esm({
|
|
4482
4322
|
"src/rspack/HtmlBasicPlugin.ts"() {
|
|
4483
4323
|
"use strict";
|
|
4484
4324
|
init_esm();
|
|
4325
|
+
init_helpers();
|
|
4485
4326
|
init_pluginHelper();
|
|
4486
4327
|
VOID_TAGS = [
|
|
4487
4328
|
"area",
|
|
@@ -4556,9 +4397,9 @@ var init_HtmlBasicPlugin = __esm({
|
|
|
4556
4397
|
if (typeof optPublicPath === "function") {
|
|
4557
4398
|
filename = optPublicPath(filename, data.publicPath);
|
|
4558
4399
|
} else if (typeof optPublicPath === "string") {
|
|
4559
|
-
filename =
|
|
4400
|
+
filename = ensureAssetPrefix(filename, optPublicPath);
|
|
4560
4401
|
} else if (optPublicPath !== false) {
|
|
4561
|
-
filename =
|
|
4402
|
+
filename = ensureAssetPrefix(filename, data.publicPath);
|
|
4562
4403
|
}
|
|
4563
4404
|
const optHash = tag.hash ?? tagConfig.hash;
|
|
4564
4405
|
if (typeof optHash === "function") {
|
|
@@ -4684,13 +4525,14 @@ __export(HtmlAppIconPlugin_exports, {
|
|
|
4684
4525
|
HtmlAppIconPlugin: () => HtmlAppIconPlugin
|
|
4685
4526
|
});
|
|
4686
4527
|
import fs4 from "fs";
|
|
4687
|
-
import { basename, posix as
|
|
4688
|
-
import { getPublicPathFromCompiler as getPublicPathFromCompiler2
|
|
4528
|
+
import { basename, posix as posix3 } from "path";
|
|
4529
|
+
import { getPublicPathFromCompiler as getPublicPathFromCompiler2 } from "@rsbuild/shared";
|
|
4689
4530
|
var HtmlAppIconPlugin;
|
|
4690
4531
|
var init_HtmlAppIconPlugin = __esm({
|
|
4691
4532
|
"src/rspack/HtmlAppIconPlugin.ts"() {
|
|
4692
4533
|
"use strict";
|
|
4693
4534
|
init_esm();
|
|
4535
|
+
init_helpers();
|
|
4694
4536
|
init_pluginHelper();
|
|
4695
4537
|
HtmlAppIconPlugin = class {
|
|
4696
4538
|
constructor(options) {
|
|
@@ -4707,7 +4549,7 @@ var init_HtmlAppIconPlugin = __esm({
|
|
|
4707
4549
|
`[${this.name}] Can not find the app icon, please check if the '${this.iconPath}' file exists'.`
|
|
4708
4550
|
);
|
|
4709
4551
|
}
|
|
4710
|
-
const iconRelativePath =
|
|
4552
|
+
const iconRelativePath = posix3.join(this.distDir, basename(this.iconPath));
|
|
4711
4553
|
compiler.hooks.compilation.tap(this.name, (compilation) => {
|
|
4712
4554
|
getHTMLPlugin().getHooks(compilation).alterAssetTagGroups.tap(this.name, (data) => {
|
|
4713
4555
|
const publicPath = getPublicPathFromCompiler2(compiler);
|
|
@@ -4717,7 +4559,7 @@ var init_HtmlAppIconPlugin = __esm({
|
|
|
4717
4559
|
attributes: {
|
|
4718
4560
|
rel: "apple-touch-icon",
|
|
4719
4561
|
sizes: "180*180",
|
|
4720
|
-
href:
|
|
4562
|
+
href: ensureAssetPrefix(iconRelativePath, publicPath)
|
|
4721
4563
|
},
|
|
4722
4564
|
meta: {}
|
|
4723
4565
|
});
|
|
@@ -5070,7 +4912,7 @@ var wasm_exports = {};
|
|
|
5070
4912
|
__export(wasm_exports, {
|
|
5071
4913
|
pluginWasm: () => pluginWasm
|
|
5072
4914
|
});
|
|
5073
|
-
import { posix as
|
|
4915
|
+
import { posix as posix4 } from "path";
|
|
5074
4916
|
import { getDistPath as getDistPath6 } from "@rsbuild/shared";
|
|
5075
4917
|
var pluginWasm;
|
|
5076
4918
|
var init_wasm = __esm({
|
|
@@ -5087,7 +4929,7 @@ var init_wasm = __esm({
|
|
|
5087
4929
|
...chain.get("experiments"),
|
|
5088
4930
|
asyncWebAssembly: true
|
|
5089
4931
|
});
|
|
5090
|
-
const wasmFilename =
|
|
4932
|
+
const wasmFilename = posix4.join(distPath, "[hash].module.wasm");
|
|
5091
4933
|
chain.output.merge({
|
|
5092
4934
|
webassemblyModuleFilename: wasmFilename
|
|
5093
4935
|
});
|
|
@@ -5186,7 +5028,7 @@ var define_exports = {};
|
|
|
5186
5028
|
__export(define_exports, {
|
|
5187
5029
|
pluginDefine: () => pluginDefine
|
|
5188
5030
|
});
|
|
5189
|
-
import { getNodeEnv as
|
|
5031
|
+
import { getNodeEnv as getNodeEnv7 } from "@rsbuild/shared";
|
|
5190
5032
|
var pluginDefine;
|
|
5191
5033
|
var init_define = __esm({
|
|
5192
5034
|
"src/plugins/define.ts"() {
|
|
@@ -5199,7 +5041,7 @@ var init_define = __esm({
|
|
|
5199
5041
|
api.modifyBundlerChain((chain, { CHAIN_ID: CHAIN_ID3, bundler }) => {
|
|
5200
5042
|
const config = api.getNormalizedConfig();
|
|
5201
5043
|
const builtinVars = {
|
|
5202
|
-
"process.env.NODE_ENV": JSON.stringify(
|
|
5044
|
+
"process.env.NODE_ENV": JSON.stringify(getNodeEnv7()),
|
|
5203
5045
|
"process.env.ASSET_PREFIX": JSON.stringify(
|
|
5204
5046
|
getPublicPathFromChain(chain, false)
|
|
5205
5047
|
)
|
|
@@ -5643,12 +5485,7 @@ __export(open_exports, {
|
|
|
5643
5485
|
});
|
|
5644
5486
|
import { exec } from "child_process";
|
|
5645
5487
|
import { promisify } from "util";
|
|
5646
|
-
import {
|
|
5647
|
-
canParse,
|
|
5648
|
-
castArray as castArray6,
|
|
5649
|
-
debug as debug7,
|
|
5650
|
-
logger as logger13
|
|
5651
|
-
} from "@rsbuild/shared";
|
|
5488
|
+
import { castArray as castArray6, debug as debug7, logger as logger13 } from "@rsbuild/shared";
|
|
5652
5489
|
async function openBrowser(url2) {
|
|
5653
5490
|
const shouldTryOpenChromeWithAppleScript = process.platform === "darwin";
|
|
5654
5491
|
if (shouldTryOpenChromeWithAppleScript) {
|
|
@@ -5746,6 +5583,7 @@ var init_open = __esm({
|
|
|
5746
5583
|
"use strict";
|
|
5747
5584
|
init_esm();
|
|
5748
5585
|
init_constants();
|
|
5586
|
+
init_helpers();
|
|
5749
5587
|
execAsync = promisify(exec);
|
|
5750
5588
|
supportedChromiumBrowsers = [
|
|
5751
5589
|
"Google Chrome Canary",
|
|
@@ -5795,7 +5633,7 @@ var InlineChunkHtmlPlugin_exports = {};
|
|
|
5795
5633
|
__export(InlineChunkHtmlPlugin_exports, {
|
|
5796
5634
|
InlineChunkHtmlPlugin: () => InlineChunkHtmlPlugin
|
|
5797
5635
|
});
|
|
5798
|
-
import { join as
|
|
5636
|
+
import { join as join9 } from "path";
|
|
5799
5637
|
import {
|
|
5800
5638
|
addTrailingSlash as addTrailingSlash2,
|
|
5801
5639
|
getPublicPathFromCompiler as getPublicPathFromCompiler3,
|
|
@@ -5839,7 +5677,7 @@ var init_InlineChunkHtmlPlugin = __esm({
|
|
|
5839
5677
|
if (devtool && // If the source map is inlined, we do not need to update the sourceMappingURL
|
|
5840
5678
|
!devtool.includes("inline") && source.includes("# sourceMappingURL")) {
|
|
5841
5679
|
const prefix = addTrailingSlash2(
|
|
5842
|
-
|
|
5680
|
+
join9(publicPath, this.distPath[type] || "")
|
|
5843
5681
|
);
|
|
5844
5682
|
return source.replace(
|
|
5845
5683
|
/# sourceMappingURL=/,
|
|
@@ -6275,8 +6113,7 @@ __export(HtmlPreloadOrPrefetchPlugin_exports, {
|
|
|
6275
6113
|
});
|
|
6276
6114
|
import {
|
|
6277
6115
|
getPublicPathFromCompiler as getPublicPathFromCompiler4,
|
|
6278
|
-
upperFirst as upperFirst2
|
|
6279
|
-
withPublicPath as withPublicPath3
|
|
6116
|
+
upperFirst as upperFirst2
|
|
6280
6117
|
} from "@rsbuild/shared";
|
|
6281
6118
|
function filterResourceHints(resourceHints, scripts) {
|
|
6282
6119
|
return resourceHints.filter(
|
|
@@ -6323,7 +6160,7 @@ function generateLinks(options, type, compilation, htmlPluginData, HTMLCount) {
|
|
|
6323
6160
|
const publicPath = getPublicPathFromCompiler4(compilation.compiler);
|
|
6324
6161
|
const { crossOriginLoading } = compilation.compiler.options.output;
|
|
6325
6162
|
for (const file of sortedFilteredFiles) {
|
|
6326
|
-
const href =
|
|
6163
|
+
const href = ensureAssetPrefix(file, publicPath);
|
|
6327
6164
|
const attributes = {
|
|
6328
6165
|
href,
|
|
6329
6166
|
rel: type
|
|
@@ -6356,6 +6193,7 @@ var init_HtmlPreloadOrPrefetchPlugin = __esm({
|
|
|
6356
6193
|
"src/rspack/preload/HtmlPreloadOrPrefetchPlugin.ts"() {
|
|
6357
6194
|
"use strict";
|
|
6358
6195
|
init_esm();
|
|
6196
|
+
init_helpers();
|
|
6359
6197
|
init_pluginHelper();
|
|
6360
6198
|
init_helpers2();
|
|
6361
6199
|
defaultOptions = {
|
|
@@ -6521,7 +6359,7 @@ var server_exports = {};
|
|
|
6521
6359
|
__export(server_exports, {
|
|
6522
6360
|
pluginServer: () => pluginServer
|
|
6523
6361
|
});
|
|
6524
|
-
import { isAbsolute as isAbsolute7, join as
|
|
6362
|
+
import { isAbsolute as isAbsolute7, join as join10 } from "path";
|
|
6525
6363
|
import { fse as fse7 } from "@rsbuild/shared";
|
|
6526
6364
|
var pluginServer;
|
|
6527
6365
|
var init_server = __esm({
|
|
@@ -6540,7 +6378,7 @@ var init_server = __esm({
|
|
|
6540
6378
|
if (!copyOnBuild || !name) {
|
|
6541
6379
|
continue;
|
|
6542
6380
|
}
|
|
6543
|
-
const normalizedPath = isAbsolute7(name) ? name :
|
|
6381
|
+
const normalizedPath = isAbsolute7(name) ? name : join10(api.context.rootPath, name);
|
|
6544
6382
|
if (!fse7.existsSync(normalizedPath)) {
|
|
6545
6383
|
continue;
|
|
6546
6384
|
}
|
|
@@ -7175,13 +7013,193 @@ var init_nonce = __esm({
|
|
|
7175
7013
|
}
|
|
7176
7014
|
});
|
|
7177
7015
|
|
|
7016
|
+
// src/server/prodServer.ts
|
|
7017
|
+
var prodServer_exports = {};
|
|
7018
|
+
__export(prodServer_exports, {
|
|
7019
|
+
RsbuildProdServer: () => RsbuildProdServer,
|
|
7020
|
+
startProdServer: () => startProdServer
|
|
7021
|
+
});
|
|
7022
|
+
import { join as join11 } from "path";
|
|
7023
|
+
import {
|
|
7024
|
+
getNodeEnv as getNodeEnv8,
|
|
7025
|
+
isDebug as isDebug5,
|
|
7026
|
+
setNodeEnv as setNodeEnv4
|
|
7027
|
+
} from "@rsbuild/shared";
|
|
7028
|
+
async function startProdServer(context, config, { getPortSilently } = {}) {
|
|
7029
|
+
if (!getNodeEnv8()) {
|
|
7030
|
+
setNodeEnv4("production");
|
|
7031
|
+
}
|
|
7032
|
+
const { port, host, https } = await getServerConfig({
|
|
7033
|
+
config,
|
|
7034
|
+
getPortSilently
|
|
7035
|
+
});
|
|
7036
|
+
const { default: connect } = await import("../compiled/connect/index.js");
|
|
7037
|
+
const middlewares = connect();
|
|
7038
|
+
const serverConfig = config.server;
|
|
7039
|
+
const server = new RsbuildProdServer(
|
|
7040
|
+
{
|
|
7041
|
+
pwd: context.rootPath,
|
|
7042
|
+
output: {
|
|
7043
|
+
path: config.output.distPath.root || ROOT_DIST_DIR,
|
|
7044
|
+
assetPrefix: config.output.assetPrefix
|
|
7045
|
+
},
|
|
7046
|
+
serverConfig
|
|
7047
|
+
},
|
|
7048
|
+
middlewares
|
|
7049
|
+
);
|
|
7050
|
+
await context.hooks.onBeforeStartProdServer.call();
|
|
7051
|
+
const httpServer = await createHttpServer({
|
|
7052
|
+
serverConfig,
|
|
7053
|
+
middlewares: server.middlewares
|
|
7054
|
+
});
|
|
7055
|
+
await server.onInit(httpServer);
|
|
7056
|
+
return new Promise((resolve) => {
|
|
7057
|
+
httpServer.listen(
|
|
7058
|
+
{
|
|
7059
|
+
host,
|
|
7060
|
+
port
|
|
7061
|
+
},
|
|
7062
|
+
async () => {
|
|
7063
|
+
const routes = formatRoutes(
|
|
7064
|
+
context.entry,
|
|
7065
|
+
config.output.distPath.html,
|
|
7066
|
+
config.html.outputStructure
|
|
7067
|
+
);
|
|
7068
|
+
await context.hooks.onAfterStartProdServer.call({
|
|
7069
|
+
port,
|
|
7070
|
+
routes
|
|
7071
|
+
});
|
|
7072
|
+
const protocol = https ? "https" : "http";
|
|
7073
|
+
const urls = getAddressUrls({ protocol, port, host });
|
|
7074
|
+
printServerURLs({
|
|
7075
|
+
urls,
|
|
7076
|
+
port,
|
|
7077
|
+
routes,
|
|
7078
|
+
protocol,
|
|
7079
|
+
printUrls: serverConfig.printUrls
|
|
7080
|
+
});
|
|
7081
|
+
const onClose = () => {
|
|
7082
|
+
server.close();
|
|
7083
|
+
httpServer.close();
|
|
7084
|
+
};
|
|
7085
|
+
resolve({
|
|
7086
|
+
port,
|
|
7087
|
+
urls: urls.map((item) => item.url),
|
|
7088
|
+
server: {
|
|
7089
|
+
close: async () => {
|
|
7090
|
+
onClose();
|
|
7091
|
+
}
|
|
7092
|
+
}
|
|
7093
|
+
});
|
|
7094
|
+
}
|
|
7095
|
+
);
|
|
7096
|
+
});
|
|
7097
|
+
}
|
|
7098
|
+
var RsbuildProdServer;
|
|
7099
|
+
var init_prodServer = __esm({
|
|
7100
|
+
"src/server/prodServer.ts"() {
|
|
7101
|
+
"use strict";
|
|
7102
|
+
init_esm();
|
|
7103
|
+
init_constants();
|
|
7104
|
+
init_helper();
|
|
7105
|
+
init_httpServer();
|
|
7106
|
+
init_middlewares();
|
|
7107
|
+
RsbuildProdServer = class {
|
|
7108
|
+
constructor(options, middlewares) {
|
|
7109
|
+
__publicField(this, "app");
|
|
7110
|
+
__publicField(this, "options");
|
|
7111
|
+
__publicField(this, "middlewares");
|
|
7112
|
+
this.options = options;
|
|
7113
|
+
this.middlewares = middlewares;
|
|
7114
|
+
}
|
|
7115
|
+
// Complete the preparation of services
|
|
7116
|
+
async onInit(app) {
|
|
7117
|
+
this.app = app;
|
|
7118
|
+
await this.applyDefaultMiddlewares();
|
|
7119
|
+
}
|
|
7120
|
+
async applyDefaultMiddlewares() {
|
|
7121
|
+
const { headers, proxy, historyApiFallback, compress } = this.options.serverConfig;
|
|
7122
|
+
if (isDebug5()) {
|
|
7123
|
+
this.middlewares.use(await getRequestLoggerMiddleware());
|
|
7124
|
+
}
|
|
7125
|
+
if (compress) {
|
|
7126
|
+
const { default: compression } = await import("../compiled/http-compression/index.js");
|
|
7127
|
+
this.middlewares.use((req, res, next) => {
|
|
7128
|
+
compression({
|
|
7129
|
+
gzip: true,
|
|
7130
|
+
brotli: false
|
|
7131
|
+
})(req, res, next);
|
|
7132
|
+
});
|
|
7133
|
+
}
|
|
7134
|
+
if (headers) {
|
|
7135
|
+
this.middlewares.use((_req, res, next) => {
|
|
7136
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
7137
|
+
res.setHeader(key, value);
|
|
7138
|
+
}
|
|
7139
|
+
next();
|
|
7140
|
+
});
|
|
7141
|
+
}
|
|
7142
|
+
if (proxy) {
|
|
7143
|
+
const { createProxyMiddleware: createProxyMiddleware2 } = await Promise.resolve().then(() => (init_proxy(), proxy_exports));
|
|
7144
|
+
const { middlewares, upgrade } = createProxyMiddleware2(proxy);
|
|
7145
|
+
for (const middleware of middlewares) {
|
|
7146
|
+
this.middlewares.use(middleware);
|
|
7147
|
+
}
|
|
7148
|
+
this.app.on("upgrade", upgrade);
|
|
7149
|
+
}
|
|
7150
|
+
this.applyStaticAssetMiddleware();
|
|
7151
|
+
if (historyApiFallback) {
|
|
7152
|
+
const { default: connectHistoryApiFallback } = await import("../compiled/connect-history-api-fallback/index.js");
|
|
7153
|
+
const historyApiFallbackMiddleware = connectHistoryApiFallback(
|
|
7154
|
+
historyApiFallback === true ? {} : historyApiFallback
|
|
7155
|
+
);
|
|
7156
|
+
this.middlewares.use(historyApiFallbackMiddleware);
|
|
7157
|
+
await this.applyStaticAssetMiddleware();
|
|
7158
|
+
}
|
|
7159
|
+
this.middlewares.use(faviconFallbackMiddleware);
|
|
7160
|
+
}
|
|
7161
|
+
async applyStaticAssetMiddleware() {
|
|
7162
|
+
const {
|
|
7163
|
+
output: { path: path14, assetPrefix },
|
|
7164
|
+
serverConfig: { htmlFallback },
|
|
7165
|
+
pwd
|
|
7166
|
+
} = this.options;
|
|
7167
|
+
const { default: sirv } = await import("../compiled/sirv/index.js");
|
|
7168
|
+
const assetMiddleware = sirv(join11(pwd, path14), {
|
|
7169
|
+
etag: true,
|
|
7170
|
+
dev: true,
|
|
7171
|
+
ignores: ["favicon.ico"],
|
|
7172
|
+
single: htmlFallback === "index"
|
|
7173
|
+
});
|
|
7174
|
+
this.middlewares.use((req, res, next) => {
|
|
7175
|
+
const url2 = req.url;
|
|
7176
|
+
if (assetPrefix && url2?.startsWith(assetPrefix)) {
|
|
7177
|
+
req.url = url2.slice(assetPrefix.length);
|
|
7178
|
+
assetMiddleware(req, res, (...args) => {
|
|
7179
|
+
req.url = url2;
|
|
7180
|
+
next(...args);
|
|
7181
|
+
});
|
|
7182
|
+
} else {
|
|
7183
|
+
assetMiddleware(req, res, next);
|
|
7184
|
+
}
|
|
7185
|
+
});
|
|
7186
|
+
}
|
|
7187
|
+
close() {
|
|
7188
|
+
}
|
|
7189
|
+
};
|
|
7190
|
+
}
|
|
7191
|
+
});
|
|
7192
|
+
|
|
7178
7193
|
// src/createRsbuild.ts
|
|
7179
7194
|
var createRsbuild_exports = {};
|
|
7180
7195
|
__export(createRsbuild_exports, {
|
|
7181
7196
|
createRsbuild: () => createRsbuild,
|
|
7182
7197
|
pickRsbuildConfig: () => pickRsbuildConfig
|
|
7183
7198
|
});
|
|
7184
|
-
import {
|
|
7199
|
+
import {
|
|
7200
|
+
debug as debug8,
|
|
7201
|
+
pick as pick2
|
|
7202
|
+
} from "@rsbuild/shared";
|
|
7185
7203
|
async function applyDefaultPlugins(pluginManager, context) {
|
|
7186
7204
|
const { pluginBasic: pluginBasic2 } = await Promise.resolve().then(() => (init_basic(), basic_exports));
|
|
7187
7205
|
const { pluginEntry: pluginEntry2 } = await Promise.resolve().then(() => (init_entry(), entry_exports));
|
|
@@ -7281,6 +7299,11 @@ async function createRsbuild(options = {}) {
|
|
|
7281
7299
|
rsbuildOptions,
|
|
7282
7300
|
setCssExtractPlugin
|
|
7283
7301
|
});
|
|
7302
|
+
const preview = async (options2) => {
|
|
7303
|
+
const { startProdServer: startProdServer2 } = await Promise.resolve().then(() => (init_prodServer(), prodServer_exports));
|
|
7304
|
+
const config = await initRsbuildConfig({ context, pluginManager });
|
|
7305
|
+
return startProdServer2(context, config, options2);
|
|
7306
|
+
};
|
|
7284
7307
|
const rsbuild = {
|
|
7285
7308
|
...pick2(pluginManager, [
|
|
7286
7309
|
"addPlugins",
|
|
@@ -7306,13 +7329,13 @@ async function createRsbuild(options = {}) {
|
|
|
7306
7329
|
]),
|
|
7307
7330
|
...pick2(providerInstance, [
|
|
7308
7331
|
"build",
|
|
7309
|
-
"preview",
|
|
7310
7332
|
"initConfigs",
|
|
7311
7333
|
"inspectConfig",
|
|
7312
7334
|
"createCompiler",
|
|
7313
7335
|
"createDevServer",
|
|
7314
7336
|
"startDevServer"
|
|
7315
7337
|
]),
|
|
7338
|
+
preview,
|
|
7316
7339
|
context: pluginAPI.context
|
|
7317
7340
|
};
|
|
7318
7341
|
if (rsbuildConfig.plugins) {
|
|
@@ -7328,6 +7351,7 @@ var init_createRsbuild = __esm({
|
|
|
7328
7351
|
init_esm();
|
|
7329
7352
|
init_createContext();
|
|
7330
7353
|
init_initPlugins();
|
|
7354
|
+
init_internal();
|
|
7331
7355
|
init_pluginHelper();
|
|
7332
7356
|
init_pluginManager();
|
|
7333
7357
|
getRspackProvider = async () => {
|
|
@@ -7425,56 +7449,13 @@ var init_init = __esm({
|
|
|
7425
7449
|
}
|
|
7426
7450
|
});
|
|
7427
7451
|
|
|
7428
|
-
// src/index.ts
|
|
7429
|
-
init_esm();
|
|
7430
|
-
import { rspack as rspack10 } from "@rspack/core";
|
|
7431
|
-
|
|
7432
|
-
// src/internal.ts
|
|
7433
|
-
var internal_exports = {};
|
|
7434
|
-
__export(internal_exports, {
|
|
7435
|
-
applySwcDecoratorConfig: () => applySwcDecoratorConfig,
|
|
7436
|
-
createDevServer: () => createDevServer,
|
|
7437
|
-
createPluginManager: () => createPluginManager,
|
|
7438
|
-
formatStats: () => formatStats,
|
|
7439
|
-
getChainUtils: () => getChainUtils,
|
|
7440
|
-
getDevMiddleware: () => getDevMiddleware,
|
|
7441
|
-
getHTMLPlugin: () => getHTMLPlugin,
|
|
7442
|
-
getStatsOptions: () => getStatsOptions,
|
|
7443
|
-
getSwcMinimizerOptions: () => getSwcMinimizerOptions,
|
|
7444
|
-
initHooks: () => initHooks,
|
|
7445
|
-
initPlugins: () => initPlugins,
|
|
7446
|
-
initRsbuildConfig: () => initRsbuildConfig,
|
|
7447
|
-
outputInspectConfigFiles: () => outputInspectConfigFiles,
|
|
7448
|
-
prepareCli: () => prepareCli,
|
|
7449
|
-
runCli: () => runCli,
|
|
7450
|
-
setHTMLPlugin: () => setHTMLPlugin,
|
|
7451
|
-
startProdServer: () => startProdServer,
|
|
7452
|
-
stringifyConfig: () => stringifyConfig
|
|
7453
|
-
});
|
|
7454
|
-
init_esm();
|
|
7455
|
-
|
|
7456
7452
|
// src/cli/commands.ts
|
|
7457
|
-
init_esm();
|
|
7458
|
-
init_helpers();
|
|
7459
|
-
init_init();
|
|
7460
7453
|
import { existsSync } from "fs";
|
|
7461
7454
|
import { join as join12 } from "path";
|
|
7462
7455
|
import { color as color13, logger as logger18 } from "@rsbuild/shared";
|
|
7463
7456
|
import { program } from "../compiled/commander/index.js";
|
|
7464
|
-
var applyCommonOptions = (command) => {
|
|
7465
|
-
command.option(
|
|
7466
|
-
"-c --config <config>",
|
|
7467
|
-
"specify the configuration file, can be a relative or absolute path"
|
|
7468
|
-
).option(
|
|
7469
|
-
"--env-mode <mode>",
|
|
7470
|
-
"specify the env mode to load the `.env.[mode]` file"
|
|
7471
|
-
);
|
|
7472
|
-
};
|
|
7473
|
-
var applyServerOptions = (command) => {
|
|
7474
|
-
command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
|
|
7475
|
-
};
|
|
7476
7457
|
function runCli() {
|
|
7477
|
-
program.name("rsbuild").usage("<command> [options]").version("0.7.
|
|
7458
|
+
program.name("rsbuild").usage("<command> [options]").version("0.7.8");
|
|
7478
7459
|
const devCommand = program.command("dev");
|
|
7479
7460
|
const buildCommand = program.command("build");
|
|
7480
7461
|
const previewCommand = program.command("preview");
|
|
@@ -7549,9 +7530,29 @@ function runCli() {
|
|
|
7549
7530
|
});
|
|
7550
7531
|
program.parse();
|
|
7551
7532
|
}
|
|
7533
|
+
var applyCommonOptions, applyServerOptions;
|
|
7534
|
+
var init_commands = __esm({
|
|
7535
|
+
"src/cli/commands.ts"() {
|
|
7536
|
+
"use strict";
|
|
7537
|
+
init_esm();
|
|
7538
|
+
init_helpers();
|
|
7539
|
+
init_init();
|
|
7540
|
+
applyCommonOptions = (command) => {
|
|
7541
|
+
command.option(
|
|
7542
|
+
"-c --config <config>",
|
|
7543
|
+
"specify the configuration file, can be a relative or absolute path"
|
|
7544
|
+
).option(
|
|
7545
|
+
"--env-mode <mode>",
|
|
7546
|
+
"specify the env mode to load the `.env.[mode]` file"
|
|
7547
|
+
);
|
|
7548
|
+
};
|
|
7549
|
+
applyServerOptions = (command) => {
|
|
7550
|
+
command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
|
|
7551
|
+
};
|
|
7552
|
+
}
|
|
7553
|
+
});
|
|
7552
7554
|
|
|
7553
7555
|
// src/cli/prepare.ts
|
|
7554
|
-
init_esm();
|
|
7555
7556
|
import { logger as logger19 } from "@rsbuild/shared";
|
|
7556
7557
|
function initNodeEnv() {
|
|
7557
7558
|
if (!process.env.NODE_ENV) {
|
|
@@ -7565,41 +7566,76 @@ function prepareCli() {
|
|
|
7565
7566
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
7566
7567
|
console.log();
|
|
7567
7568
|
}
|
|
7568
|
-
logger19.greet(` ${`Rsbuild v${"0.7.
|
|
7569
|
+
logger19.greet(` ${`Rsbuild v${"0.7.8"}`}
|
|
7569
7570
|
`);
|
|
7570
7571
|
}
|
|
7572
|
+
var init_prepare = __esm({
|
|
7573
|
+
"src/cli/prepare.ts"() {
|
|
7574
|
+
"use strict";
|
|
7575
|
+
init_esm();
|
|
7576
|
+
}
|
|
7577
|
+
});
|
|
7571
7578
|
|
|
7572
7579
|
// src/internal.ts
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7580
|
+
var internal_exports = {};
|
|
7581
|
+
__export(internal_exports, {
|
|
7582
|
+
applySwcDecoratorConfig: () => applySwcDecoratorConfig,
|
|
7583
|
+
createDevServer: () => createDevServer,
|
|
7584
|
+
createPluginManager: () => createPluginManager,
|
|
7585
|
+
formatStats: () => formatStats,
|
|
7586
|
+
getChainUtils: () => getChainUtils,
|
|
7587
|
+
getDevMiddleware: () => getDevMiddleware,
|
|
7588
|
+
getHTMLPlugin: () => getHTMLPlugin,
|
|
7589
|
+
getStatsOptions: () => getStatsOptions,
|
|
7590
|
+
getSwcMinimizerOptions: () => getSwcMinimizerOptions,
|
|
7591
|
+
initHooks: () => initHooks,
|
|
7592
|
+
initPlugins: () => initPlugins,
|
|
7593
|
+
initRsbuildConfig: () => initRsbuildConfig,
|
|
7594
|
+
outputInspectConfigFiles: () => outputInspectConfigFiles,
|
|
7595
|
+
prepareCli: () => prepareCli,
|
|
7596
|
+
runCli: () => runCli,
|
|
7597
|
+
setHTMLPlugin: () => setHTMLPlugin,
|
|
7598
|
+
stringifyConfig: () => stringifyConfig
|
|
7599
|
+
});
|
|
7600
|
+
var init_internal = __esm({
|
|
7601
|
+
"src/internal.ts"() {
|
|
7602
|
+
"use strict";
|
|
7603
|
+
init_esm();
|
|
7604
|
+
init_commands();
|
|
7605
|
+
init_prepare();
|
|
7606
|
+
init_pluginManager();
|
|
7607
|
+
init_initHooks();
|
|
7608
|
+
init_initConfigs();
|
|
7609
|
+
init_config();
|
|
7610
|
+
init_pluginHelper();
|
|
7611
|
+
init_helpers();
|
|
7612
|
+
init_rspackConfig();
|
|
7613
|
+
init_swc();
|
|
7614
|
+
init_minimize();
|
|
7615
|
+
init_devMiddleware();
|
|
7616
|
+
init_devServer();
|
|
7617
|
+
}
|
|
7618
|
+
});
|
|
7588
7619
|
|
|
7589
7620
|
// src/index.ts
|
|
7621
|
+
init_esm();
|
|
7622
|
+
init_internal();
|
|
7590
7623
|
init_loadEnv();
|
|
7591
7624
|
init_createRsbuild();
|
|
7592
7625
|
init_config();
|
|
7593
7626
|
init_mergeConfig();
|
|
7627
|
+
init_helpers();
|
|
7594
7628
|
init_constants();
|
|
7629
|
+
import { rspack as rspack10 } from "@rspack/core";
|
|
7595
7630
|
import { logger as logger20 } from "@rsbuild/shared";
|
|
7596
|
-
var version = "0.7.
|
|
7631
|
+
var version = "0.7.8";
|
|
7597
7632
|
export {
|
|
7598
7633
|
PLUGIN_CSS_NAME,
|
|
7599
7634
|
PLUGIN_SWC_NAME,
|
|
7600
7635
|
internal_exports as __internalHelper,
|
|
7601
7636
|
createRsbuild,
|
|
7602
7637
|
defineConfig,
|
|
7638
|
+
ensureAssetPrefix,
|
|
7603
7639
|
loadConfig,
|
|
7604
7640
|
loadEnv,
|
|
7605
7641
|
logger20 as logger,
|