@rsbuild/core 0.0.27 → 0.0.28
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/cli/commands.js +1 -1
- package/dist/cli/prepare.js +1 -1
- package/dist/rspack-provider/config.js +1 -0
- package/dist/rspack-provider/core/createContext.js +1 -1
- package/dist/server/devServer.js +2 -1
- package/dist/server/prodServer.d.ts +2 -1
- package/dist/server/prodServer.js +11 -1
- package/package.json +2 -2
package/dist/cli/commands.js
CHANGED
|
@@ -49,7 +49,7 @@ async function init(options) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
function runCli() {
|
|
52
|
-
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.0.
|
|
52
|
+
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.0.28");
|
|
53
53
|
import_commander.program.command("dev").option(`--open`, "open the page in browser on startup").option(
|
|
54
54
|
"-c --config <config>",
|
|
55
55
|
"specify the configuration file, can be a relative or absolute path"
|
package/dist/cli/prepare.js
CHANGED
|
@@ -34,7 +34,7 @@ function prepareCli() {
|
|
|
34
34
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js")) {
|
|
35
35
|
console.log();
|
|
36
36
|
}
|
|
37
|
-
import_rslog.logger.greet(` ${`Rsbuild v${"0.0.
|
|
37
|
+
import_rslog.logger.greet(` ${`Rsbuild v${"0.0.28"}`}
|
|
38
38
|
`);
|
|
39
39
|
}
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -26,6 +26,7 @@ module.exports = __toCommonJS(config_exports);
|
|
|
26
26
|
var import_shared = require("@rsbuild/shared");
|
|
27
27
|
const createDefaultConfig = () => ({
|
|
28
28
|
dev: (0, import_shared.getDefaultDevConfig)(),
|
|
29
|
+
server: (0, import_shared.getDefaultServerConfig)(),
|
|
29
30
|
html: (0, import_shared.getDefaultHtmlConfig)(),
|
|
30
31
|
source: (0, import_shared.getDefaultSourceConfig)(),
|
|
31
32
|
output: (0, import_shared.getDefaultOutputConfig)(),
|
|
@@ -64,7 +64,7 @@ function createContextByConfig(options, bundlerType, sourceConfig = {}, outputCo
|
|
|
64
64
|
entry: sourceConfig.entry || // TODO: remove sourceConfig.entries in v0.2.0
|
|
65
65
|
// compat with previous config
|
|
66
66
|
sourceConfig.entries || getDefaultEntry(rootPath),
|
|
67
|
-
version: "0.0.
|
|
67
|
+
version: "0.0.28",
|
|
68
68
|
target,
|
|
69
69
|
rootPath,
|
|
70
70
|
distPath,
|
package/dist/server/devServer.js
CHANGED
|
@@ -112,9 +112,10 @@ class RsbuildDevServer {
|
|
|
112
112
|
}
|
|
113
113
|
devMiddleware.init(app);
|
|
114
114
|
devMiddleware.middleware && this.middlewares.use(devMiddleware.middleware);
|
|
115
|
+
const { distPath } = this.output;
|
|
115
116
|
this.middlewares.use(
|
|
116
117
|
(0, import_middlewares.getHtmlFallbackMiddleware)({
|
|
117
|
-
distPath: (0, import_path.join)(this.pwd,
|
|
118
|
+
distPath: (0, import_path.isAbsolute)(distPath) ? distPath : (0, import_path.join)(this.pwd, distPath),
|
|
118
119
|
publicPath: this.output.publicPath,
|
|
119
120
|
callback: devMiddleware.middleware
|
|
120
121
|
})
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
import type { ListenOptions } from 'net';
|
|
4
4
|
import { Server } from 'http';
|
|
5
5
|
import connect from '@rsbuild/shared/connect';
|
|
6
|
-
import { Context, RsbuildConfig, StartServerResult, PreviewServerOptions } from '@rsbuild/shared';
|
|
6
|
+
import { Context, RsbuildConfig, StartServerResult, PreviewServerOptions, ServerConfig } from '@rsbuild/shared';
|
|
7
7
|
type RsbuildProdServerOptions = {
|
|
8
8
|
pwd: string;
|
|
9
9
|
output: {
|
|
10
10
|
path: string;
|
|
11
11
|
assetPrefix?: string;
|
|
12
12
|
};
|
|
13
|
+
serverConfig: ServerConfig;
|
|
13
14
|
};
|
|
14
15
|
export declare class RsbuildProdServer {
|
|
15
16
|
private app;
|
|
@@ -49,6 +49,15 @@ class RsbuildProdServer {
|
|
|
49
49
|
await this.applyDefaultMiddlewares();
|
|
50
50
|
}
|
|
51
51
|
async applyDefaultMiddlewares() {
|
|
52
|
+
const { headers } = this.options.serverConfig;
|
|
53
|
+
if (headers) {
|
|
54
|
+
this.middlewares.use((_req, res, next) => {
|
|
55
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
56
|
+
res.setHeader(key, value);
|
|
57
|
+
}
|
|
58
|
+
next();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
52
61
|
this.applyStaticAssetMiddleware();
|
|
53
62
|
this.middlewares.use(import_middlewares.faviconFallbackMiddleware);
|
|
54
63
|
}
|
|
@@ -103,7 +112,8 @@ async function startProdServer(context, rsbuildConfig, { printURLs = true } = {}
|
|
|
103
112
|
output: {
|
|
104
113
|
path: ((_c = (_b = rsbuildConfig.output) == null ? void 0 : _b.distPath) == null ? void 0 : _c.root) || import_shared.ROOT_DIST_DIR,
|
|
105
114
|
assetPrefix: (_d = rsbuildConfig.output) == null ? void 0 : _d.assetPrefix
|
|
106
|
-
}
|
|
115
|
+
},
|
|
116
|
+
serverConfig: rsbuildConfig.server || {}
|
|
107
117
|
});
|
|
108
118
|
const httpServer = await server.createHTTPServer();
|
|
109
119
|
await server.onInit(httpServer);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "Unleash the power of Rspack with the out-of-the-box build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"postcss": "8.4.31",
|
|
65
65
|
"semver": "^7.5.4",
|
|
66
66
|
"ws": "^8.2.0",
|
|
67
|
-
"@rsbuild/shared": "0.0.
|
|
67
|
+
"@rsbuild/shared": "0.0.28"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/node": "^16",
|