@rsbuild/core 0.4.5 → 0.4.7
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/dotenv/index.js +1 -1
- package/compiled/dotenv/package.json +1 -1
- package/compiled/dotenv-expand/index.js +1 -1
- package/compiled/dotenv-expand/lib/main.d.ts +30 -9
- package/compiled/dotenv-expand/package.json +1 -1
- package/dist/cli/commands.d.ts +1 -5
- package/dist/cli/commands.js +6 -80
- package/dist/cli/init.d.ts +5 -0
- package/dist/cli/init.js +101 -0
- package/dist/cli/prepare.js +1 -1
- package/dist/{cli/config.d.ts → config.d.ts} +1 -1
- package/dist/{cli/config.js → config.js} +15 -11
- package/dist/createRsbuild.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/loadEnv.js +5 -1
- package/dist/plugins/cache.js +7 -3
- package/dist/plugins/entry.d.ts +3 -1
- package/dist/plugins/entry.js +32 -17
- package/dist/provider/createContext.js +4 -3
- package/dist/provider/plugins/progress.js +2 -1
- package/dist/provider/plugins/swc.js +1 -0
- package/dist/rspack/HtmlCrossOriginPlugin.d.ts +1 -1
- package/dist/rspack/HtmlCrossOriginPlugin.js +8 -3
- package/dist/server/restart.js +2 -2
- package/package.json +2 -2
package/compiled/dotenv/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e={
|
|
1
|
+
(()=>{var e={434:(e,t,o)=>{const r=o(147);const n=o(17);const s=o(37);const c=o(113);const a=o(684);const i=a.version;const u=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function parse(e){const t={};let o=e.toString();o=o.replace(/\r\n?/gm,"\n");let r;while((r=u.exec(o))!=null){const e=r[1];let o=r[2]||"";o=o.trim();const n=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/gm,"$2");if(n==='"'){o=o.replace(/\\n/g,"\n");o=o.replace(/\\r/g,"\r")}t[e]=o}return t}function _parseVault(e){const t=_vaultPath(e);const o=l.configDotenv({path:t});if(!o.parsed){const e=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);e.code="MISSING_DATA";throw e}const r=_dotenvKey(e).split(",");const n=r.length;let s;for(let e=0;e<n;e++){try{const t=r[e].trim();const n=_instructions(o,t);s=l.decrypt(n.ciphertext,n.key);break}catch(t){if(e+1>=n){throw t}}}return l.parse(s)}function _log(e){console.log(`[dotenv@${i}][INFO] ${e}`)}function _warn(e){console.log(`[dotenv@${i}][WARN] ${e}`)}function _debug(e){console.log(`[dotenv@${i}][DEBUG] ${e}`)}function _dotenvKey(e){if(e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0){return e.DOTENV_KEY}if(process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0){return process.env.DOTENV_KEY}return""}function _instructions(e,t){let o;try{o=new URL(t)}catch(e){if(e.code==="ERR_INVALID_URL"){const e=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");e.code="INVALID_DOTENV_KEY";throw e}throw e}const r=o.password;if(!r){const e=new Error("INVALID_DOTENV_KEY: Missing key part");e.code="INVALID_DOTENV_KEY";throw e}const n=o.searchParams.get("environment");if(!n){const e=new Error("INVALID_DOTENV_KEY: Missing environment part");e.code="INVALID_DOTENV_KEY";throw e}const s=`DOTENV_VAULT_${n.toUpperCase()}`;const c=e.parsed[s];if(!c){const e=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);e.code="NOT_FOUND_DOTENV_ENVIRONMENT";throw e}return{ciphertext:c,key:r}}function _vaultPath(e){let t=null;if(e&&e.path&&e.path.length>0){if(Array.isArray(e.path)){for(const o of e.path){if(r.existsSync(o)){t=o.endsWith(".vault")?o:`${o}.vault`}}}else{t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`}}else{t=n.resolve(process.cwd(),".env.vault")}if(r.existsSync(t)){return t}return null}function _resolveHome(e){return e[0]==="~"?n.join(s.homedir(),e.slice(1)):e}function _configVault(e){_log("Loading env from encrypted .env.vault");const t=l._parseVault(e);let o=process.env;if(e&&e.processEnv!=null){o=e.processEnv}l.populate(o,t,e);return{parsed:t}}function configDotenv(e){const t=n.resolve(process.cwd(),".env");let o="utf8";const s=Boolean(e&&e.debug);if(e&&e.encoding){o=e.encoding}else{if(s){_debug("No encoding is specified. UTF-8 is used by default")}}let c=[];if(e&&e.path){if(!Array.isArray(e.path)){if(r.existsSync(e.path)){c=[_resolveHome(e.path)]}}else{for(const t of e.path){if(r.existsSync(t)){c.push(_resolveHome(t))}}}if(!c.length){c=[t]}}const a=c.length?c:[t];const i={};try{for(const t of a){const n=l.parse(r.readFileSync(t,{encoding:o}));l.populate(i,n,e)}let t=process.env;if(e&&e.processEnv!=null){t=e.processEnv}l.populate(t,i,e)}catch(e){if(s){_debug(`Failed to load ${a} ${e.message}`)}return{error:e}}return{parsed:i}}function config(e){if(_dotenvKey(e).length===0){return l.configDotenv(e)}const t=_vaultPath(e);if(!t){_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`);return l.configDotenv(e)}return l._configVault(e)}function decrypt(e,t){const o=Buffer.from(t.slice(-64),"hex");let r=Buffer.from(e,"base64");const n=r.subarray(0,12);const s=r.subarray(-16);r=r.subarray(12,-16);try{const e=c.createDecipheriv("aes-256-gcm",o,n);e.setAuthTag(s);return`${e.update(r)}${e.final()}`}catch(e){const t=e instanceof RangeError;const o=e.message==="Invalid key length";const r=e.message==="Unsupported state or unable to authenticate data";if(t||o){const e=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");e.code="INVALID_DOTENV_KEY";throw e}else if(r){const e=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");e.code="DECRYPTION_FAILED";throw e}else{throw e}}}function populate(e,t,o={}){const r=Boolean(o&&o.debug);const n=Boolean(o&&o.override);if(typeof t!=="object"){const e=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");e.code="OBJECT_REQUIRED";throw e}for(const o of Object.keys(t)){if(Object.prototype.hasOwnProperty.call(e,o)){if(n===true){e[o]=t[o]}if(r){if(n===true){_debug(`"${o}" is already defined and WAS overwritten`)}else{_debug(`"${o}" is already defined and was NOT overwritten`)}}}else{e[o]=t[o]}}}const l={configDotenv:configDotenv,_configVault:_configVault,_parseVault:_parseVault,config:config,decrypt:decrypt,parse:parse,populate:populate};e.exports.configDotenv=l.configDotenv;e.exports._configVault=l._configVault;e.exports._parseVault=l._parseVault;e.exports.config=l.config;e.exports.decrypt=l.decrypt;e.exports.parse=l.parse;e.exports.populate=l.populate;e.exports=l},684:e=>{"use strict";e.exports=require("./package.json")},113:e=>{"use strict";e.exports=require("crypto")},147:e=>{"use strict";e.exports=require("fs")},37:e=>{"use strict";e.exports=require("os")},17:e=>{"use strict";e.exports=require("path")}};var t={};function __nccwpck_require__(o){var r=t[o];if(r!==undefined){return r.exports}var n=t[o]={exports:{}};var s=true;try{e[o](n,n.exports,__nccwpck_require__);s=false}finally{if(s)delete t[o]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var o=__nccwpck_require__(434);module.exports=o})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"dotenv","version":"16.4.
|
|
1
|
+
{"name":"dotenv","version":"16.4.4","funding":"https://dotenvx.com","license":"BSD-2-Clause","types":"lib/main.d.ts","type":"commonjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={
|
|
1
|
+
(()=>{"use strict";var e={693:e=>{const r=/(\\)?(\$)(?!\()(\{?)([\w.]+)(?::?-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))?(\}?)/gi;function _resolveEscapeSequences(e){return e.replace(/\\\$/g,"$")}function interpolate(e,t,n){return e.replace(r,((r,s,a,p,i,o,u)=>{if(s==="\\"){return r.slice(1)}else{if(t[i]){if(t[i]===n[i]){return t[i]}else{return interpolate(t[i],t,n)}}if(n[i]){if(n[i]===e){return n[i]}else{return interpolate(n[i],t,n)}}if(o){if(o.startsWith("$")){return interpolate(o,t,n)}else{return o}}return""}}))}function expand(e){let r=process.env;if(e&&e.processEnv!=null){r=e.processEnv}for(const t in e.parsed){let n=e.parsed[t];const s=Object.prototype.hasOwnProperty.call(r,t);if(s){if(r[t]===e.parsed[t]){n=interpolate(n,r,e.parsed)}else{n=r[t]}}else{n=interpolate(n,r,e.parsed)}e.parsed[t]=_resolveEscapeSequences(n)}for(const t in e.parsed){r[t]=e.parsed[t]}return e}e.exports.expand=expand}};var r={};function __nccwpck_require__(t){var n=r[t];if(n!==undefined){return n.exports}var s=r[t]={exports:{}};var a=true;try{e[t](s,s.exports,__nccwpck_require__);a=false}finally{if(a)delete r[t]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(693);module.exports=t})();
|
|
@@ -1,20 +1,41 @@
|
|
|
1
1
|
// TypeScript Version: 3.0
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
|
|
4
|
+
export interface DotenvPopulateInput {
|
|
5
|
+
[name: string]: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DotenvParseInput {
|
|
9
|
+
[name: string]: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface DotenvParseOutput {
|
|
13
|
+
[name: string]: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
4
16
|
export interface DotenvExpandOptions {
|
|
5
|
-
ignoreProcessEnv?: boolean;
|
|
6
17
|
error?: Error;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Default: `process.env`
|
|
21
|
+
*
|
|
22
|
+
* Specify an object to write your secrets to. Defaults to process.env environment variables.
|
|
23
|
+
*
|
|
24
|
+
* example: `const processEnv = {}; require('dotenv').config({ processEnv: processEnv })`
|
|
25
|
+
*/
|
|
26
|
+
processEnv?: DotenvPopulateInput;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Default: `object`
|
|
30
|
+
*
|
|
31
|
+
* Object coming from dotenv's parsed result.
|
|
32
|
+
*/
|
|
33
|
+
parsed?: DotenvParseInput;
|
|
10
34
|
}
|
|
11
35
|
|
|
12
36
|
export interface DotenvExpandOutput {
|
|
13
|
-
ignoreProcessEnv?: boolean;
|
|
14
37
|
error?: Error;
|
|
15
|
-
parsed?:
|
|
16
|
-
[name: string]: string;
|
|
17
|
-
};
|
|
38
|
+
parsed?: DotenvParseOutput;
|
|
18
39
|
}
|
|
19
40
|
|
|
20
41
|
/**
|
|
@@ -22,7 +43,7 @@ export interface DotenvExpandOutput {
|
|
|
22
43
|
*
|
|
23
44
|
* See https://docs.dotenv.org
|
|
24
45
|
*
|
|
25
|
-
* @param options - additional options. example: `{
|
|
46
|
+
* @param options - additional options. example: `{ processEnv: {}, error: null, parsed: { { KEY: 'value' } }`
|
|
26
47
|
* @returns an object with a `parsed` key if successful or `error` key if an error occurred. example: { parsed: { KEY: 'value' } }
|
|
27
48
|
*
|
|
28
49
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"dotenv-expand","author":"motdotla","version":"
|
|
1
|
+
{"name":"dotenv-expand","author":"motdotla","version":"11.0.6","funding":"https://dotenvx.com","license":"BSD-2-Clause","types":"lib/main.d.ts","type":"commonjs"}
|
package/dist/cli/commands.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RsbuildMode } from '@rsbuild/shared';
|
|
2
2
|
export type CommonOptions = {
|
|
3
3
|
config?: string;
|
|
4
4
|
envMode?: string;
|
|
@@ -16,8 +16,4 @@ export type InspectOptions = CommonOptions & {
|
|
|
16
16
|
};
|
|
17
17
|
export type DevOptions = CommonOptions;
|
|
18
18
|
export type PreviewOptions = CommonOptions;
|
|
19
|
-
export declare function init({ cliOptions, isRestart, }: {
|
|
20
|
-
cliOptions?: CommonOptions;
|
|
21
|
-
isRestart?: boolean;
|
|
22
|
-
}): Promise<import("@rsbuild/shared").RsbuildInstance | undefined>;
|
|
23
19
|
export declare function runCli(): void;
|
package/dist/cli/commands.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,18 +15,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var commands_exports = {};
|
|
30
20
|
__export(commands_exports, {
|
|
31
|
-
init: () => init,
|
|
32
21
|
runCli: () => runCli
|
|
33
22
|
});
|
|
34
23
|
module.exports = __toCommonJS(commands_exports);
|
|
@@ -36,69 +25,7 @@ var import_node_path = require("node:path");
|
|
|
36
25
|
var import_node_fs = require("node:fs");
|
|
37
26
|
var import_shared = require("@rsbuild/shared");
|
|
38
27
|
var import_commander = require("@rsbuild/shared/commander");
|
|
39
|
-
var
|
|
40
|
-
var import_config = require("./config");
|
|
41
|
-
var import_restart = require("../server/restart");
|
|
42
|
-
let commonOpts = {};
|
|
43
|
-
async function init({
|
|
44
|
-
cliOptions,
|
|
45
|
-
isRestart
|
|
46
|
-
}) {
|
|
47
|
-
if (cliOptions) {
|
|
48
|
-
commonOpts = cliOptions;
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
const root = process.cwd();
|
|
52
|
-
const envs = (0, import_loadEnv.loadEnv)({
|
|
53
|
-
cwd: root,
|
|
54
|
-
mode: cliOptions?.envMode
|
|
55
|
-
});
|
|
56
|
-
if ((0, import_shared.isDev)()) {
|
|
57
|
-
(0, import_restart.onBeforeRestartServer)(envs.cleanup);
|
|
58
|
-
}
|
|
59
|
-
const { content: config, filePath: configFilePath } = await (0, import_config.loadConfig)({
|
|
60
|
-
cwd: root,
|
|
61
|
-
path: commonOpts.config,
|
|
62
|
-
envMode: commonOpts.envMode
|
|
63
|
-
});
|
|
64
|
-
const command = process.argv[2];
|
|
65
|
-
if (command === "dev") {
|
|
66
|
-
const files = [...envs.filePaths];
|
|
67
|
-
if (configFilePath) {
|
|
68
|
-
files.push(configFilePath);
|
|
69
|
-
}
|
|
70
|
-
(0, import_config.watchFiles)(files);
|
|
71
|
-
}
|
|
72
|
-
const { createRsbuild } = await Promise.resolve().then(() => __toESM(require("../createRsbuild")));
|
|
73
|
-
config.source || (config.source = {});
|
|
74
|
-
config.source.define = {
|
|
75
|
-
...envs.publicVars,
|
|
76
|
-
...config.source.define
|
|
77
|
-
};
|
|
78
|
-
if (commonOpts.open && !config.dev?.startUrl) {
|
|
79
|
-
config.dev || (config.dev = {});
|
|
80
|
-
config.dev.startUrl = commonOpts.open;
|
|
81
|
-
}
|
|
82
|
-
if (commonOpts.host) {
|
|
83
|
-
config.server || (config.server = {});
|
|
84
|
-
config.server.host = commonOpts.host;
|
|
85
|
-
}
|
|
86
|
-
if (commonOpts.port) {
|
|
87
|
-
config.server || (config.server = {});
|
|
88
|
-
config.server.port = commonOpts.port;
|
|
89
|
-
}
|
|
90
|
-
return await createRsbuild({
|
|
91
|
-
cwd: root,
|
|
92
|
-
rsbuildConfig: config
|
|
93
|
-
});
|
|
94
|
-
} catch (err) {
|
|
95
|
-
if (isRestart) {
|
|
96
|
-
import_shared.logger.error(err);
|
|
97
|
-
} else {
|
|
98
|
-
throw err;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
28
|
+
var import_init = require("./init");
|
|
102
29
|
const applyCommonOptions = (command) => {
|
|
103
30
|
command.option(
|
|
104
31
|
"-c --config <config>",
|
|
@@ -112,7 +39,7 @@ const applyServerOptions = (command) => {
|
|
|
112
39
|
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");
|
|
113
40
|
};
|
|
114
41
|
function runCli() {
|
|
115
|
-
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.4.
|
|
42
|
+
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.4.7");
|
|
116
43
|
const devCommand = import_commander.program.command("dev");
|
|
117
44
|
const buildCommand = import_commander.program.command("build");
|
|
118
45
|
const previewCommand = import_commander.program.command("preview");
|
|
@@ -123,7 +50,7 @@ function runCli() {
|
|
|
123
50
|
[devCommand, previewCommand].forEach(applyServerOptions);
|
|
124
51
|
devCommand.description("starting the dev server").action(async (options) => {
|
|
125
52
|
try {
|
|
126
|
-
const rsbuild = await init({ cliOptions: options });
|
|
53
|
+
const rsbuild = await (0, import_init.init)({ cliOptions: options });
|
|
127
54
|
await rsbuild?.startDevServer();
|
|
128
55
|
} catch (err) {
|
|
129
56
|
import_shared.logger.error("Failed to start dev server.");
|
|
@@ -133,7 +60,7 @@ function runCli() {
|
|
|
133
60
|
});
|
|
134
61
|
buildCommand.option("-w --watch", "turn on watch mode, watch for changes and rebuild").description("build the app for production").action(async (options) => {
|
|
135
62
|
try {
|
|
136
|
-
const rsbuild = await init({ cliOptions: options });
|
|
63
|
+
const rsbuild = await (0, import_init.init)({ cliOptions: options });
|
|
137
64
|
await rsbuild?.build({
|
|
138
65
|
watch: options.watch
|
|
139
66
|
});
|
|
@@ -145,7 +72,7 @@ function runCli() {
|
|
|
145
72
|
});
|
|
146
73
|
previewCommand.description("preview the production build locally").action(async (options) => {
|
|
147
74
|
try {
|
|
148
|
-
const rsbuild = await init({ cliOptions: options });
|
|
75
|
+
const rsbuild = await (0, import_init.init)({ cliOptions: options });
|
|
149
76
|
if (rsbuild && !(0, import_node_fs.existsSync)(rsbuild.context.distPath)) {
|
|
150
77
|
throw new Error(
|
|
151
78
|
`The output directory ${import_shared.color.yellow(
|
|
@@ -162,7 +89,7 @@ function runCli() {
|
|
|
162
89
|
});
|
|
163
90
|
inspectCommand.description("inspect the Rspack and Rsbuild configs").option("--env <env>", "specify env mode", "development").option("--output <output>", "specify inspect content output path", "/").option("--verbose", "show full function definitions in output").action(async (options) => {
|
|
164
91
|
try {
|
|
165
|
-
const rsbuild = await init({ cliOptions: options });
|
|
92
|
+
const rsbuild = await (0, import_init.init)({ cliOptions: options });
|
|
166
93
|
await rsbuild?.inspectConfig({
|
|
167
94
|
env: options.env,
|
|
168
95
|
verbose: options.verbose,
|
|
@@ -179,6 +106,5 @@ function runCli() {
|
|
|
179
106
|
}
|
|
180
107
|
// Annotate the CommonJS export names for ESM import in node:
|
|
181
108
|
0 && (module.exports = {
|
|
182
|
-
init,
|
|
183
109
|
runCli
|
|
184
110
|
});
|
package/dist/cli/init.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var init_exports = {};
|
|
30
|
+
__export(init_exports, {
|
|
31
|
+
init: () => init
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(init_exports);
|
|
34
|
+
var import_shared = require("@rsbuild/shared");
|
|
35
|
+
var import_loadEnv = require("../loadEnv");
|
|
36
|
+
var import_config = require("../config");
|
|
37
|
+
var import_restart = require("../server/restart");
|
|
38
|
+
let commonOpts = {};
|
|
39
|
+
async function init({
|
|
40
|
+
cliOptions,
|
|
41
|
+
isRestart
|
|
42
|
+
}) {
|
|
43
|
+
if (cliOptions) {
|
|
44
|
+
commonOpts = cliOptions;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const root = process.cwd();
|
|
48
|
+
const envs = (0, import_loadEnv.loadEnv)({
|
|
49
|
+
cwd: root,
|
|
50
|
+
mode: cliOptions?.envMode
|
|
51
|
+
});
|
|
52
|
+
if ((0, import_shared.isDev)()) {
|
|
53
|
+
(0, import_restart.onBeforeRestartServer)(envs.cleanup);
|
|
54
|
+
}
|
|
55
|
+
const { content: config, filePath: configFilePath } = await (0, import_config.loadConfig)({
|
|
56
|
+
cwd: root,
|
|
57
|
+
path: commonOpts.config,
|
|
58
|
+
envMode: commonOpts.envMode
|
|
59
|
+
});
|
|
60
|
+
const command = process.argv[2];
|
|
61
|
+
if (command === "dev") {
|
|
62
|
+
const files = [...envs.filePaths];
|
|
63
|
+
if (configFilePath) {
|
|
64
|
+
files.push(configFilePath);
|
|
65
|
+
}
|
|
66
|
+
(0, import_config.watchFiles)(files);
|
|
67
|
+
}
|
|
68
|
+
const { createRsbuild } = await Promise.resolve().then(() => __toESM(require("../createRsbuild")));
|
|
69
|
+
config.source || (config.source = {});
|
|
70
|
+
config.source.define = {
|
|
71
|
+
...envs.publicVars,
|
|
72
|
+
...config.source.define
|
|
73
|
+
};
|
|
74
|
+
if (commonOpts.open && !config.dev?.startUrl) {
|
|
75
|
+
config.dev || (config.dev = {});
|
|
76
|
+
config.dev.startUrl = commonOpts.open;
|
|
77
|
+
}
|
|
78
|
+
if (commonOpts.host) {
|
|
79
|
+
config.server || (config.server = {});
|
|
80
|
+
config.server.host = commonOpts.host;
|
|
81
|
+
}
|
|
82
|
+
if (commonOpts.port) {
|
|
83
|
+
config.server || (config.server = {});
|
|
84
|
+
config.server.port = commonOpts.port;
|
|
85
|
+
}
|
|
86
|
+
return createRsbuild({
|
|
87
|
+
cwd: root,
|
|
88
|
+
rsbuildConfig: config
|
|
89
|
+
});
|
|
90
|
+
} catch (err) {
|
|
91
|
+
if (isRestart) {
|
|
92
|
+
import_shared.logger.error(err);
|
|
93
|
+
} else {
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
init
|
|
101
|
+
});
|
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.4.
|
|
37
|
+
import_rslog.logger.greet(` ${`Rsbuild v${"0.4.7"}`}
|
|
38
38
|
`);
|
|
39
39
|
}
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -17,7 +17,7 @@ export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfi
|
|
|
17
17
|
export declare function defineConfig(config: RsbuildConfigExport): RsbuildConfigExport;
|
|
18
18
|
export declare function watchFiles(files: string[]): Promise<void>;
|
|
19
19
|
export declare function loadConfig({ cwd, path, envMode, }: {
|
|
20
|
-
cwd
|
|
20
|
+
cwd?: string;
|
|
21
21
|
path?: string;
|
|
22
22
|
envMode?: string;
|
|
23
23
|
}): Promise<{
|
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(config_exports);
|
|
|
36
36
|
var import_node_fs = __toESM(require("node:fs"));
|
|
37
37
|
var import_node_path = require("node:path");
|
|
38
38
|
var import_shared = require("@rsbuild/shared");
|
|
39
|
-
var import_restart = require("
|
|
39
|
+
var import_restart = require("./server/restart");
|
|
40
40
|
function defineConfig(config) {
|
|
41
41
|
return config;
|
|
42
42
|
}
|
|
@@ -89,17 +89,21 @@ async function watchFiles(files) {
|
|
|
89
89
|
watcher.on("unlink", callback);
|
|
90
90
|
}
|
|
91
91
|
async function loadConfig({
|
|
92
|
-
cwd,
|
|
92
|
+
cwd = process.cwd(),
|
|
93
93
|
path,
|
|
94
94
|
envMode
|
|
95
95
|
}) {
|
|
96
|
-
const
|
|
97
|
-
if (!
|
|
96
|
+
const configFilePath = resolveConfigPath(cwd, path);
|
|
97
|
+
if (!configFilePath) {
|
|
98
98
|
return {
|
|
99
99
|
content: {},
|
|
100
|
-
filePath:
|
|
100
|
+
filePath: configFilePath
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
+
const applyMetaInfo = (config) => {
|
|
104
|
+
config._privateMeta = { configFilePath };
|
|
105
|
+
return config;
|
|
106
|
+
};
|
|
103
107
|
try {
|
|
104
108
|
const { default: jiti } = await Promise.resolve().then(() => __toESM(require("@rsbuild/shared/jiti")));
|
|
105
109
|
const loadConfig2 = jiti(__filename, {
|
|
@@ -108,7 +112,7 @@ async function loadConfig({
|
|
|
108
112
|
requireCache: false,
|
|
109
113
|
interopDefault: true
|
|
110
114
|
});
|
|
111
|
-
const configExport = loadConfig2(
|
|
115
|
+
const configExport = loadConfig2(configFilePath);
|
|
112
116
|
if (typeof configExport === "function") {
|
|
113
117
|
const command = process.argv[2];
|
|
114
118
|
const params = {
|
|
@@ -121,8 +125,8 @@ async function loadConfig({
|
|
|
121
125
|
throw new Error("Rsbuild config function must return a config object.");
|
|
122
126
|
}
|
|
123
127
|
return {
|
|
124
|
-
content: result,
|
|
125
|
-
filePath:
|
|
128
|
+
content: applyMetaInfo(result),
|
|
129
|
+
filePath: configFilePath
|
|
126
130
|
};
|
|
127
131
|
}
|
|
128
132
|
if (!(0, import_shared.isObject)(configExport)) {
|
|
@@ -133,11 +137,11 @@ async function loadConfig({
|
|
|
133
137
|
);
|
|
134
138
|
}
|
|
135
139
|
return {
|
|
136
|
-
content: configExport,
|
|
137
|
-
filePath:
|
|
140
|
+
content: applyMetaInfo(configExport),
|
|
141
|
+
filePath: configFilePath
|
|
138
142
|
};
|
|
139
143
|
} catch (err) {
|
|
140
|
-
import_shared.logger.error(`Failed to load file: ${import_shared.color.dim(
|
|
144
|
+
import_shared.logger.error(`Failed to load file: ${import_shared.color.dim(configFilePath)}`);
|
|
141
145
|
throw err;
|
|
142
146
|
}
|
|
143
147
|
}
|
package/dist/createRsbuild.js
CHANGED
|
@@ -94,7 +94,8 @@ async function createRsbuild(options) {
|
|
|
94
94
|
context: publicContext
|
|
95
95
|
};
|
|
96
96
|
if (rsbuildConfig.plugins) {
|
|
97
|
-
|
|
97
|
+
const plugins2 = await Promise.all(rsbuildConfig.plugins);
|
|
98
|
+
rsbuild.addPlugins(plugins2);
|
|
98
99
|
}
|
|
99
100
|
return rsbuild;
|
|
100
101
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { loadEnv } from './loadEnv';
|
|
6
6
|
export { createRsbuild } from './createRsbuild';
|
|
7
|
-
export { loadConfig, defineConfig } from './
|
|
7
|
+
export { loadConfig, defineConfig } from './config';
|
|
8
8
|
export declare const version: any;
|
|
9
9
|
export { logger, mergeRsbuildConfig } from '@rsbuild/shared';
|
|
10
10
|
export { PLUGIN_SWC_NAME, PLUGIN_CSS_NAME, PLUGIN_SASS_NAME, PLUGIN_LESS_NAME, PLUGIN_STYLUS_NAME, } from './constants';
|
package/dist/index.js
CHANGED
|
@@ -34,10 +34,10 @@ __export(src_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(src_exports);
|
|
35
35
|
var import_loadEnv = require("./loadEnv");
|
|
36
36
|
var import_createRsbuild = require("./createRsbuild");
|
|
37
|
-
var import_config = require("./
|
|
37
|
+
var import_config = require("./config");
|
|
38
38
|
var import_shared = require("@rsbuild/shared");
|
|
39
39
|
var import_constants = require("./constants");
|
|
40
|
-
const version = "0.4.
|
|
40
|
+
const version = "0.4.7";
|
|
41
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
42
|
0 && (module.exports = {
|
|
43
43
|
PLUGIN_CSS_NAME,
|
package/dist/loadEnv.js
CHANGED
|
@@ -67,9 +67,13 @@ function loadEnv({
|
|
|
67
67
|
});
|
|
68
68
|
let cleaned = false;
|
|
69
69
|
const cleanup = () => {
|
|
70
|
-
if (cleaned)
|
|
70
|
+
if (cleaned) {
|
|
71
71
|
return;
|
|
72
|
+
}
|
|
72
73
|
Object.keys(parsed).forEach((key) => {
|
|
74
|
+
if (key === "NODE_ENV") {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
73
77
|
if (process.env[key] === parsed[key]) {
|
|
74
78
|
delete process.env[key];
|
|
75
79
|
}
|
package/dist/plugins/cache.js
CHANGED
|
@@ -57,7 +57,7 @@ function getCacheDirectory({ cacheDirectory }, context) {
|
|
|
57
57
|
}
|
|
58
58
|
return (0, import_node_path.join)(context.cachePath, context.bundlerType);
|
|
59
59
|
}
|
|
60
|
-
async function getBuildDependencies(context) {
|
|
60
|
+
async function getBuildDependencies(context, config) {
|
|
61
61
|
const rootPackageJson = (0, import_node_path.join)(context.rootPath, "package.json");
|
|
62
62
|
const browserslistConfig = (0, import_node_path.join)(context.rootPath, ".browserslistrc");
|
|
63
63
|
const buildDependencies = {};
|
|
@@ -67,6 +67,9 @@ async function getBuildDependencies(context) {
|
|
|
67
67
|
if (context.tsconfigPath) {
|
|
68
68
|
buildDependencies.tsconfig = [context.tsconfigPath];
|
|
69
69
|
}
|
|
70
|
+
if (config._privateMeta?.configFilePath) {
|
|
71
|
+
buildDependencies.rsbuildConfig = [config._privateMeta.configFilePath];
|
|
72
|
+
}
|
|
70
73
|
if (await (0, import_shared2.isFileExists)(browserslistConfig)) {
|
|
71
74
|
buildDependencies.browserslistrc = [browserslistConfig];
|
|
72
75
|
}
|
|
@@ -84,7 +87,8 @@ const pluginCache = () => ({
|
|
|
84
87
|
name: "rsbuild:cache",
|
|
85
88
|
setup(api) {
|
|
86
89
|
api.modifyBundlerChain(async (chain, { target, env }) => {
|
|
87
|
-
const
|
|
90
|
+
const config = api.getNormalizedConfig();
|
|
91
|
+
const { buildCache } = config.performance;
|
|
88
92
|
if (buildCache === false) {
|
|
89
93
|
chain.cache(false);
|
|
90
94
|
return;
|
|
@@ -92,7 +96,7 @@ const pluginCache = () => ({
|
|
|
92
96
|
const { context } = api;
|
|
93
97
|
const cacheConfig = typeof buildCache === "boolean" ? {} : buildCache;
|
|
94
98
|
const cacheDirectory = getCacheDirectory(cacheConfig, context);
|
|
95
|
-
const buildDependencies = await getBuildDependencies(context);
|
|
99
|
+
const buildDependencies = await getBuildDependencies(context, config);
|
|
96
100
|
await validateCache(cacheDirectory, buildDependencies);
|
|
97
101
|
const useDigest = Array.isArray(cacheConfig.cacheDigest) && cacheConfig.cacheDigest.length;
|
|
98
102
|
chain.cache({
|
package/dist/plugins/entry.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RsbuildEntry, type RsbuildTarget } from '@rsbuild/shared';
|
|
2
|
+
import type { NormalizedConfig, RsbuildConfig, RsbuildPlugin } from '../types';
|
|
3
|
+
export declare function getEntryObject(config: RsbuildConfig | NormalizedConfig, target: RsbuildTarget): RsbuildEntry;
|
|
2
4
|
export declare const pluginEntry: () => RsbuildPlugin;
|
package/dist/plugins/entry.js
CHANGED
|
@@ -18,30 +18,44 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var entry_exports = {};
|
|
20
20
|
__export(entry_exports, {
|
|
21
|
+
getEntryObject: () => getEntryObject,
|
|
21
22
|
pluginEntry: () => pluginEntry
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(entry_exports);
|
|
24
25
|
var import_shared = require("@rsbuild/shared");
|
|
26
|
+
function getEntryObject(config, target) {
|
|
27
|
+
if (!config.source?.entry) {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
return (0, import_shared.mergeChainedOptions)({
|
|
31
|
+
defaults: {},
|
|
32
|
+
options: config.source?.entry,
|
|
33
|
+
utils: { target },
|
|
34
|
+
useObjectParam: true
|
|
35
|
+
});
|
|
36
|
+
}
|
|
25
37
|
const pluginEntry = () => ({
|
|
26
38
|
name: "rsbuild:entry",
|
|
27
39
|
setup(api) {
|
|
28
|
-
api.modifyBundlerChain(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
api.modifyBundlerChain(
|
|
41
|
+
async (chain, { target, isServer, isServiceWorker }) => {
|
|
42
|
+
const config = api.getNormalizedConfig();
|
|
43
|
+
const { preEntry } = config.source;
|
|
44
|
+
const entry = target === "web" ? api.context.entry : getEntryObject(config, target);
|
|
45
|
+
const injectCoreJsEntry = config.output.polyfill === "entry" && !isServer && !isServiceWorker;
|
|
46
|
+
Object.keys(entry).forEach((entryName) => {
|
|
47
|
+
const entryPoint = chain.entry(entryName);
|
|
48
|
+
const addEntry = (item) => {
|
|
49
|
+
entryPoint.add(item);
|
|
50
|
+
};
|
|
51
|
+
preEntry.forEach(addEntry);
|
|
52
|
+
if (injectCoreJsEntry) {
|
|
53
|
+
addEntry((0, import_shared.createVirtualModule)('import "core-js";'));
|
|
54
|
+
}
|
|
55
|
+
(0, import_shared.castArray)(entry[entryName]).forEach(addEntry);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
);
|
|
45
59
|
api.onBeforeCreateCompiler(({ bundlerConfigs }) => {
|
|
46
60
|
if (bundlerConfigs.every((config) => !config.entry)) {
|
|
47
61
|
throw new Error(
|
|
@@ -57,5 +71,6 @@ const pluginEntry = () => ({
|
|
|
57
71
|
});
|
|
58
72
|
// Annotate the CommonJS export names for ESM import in node:
|
|
59
73
|
0 && (module.exports = {
|
|
74
|
+
getEntryObject,
|
|
60
75
|
pluginEntry
|
|
61
76
|
});
|
|
@@ -27,6 +27,7 @@ var import_node_path = require("node:path");
|
|
|
27
27
|
var import_shared = require("@rsbuild/shared");
|
|
28
28
|
var import_initHooks = require("./initHooks");
|
|
29
29
|
var import_config = require("./config");
|
|
30
|
+
var import_entry = require("../plugins/entry");
|
|
30
31
|
function getAbsolutePath(root, filepath) {
|
|
31
32
|
return (0, import_node_path.isAbsolute)(filepath) ? filepath : (0, import_node_path.join)(root, filepath);
|
|
32
33
|
}
|
|
@@ -41,9 +42,9 @@ async function createContextByConfig(options, bundlerType, config = {}) {
|
|
|
41
42
|
const cachePath = (0, import_node_path.join)(rootPath, "node_modules", ".cache");
|
|
42
43
|
const tsconfigPath = config.source?.tsconfigPath;
|
|
43
44
|
const context = {
|
|
44
|
-
entry: config
|
|
45
|
+
entry: (0, import_entry.getEntryObject)(config, "web"),
|
|
45
46
|
targets: config.output?.targets || [],
|
|
46
|
-
version: "0.4.
|
|
47
|
+
version: "0.4.7",
|
|
47
48
|
rootPath,
|
|
48
49
|
distPath,
|
|
49
50
|
cachePath,
|
|
@@ -56,7 +57,7 @@ function updateContextByNormalizedConfig(context, config) {
|
|
|
56
57
|
context.targets = config.output.targets;
|
|
57
58
|
context.distPath = getAbsoluteDistPath(context.rootPath, config);
|
|
58
59
|
if (config.source.entry) {
|
|
59
|
-
context.entry = config
|
|
60
|
+
context.entry = (0, import_entry.getEntryObject)(config, "web");
|
|
60
61
|
}
|
|
61
62
|
if (config.source.tsconfigPath) {
|
|
62
63
|
context.tsconfigPath = getAbsolutePath(
|
|
@@ -42,10 +42,11 @@ const pluginProgress = () => ({
|
|
|
42
42
|
if (!options) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
+
const prefix = options !== true && options.id !== void 0 ? options.id : import_shared.TARGET_ID_MAP[target];
|
|
45
46
|
const { ProgressPlugin } = await Promise.resolve().then(() => __toESM(require("@rspack/core")));
|
|
46
47
|
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
47
48
|
{
|
|
48
|
-
prefix
|
|
49
|
+
prefix,
|
|
49
50
|
...options === true ? {} : options
|
|
50
51
|
}
|
|
51
52
|
]);
|
|
@@ -131,6 +131,7 @@ function applySwcDecoratorConfig(swcConfig, config) {
|
|
|
131
131
|
case "legacy":
|
|
132
132
|
swcConfig.jsc.transform.legacyDecorator = true;
|
|
133
133
|
swcConfig.jsc.transform.decoratorMetadata = true;
|
|
134
|
+
swcConfig.jsc.transform.useDefineForClassFields = false;
|
|
134
135
|
break;
|
|
135
136
|
case "2022-03":
|
|
136
137
|
swcConfig.jsc.transform.legacyDecorator = false;
|
|
@@ -26,6 +26,7 @@ __export(HtmlCrossOriginPlugin_exports, {
|
|
|
26
26
|
HtmlCrossOriginPlugin: () => HtmlCrossOriginPlugin
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(HtmlCrossOriginPlugin_exports);
|
|
29
|
+
var import_shared = require("@rsbuild/shared");
|
|
29
30
|
var import_htmlPluginUtil = require("../provider/htmlPluginUtil");
|
|
30
31
|
class HtmlCrossOriginPlugin {
|
|
31
32
|
constructor(options) {
|
|
@@ -36,11 +37,15 @@ class HtmlCrossOriginPlugin {
|
|
|
36
37
|
this.crossOrigin = crossOrigin;
|
|
37
38
|
}
|
|
38
39
|
apply(compiler) {
|
|
39
|
-
if (!this.crossOrigin
|
|
40
|
-
// https://github.com/web-infra-dev/rspack/blob/bc8e67b5419adda15c2b389517c9b37d02c8240f/crates/rspack_plugin_runtime/src/runtime_module/load_script.rs#L39
|
|
41
|
-
compiler.options.output.publicPath === "/" && this.crossOrigin !== "use-credentials") {
|
|
40
|
+
if (!this.crossOrigin) {
|
|
42
41
|
return;
|
|
43
42
|
}
|
|
43
|
+
if (this.crossOrigin !== "use-credentials") {
|
|
44
|
+
const { publicPath } = compiler.options.output;
|
|
45
|
+
if (!publicPath || publicPath === import_shared.DEFAULT_ASSET_PREFIX || publicPath === "auto") {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
44
49
|
compiler.hooks.compilation.tap(this.name, (compilation) => {
|
|
45
50
|
(0, import_htmlPluginUtil.getHTMLPlugin)().getHooks(compilation).alterAssetTags.tap(this.name, (alterAssetTags) => {
|
|
46
51
|
const {
|
package/dist/server/restart.js
CHANGED
|
@@ -34,7 +34,7 @@ __export(restart_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(restart_exports);
|
|
35
35
|
var import_node_path = __toESM(require("node:path"));
|
|
36
36
|
var import_shared = require("@rsbuild/shared");
|
|
37
|
-
var
|
|
37
|
+
var import_init = require("../cli/init");
|
|
38
38
|
let cleaners = [];
|
|
39
39
|
const onBeforeRestartServer = (cleaner) => {
|
|
40
40
|
cleaners.push(cleaner);
|
|
@@ -53,7 +53,7 @@ const restartDevServer = async ({ filePath }) => {
|
|
|
53
53
|
await cleaner();
|
|
54
54
|
cleaners = [];
|
|
55
55
|
}
|
|
56
|
-
const rsbuild = await (0,
|
|
56
|
+
const rsbuild = await (0, import_init.init)({ isRestart: true });
|
|
57
57
|
if (!rsbuild) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"core-js": "~3.32.2",
|
|
58
58
|
"html-webpack-plugin": "npm:html-rspack-plugin@5.6.0",
|
|
59
59
|
"postcss": "^8.4.33",
|
|
60
|
-
"@rsbuild/shared": "0.4.
|
|
60
|
+
"@rsbuild/shared": "0.4.7"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "16.x",
|