@rsbuild/core 2.0.0-beta.7 → 2.0.0-beta.9

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 (59) hide show
  1. package/compiled/connect-next/index.d.ts +56 -0
  2. package/compiled/{connect → connect-next}/license +1 -0
  3. package/compiled/connect-next/package.json +1 -0
  4. package/compiled/css-loader/index.js +2 -2
  5. package/compiled/html-rspack-plugin/index.js +14 -14
  6. package/compiled/jiti/dist/babel.cjs +60 -60
  7. package/compiled/jiti/dist/jiti.cjs +2 -2
  8. package/compiled/postcss-loader/index.js +6 -6
  9. package/compiled/rslog/index.d.ts +17 -1
  10. package/compiled/rslog/package.json +1 -1
  11. package/compiled/rspack-chain/package.json +1 -1
  12. package/compiled/rspack-chain/types/index.d.ts +0 -3
  13. package/compiled/style-loader/index.js +10 -10
  14. package/dist/{131.js → 958.js} +258 -361
  15. package/dist/chokidar.js +59 -57
  16. package/dist/client/hmr.js +1 -1
  17. package/dist/client/overlay.js +1 -1
  18. package/dist/connect-next.js +268 -0
  19. package/dist/{connect.js.LICENSE.txt → connect-next.js.LICENSE.txt} +3 -13
  20. package/dist/cors.js +2 -2
  21. package/dist/http-proxy-middleware.js +57 -552
  22. package/dist/index.js +1 -1
  23. package/dist/launch-editor-middleware.js +23 -8
  24. package/dist/manifest-plugin.js +18 -18
  25. package/dist/memfs.js +178 -717
  26. package/dist/{710.js → mrmime.js} +2 -1
  27. package/dist/open.js +35 -32
  28. package/dist/range-parser.js +2 -2
  29. package/dist/remapping.js +2 -2
  30. package/dist/rslib-runtime.js +3 -3
  31. package/dist/sirv.js +14 -14
  32. package/dist/src.js +510 -0
  33. package/dist/tinyglobby.js +25 -25
  34. package/dist/transformLoader.mjs +38 -1
  35. package/dist/transformRawLoader.mjs +1 -1
  36. package/dist/ws.js +1541 -0
  37. package/dist-types/helpers/index.d.ts +1 -1
  38. package/dist-types/helpers/vendors.d.ts +0 -1
  39. package/dist-types/server/runner/asModule.d.ts +1 -1
  40. package/dist-types/server/socketServer.d.ts +1 -1
  41. package/dist-types/types/config.d.ts +3 -2
  42. package/dist-types/types/thirdParty.d.ts +1 -1
  43. package/package.json +9 -10
  44. package/compiled/connect/index.d.ts +0 -90
  45. package/compiled/connect/package.json +0 -1
  46. package/compiled/ws/index.d.ts +0 -437
  47. package/compiled/ws/index.js +0 -3166
  48. package/compiled/ws/license +0 -20
  49. package/compiled/ws/package.json +0 -1
  50. package/dist/397.js +0 -11
  51. package/dist/7.js +0 -1
  52. package/dist/712.js +0 -15
  53. package/dist/743.js +0 -7
  54. package/dist/88.js +0 -40
  55. package/dist/connect.js +0 -574
  56. package/dist-types/helpers/color.d.ts +0 -4
  57. /package/dist/{131.js.LICENSE.txt → 958.js.LICENSE.txt} +0 -0
  58. /package/dist/client/{59.js → 797.js} +0 -0
  59. /package/dist/{31.js → trace-mapping.js} +0 -0
@@ -442,4 +442,5 @@ function lookup(extn) {
442
442
  let tmp = ('' + extn).trim().toLowerCase(), idx = tmp.lastIndexOf('.');
443
443
  return mimes[!~idx ? tmp : tmp.substring(++idx)];
444
444
  }
445
- export { lookup };
445
+ var mrmime_mimes = void 0;
446
+ export { lookup, mrmime_mimes as mimes };
package/dist/open.js CHANGED
@@ -1,20 +1,23 @@
1
1
  let isDockerCached, cachedResult, canAccessPowerShellPromise, mountPoint, defaultMountPoint;
2
- import { __webpack_require__ } from "./rslib-runtime.js";
3
- import node_child_process, { execFile } from "node:child_process";
4
- import { external_node_util_promisify } from "./131.js";
5
- import "./743.js";
6
- import { constants, promises } from "./7.js";
7
- let external_node_fs_ = __webpack_require__("node:fs");
2
+ import node_process from "node:process";
3
+ import node_path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import node_child_process, { execFile as external_node_child_process_execFile } from "node:child_process";
6
+ import promises, { constants } from "node:fs/promises";
7
+ import { promisify } from "node:util";
8
+ import node_os from "node:os";
9
+ import node_fs from "node:fs";
10
+ import { Buffer } from "node:buffer";
8
11
  function hasDockerEnv() {
9
12
  try {
10
- return external_node_fs_.default.statSync('/.dockerenv'), !0;
13
+ return node_fs.statSync('/.dockerenv'), !0;
11
14
  } catch {
12
15
  return !1;
13
16
  }
14
17
  }
15
18
  function hasDockerCGroup() {
16
19
  try {
17
- return external_node_fs_.default.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
20
+ return node_fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
18
21
  } catch {
19
22
  return !1;
20
23
  }
@@ -25,22 +28,22 @@ function isDocker() {
25
28
  function isInsideContainer() {
26
29
  return void 0 === cachedResult && (cachedResult = (()=>{
27
30
  try {
28
- return external_node_fs_.default.statSync('/run/.containerenv'), !0;
31
+ return node_fs.statSync('/run/.containerenv'), !0;
29
32
  } catch {
30
33
  return !1;
31
34
  }
32
35
  })() || isDocker()), cachedResult;
33
36
  }
34
- let external_node_process_ = __webpack_require__("node:process"), external_node_os_ = __webpack_require__("node:os"), isWsl = ()=>{
35
- if ('linux' !== external_node_process_.default.platform) return !1;
36
- if (external_node_os_.default.release().toLowerCase().includes('microsoft')) return !isInsideContainer();
37
+ let isWsl = ()=>{
38
+ if ('linux' !== node_process.platform) return !1;
39
+ if (node_os.release().toLowerCase().includes('microsoft')) return !isInsideContainer();
37
40
  try {
38
- if (external_node_fs_.default.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) return !isInsideContainer();
41
+ if (node_fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) return !isInsideContainer();
39
42
  } catch {}
40
- return !!(external_node_fs_.default.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop') || external_node_fs_.default.existsSync('/run/WSL')) && !isInsideContainer();
41
- }, is_wsl = external_node_process_.default.env.__IS_WSL_TEST__ ? isWsl : isWsl(), external_node_buffer_ = __webpack_require__("node:buffer"), powershell_utils_execFile = external_node_util_promisify(node_child_process.execFile), powerShellPath = ()=>`${external_node_process_.default.env.SYSTEMROOT || external_node_process_.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {})=>{
43
+ return !!(node_fs.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop') || node_fs.existsSync('/run/WSL')) && !isInsideContainer();
44
+ }, is_wsl = node_process.env.__IS_WSL_TEST__ ? isWsl : isWsl(), execFile = promisify(node_child_process.execFile), powerShellPath = ()=>`${node_process.env.SYSTEMROOT || node_process.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {})=>{
42
45
  let { powerShellPath: psPath, ...execFileOptions } = options, encodedCommand = executePowerShell.encodeCommand(command);
43
- return powershell_utils_execFile(psPath ?? powerShellPath(), [
46
+ return execFile(psPath ?? powerShellPath(), [
44
47
  ...executePowerShell.argumentsPrefix,
45
48
  encodedCommand
46
49
  ], {
@@ -61,8 +64,8 @@ executePowerShell.argumentsPrefix = [
61
64
  '-ExecutionPolicy',
62
65
  'Bypass',
63
66
  '-EncodedCommand'
64
- ], executePowerShell.encodeCommand = (command)=>external_node_buffer_.Buffer.from(command, 'utf16le').toString('base64'), executePowerShell.escapeArgument = (value)=>`'${String(value).replaceAll('\'', '\'\'')}'`;
65
- let wsl_utils_execFile = external_node_util_promisify(node_child_process.execFile), wslDrivesMountPoint = (defaultMountPoint = '/mnt/', async function() {
67
+ ], executePowerShell.encodeCommand = (command)=>Buffer.from(command, 'utf16le').toString('base64'), executePowerShell.escapeArgument = (value)=>`'${String(value).replaceAll('\'', '\'\'')}'`;
68
+ let wsl_utils_execFile = promisify(node_child_process.execFile), wslDrivesMountPoint = (defaultMountPoint = '/mnt/', async function() {
66
69
  if (mountPoint) return mountPoint;
67
70
  let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
68
71
  try {
@@ -120,9 +123,9 @@ function defineLazyProperty(object, propertyName, valueGetter) {
120
123
  }
121
124
  }), object;
122
125
  }
123
- let execFileAsync = external_node_util_promisify(execFile);
126
+ let execFileAsync = promisify(external_node_child_process_execFile);
124
127
  async function defaultBrowserId() {
125
- if ('darwin' !== external_node_process_.default.platform) throw Error('macOS only');
128
+ if ('darwin' !== node_process.platform) throw Error('macOS only');
126
129
  let { stdout } = await execFileAsync('defaults', [
127
130
  'read',
128
131
  'com.apple.LaunchServices/com.apple.launchservices.secure',
@@ -130,9 +133,9 @@ async function defaultBrowserId() {
130
133
  ]), match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout), browserId = match?.groups.id ?? 'com.apple.Safari';
131
134
  return 'com.apple.safari' === browserId ? 'com.apple.Safari' : browserId;
132
135
  }
133
- let run_applescript_execFileAsync = external_node_util_promisify(execFile);
136
+ let run_applescript_execFileAsync = promisify(external_node_child_process_execFile);
134
137
  async function runAppleScript(script, { humanReadableOutput = !0, signal } = {}) {
135
- if ('darwin' !== external_node_process_.default.platform) throw Error('macOS only');
138
+ if ('darwin' !== node_process.platform) throw Error('macOS only');
136
139
  let execOptions = {};
137
140
  signal && (execOptions.signal = signal);
138
141
  let { stdout } = await run_applescript_execFileAsync("osascript", [
@@ -147,7 +150,7 @@ async function runAppleScript(script, { humanReadableOutput = !0, signal } = {})
147
150
  async function bundleName(bundleId) {
148
151
  return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
149
152
  }
150
- let windows_execFileAsync = external_node_util_promisify(execFile), windowsBrowserProgIds = {
153
+ let windows_execFileAsync = promisify(external_node_child_process_execFile), windowsBrowserProgIds = {
151
154
  MSEdgeHTM: {
152
155
  name: 'Edge',
153
156
  id: 'com.microsoft.edge'
@@ -229,16 +232,16 @@ async function defaultBrowser(_execFileAsync = windows_execFileAsync) {
229
232
  id
230
233
  };
231
234
  }
232
- let default_browser_execFileAsync = external_node_util_promisify(execFile);
235
+ let default_browser_execFileAsync = promisify(external_node_child_process_execFile);
233
236
  async function default_browser_defaultBrowser() {
234
- if ('darwin' === external_node_process_.default.platform) {
237
+ if ('darwin' === node_process.platform) {
235
238
  let id = await defaultBrowserId();
236
239
  return {
237
240
  name: await bundleName(id),
238
241
  id
239
242
  };
240
243
  }
241
- if ('linux' === external_node_process_.default.platform) {
244
+ if ('linux' === node_process.platform) {
242
245
  let { stdout } = await default_browser_execFileAsync('xdg-mime', [
243
246
  'query',
244
247
  'default',
@@ -249,10 +252,10 @@ async function default_browser_defaultBrowser() {
249
252
  id
250
253
  };
251
254
  }
252
- if ('win32' === external_node_process_.default.platform) return defaultBrowser();
255
+ if ('win32' === node_process.platform) return defaultBrowser();
253
256
  throw Error('Only macOS, Linux, and Windows are supported');
254
257
  }
255
- let isInSsh = !!(external_node_process_.default.env.SSH_CONNECTION || external_node_process_.default.env.SSH_CLIENT || external_node_process_.default.env.SSH_TTY), external_node_path_ = __webpack_require__("node:path"), external_node_url_ = __webpack_require__("node:url"), fallbackAttemptSymbol = Symbol('fallbackAttempt'), open_dirname = import.meta.url ? external_node_path_.default.dirname((0, external_node_url_.fileURLToPath)(import.meta.url)) : '', localXdgOpenPath = external_node_path_.default.join(open_dirname, 'xdg-open'), { platform: platform, arch: arch } = external_node_process_.default, tryEachApp = async (apps, opener)=>{
258
+ let isInSsh = !!(node_process.env.SSH_CONNECTION || node_process.env.SSH_CLIENT || node_process.env.SSH_TTY), fallbackAttemptSymbol = Symbol('fallbackAttempt'), open_dirname = import.meta.url ? node_path.dirname(fileURLToPath(import.meta.url)) : '', localXdgOpenPath = node_path.join(open_dirname, 'xdg-open'), { platform: platform, arch: arch } = node_process, tryEachApp = async (apps, opener)=>{
256
259
  if (0 === apps.length) return;
257
260
  let errors = [];
258
261
  for (let app of apps)try {
@@ -339,7 +342,7 @@ let isInSsh = !!(external_node_process_.default.env.SSH_CONNECTION || external_n
339
342
  try {
340
343
  await promises.access(localXdgOpenPath, constants.X_OK), exeLocalXdgOpen = !0;
341
344
  } catch {}
342
- command = external_node_process_.default.versions.electron ?? ('android' === platform || !open_dirname || '/' === open_dirname || !exeLocalXdgOpen) ? 'xdg-open' : localXdgOpenPath;
345
+ command = node_process.versions.electron ?? ('android' === platform || !open_dirname || '/' === open_dirname || !exeLocalXdgOpen) ? 'xdg-open' : localXdgOpenPath;
343
346
  }
344
347
  appArguments.length > 0 && cliArguments.push(...appArguments), options.wait || (childProcessOptions.stdio = 'ignore', childProcessOptions.detached = !0);
345
348
  }
@@ -426,11 +429,11 @@ defineLazyProperty(open_apps, 'chrome', ()=>detectPlatformBinary({
426
429
  })), defineLazyProperty(open_apps, 'safari', ()=>detectPlatformBinary({
427
430
  darwin: 'Safari'
428
431
  }));
429
- let node_modules_open = (target, options)=>{
432
+ export default ((target, options)=>{
430
433
  if ('string' != typeof target) throw TypeError('Expected a `target`');
431
434
  return baseOpen({
432
435
  ...options,
433
436
  target
434
437
  });
435
- };
436
- export { node_modules_open, open_apps };
438
+ });
439
+ export { open_apps as apps };
@@ -1,4 +1,4 @@
1
- /*! For license information please see range-parser.js.LICENSE.txt */
1
+ /*! LICENSE: range-parser.js.LICENSE.txt */
2
2
  import { __webpack_require__ } from "./rslib-runtime.js";
3
3
  __webpack_require__.add({
4
4
  "../../node_modules/.pnpm/range-parser@1.2.1/node_modules/range-parser/index.js" (module) {
@@ -46,4 +46,4 @@ __webpack_require__.add({
46
46
  return ranges.length < 1 ? -1 : options && options.combine ? combineRanges(ranges) : ranges;
47
47
  };
48
48
  }
49
- });
49
+ }), __webpack_require__("../../node_modules/.pnpm/range-parser@1.2.1/node_modules/range-parser/index.js");
package/dist/remapping.js CHANGED
@@ -1,4 +1,4 @@
1
- import { decodedMappings as trace_mapping_decodedMappings, sourcemap_codec_encode, traceSegment, TraceMap as trace_mapping_TraceMap } from "./31.js";
1
+ import { decodedMappings as trace_mapping_decodedMappings, sourcemap_codec_encode, traceSegment, TraceMap as trace_mapping_TraceMap } from "./trace-mapping.js";
2
2
  var SetArray = class {
3
3
  constructor(){
4
4
  this._indexes = {
@@ -193,4 +193,4 @@ function remapping(input, loader, options) {
193
193
  decodedMappings: !1
194
194
  });
195
195
  }
196
- export { remapping };
196
+ export default remapping;
@@ -7,9 +7,7 @@ function __webpack_require__(moduleId) {
7
7
  };
8
8
  return __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__), module.exports;
9
9
  }
10
- __webpack_require__.m = __webpack_modules__, __webpack_require__.add = function registerModules(modules) {
11
- Object.assign(__webpack_require__.m, modules);
12
- }, __webpack_require__.n = (module)=>{
10
+ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
13
11
  var getter = module && module.__esModule ? ()=>module.default : ()=>module;
14
12
  return __webpack_require__.d(getter, {
15
13
  a: getter
@@ -34,6 +32,8 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.add = function
34
32
  enumerable: !0,
35
33
  get: definition[key]
36
34
  });
35
+ }, __webpack_require__.add = function registerModules(modules) {
36
+ Object.assign(__webpack_require__.m, modules);
37
37
  }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports)=>{
38
38
  "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
39
39
  value: 'Module'
package/dist/sirv.js CHANGED
@@ -1,12 +1,12 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
1
+ import { createReadStream, existsSync, statSync } from "node:fs";
2
+ import { join, normalize, resolve, sep } from "node:path";
3
+ import { join as external_path_join, resolve as external_path_resolve } from "path";
4
+ import { readdirSync, statSync as external_fs_statSync } from "fs";
2
5
  import { parse } from "node:querystring";
3
- import "./131.js";
4
- import { lookup as mrmime_lookup } from "./710.js";
5
- let external_path_ = __webpack_require__("path"), external_fs_ = __webpack_require__("fs");
6
+ import { lookup as mrmime_lookup } from "./mrmime.js";
6
7
  function totalist(dir, callback, pre = '') {
7
- dir = (0, external_path_.resolve)('.', dir);
8
- let arr = (0, external_fs_.readdirSync)(dir), i = 0, abs, stats;
9
- for(; i < arr.length; i++)abs = (0, external_path_.join)(dir, arr[i]), (stats = (0, external_fs_.statSync)(abs)).isDirectory() ? totalist(abs, callback, (0, external_path_.join)(pre, arr[i])) : callback((0, external_path_.join)(pre, arr[i]), abs, stats);
8
+ let arr = readdirSync(dir = external_path_resolve('.', dir)), i = 0, abs, stats;
9
+ for(; i < arr.length; i++)(stats = external_fs_statSync(abs = external_path_join(dir, arr[i]))).isDirectory() ? totalist(abs, callback, external_path_join(pre, arr[i])) : callback(external_path_join(pre, arr[i]), abs, stats);
10
10
  }
11
11
  function build_parse(req) {
12
12
  let raw = req.url;
@@ -26,7 +26,7 @@ function build_parse(req) {
26
26
  raw
27
27
  };
28
28
  }
29
- let external_node_fs_ = __webpack_require__("node:fs"), external_node_path_ = __webpack_require__("node:path"), noop = ()=>{};
29
+ let noop = ()=>{};
30
30
  function isMatch(uri, arr) {
31
31
  for(let i = 0; i < arr.length; i++)if (arr[i].test(uri)) return !0;
32
32
  }
@@ -43,8 +43,8 @@ function viaCache(cache, uri, extns) {
43
43
  }
44
44
  function viaLocal(dir, isEtag, uri, extns) {
45
45
  let abs, stats, name, headers, i = 0, arr = toAssume(uri, extns);
46
- for(; i < arr.length; i++)if ((abs = (0, external_node_path_.normalize)((0, external_node_path_.join)(dir, name = arr[i]))).startsWith(dir) && external_node_fs_.existsSync(abs)) {
47
- if ((stats = external_node_fs_.statSync(abs)).isDirectory()) continue;
46
+ for(; i < arr.length; i++)if ((abs = normalize(join(dir, name = arr[i]))).startsWith(dir) && existsSync(abs)) {
47
+ if ((stats = statSync(abs)).isDirectory()) continue;
48
48
  return (headers = toHeaders(name, stats, isEtag))['Cache-Control'] = isEtag ? 'no-cache' : 'no-store', {
49
49
  abs,
50
50
  stats,
@@ -66,7 +66,7 @@ function send(req, res, file, stats, headers) {
66
66
  if (end >= stats.size && (end = stats.size - 1), start >= stats.size) return res.setHeader('Content-Range', `bytes */${stats.size}`), res.statusCode = 416, res.end();
67
67
  headers['Content-Range'] = `bytes ${start}-${end}/${stats.size}`, headers['Content-Length'] = end - start + 1, headers['Accept-Ranges'] = 'bytes';
68
68
  }
69
- res.writeHead(code, headers), external_node_fs_.createReadStream(file, opts).pipe(res);
69
+ res.writeHead(code, headers), createReadStream(file, opts).pipe(res);
70
70
  }
71
71
  let ENCODING = {
72
72
  '.br': 'br',
@@ -83,7 +83,7 @@ function toHeaders(name, stats, isEtag) {
83
83
  return enc && (headers['Content-Encoding'] = enc), isEtag && (headers.ETag = `W/"${stats.size}-${stats.mtime.getTime()}"`), headers;
84
84
  }
85
85
  function build(dir, opts = {}) {
86
- dir = (0, external_node_path_.resolve)(dir || '.');
86
+ dir = resolve(dir || '.');
87
87
  let isNotFound = opts.onNoMatch || is404, setHeaders = opts.setHeaders || noop, extensions = opts.extensions || [
88
88
  'html',
89
89
  'htm'
@@ -107,7 +107,7 @@ function build(dir, opts = {}) {
107
107
  headers
108
108
  };
109
109
  });
110
- let lookup = opts.dev ? viaLocal.bind(0, dir + external_node_path_.sep, isEtag) : viaCache.bind(0, FILES);
110
+ let lookup = opts.dev ? viaLocal.bind(0, dir + sep, isEtag) : viaCache.bind(0, FILES);
111
111
  return function(req, res, next) {
112
112
  let extns = [
113
113
  ''
@@ -119,4 +119,4 @@ function build(dir, opts = {}) {
119
119
  return data ? isEtag && req.headers['if-none-match'] === data.headers.ETag ? (res.writeHead(304), res.end()) : void ((gzips || brots) && res.setHeader('Vary', 'Accept-Encoding'), setHeaders(res, pathname, data.stats), send(req, res, data.abs, data.stats, data.headers)) : next ? next() : isNotFound(req, res);
120
120
  };
121
121
  }
122
- export { build };
122
+ export default build;