@rsbuild/core 0.3.5 → 0.3.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.
Files changed (44) hide show
  1. package/compiled/launch-editor-middleware/index.d.ts +1 -0
  2. package/compiled/launch-editor-middleware/index.js +1 -0
  3. package/compiled/launch-editor-middleware/license +21 -0
  4. package/compiled/launch-editor-middleware/package.json +1 -0
  5. package/dist/cli/commands.js +5 -5
  6. package/dist/cli/config.js +13 -6
  7. package/dist/cli/prepare.js +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/loadEnv.js +9 -4
  10. package/dist/plugins/asset.js +3 -3
  11. package/dist/plugins/basic.js +2 -2
  12. package/dist/plugins/cache.js +9 -9
  13. package/dist/plugins/fileSize.js +7 -7
  14. package/dist/plugins/html.js +4 -4
  15. package/dist/plugins/nodeAddons.js +3 -3
  16. package/dist/plugins/server.js +2 -2
  17. package/dist/plugins/splitChunks.js +4 -4
  18. package/dist/plugins/startUrl.js +5 -5
  19. package/dist/plugins/wasm.js +2 -2
  20. package/dist/provider/config.js +5 -11
  21. package/dist/provider/core/createContext.js +4 -4
  22. package/dist/provider/core/inspectConfig.js +3 -3
  23. package/dist/provider/plugins/css.js +9 -5
  24. package/dist/provider/plugins/output.js +3 -3
  25. package/dist/provider/plugins/resolve.js +3 -7
  26. package/dist/provider/plugins/rspackProfile.d.ts +1 -1
  27. package/dist/provider/plugins/rspackProfile.js +7 -7
  28. package/dist/provider/plugins/swc.js +3 -3
  29. package/dist/provider/shared.js +2 -2
  30. package/dist/rspack/HtmlAppIconPlugin.js +5 -5
  31. package/dist/rspack/InlineChunkHtmlPlugin.js +2 -2
  32. package/dist/rspack/preload/helpers/determineAsValue.js +11 -27
  33. package/dist/server/compilerDevMiddleware.d.ts +2 -2
  34. package/dist/server/devServer.js +7 -1
  35. package/dist/server/getDevMiddlewares.d.ts +2 -2
  36. package/dist/server/getDevMiddlewares.js +7 -5
  37. package/dist/server/httpServer.js +2 -2
  38. package/dist/server/middlewares.js +8 -8
  39. package/dist/server/prodServer.d.ts +1 -1
  40. package/dist/server/prodServer.js +2 -2
  41. package/dist/server/restart.js +2 -2
  42. package/dist/server/socketServer.d.ts +2 -2
  43. package/package.json +2 -2
  44. package/types.d.ts +24 -0
@@ -0,0 +1 @@
1
+ export = any;
@@ -0,0 +1 @@
1
+ (()=>{var e={426:(e,t,n)=>{const r=n(310);const s=n(17);const i=n(80);e.exports=(e,t,n)=>{if(typeof e==="function"){n=e;e=undefined}if(typeof t==="function"){n=t;t=undefined}t=t||process.cwd();return function launchEditorMiddleware(o,a,c){const{file:p}=r.parse(o.url,true).query||{};if(!p){a.statusCode=500;a.end(`launch-editor-middleware: required query param "file" is missing.`)}else{i(s.resolve(t,p),e,n);a.end()}}}},881:e=>{e.exports={atom:"atom",Brackets:"brackets","code-insiders":"code-insiders",code:"code",vscodium:"vscodium",codium:"codium",emacs:"emacs",gvim:"gvim","idea.sh":"idea","phpstorm.sh":"phpstorm","pycharm.sh":"pycharm","rubymine.sh":"rubymine",sublime_text:"subl",vim:"vim","webstorm.sh":"webstorm","goland.sh":"goland","rider.sh":"rider"}},341:e=>{e.exports={"/Applications/Atom.app/Contents/MacOS/Atom":"atom","/Applications/Atom Beta.app/Contents/MacOS/Atom Beta":"/Applications/Atom Beta.app/Contents/MacOS/Atom Beta","/Applications/Brackets.app/Contents/MacOS/Brackets":"brackets","/Applications/Sublime Text.app/Contents/MacOS/Sublime Text":"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl","/Applications/Sublime Text.app/Contents/MacOS/sublime_text":"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl","/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2":"/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl","/Applications/Sublime Text Dev.app/Contents/MacOS/Sublime Text":"/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl","/Applications/Visual Studio Code.app/Contents/MacOS/Electron":"code","/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron":"code-insiders","/Applications/VSCodium.app/Contents/MacOS/Electron":"codium","/Applications/AppCode.app/Contents/MacOS/appcode":"/Applications/AppCode.app/Contents/MacOS/appcode","/Applications/CLion.app/Contents/MacOS/clion":"/Applications/CLion.app/Contents/MacOS/clion","/Applications/IntelliJ IDEA.app/Contents/MacOS/idea":"/Applications/IntelliJ IDEA.app/Contents/MacOS/idea","/Applications/PhpStorm.app/Contents/MacOS/phpstorm":"/Applications/PhpStorm.app/Contents/MacOS/phpstorm","/Applications/PyCharm.app/Contents/MacOS/pycharm":"/Applications/PyCharm.app/Contents/MacOS/pycharm","/Applications/PyCharm CE.app/Contents/MacOS/pycharm":"/Applications/PyCharm CE.app/Contents/MacOS/pycharm","/Applications/RubyMine.app/Contents/MacOS/rubymine":"/Applications/RubyMine.app/Contents/MacOS/rubymine","/Applications/WebStorm.app/Contents/MacOS/webstorm":"/Applications/WebStorm.app/Contents/MacOS/webstorm","/Applications/MacVim.app/Contents/MacOS/MacVim":"mvim","/Applications/GoLand.app/Contents/MacOS/goland":"/Applications/GoLand.app/Contents/MacOS/goland","/Applications/Rider.app/Contents/MacOS/rider":"/Applications/Rider.app/Contents/MacOS/rider"}},3:e=>{e.exports=["Brackets.exe","Code.exe","Code - Insiders.exe","VSCodium.exe","atom.exe","sublime_text.exe","notepad++.exe","clion.exe","clion64.exe","idea.exe","idea64.exe","phpstorm.exe","phpstorm64.exe","pycharm.exe","pycharm64.exe","rubymine.exe","rubymine64.exe","webstorm.exe","webstorm64.exe","goland.exe","goland64.exe","rider.exe","rider64.exe"]},417:(e,t,n)=>{const r=n(17);e.exports=function getArgumentsForPosition(e,t,n,s=1){const i=r.basename(e).replace(/\.(exe|cmd|bat)$/i,"");switch(i){case"atom":case"Atom":case"Atom Beta":case"subl":case"sublime":case"sublime_text":case"wstorm":case"charm":return[`${t}:${n}:${s}`];case"notepad++":return["-n"+n,"-c"+s,t];case"vim":case"mvim":return[`+call cursor(${n}, ${s})`,t];case"joe":case"gvim":return["+"+`${n}`,t];case"emacs":case"emacsclient":return[`+${n}:${s}`,t];case"rmate":case"mate":case"mine":return["--line",n,t];case"code":case"Code":case"code-insiders":case"Code - Insiders":case"codium":case"vscodium":case"VSCodium":return["-r","-g",`${t}:${n}:${s}`];case"appcode":case"clion":case"clion64":case"idea":case"idea64":case"phpstorm":case"phpstorm64":case"pycharm":case"pycharm64":case"rubymine":case"rubymine64":case"webstorm":case"webstorm64":case"goland":case"goland64":case"rider":case"rider64":return["--line",n,"--column",s,t]}if(process.env.LAUNCH_EDITOR){return[t,n,s]}return[t]}},841:(e,t,n)=>{const r=n(17);const s=n(522);const i=n(81);const o=n(341);const a=n(881);const c=n(3);e.exports=function guessEditor(e){if(e){return s.parse(e)}if(process.env.LAUNCH_EDITOR){return[process.env.LAUNCH_EDITOR]}if(process.versions.webcontainer){return[process.env.EDITOR||"code"]}try{if(process.platform==="darwin"){const e=i.execSync("ps x -o comm=",{stdio:["pipe","pipe","ignore"]}).toString();const t=Object.keys(o);const n=e.split("\n");for(let r=0;r<t.length;r++){const s=t[r];if(e.indexOf(s)!==-1){return[o[s]]}const i=s.replace("/Applications","");if(e.indexOf(i)!==-1){if(s!==o[s]){return[o[s]]}const e=n.find((e=>e.endsWith(i)));if(e!==undefined){return[e]}}}}else if(process.platform==="win32"){const e=i.execSync('powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"',{stdio:["pipe","pipe","ignore"]}).toString();const t=e.split("\r\n");for(let e=0;e<t.length;e++){const n=t[e].trim();const s=r.basename(n);if(c.indexOf(s)!==-1){return[n]}}}else if(process.platform==="linux"){const e=i.execSync("ps x --no-heading -o comm --sort=comm",{stdio:["pipe","pipe","ignore"]}).toString();const t=Object.keys(a);for(let n=0;n<t.length;n++){const r=t[n];if(e.indexOf(r)!==-1){return[a[r]]}}}}catch(e){}if(process.env.VISUAL){return[process.env.VISUAL]}else if(process.env.EDITOR){return[process.env.EDITOR]}return[null]}},80:(e,t,n)=>{const r=n(147);const s=n(37);const i=n(17);const o=n(802);const a=n(81);const c=n(841);const p=n(417);function wrapErrorCallback(e){return(t,n)=>{console.log();console.log(o.red("Could not open "+i.basename(t)+" in the editor."));if(n){if(n[n.length-1]!=="."){n+="."}console.log(o.red("The editor process exited with an error: "+n))}console.log();if(e)e(t,n)}}function isTerminalEditor(e){switch(e){case"vim":case"emacs":case"nano":return true}return false}const l=/:(\d+)(:(\d+))?$/;function parseFile(e){const t=e.replace(l,"");const n=e.match(l);const r=n&&n[1];const s=n&&n[3];return{fileName:t,lineNumber:r,columnNumber:s}}let u=null;function launchEditor(e,t,n){const o=parseFile(e);let{fileName:l}=o;const{lineNumber:d,columnNumber:m}=o;if(!r.existsSync(l)){return}if(typeof t==="function"){n=t;t=undefined}n=wrapErrorCallback(n);const[f,...x]=c(t);if(!f){n(l,null);return}if(process.platform==="linux"&&l.startsWith("/mnt/")&&/Microsoft/i.test(s.release())){l=i.relative("",l)}if(d){const e=p(f,l,d,m);x.push.apply(x,e)}else{x.push(l)}if(u&&isTerminalEditor(f)){u.kill("SIGKILL")}if(process.platform==="win32"){u=a.spawn("cmd.exe",["/C",f].concat(x),{stdio:"inherit"})}else{u=a.spawn(f,x,{stdio:"inherit"})}u.on("exit",(function(e){u=null;if(e){n(l,"(code "+e+")")}}));u.on("error",(function(e){n(l,e.message)}))}e.exports=launchEditor},522:(e,t,n)=>{"use strict";t.quote=n(392);t.parse=n(145)},145:e=>{"use strict";var t="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")";var n=new RegExp("^"+t+"$");var r="|&;()<> \\t";var s='"((\\\\"|[^"])*?)"';var i="'((\\\\'|[^'])*?)'";var o=/^#$/;var a="'";var c='"';var p="$";var l="";var u=4294967296;for(var d=0;d<4;d++){l+=(u*Math.random()).toString(16)}var m=new RegExp("^"+l);function matchAll(e,t){var n=t.lastIndex;var r=[];var s;while(s=t.exec(e)){r.push(s);if(t.lastIndex===s.index){t.lastIndex+=1}}t.lastIndex=n;return r}function getVar(e,t,n){var r=typeof e==="function"?e(n):e[n];if(typeof r==="undefined"&&n!=""){r=""}else if(typeof r==="undefined"){r="$"}if(typeof r==="object"){return t+l+JSON.stringify(r)+l}return t+r}function parseInternal(e,l,u){if(!u){u={}}var d=u.escape||"\\";var m="(\\"+d+"['\""+r+"]|[^\\s'\""+r+"])+";var f=new RegExp(["("+t+")","("+m+"|"+s+"|"+i+")+"].join("|"),"g");var x=matchAll(e,f);if(x.length===0){return[]}if(!l){l={}}var h=false;return x.map((function(t){var r=t[0];if(!r||h){return void undefined}if(n.test(r)){return{op:r}}var s=false;var i=false;var u="";var m=false;var f;function parseEnvVar(){f+=1;var e;var t;var n=r.charAt(f);if(n==="{"){f+=1;if(r.charAt(f)==="}"){throw new Error("Bad substitution: "+r.slice(f-2,f+1))}e=r.indexOf("}",f);if(e<0){throw new Error("Bad substitution: "+r.slice(f))}t=r.slice(f,e);f=e}else if(/[*@#?$!_-]/.test(n)){t=n;f+=1}else{var s=r.slice(f);e=s.match(/[^\w\d_]/);if(!e){t=s;f=r.length}else{t=s.slice(0,e.index);f+=e.index-1}}return getVar(l,"",t)}for(f=0;f<r.length;f++){var x=r.charAt(f);m=m||!s&&(x==="*"||x==="?");if(i){u+=x;i=false}else if(s){if(x===s){s=false}else if(s==a){u+=x}else{if(x===d){f+=1;x=r.charAt(f);if(x===c||x===d||x===p){u+=x}else{u+=d+x}}else if(x===p){u+=parseEnvVar()}else{u+=x}}}else if(x===c||x===a){s=x}else if(n.test(x)){return{op:r}}else if(o.test(x)){h=true;var b={comment:e.slice(t.index+f+1)};if(u.length){return[u,b]}return[b]}else if(x===d){i=true}else if(x===p){u+=parseEnvVar()}else{u+=x}}if(m){return{op:"glob",pattern:u}}return u})).reduce((function(e,t){return typeof t==="undefined"?e:e.concat(t)}),[])}e.exports=function parse(e,t,n){var r=parseInternal(e,t,n);if(typeof t!=="function"){return r}return r.reduce((function(e,t){if(typeof t==="object"){return e.concat(t)}var n=t.split(RegExp("("+l+".*?"+l+")","g"));if(n.length===1){return e.concat(n[0])}return e.concat(n.filter(Boolean).map((function(e){if(m.test(e)){return JSON.parse(e.split(l)[1])}return e})))}),[])}},392:e=>{"use strict";e.exports=function quote(e){return e.map((function(e){if(e&&typeof e==="object"){return e.op.replace(/(.)/g,"\\$1")}if(/["\s]/.test(e)&&!/'/.test(e)){return"'"+e.replace(/(['\\])/g,"\\$1")+"'"}if(/["'\s]/.test(e)){return'"'+e.replace(/(["\\$`!])/g,"\\$1")+'"'}return String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")})).join(" ")}},802:e=>{"use strict";e.exports=require("@rsbuild/shared/picocolors")},81:e=>{"use strict";e.exports=require("child_process")},147:e=>{"use strict";e.exports=require("fs")},37:e=>{"use strict";e.exports=require("os")},17:e=>{"use strict";e.exports=require("path")},310:e=>{"use strict";e.exports=require("url")}};var t={};function __nccwpck_require__(n){var r=t[n];if(r!==undefined){return r.exports}var s=t[n]={exports:{}};var i=true;try{e[n](s,s.exports,__nccwpck_require__);i=false}finally{if(i)delete t[n]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(426);module.exports=n})();
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017-present, Yuxi (Evan) You
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1 @@
1
+ {"name":"launch-editor-middleware","author":"Evan You","version":"2.6.1","license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -32,8 +32,8 @@ __export(commands_exports, {
32
32
  runCli: () => runCli
33
33
  });
34
34
  module.exports = __toCommonJS(commands_exports);
35
- var import_path = require("path");
36
- var import_fs = require("fs");
35
+ var import_node_path = require("node:path");
36
+ var import_node_fs = require("node:fs");
37
37
  var import_shared = require("@rsbuild/shared");
38
38
  var import_commander = require("@rsbuild/shared/commander");
39
39
  var import_loadEnv = require("../loadEnv");
@@ -111,7 +111,7 @@ const applyServerOptions = (command) => {
111
111
  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");
112
112
  };
113
113
  function runCli() {
114
- import_commander.program.name("rsbuild").usage("<command> [options]").version("0.3.5");
114
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.3.7");
115
115
  const devCommand = import_commander.program.command("dev");
116
116
  const buildCommand = import_commander.program.command("build");
117
117
  const previewCommand = import_commander.program.command("preview");
@@ -145,7 +145,7 @@ function runCli() {
145
145
  previewCommand.description("preview the production build locally").action(async (options) => {
146
146
  try {
147
147
  const rsbuild = await init({ cliOptions: options });
148
- if (rsbuild && !(0, import_fs.existsSync)(rsbuild.context.distPath)) {
148
+ if (rsbuild && !(0, import_node_fs.existsSync)(rsbuild.context.distPath)) {
149
149
  throw new Error(
150
150
  `The output directory ${import_shared.color.yellow(
151
151
  rsbuild.context.distPath
@@ -165,7 +165,7 @@ function runCli() {
165
165
  await rsbuild?.inspectConfig({
166
166
  env: options.env,
167
167
  verbose: options.verbose,
168
- outputPath: (0, import_path.join)(rsbuild.context.distPath, options.output),
168
+ outputPath: (0, import_node_path.join)(rsbuild.context.distPath, options.output),
169
169
  writeToDisk: true
170
170
  });
171
171
  } catch (err) {
@@ -35,8 +35,8 @@ __export(config_exports, {
35
35
  watchFiles: () => watchFiles
36
36
  });
37
37
  module.exports = __toCommonJS(config_exports);
38
- var import_fs = __toESM(require("fs"));
39
- var import_path = require("path");
38
+ var import_node_fs = __toESM(require("node:fs"));
39
+ var import_node_path = require("node:path");
40
40
  var import_shared = require("@rsbuild/shared");
41
41
  var import_restart = require("../server/restart");
42
42
  function defineConfig(config) {
@@ -44,8 +44,8 @@ function defineConfig(config) {
44
44
  }
45
45
  const resolveConfigPath = (root, customConfig) => {
46
46
  if (customConfig) {
47
- const customConfigPath = (0, import_path.isAbsolute)(customConfig) ? customConfig : (0, import_path.join)(root, customConfig);
48
- if (import_fs.default.existsSync(customConfigPath)) {
47
+ const customConfigPath = (0, import_node_path.isAbsolute)(customConfig) ? customConfig : (0, import_node_path.join)(root, customConfig);
48
+ if (import_node_fs.default.existsSync(customConfigPath)) {
49
49
  return customConfigPath;
50
50
  }
51
51
  import_shared.logger.warn(`Cannot find config file: ${import_shared.color.dim(customConfigPath)}
@@ -60,8 +60,8 @@ const resolveConfigPath = (root, customConfig) => {
60
60
  "rsbuild.config.cts"
61
61
  ];
62
62
  for (const file of CONFIG_FILES) {
63
- const configFile = (0, import_path.join)(root, file);
64
- if (import_fs.default.existsSync(configFile)) {
63
+ const configFile = (0, import_node_path.join)(root, file);
64
+ if (import_node_fs.default.existsSync(configFile)) {
65
65
  return configFile;
66
66
  }
67
67
  }
@@ -112,6 +112,13 @@ async function loadConfigByPath(configFile) {
112
112
  }
113
113
  return result;
114
114
  }
115
+ if (!(0, import_shared.isObject)(configExport)) {
116
+ throw new Error(
117
+ `Rsbuild config must be an object or a function that returns an object, get ${import_shared.color.yellow(
118
+ configExport
119
+ )}`
120
+ );
121
+ }
115
122
  return configExport;
116
123
  } catch (err) {
117
124
  import_shared.logger.error(`Failed to load file: ${import_shared.color.dim(configFile)}`);
@@ -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.3.5"}`}
37
+ import_rslog.logger.greet(` ${`Rsbuild v${"0.3.7"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ var import_createRsbuild = require("./createRsbuild");
38
38
  var import_config = require("./cli/config");
39
39
  var import_shared = require("@rsbuild/shared");
40
40
  var import_constants = require("./constants");
41
- const version = "0.3.5";
41
+ const version = "0.3.7";
42
42
  // Annotate the CommonJS export names for ESM import in node:
43
43
  0 && (module.exports = {
44
44
  PLUGIN_BABEL_NAME,
package/dist/loadEnv.js CHANGED
@@ -31,8 +31,8 @@ __export(loadEnv_exports, {
31
31
  loadEnv: () => loadEnv
32
32
  });
33
33
  module.exports = __toCommonJS(loadEnv_exports);
34
- var import_fs = __toESM(require("fs"));
35
- var import_path = require("path");
34
+ var import_node_fs = __toESM(require("node:fs"));
35
+ var import_node_path = require("node:path");
36
36
  var import_shared = require("@rsbuild/shared");
37
37
  var import_dotenv = require("../compiled/dotenv");
38
38
  var import_dotenv_expand = require("../compiled/dotenv-expand");
@@ -41,16 +41,21 @@ function loadEnv({
41
41
  mode = (0, import_shared.getNodeEnv)(),
42
42
  prefixes = ["PUBLIC_"]
43
43
  } = {}) {
44
+ if (mode === "local") {
45
+ throw new Error(
46
+ `'local' cannot be used as a value for env mode, because ".env.local" represents a temporary local file. Please use another value.`
47
+ );
48
+ }
44
49
  const filenames = [
45
50
  ".env",
46
51
  ".env.local",
47
52
  `.env.${mode}`,
48
53
  `.env.${mode}.local`
49
54
  ];
50
- const filePaths = filenames.map((filename) => (0, import_path.join)(cwd, filename)).filter(import_shared.isFileSync);
55
+ const filePaths = filenames.map((filename) => (0, import_node_path.join)(cwd, filename)).filter(import_shared.isFileSync);
51
56
  const parsed = {};
52
57
  filePaths.forEach((envPath) => {
53
- Object.assign(parsed, (0, import_dotenv.parse)(import_fs.default.readFileSync(envPath)));
58
+ Object.assign(parsed, (0, import_dotenv.parse)(import_node_fs.default.readFileSync(envPath)));
54
59
  });
55
60
  (0, import_dotenv_expand.expand)({ parsed });
56
61
  const publicVars = {};
@@ -32,7 +32,7 @@ __export(asset_exports, {
32
32
  pluginAsset: () => pluginAsset
33
33
  });
34
34
  module.exports = __toCommonJS(asset_exports);
35
- var import_path = __toESM(require("path"));
35
+ var import_node_path = __toESM(require("node:path"));
36
36
  var import_shared = require("@rsbuild/shared");
37
37
  function getRegExpForExts(exts) {
38
38
  const matcher = exts.map((ext) => ext.trim()).map((ext) => ext.startsWith(".") ? ext.slice(1) : ext).join("|");
@@ -55,13 +55,13 @@ const pluginAsset = () => ({
55
55
  (0, import_shared.chainStaticAssetRule)({
56
56
  rule,
57
57
  maxSize,
58
- filename: import_path.default.posix.join(distDir, filename),
58
+ filename: import_node_path.default.posix.join(distDir, filename),
59
59
  assetType
60
60
  });
61
61
  };
62
62
  createAssetRule("image", import_shared.IMAGE_EXTENSIONS);
63
63
  createAssetRule("svg", ["svg"]);
64
- createAssetRule("media", import_shared.MEDIA_EXTENSIONS);
64
+ createAssetRule("media", [...import_shared.VIDEO_EXTENSIONS, ...import_shared.AUDIO_EXTENSIONS]);
65
65
  createAssetRule("font", import_shared.FONT_EXTENSIONS);
66
66
  });
67
67
  }
@@ -31,7 +31,7 @@ __export(basic_exports, {
31
31
  pluginBasic: () => pluginBasic
32
32
  });
33
33
  module.exports = __toCommonJS(basic_exports);
34
- var import_path = __toESM(require("path"));
34
+ var import_node_path = __toESM(require("node:path"));
35
35
  var import_shared = require("@rsbuild/shared");
36
36
  const pluginBasic = () => ({
37
37
  name: "rsbuild:basic",
@@ -61,7 +61,7 @@ const pluginBasic = () => ({
61
61
  }
62
62
  if (env === "development") {
63
63
  chain.output.devtoolModuleFilenameTemplate(
64
- (info) => import_path.default.resolve(info.absoluteResourcePath).replace(/\\/g, "/")
64
+ (info) => import_node_path.default.resolve(info.absoluteResourcePath).replace(/\\/g, "/")
65
65
  );
66
66
  }
67
67
  }
@@ -31,12 +31,12 @@ __export(cache_exports, {
31
31
  pluginCache: () => pluginCache
32
32
  });
33
33
  module.exports = __toCommonJS(cache_exports);
34
- var import_crypto = __toESM(require("crypto"));
35
- var import_path = require("path");
34
+ var import_node_crypto = __toESM(require("node:crypto"));
35
+ var import_node_path = require("node:path");
36
36
  var import_shared = require("@rsbuild/shared");
37
37
  var import_shared2 = require("@rsbuild/shared");
38
38
  async function validateCache(cacheDirectory, buildDependencies) {
39
- const configFile = (0, import_path.join)(cacheDirectory, "buildDependencies.json");
39
+ const configFile = (0, import_node_path.join)(cacheDirectory, "buildDependencies.json");
40
40
  if (await (0, import_shared2.isFileExists)(configFile)) {
41
41
  const prevBuildDependencies = await import_shared.fse.readJSON(configFile);
42
42
  if (JSON.stringify(prevBuildDependencies) === JSON.stringify(buildDependencies)) {
@@ -47,19 +47,19 @@ async function validateCache(cacheDirectory, buildDependencies) {
47
47
  await import_shared.fse.outputJSON(configFile, buildDependencies);
48
48
  }
49
49
  function getDigestHash(digest) {
50
- const fsHash = import_crypto.default.createHash("md5");
50
+ const fsHash = import_node_crypto.default.createHash("md5");
51
51
  const md5 = fsHash.update(JSON.stringify(digest)).digest("hex").slice(0, 8);
52
52
  return md5;
53
53
  }
54
54
  function getCacheDirectory({ cacheDirectory }, context) {
55
55
  if (cacheDirectory) {
56
- return (0, import_path.isAbsolute)(cacheDirectory) ? cacheDirectory : (0, import_path.join)(context.rootPath, cacheDirectory);
56
+ return (0, import_node_path.isAbsolute)(cacheDirectory) ? cacheDirectory : (0, import_node_path.join)(context.rootPath, cacheDirectory);
57
57
  }
58
- return (0, import_path.join)(context.cachePath, context.bundlerType);
58
+ return (0, import_node_path.join)(context.cachePath, context.bundlerType);
59
59
  }
60
60
  async function getBuildDependencies(context) {
61
- const rootPackageJson = (0, import_path.join)(context.rootPath, "package.json");
62
- const browserslistConfig = (0, import_path.join)(context.rootPath, ".browserslistrc");
61
+ const rootPackageJson = (0, import_node_path.join)(context.rootPath, "package.json");
62
+ const browserslistConfig = (0, import_node_path.join)(context.rootPath, ".browserslistrc");
63
63
  const buildDependencies = {};
64
64
  if (await (0, import_shared2.isFileExists)(rootPackageJson)) {
65
65
  buildDependencies.packageJson = [rootPackageJson];
@@ -72,7 +72,7 @@ async function getBuildDependencies(context) {
72
72
  }
73
73
  const tailwindExts = ["ts", "js", "cjs", "mjs"];
74
74
  const configs = tailwindExts.map(
75
- (ext) => (0, import_path.join)(context.rootPath, `tailwind.config.${ext}`)
75
+ (ext) => (0, import_node_path.join)(context.rootPath, `tailwind.config.${ext}`)
76
76
  );
77
77
  const tailwindConfig = (0, import_shared2.findExists)(configs);
78
78
  if (tailwindConfig) {
@@ -32,7 +32,7 @@ __export(fileSize_exports, {
32
32
  pluginFileSize: () => pluginFileSize
33
33
  });
34
34
  module.exports = __toCommonJS(fileSize_exports);
35
- var import_path = __toESM(require("path"));
35
+ var import_node_path = __toESM(require("node:path"));
36
36
  var import_shared = require("@rsbuild/shared");
37
37
  var import_shared2 = require("@rsbuild/shared");
38
38
  const filterAsset = (asset) => !/\.map$/.test(asset) && !/\.LICENSE\.txt$/.test(asset);
@@ -68,13 +68,13 @@ async function printFileSizes(config, stats, distPath) {
68
68
  const { default: gzipSize } = await Promise.resolve().then(() => __toESM(require("@rsbuild/shared/gzip-size")));
69
69
  const formatAsset = (asset) => {
70
70
  const fileName = asset.name.split("?")[0];
71
- const contents = import_shared.fse.readFileSync(import_path.default.join(distPath, fileName));
71
+ const contents = import_shared.fse.readFileSync(import_node_path.default.join(distPath, fileName));
72
72
  const size = contents.length;
73
73
  const gzippedSize = gzipSize.sync(contents);
74
74
  return {
75
75
  size,
76
- folder: import_path.default.join(import_path.default.basename(distPath), import_path.default.dirname(fileName)),
77
- name: import_path.default.basename(fileName),
76
+ folder: import_node_path.default.join(import_node_path.default.basename(distPath), import_node_path.default.dirname(fileName)),
77
+ name: import_node_path.default.basename(fileName),
78
78
  gzippedSize,
79
79
  sizeLabel: calcFileSize(size),
80
80
  gzipSizeLabel: getAssetColor(gzippedSize)(calcFileSize(gzippedSize))
@@ -104,7 +104,7 @@ async function printFileSizes(config, stats, distPath) {
104
104
  import_shared2.logger.info("Production file sizes:\n");
105
105
  const longestLabelLength = Math.max(...assets.map((a) => a.sizeLabel.length));
106
106
  const longestFileLength = Math.max(
107
- ...assets.map((a) => (a.folder + import_path.default.sep + a.name).length)
107
+ ...assets.map((a) => (a.folder + import_node_path.default.sep + a.name).length)
108
108
  );
109
109
  if (config.detail !== false) {
110
110
  printHeader(longestFileLength, longestLabelLength);
@@ -114,7 +114,7 @@ async function printFileSizes(config, stats, distPath) {
114
114
  assets.forEach((asset) => {
115
115
  let { sizeLabel } = asset;
116
116
  const { name, folder, gzipSizeLabel } = asset;
117
- const fileNameLength = (folder + import_path.default.sep + name).length;
117
+ const fileNameLength = (folder + import_node_path.default.sep + name).length;
118
118
  const sizeLength = sizeLabel.length;
119
119
  totalSize += asset.size;
120
120
  totalGzipSize += asset.gzippedSize;
@@ -123,7 +123,7 @@ async function printFileSizes(config, stats, distPath) {
123
123
  const rightPadding = " ".repeat(longestLabelLength - sizeLength);
124
124
  sizeLabel += rightPadding;
125
125
  }
126
- let fileNameLabel = import_shared2.color.dim(asset.folder + import_path.default.sep) + import_shared2.color.cyan(asset.name);
126
+ let fileNameLabel = import_shared2.color.dim(asset.folder + import_node_path.default.sep) + import_shared2.color.cyan(asset.name);
127
127
  if (fileNameLength < longestFileLength) {
128
128
  const rightPadding = " ".repeat(longestFileLength - fileNameLength);
129
129
  fileNameLabel += rightPadding;
@@ -37,7 +37,7 @@ __export(html_exports, {
37
37
  pluginHtml: () => pluginHtml
38
38
  });
39
39
  module.exports = __toCommonJS(html_exports);
40
- var import_path = __toESM(require("path"));
40
+ var import_node_path = __toESM(require("node:path"));
41
41
  var import_shared = require("@rsbuild/shared");
42
42
  function getTitle(entryName, config) {
43
43
  return (0, import_shared.mergeChainedOptions)({
@@ -58,7 +58,7 @@ function getInject(entryName, config) {
58
58
  }
59
59
  const existTemplatePath = [];
60
60
  async function getTemplate(entryName, config, rootPath) {
61
- const DEFAULT_TEMPLATE = import_path.default.resolve(
61
+ const DEFAULT_TEMPLATE = import_node_path.default.resolve(
62
62
  __dirname,
63
63
  "../../static/template.html"
64
64
  );
@@ -73,7 +73,7 @@ async function getTemplate(entryName, config, rootPath) {
73
73
  templatePath
74
74
  };
75
75
  }
76
- const absolutePath = (0, import_path.isAbsolute)(templatePath) ? templatePath : import_path.default.resolve(rootPath, templatePath);
76
+ const absolutePath = (0, import_node_path.isAbsolute)(templatePath) ? templatePath : import_node_path.default.resolve(rootPath, templatePath);
77
77
  if (!existTemplatePath.includes(absolutePath)) {
78
78
  if (!await (0, import_shared.isFileExists)(absolutePath)) {
79
79
  throw new Error(
@@ -274,7 +274,7 @@ const pluginHtml = () => ({
274
274
  if (appIcon) {
275
275
  const { HtmlAppIconPlugin } = await Promise.resolve().then(() => __toESM(require("../rspack/HtmlAppIconPlugin")));
276
276
  const distDir = (0, import_shared.getDistPath)(config, "image");
277
- const iconPath = import_path.default.isAbsolute(appIcon) ? appIcon : import_path.default.join(api.context.rootPath, appIcon);
277
+ const iconPath = import_node_path.default.isAbsolute(appIcon) ? appIcon : import_node_path.default.join(api.context.rootPath, appIcon);
278
278
  chain.plugin(CHAIN_ID.PLUGIN.APP_ICON).use(HtmlAppIconPlugin, [{ iconPath, distDir }]);
279
279
  }
280
280
  }
@@ -21,7 +21,7 @@ __export(nodeAddons_exports, {
21
21
  pluginNodeAddons: () => pluginNodeAddons
22
22
  });
23
23
  module.exports = __toCommonJS(nodeAddons_exports);
24
- var import_path = require("path");
24
+ var import_node_path = require("node:path");
25
25
  var import_shared = require("@rsbuild/shared");
26
26
  const pluginNodeAddons = () => ({
27
27
  name: "rsbuild:node-addons",
@@ -33,7 +33,7 @@ const pluginNodeAddons = () => ({
33
33
  const getDistName = (resourcePath) => {
34
34
  const pkgJSON = (0, import_shared.findUpSync)({
35
35
  filename: "package.json",
36
- cwd: (0, import_path.dirname)(resourcePath)
36
+ cwd: (0, import_node_path.dirname)(resourcePath)
37
37
  });
38
38
  if (!pkgJSON) {
39
39
  throw new Error(
@@ -56,7 +56,7 @@ const pluginNodeAddons = () => ({
56
56
  const serverPath = (0, import_shared.getDistPath)(config, "server");
57
57
  return `${serverPath}/${getFilename(resourcePath, pkgName)}`;
58
58
  };
59
- chain.module.rule(CHAIN_ID.RULE.NODE).test(/\.node$/).use(CHAIN_ID.USE.NODE).loader((0, import_path.join)(__dirname, "../../compiled/node-loader")).options({
59
+ chain.module.rule(CHAIN_ID.RULE.NODE).test(/\.node$/).use(CHAIN_ID.USE.NODE).loader((0, import_node_path.join)(__dirname, "../../compiled/node-loader")).options({
60
60
  name: getDistName
61
61
  });
62
62
  });
@@ -22,7 +22,7 @@ __export(server_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(server_exports);
24
24
  var import_shared = require("@rsbuild/shared");
25
- var import_path = require("path");
25
+ var import_node_path = require("node:path");
26
26
  const pluginServer = () => ({
27
27
  name: "rsbuild:server",
28
28
  setup(api) {
@@ -33,7 +33,7 @@ const pluginServer = () => ({
33
33
  if (!copyOnBuild || !name) {
34
34
  return;
35
35
  }
36
- const publicDir = (0, import_path.isAbsolute)(name) ? name : (0, import_path.join)(api.context.rootPath, name);
36
+ const publicDir = (0, import_node_path.isAbsolute)(name) ? name : (0, import_node_path.join)(api.context.rootPath, name);
37
37
  if (!import_shared.fse.existsSync(publicDir)) {
38
38
  return;
39
39
  }
@@ -33,7 +33,7 @@ __export(splitChunks_exports, {
33
33
  pluginSplitChunks: () => pluginSplitChunks
34
34
  });
35
35
  module.exports = __toCommonJS(splitChunks_exports);
36
- var import_assert = __toESM(require("assert"));
36
+ var import_node_assert = __toESM(require("node:assert"));
37
37
  var import_shared = require("@rsbuild/shared");
38
38
  function getUserDefinedCacheGroups(forceSplitting) {
39
39
  const cacheGroups = {};
@@ -86,13 +86,13 @@ function splitByExperience(ctx) {
86
86
  }
87
87
  };
88
88
  }
89
- const MODULE_PATH_REGEX = /[\\/]node_modules[\\/](\.pnpm[\\/])?(?:(@[^[\\/]+)(?:[\\/]))?([^\\/]+)/;
89
+ const MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\/])?([^\\/]+)/;
90
90
  function getPackageNameFromModulePath(modulePath) {
91
91
  const handleModuleContext = modulePath?.match(MODULE_PATH_REGEX);
92
92
  if (!handleModuleContext) {
93
93
  return void 0;
94
94
  }
95
- const [, , scope, name] = handleModuleContext;
95
+ const [, scope, name] = handleModuleContext;
96
96
  const packageName = ["npm", (scope ?? "").replace("@", ""), name].filter(Boolean).join(".");
97
97
  return packageName;
98
98
  }
@@ -120,7 +120,7 @@ function splitByModule(ctx) {
120
120
  }
121
121
  function splitBySize(ctx) {
122
122
  const { override, userDefinedCacheGroups, defaultConfig, rsbuildConfig } = ctx;
123
- (0, import_assert.default)(rsbuildConfig.strategy === "split-by-size");
123
+ (0, import_node_assert.default)(rsbuildConfig.strategy === "split-by-size");
124
124
  return {
125
125
  ...defaultConfig,
126
126
  minSize: rsbuildConfig.minSize ?? 0,
@@ -33,11 +33,11 @@ __export(startUrl_exports, {
33
33
  replacePlaceholder: () => replacePlaceholder
34
34
  });
35
35
  module.exports = __toCommonJS(startUrl_exports);
36
- var import_path = require("path");
36
+ var import_node_path = require("node:path");
37
37
  var import_shared = require("@rsbuild/shared");
38
- var import_child_process = require("child_process");
39
- var import_util = require("util");
40
- const execAsync = (0, import_util.promisify)(import_child_process.exec);
38
+ var import_node_child_process = require("node:child_process");
39
+ var import_node_util = require("node:util");
40
+ const execAsync = (0, import_node_util.promisify)(import_node_child_process.exec);
41
41
  const supportedChromiumBrowsers = [
42
42
  "Google Chrome Canary",
43
43
  "Google Chrome Dev",
@@ -67,7 +67,7 @@ async function openBrowser(url) {
67
67
  url
68
68
  )}" "${targetBrowser}"`,
69
69
  {
70
- cwd: (0, import_path.join)(__dirname, "../../static")
70
+ cwd: (0, import_node_path.join)(__dirname, "../../static")
71
71
  }
72
72
  );
73
73
  return true;
@@ -21,7 +21,7 @@ __export(wasm_exports, {
21
21
  pluginWasm: () => pluginWasm
22
22
  });
23
23
  module.exports = __toCommonJS(wasm_exports);
24
- var import_path = require("path");
24
+ var import_node_path = require("node:path");
25
25
  var import_shared = require("@rsbuild/shared");
26
26
  const pluginWasm = () => ({
27
27
  name: "rsbuild:wasm",
@@ -33,7 +33,7 @@ const pluginWasm = () => ({
33
33
  ...chain.get("experiments"),
34
34
  asyncWebAssembly: true
35
35
  });
36
- const wasmFilename = import_path.posix.join(distPath, "[hash].module.wasm");
36
+ const wasmFilename = import_node_path.posix.join(distPath, "[hash].module.wasm");
37
37
  chain.output.merge({
38
38
  webassemblyModuleFilename: wasmFilename
39
39
  });
@@ -22,7 +22,7 @@ __export(config_exports, {
22
22
  withDefaultConfig: () => withDefaultConfig
23
23
  });
24
24
  module.exports = __toCommonJS(config_exports);
25
- var import_path = require("path");
25
+ var import_node_path = require("node:path");
26
26
  var import_shared = require("@rsbuild/shared");
27
27
  const createDefaultConfig = () => ({
28
28
  dev: (0, import_shared.getDefaultDevConfig)(),
@@ -44,7 +44,7 @@ function getDefaultEntry(root) {
44
44
  "jsx",
45
45
  ".mjs",
46
46
  ".cjs"
47
- ].map((ext) => (0, import_path.join)(root, `src/index.${ext}`));
47
+ ].map((ext) => (0, import_node_path.join)(root, `src/index.${ext}`));
48
48
  const entryFile = (0, import_shared.findExists)(files);
49
49
  if (entryFile) {
50
50
  return {
@@ -54,26 +54,20 @@ function getDefaultEntry(root) {
54
54
  return {};
55
55
  }
56
56
  const withDefaultConfig = async (rootPath, config) => {
57
- const merged = (0, import_shared.mergeRsbuildConfig)(
58
- createDefaultConfig(),
59
- config
60
- );
57
+ const merged = (0, import_shared.mergeRsbuildConfig)(createDefaultConfig(), config);
61
58
  merged.source || (merged.source = {});
62
59
  if (!merged.source.entry) {
63
60
  merged.source.entry = getDefaultEntry(rootPath);
64
61
  }
65
62
  if (!merged.source.tsconfigPath) {
66
- const tsconfigPath = (0, import_path.join)(rootPath, import_shared.TS_CONFIG_FILE);
63
+ const tsconfigPath = (0, import_node_path.join)(rootPath, import_shared.TS_CONFIG_FILE);
67
64
  if (await (0, import_shared.isFileExists)(tsconfigPath)) {
68
65
  merged.source.tsconfigPath = tsconfigPath;
69
66
  }
70
67
  }
71
68
  return merged;
72
69
  };
73
- const normalizeConfig = (config) => (0, import_shared.mergeRsbuildConfig)(
74
- createDefaultConfig(),
75
- config
76
- );
70
+ const normalizeConfig = (config) => (0, import_shared.mergeRsbuildConfig)(createDefaultConfig(), config);
77
71
  // Annotate the CommonJS export names for ESM import in node:
78
72
  0 && (module.exports = {
79
73
  normalizeConfig,
@@ -23,12 +23,12 @@ __export(createContext_exports, {
23
23
  updateContextByNormalizedConfig: () => updateContextByNormalizedConfig
24
24
  });
25
25
  module.exports = __toCommonJS(createContext_exports);
26
- var import_path = require("path");
26
+ 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
30
  function getAbsolutePath(root, filepath) {
31
- return (0, import_path.isAbsolute)(filepath) ? filepath : (0, import_path.join)(root, filepath);
31
+ return (0, import_node_path.isAbsolute)(filepath) ? filepath : (0, import_node_path.join)(root, filepath);
32
32
  }
33
33
  function getAbsoluteDistPath(cwd, config) {
34
34
  const dirRoot = (0, import_shared.getDistPath)(config, "root");
@@ -38,12 +38,12 @@ async function createContextByConfig(options, bundlerType, config = {}) {
38
38
  const { cwd } = options;
39
39
  const rootPath = cwd;
40
40
  const distPath = getAbsoluteDistPath(cwd, config);
41
- const cachePath = (0, import_path.join)(rootPath, "node_modules", ".cache");
41
+ const cachePath = (0, import_node_path.join)(rootPath, "node_modules", ".cache");
42
42
  const tsconfigPath = config.source?.tsconfigPath;
43
43
  const context = {
44
44
  entry: config.source?.entry || {},
45
45
  targets: config.output?.targets || [],
46
- version: "0.3.5",
46
+ version: "0.3.7",
47
47
  rootPath,
48
48
  distPath,
49
49
  cachePath,
@@ -21,7 +21,7 @@ __export(inspectConfig_exports, {
21
21
  inspectConfig: () => inspectConfig
22
22
  });
23
23
  module.exports = __toCommonJS(inspectConfig_exports);
24
- var import_path = require("path");
24
+ var import_node_path = require("node:path");
25
25
  var import_initConfigs = require("./initConfigs");
26
26
  var import_shared = require("@rsbuild/shared");
27
27
  async function inspectConfig({
@@ -55,8 +55,8 @@ async function inspectConfig({
55
55
  )
56
56
  );
57
57
  let outputPath = inspectOptions.outputPath || context.distPath;
58
- if (!(0, import_path.isAbsolute)(outputPath)) {
59
- outputPath = (0, import_path.join)(context.rootPath, outputPath);
58
+ if (!(0, import_node_path.isAbsolute)(outputPath)) {
59
+ outputPath = (0, import_node_path.join)(context.rootPath, outputPath);
60
60
  }
61
61
  if (inspectOptions.writeToDisk) {
62
62
  await (0, import_shared.outputInspectConfigFiles)({
@@ -34,7 +34,7 @@ __export(css_exports, {
34
34
  pluginCss: () => pluginCss
35
35
  });
36
36
  module.exports = __toCommonJS(css_exports);
37
- var import_path = __toESM(require("path"));
37
+ var import_node_path = __toESM(require("node:path"));
38
38
  var import_shared = require("@rsbuild/shared");
39
39
  const enableNativeCss = (config) => !config.output.injectStyles;
40
40
  async function applyBaseCSSRule({
@@ -86,7 +86,7 @@ async function applyBaseCSSRule({
86
86
  } else {
87
87
  if (!isServer && !isWebWorker && enableCSSModuleTS) {
88
88
  const { cssModules } = config.output;
89
- rule.use(CHAIN_ID.USE.CSS_MODULES_TS).loader(import_path.default.resolve(__dirname, "../css-modules-typescript-pre-loader")).options({
89
+ rule.use(CHAIN_ID.USE.CSS_MODULES_TS).loader(import_node_path.default.resolve(__dirname, "../css-modules-typescript-pre-loader")).options({
90
90
  modules: {
91
91
  exportLocalsConvention: cssModules.exportLocalsConvention,
92
92
  auto: cssModules.auto
@@ -162,9 +162,11 @@ const pluginCss = () => {
162
162
  });
163
163
  api.modifyRspackConfig(
164
164
  async (rspackConfig, { isProd, isServer, isWebWorker }) => {
165
+ var _a;
165
166
  const config = api.getNormalizedConfig();
166
167
  if (!enableNativeCss(config)) {
167
- (0, import_shared.setConfig)(rspackConfig, "experiments.css", false);
168
+ rspackConfig.experiments || (rspackConfig.experiments = {});
169
+ rspackConfig.experiments.css = false;
168
170
  return;
169
171
  }
170
172
  let localIdentName = config.output.cssModules.localIdentName || // Using shorter classname in production to reduce bundle size
@@ -175,11 +177,13 @@ const pluginCss = () => {
175
177
  );
176
178
  localIdentName = localIdentName.replace(":base64", "");
177
179
  }
178
- (0, import_shared.setConfig)(rspackConfig, "builtins.css.modules", {
180
+ rspackConfig.builtins || (rspackConfig.builtins = {});
181
+ (_a = rspackConfig.builtins).css || (_a.css = {});
182
+ rspackConfig.builtins.css.modules = {
179
183
  localsConvention: config.output.cssModules.exportLocalsConvention,
180
184
  localIdentName,
181
185
  exportsOnly: isServer || isWebWorker
182
- });
186
+ };
183
187
  const rules = rspackConfig.module?.rules;
184
188
  applyCSSModuleRule(rules, import_shared.CSS_REGEX, config);
185
189
  }
@@ -31,7 +31,7 @@ __export(output_exports, {
31
31
  pluginOutput: () => pluginOutput
32
32
  });
33
33
  module.exports = __toCommonJS(output_exports);
34
- var import_path = require("path");
34
+ var import_node_path = require("node:path");
35
35
  var import_shared = require("@rsbuild/shared");
36
36
  const pluginOutput = () => ({
37
37
  name: "rsbuild:output",
@@ -51,8 +51,8 @@ const pluginOutput = () => ({
51
51
  const cssPath = (0, import_shared.getDistPath)(config, "css");
52
52
  const cssFilename = (0, import_shared.getFilename)(config, "css", isProd);
53
53
  rspackConfig.output || (rspackConfig.output = {});
54
- rspackConfig.output.cssFilename = import_path.posix.join(cssPath, cssFilename);
55
- rspackConfig.output.cssChunkFilename = import_path.posix.join(
54
+ rspackConfig.output.cssFilename = import_node_path.posix.join(cssPath, cssFilename);
55
+ rspackConfig.output.cssChunkFilename = import_node_path.posix.join(
56
56
  cssPath,
57
57
  `async/${cssFilename}`
58
58
  );
@@ -29,16 +29,12 @@ const pluginResolve = () => ({
29
29
  api.modifyRspackConfig(async (rspackConfig, { isServer }) => {
30
30
  const isTsProject = Boolean(api.context.tsconfigPath);
31
31
  const config = api.getNormalizedConfig();
32
+ rspackConfig.resolve || (rspackConfig.resolve = {});
32
33
  if (isTsProject && config.source.aliasStrategy === "prefer-tsconfig") {
33
- (0, import_shared.setConfig)(
34
- rspackConfig,
35
- "resolve.tsConfigPath",
36
- api.context.tsconfigPath
37
- );
34
+ rspackConfig.resolve.tsConfigPath = api.context.tsconfigPath;
38
35
  }
39
36
  if (isServer) {
40
- const nodeConditionNames = ["require", "node"];
41
- (0, import_shared.setConfig)(rspackConfig, "resolve.conditionNames", nodeConditionNames);
37
+ rspackConfig.resolve.conditionNames = ["require", "node"];
42
38
  }
43
39
  });
44
40
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import type { RsbuildPlugin } from '../../types';
3
- import inspector from 'inspector';
3
+ import inspector from 'node:inspector';
4
4
  export declare const stopProfiler: (output: string, profileSession?: inspector.Session) => void;
5
5
  export declare const pluginRspackProfile: () => RsbuildPlugin;
@@ -32,8 +32,8 @@ __export(rspackProfile_exports, {
32
32
  stopProfiler: () => stopProfiler
33
33
  });
34
34
  module.exports = __toCommonJS(rspackProfile_exports);
35
- var import_path = __toESM(require("path"));
36
- var import_inspector = __toESM(require("inspector"));
35
+ var import_node_path = __toESM(require("node:path"));
36
+ var import_node_inspector = __toESM(require("node:inspector"));
37
37
  var import_shared = require("@rsbuild/shared");
38
38
  var import_shared2 = require("@rsbuild/shared");
39
39
  const stopProfiler = (output, profileSession) => {
@@ -60,7 +60,7 @@ const pluginRspackProfile = () => ({
60
60
  experimental_cleanupGlobalTrace: cleanupGlobalTrace
61
61
  } = await Promise.resolve().then(() => __toESM(require("@rspack/core")));
62
62
  const timestamp = Date.now();
63
- const profileDir = import_path.default.join(
63
+ const profileDir = import_node_path.default.join(
64
64
  api.context.distPath,
65
65
  `rspack-profile-${timestamp}`
66
66
  );
@@ -68,16 +68,16 @@ const pluginRspackProfile = () => ({
68
68
  const enableProfileTrace = RSPACK_PROFILE === "ALL" || RSPACK_PROFILE.includes("TRACE");
69
69
  const enableCPUProfile = RSPACK_PROFILE === "ALL" || RSPACK_PROFILE.includes("CPU");
70
70
  const enableLogging = RSPACK_PROFILE === "ALL" || RSPACK_PROFILE.includes("LOGGING");
71
- const traceFilePath = import_path.default.join(profileDir, "trace.json");
72
- const cpuProfilePath = import_path.default.join(profileDir, "jscpuprofile.json");
73
- const loggingFilePath = import_path.default.join(profileDir, "logging.json");
71
+ const traceFilePath = import_node_path.default.join(profileDir, "trace.json");
72
+ const cpuProfilePath = import_node_path.default.join(profileDir, "jscpuprofile.json");
73
+ const loggingFilePath = import_node_path.default.join(profileDir, "logging.json");
74
74
  const onStart = () => {
75
75
  import_shared.fse.ensureDirSync(profileDir);
76
76
  if (enableProfileTrace) {
77
77
  registerGlobalTrace("trace", "chrome", traceFilePath);
78
78
  }
79
79
  if (enableCPUProfile) {
80
- profileSession = new import_inspector.default.Session();
80
+ profileSession = new import_node_inspector.default.Session();
81
81
  profileSession.connect();
82
82
  profileSession.post("Profiler.enable");
83
83
  profileSession.post("Profiler.start");
@@ -33,7 +33,7 @@ __export(swc_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(swc_exports);
35
35
  var import_shared = require("@rsbuild/shared");
36
- var import_path = __toESM(require("path"));
36
+ var import_node_path = __toESM(require("node:path"));
37
37
  var import_constants = require("../../constants");
38
38
  const builtinSwcLoaderName = "builtin:swc-loader";
39
39
  async function getDefaultSwcConfig(config, rootPath, target) {
@@ -79,7 +79,7 @@ const pluginSwc = () => ({
79
79
  if (swcConfig.jsc?.externalHelpers) {
80
80
  chain.resolve.alias.set(
81
81
  "@swc/helpers",
82
- import_path.default.dirname(require.resolve("@swc/helpers/package.json"))
82
+ import_node_path.default.dirname(require.resolve("@swc/helpers/package.json"))
83
83
  );
84
84
  }
85
85
  if ((0, import_shared.isWebTarget)(target)) {
@@ -101,7 +101,7 @@ const pluginSwc = () => ({
101
101
  async function applyCoreJs(swcConfig, chain, polyfillMode) {
102
102
  const coreJsPath = require.resolve("core-js/package.json");
103
103
  const version = (0, import_shared.getCoreJsVersion)(coreJsPath);
104
- const coreJsDir = import_path.default.dirname(coreJsPath);
104
+ const coreJsDir = import_node_path.default.dirname(coreJsPath);
105
105
  swcConfig.env.coreJs = version;
106
106
  if (polyfillMode === "usage") {
107
107
  swcConfig.env.shippedProposals = true;
@@ -36,7 +36,7 @@ __export(shared_exports, {
36
36
  rspackMinVersion: () => rspackMinVersion
37
37
  });
38
38
  module.exports = __toCommonJS(shared_exports);
39
- var import_path = require("path");
39
+ var import_node_path = require("node:path");
40
40
  var import_shared = require("@rsbuild/shared");
41
41
  var import_shared2 = require("@rsbuild/shared");
42
42
  var import_shared3 = require("@rsbuild/shared");
@@ -103,7 +103,7 @@ const isSatisfyRspackVersion = async (originalVersion) => {
103
103
  return true;
104
104
  };
105
105
  const getCompiledPath = (packageName) => {
106
- const providerCompilerPath = (0, import_path.join)(__dirname, "../../compiled", packageName);
106
+ const providerCompilerPath = (0, import_node_path.join)(__dirname, "../../compiled", packageName);
107
107
  if (import_shared2.fse.existsSync(providerCompilerPath)) {
108
108
  return providerCompilerPath;
109
109
  }
@@ -36,8 +36,8 @@ __export(HtmlAppIconPlugin_exports, {
36
36
  HtmlAppIconPlugin: () => HtmlAppIconPlugin
37
37
  });
38
38
  module.exports = __toCommonJS(HtmlAppIconPlugin_exports);
39
- var import_fs = __toESM(require("fs"));
40
- var import_path = require("path");
39
+ var import_node_fs = __toESM(require("node:fs"));
40
+ var import_node_path = require("node:path");
41
41
  var import_webpack_sources = __toESM(require("@rsbuild/shared/webpack-sources"));
42
42
  var import_shared = require("@rsbuild/shared");
43
43
  var import_htmlPluginUtil = require("../provider/htmlPluginUtil");
@@ -51,12 +51,12 @@ class HtmlAppIconPlugin {
51
51
  this.iconPath = options.iconPath;
52
52
  }
53
53
  apply(compiler) {
54
- if (!import_fs.default.existsSync(this.iconPath)) {
54
+ if (!import_node_fs.default.existsSync(this.iconPath)) {
55
55
  throw new Error(
56
56
  `[${this.name}] Can not find the app icon, please check if the '${this.iconPath}' file exists'.`
57
57
  );
58
58
  }
59
- const iconRelativePath = import_path.posix.join(this.distDir, (0, import_path.basename)(this.iconPath));
59
+ const iconRelativePath = import_node_path.posix.join(this.distDir, (0, import_node_path.basename)(this.iconPath));
60
60
  compiler.hooks.compilation.tap(this.name, (compilation) => {
61
61
  (0, import_htmlPluginUtil.getHTMLPlugin)().getHooks(compilation).alterAssetTagGroups.tap(this.name, (data) => {
62
62
  const publicPath = (0, import_shared.getPublicPathFromCompiler)(compiler);
@@ -82,7 +82,7 @@ class HtmlAppIconPlugin {
82
82
  stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS
83
83
  },
84
84
  (assets) => {
85
- const source = import_fs.default.readFileSync(this.iconPath);
85
+ const source = import_node_fs.default.readFileSync(this.iconPath);
86
86
  assets[iconRelativePath] = new import_webpack_sources.default.RawSource(
87
87
  source,
88
88
  false
@@ -26,7 +26,7 @@ __export(InlineChunkHtmlPlugin_exports, {
26
26
  InlineChunkHtmlPlugin: () => InlineChunkHtmlPlugin
27
27
  });
28
28
  module.exports = __toCommonJS(InlineChunkHtmlPlugin_exports);
29
- var import_path = require("path");
29
+ var import_node_path = require("node:path");
30
30
  var import_shared = require("@rsbuild/shared");
31
31
  var import_htmlPluginUtil = require("../provider/htmlPluginUtil");
32
32
  class InlineChunkHtmlPlugin {
@@ -61,7 +61,7 @@ class InlineChunkHtmlPlugin {
61
61
  if (devtool && // If the source map is inlined, we do not need to update the sourceMappingURL
62
62
  !devtool.includes("inline") && source.includes("# sourceMappingURL")) {
63
63
  const prefix = (0, import_shared.addTrailingSlash)(
64
- (0, import_path.join)(publicPath, this.distPath[type] || "")
64
+ (0, import_node_path.join)(publicPath, this.distPath[type] || "")
65
65
  );
66
66
  return source.replace(
67
67
  /# sourceMappingURL=/,
@@ -31,8 +31,9 @@ __export(determineAsValue_exports, {
31
31
  determineAsValue: () => determineAsValue
32
32
  });
33
33
  module.exports = __toCommonJS(determineAsValue_exports);
34
- var import_path = __toESM(require("path"));
35
- var import_url = require("url");
34
+ var import_node_path = __toESM(require("node:path"));
35
+ var import_node_url = require("node:url");
36
+ var import_shared = require("@rsbuild/shared");
36
37
  /**
37
38
  * @license
38
39
  * Copyright 2018 Google Inc.
@@ -54,41 +55,24 @@ function determineAsValue({
54
55
  href,
55
56
  file
56
57
  }) {
57
- const url = new import_url.URL(file || href, "https://example.com");
58
- const extension = import_path.default.extname(url.pathname);
59
- if ([".css"].includes(extension)) {
58
+ const url = new import_node_url.URL(file || href, "https://example.com");
59
+ const extension = import_node_path.default.extname(url.pathname).slice(1);
60
+ if (["css"].includes(extension)) {
60
61
  return "style";
61
62
  }
62
- if ([
63
- ".png",
64
- ".jpg",
65
- ".jpeg",
66
- ".jfif",
67
- ".pjpeg",
68
- ".pjp",
69
- ".svg",
70
- ".webp",
71
- ".bmp",
72
- ".apng",
73
- ".avif",
74
- ".gif",
75
- ".ico",
76
- ".cur",
77
- ".tif",
78
- ".tiff"
79
- ].includes(extension)) {
63
+ if (import_shared.IMAGE_EXTENSIONS.includes(extension)) {
80
64
  return "image";
81
65
  }
82
- if ([".mp4", ".ogg", ".webm"].includes(extension)) {
66
+ if (import_shared.VIDEO_EXTENSIONS.includes(extension)) {
83
67
  return "video";
84
68
  }
85
- if ([".mp3", ".wav"].includes(extension)) {
69
+ if (import_shared.AUDIO_EXTENSIONS.includes(extension)) {
86
70
  return "audio";
87
71
  }
88
- if ([".woff2", ".otf", ".ttf", ".woff", ".eot"].includes(extension)) {
72
+ if (import_shared.FONT_EXTENSIONS.includes(extension)) {
89
73
  return "font";
90
74
  }
91
- if ([".vtt"].includes(extension)) {
75
+ if (["vtt"].includes(extension)) {
92
76
  return "track";
93
77
  }
94
78
  return "script";
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import type { IncomingMessage } from 'http';
4
- import type { Socket } from 'net';
3
+ import type { IncomingMessage } from 'node:http';
4
+ import type { Socket } from 'node:net';
5
5
  import type { DevMiddlewaresConfig, DevMiddlewareAPI, DevMiddleware as CustomDevMiddleware } from '@rsbuild/shared';
6
6
  type Options = {
7
7
  publicPaths: string[];
@@ -155,7 +155,13 @@ async function startDevServer(options, createDevMiddleware, {
155
155
  const devMiddlewares = await serverAPIs.getMiddlewares({
156
156
  compileMiddlewareAPI
157
157
  });
158
- devMiddlewares.middlewares.forEach((m) => middlewares.use(m));
158
+ devMiddlewares.middlewares.forEach((item) => {
159
+ if (Array.isArray(item)) {
160
+ middlewares.use(...item);
161
+ } else {
162
+ middlewares.use(item);
163
+ }
164
+ });
159
165
  middlewares.use(import_middlewares.notFoundMiddleware);
160
166
  httpServer.on("upgrade", devMiddlewares.onUpgrade);
161
167
  (0, import_shared.debug)("listen dev server done");
@@ -1,4 +1,4 @@
1
- import type { UpgradeEvent, RequestHandler, DevMiddlewaresConfig, CompileMiddlewareAPI } from '@rsbuild/shared';
1
+ import type { Middlewares, UpgradeEvent, DevMiddlewaresConfig, CompileMiddlewareAPI } from '@rsbuild/shared';
2
2
  export type RsbuildDevMiddlewareOptions = {
3
3
  pwd: string;
4
4
  dev: DevMiddlewaresConfig;
@@ -10,5 +10,5 @@ export type RsbuildDevMiddlewareOptions = {
10
10
  export declare const getMiddlewares: (options: RsbuildDevMiddlewareOptions) => Promise<{
11
11
  close: () => Promise<void>;
12
12
  onUpgrade: UpgradeEvent;
13
- middlewares: RequestHandler[];
13
+ middlewares: Middlewares;
14
14
  }>;
@@ -31,9 +31,9 @@ __export(getDevMiddlewares_exports, {
31
31
  getMiddlewares: () => getMiddlewares
32
32
  });
33
33
  module.exports = __toCommonJS(getDevMiddlewares_exports);
34
- var import_url = __toESM(require("url"));
34
+ var import_node_url = __toESM(require("node:url"));
35
35
  var import_middlewares = require("./middlewares");
36
- var import_path = require("path");
36
+ var import_node_path = require("node:path");
37
37
  const applySetupMiddlewares = (dev, compileMiddlewareAPI) => {
38
38
  const setupMiddlewares = dev.setupMiddlewares || [];
39
39
  const serverOptions = {
@@ -71,7 +71,7 @@ const applyDefaultMiddlewares = async ({
71
71
  }
72
72
  middlewares.push((req, res, next) => {
73
73
  res.setHeader("Access-Control-Allow-Origin", "*");
74
- const path = req.url ? import_url.default.parse(req.url).pathname : "";
74
+ const path = req.url ? import_node_url.default.parse(req.url).pathname : "";
75
75
  if (path?.includes("hot-update")) {
76
76
  res.setHeader("Access-Control-Allow-Credentials", "false");
77
77
  }
@@ -93,6 +93,8 @@ const applyDefaultMiddlewares = async ({
93
93
  middlewares.push(middleware);
94
94
  });
95
95
  }
96
+ const { default: launchEditorMiddleware } = await Promise.resolve().then(() => __toESM(require("../../compiled/launch-editor-middleware")));
97
+ middlewares.push(["/__open-in-editor", launchEditorMiddleware()]);
96
98
  if (compileMiddlewareAPI) {
97
99
  middlewares.push(compileMiddlewareAPI.middleware);
98
100
  upgradeEvents.push(
@@ -102,7 +104,7 @@ const applyDefaultMiddlewares = async ({
102
104
  if (dev.publicDir !== false && dev.publicDir?.name) {
103
105
  const { default: sirv } = await Promise.resolve().then(() => __toESM(require("../../compiled/sirv")));
104
106
  const { name } = dev.publicDir;
105
- const publicDir = (0, import_path.isAbsolute)(name) ? name : (0, import_path.join)(pwd, name);
107
+ const publicDir = (0, import_node_path.isAbsolute)(name) ? name : (0, import_node_path.join)(pwd, name);
106
108
  const assetMiddleware = sirv(publicDir, {
107
109
  etag: true,
108
110
  dev: true
@@ -112,7 +114,7 @@ const applyDefaultMiddlewares = async ({
112
114
  const { distPath } = output;
113
115
  compileMiddlewareAPI && middlewares.push(
114
116
  (0, import_middlewares.getHtmlFallbackMiddleware)({
115
- distPath: (0, import_path.isAbsolute)(distPath) ? distPath : (0, import_path.join)(pwd, distPath),
117
+ distPath: (0, import_node_path.isAbsolute)(distPath) ? distPath : (0, import_node_path.join)(pwd, distPath),
116
118
  callback: compileMiddlewareAPI.middleware,
117
119
  htmlFallback: dev.htmlFallback
118
120
  })
@@ -33,10 +33,10 @@ __export(httpServer_exports, {
33
33
  module.exports = __toCommonJS(httpServer_exports);
34
34
  const createHttpServer = async (options) => {
35
35
  if (options.https) {
36
- const { createServer: createServer2 } = await Promise.resolve().then(() => __toESM(require("https")));
36
+ const { createServer: createServer2 } = await Promise.resolve().then(() => __toESM(require("node:https")));
37
37
  return createServer2(options.https, options.middlewares);
38
38
  }
39
- const { createServer } = await Promise.resolve().then(() => __toESM(require("http")));
39
+ const { createServer } = await Promise.resolve().then(() => __toESM(require("node:http")));
40
40
  return createServer(options.middlewares);
41
41
  };
42
42
  // Annotate the CommonJS export names for ESM import in node:
@@ -34,9 +34,9 @@ __export(middlewares_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(middlewares_exports);
36
36
  var import_shared = require("@rsbuild/shared");
37
- var import_url = require("url");
38
- var import_path = __toESM(require("path"));
39
- var import_fs = __toESM(require("fs"));
37
+ var import_node_url = require("node:url");
38
+ var import_node_path = __toESM(require("node:path"));
39
+ var import_node_fs = __toESM(require("node:fs"));
40
40
  const faviconFallbackMiddleware = (req, res, next) => {
41
41
  if (req.url === "/favicon.ico") {
42
42
  res.statusCode = 204;
@@ -63,14 +63,14 @@ const getHtmlFallbackMiddleware = ({ htmlFallback, distPath, callback }) => {
63
63
  const { url } = req;
64
64
  let pathname = url;
65
65
  try {
66
- pathname = (0, import_url.parse)(url, false, true).pathname;
66
+ pathname = (0, import_node_url.parse)(url, false, true).pathname;
67
67
  } catch (err) {
68
68
  import_shared.logger.error(
69
69
  new Error(`Invalid URL: ${import_shared.color.yellow(url)}`, { cause: err })
70
70
  );
71
71
  return next();
72
72
  }
73
- let outputFileSystem = import_fs.default;
73
+ let outputFileSystem = import_node_fs.default;
74
74
  if (res.locals.webpack) {
75
75
  const { devMiddleware } = res.locals.webpack;
76
76
  outputFileSystem = devMiddleware.outputFileSystem;
@@ -87,7 +87,7 @@ const getHtmlFallbackMiddleware = ({ htmlFallback, distPath, callback }) => {
87
87
  };
88
88
  if (pathname.endsWith("/")) {
89
89
  const newUrl = `${pathname}index.html`;
90
- const filePath = import_path.default.join(distPath, pathname, "index.html");
90
+ const filePath = import_node_path.default.join(distPath, pathname, "index.html");
91
91
  if (outputFileSystem.existsSync(filePath)) {
92
92
  return rewrite(newUrl);
93
93
  }
@@ -96,13 +96,13 @@ const getHtmlFallbackMiddleware = ({ htmlFallback, distPath, callback }) => {
96
96
  !pathname.endsWith(".html")
97
97
  ) {
98
98
  const newUrl = `${pathname}.html`;
99
- const filePath = import_path.default.join(distPath, `${pathname}.html`);
99
+ const filePath = import_node_path.default.join(distPath, `${pathname}.html`);
100
100
  if (outputFileSystem.existsSync(filePath)) {
101
101
  return rewrite(newUrl);
102
102
  }
103
103
  }
104
104
  if (htmlFallback === "index") {
105
- if (outputFileSystem.existsSync(import_path.default.join(distPath, "index.html"))) {
105
+ if (outputFileSystem.existsSync(import_node_path.default.join(distPath, "index.html"))) {
106
106
  return rewrite("/index.html");
107
107
  }
108
108
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import type { Server } from 'http';
2
+ import type { Server } from 'node:http';
3
3
  import connect from '@rsbuild/shared/connect';
4
4
  import { type ServerConfig, type RsbuildConfig, type StartServerResult, type PreviewServerOptions } from '@rsbuild/shared';
5
5
  import type { InternalContext } from '../types';
@@ -38,7 +38,7 @@ __export(prodServer_exports, {
38
38
  });
39
39
  module.exports = __toCommonJS(prodServer_exports);
40
40
  var import_connect = __toESM(require("@rsbuild/shared/connect"));
41
- var import_path = require("path");
41
+ var import_node_path = require("node:path");
42
42
  var import_sirv = __toESM(require("../../compiled/sirv"));
43
43
  var import_shared = require("@rsbuild/shared");
44
44
  var import_helper = require("./helper");
@@ -100,7 +100,7 @@ class RsbuildProdServer {
100
100
  serverConfig: { htmlFallback },
101
101
  pwd
102
102
  } = this.options;
103
- const assetMiddleware = (0, import_sirv.default)((0, import_path.join)(pwd, path), {
103
+ const assetMiddleware = (0, import_sirv.default)((0, import_node_path.join)(pwd, path), {
104
104
  etag: true,
105
105
  dev: true,
106
106
  ignores: ["favicon.ico"],
@@ -32,7 +32,7 @@ __export(restart_exports, {
32
32
  restartDevServer: () => restartDevServer
33
33
  });
34
34
  module.exports = __toCommonJS(restart_exports);
35
- var import_path = __toESM(require("path"));
35
+ var import_node_path = __toESM(require("node:path"));
36
36
  var import_shared = require("@rsbuild/shared");
37
37
  var import_commands = require("../cli/commands");
38
38
  let cleaners = [];
@@ -46,7 +46,7 @@ const clearConsole = () => {
46
46
  };
47
47
  const restartDevServer = async ({ filePath }) => {
48
48
  clearConsole();
49
- const filename = import_path.default.basename(filePath);
49
+ const filename = import_node_path.default.basename(filePath);
50
50
  import_shared.logger.info(`Restart because ${import_shared.color.yellow(filename)} is changed.
51
51
  `);
52
52
  for (const cleaner of cleaners) {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import type { IncomingMessage } from 'http';
4
- import type { Socket } from 'net';
3
+ import type { IncomingMessage } from 'node:http';
4
+ import type { Socket } from 'node:net';
5
5
  import ws from '../../compiled/ws';
6
6
  import { type Stats, type DevMiddlewaresConfig } from '@rsbuild/shared';
7
7
  export declare class SocketServer {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "0.3.5",
3
+ "version": "0.3.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.5.7",
59
59
  "postcss": "^8.4.33",
60
- "@rsbuild/shared": "0.3.5"
60
+ "@rsbuild/shared": "0.3.7"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "16.x",
package/types.d.ts CHANGED
@@ -17,6 +17,14 @@ declare module '*.jpeg' {
17
17
  const src: string;
18
18
  export default src;
19
19
  }
20
+ declare module '*.pjpeg' {
21
+ const src: string;
22
+ export default src;
23
+ }
24
+ declare module '*.pjp' {
25
+ const src: string;
26
+ export default src;
27
+ }
20
28
  declare module '*.png' {
21
29
  const src: string;
22
30
  export default src;
@@ -41,10 +49,18 @@ declare module '*.avif' {
41
49
  const src: string;
42
50
  export default src;
43
51
  }
52
+ declare module '*.tif' {
53
+ const src: string;
54
+ export default src;
55
+ }
44
56
  declare module '*.tiff' {
45
57
  const src: string;
46
58
  export default src;
47
59
  }
60
+ declare module '*.jfif' {
61
+ const src: string;
62
+ export default src;
63
+ }
48
64
 
49
65
  /**
50
66
  * Font assets
@@ -109,6 +125,14 @@ declare module '*.mov' {
109
125
  const src: string;
110
126
  export default src;
111
127
  }
128
+ declare module '*.m4a' {
129
+ const src: string;
130
+ export default src;
131
+ }
132
+ declare module '*.opus' {
133
+ const src: string;
134
+ export default src;
135
+ }
112
136
 
113
137
  /**
114
138
  * Configuration files