@rsbuild/core 0.2.16 → 0.2.18
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 +5 -3
- package/dist/cli/prepare.js +1 -1
- package/dist/index.js +1 -1
- package/dist/loadEnv.d.ts +1 -0
- package/dist/loadEnv.js +12 -10
- package/dist/provider/core/createContext.js +1 -1
- package/package.json +2 -2
package/dist/cli/commands.js
CHANGED
|
@@ -38,6 +38,7 @@ var import_shared = require("@rsbuild/shared");
|
|
|
38
38
|
var import_commander = require("@rsbuild/shared/commander");
|
|
39
39
|
var import_loadEnv = require("../loadEnv");
|
|
40
40
|
var import_config = require("./config");
|
|
41
|
+
var import_restart = require("../server/restart");
|
|
41
42
|
let commonOpts = {};
|
|
42
43
|
async function init({
|
|
43
44
|
cliOptions,
|
|
@@ -48,7 +49,8 @@ async function init({
|
|
|
48
49
|
}
|
|
49
50
|
try {
|
|
50
51
|
const root = process.cwd();
|
|
51
|
-
const
|
|
52
|
+
const envs = (0, import_loadEnv.loadEnv)({ cwd: root });
|
|
53
|
+
(0, import_shared.isDev)() && (0, import_restart.onBeforeRestartServer)(envs.cleanup);
|
|
52
54
|
const config = await (0, import_config.loadConfig)({
|
|
53
55
|
cwd: root,
|
|
54
56
|
path: commonOpts.config
|
|
@@ -56,7 +58,7 @@ async function init({
|
|
|
56
58
|
const { createRsbuild } = await Promise.resolve().then(() => __toESM(require("../createRsbuild")));
|
|
57
59
|
config.source || (config.source = {});
|
|
58
60
|
config.source.define = {
|
|
59
|
-
...publicVars,
|
|
61
|
+
...envs.publicVars,
|
|
60
62
|
...config.source.define
|
|
61
63
|
};
|
|
62
64
|
if (commonOpts.open && !config.dev?.startUrl) {
|
|
@@ -84,7 +86,7 @@ async function init({
|
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
function runCli() {
|
|
87
|
-
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.2.
|
|
89
|
+
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.2.18");
|
|
88
90
|
import_commander.program.command("dev").option("--open [url]", "open the page in browser on startup").option(
|
|
89
91
|
"--port <port>",
|
|
90
92
|
"specify a port number for Rsbuild Server to listen"
|
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.2.
|
|
37
|
+
import_rslog.logger.greet(` ${`Rsbuild v${"0.2.18"}`}
|
|
38
38
|
`);
|
|
39
39
|
}
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var import_loadEnv = require("./loadEnv");
|
|
|
31
31
|
var import_createRsbuild = require("./createRsbuild");
|
|
32
32
|
var import_config = require("./cli/config");
|
|
33
33
|
var import_shared = require("@rsbuild/shared");
|
|
34
|
-
const version = "0.2.
|
|
34
|
+
const version = "0.2.18";
|
|
35
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
36
|
0 && (module.exports = {
|
|
37
37
|
createRsbuild,
|
package/dist/loadEnv.d.ts
CHANGED
package/dist/loadEnv.js
CHANGED
|
@@ -35,7 +35,6 @@ module.exports = __toCommonJS(loadEnv_exports);
|
|
|
35
35
|
var import_fs = __toESM(require("fs"));
|
|
36
36
|
var import_path = require("path");
|
|
37
37
|
var import_shared = require("@rsbuild/shared");
|
|
38
|
-
var import_restart = require("./server/restart");
|
|
39
38
|
var import_dotenv = require("../compiled/dotenv");
|
|
40
39
|
var import_dotenv_expand = require("../compiled/dotenv-expand");
|
|
41
40
|
const getEnvFiles = () => {
|
|
@@ -59,18 +58,21 @@ function loadEnv({
|
|
|
59
58
|
publicVars[`process.env.${key}`] = JSON.stringify(val);
|
|
60
59
|
}
|
|
61
60
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
let cleaned = false;
|
|
62
|
+
const cleanup = () => {
|
|
63
|
+
if (cleaned)
|
|
64
|
+
return;
|
|
65
|
+
Object.keys(parsed).forEach((key) => {
|
|
66
|
+
if (process.env[key] === parsed[key]) {
|
|
67
|
+
delete process.env[key];
|
|
68
|
+
}
|
|
69
69
|
});
|
|
70
|
-
|
|
70
|
+
cleaned = true;
|
|
71
|
+
};
|
|
71
72
|
return {
|
|
72
73
|
parsed,
|
|
73
|
-
publicVars
|
|
74
|
+
publicVars,
|
|
75
|
+
cleanup
|
|
74
76
|
};
|
|
75
77
|
}
|
|
76
78
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -59,7 +59,7 @@ function createContextByConfig(options, bundlerType, config = {}) {
|
|
|
59
59
|
const context = {
|
|
60
60
|
entry: config.source?.entry || getDefaultEntry(rootPath),
|
|
61
61
|
targets: config.output?.targets || [],
|
|
62
|
-
version: "0.2.
|
|
62
|
+
version: "0.2.18",
|
|
63
63
|
rootPath,
|
|
64
64
|
distPath,
|
|
65
65
|
cachePath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18",
|
|
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": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"core-js": "~3.32.2",
|
|
61
61
|
"html-webpack-plugin": "npm:html-rspack-plugin@5.5.7",
|
|
62
62
|
"postcss": "8.4.31",
|
|
63
|
-
"@rsbuild/shared": "0.2.
|
|
63
|
+
"@rsbuild/shared": "0.2.18"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/node": "16.x",
|