@rsbuild/core 2.0.0-beta.7 → 2.0.0-beta.8
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/bin/rsbuild.js +13 -0
- package/compiled/connect-next/index.d.ts +56 -0
- package/compiled/{connect → connect-next}/license +1 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/jiti/dist/babel.cjs +60 -60
- package/compiled/jiti/dist/jiti.cjs +2 -2
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rslog/index.d.ts +17 -1
- package/compiled/rslog/package.json +1 -1
- package/dist/{131.js → 958.js} +254 -357
- package/dist/chokidar.js +59 -57
- package/dist/client/hmr.js +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/connect-next.js +268 -0
- package/dist/{connect.js.LICENSE.txt → connect-next.js.LICENSE.txt} +3 -13
- package/dist/cors.js +2 -2
- package/dist/http-proxy-middleware.js +57 -552
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +23 -8
- package/dist/manifest-plugin.js +18 -18
- package/dist/memfs.js +178 -717
- package/dist/{710.js → mrmime.js} +2 -1
- package/dist/open.js +35 -32
- package/dist/range-parser.js +2 -2
- package/dist/remapping.js +2 -2
- package/dist/rslib-runtime.js +3 -3
- package/dist/sirv.js +14 -14
- package/dist/src.js +510 -0
- package/dist/tinyglobby.js +25 -25
- package/dist/transformLoader.mjs +38 -1
- package/dist/transformRawLoader.mjs +1 -1
- package/dist/ws.js +1541 -0
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/helpers/vendors.d.ts +0 -1
- package/dist-types/server/runner/asModule.d.ts +1 -1
- package/dist-types/server/socketServer.d.ts +1 -1
- package/dist-types/types/thirdParty.d.ts +1 -1
- package/package.json +7 -8
- package/compiled/connect/index.d.ts +0 -90
- package/compiled/connect/package.json +0 -1
- package/compiled/ws/index.d.ts +0 -437
- package/compiled/ws/index.js +0 -3166
- package/compiled/ws/license +0 -20
- package/compiled/ws/package.json +0 -1
- package/dist/397.js +0 -11
- package/dist/7.js +0 -1
- package/dist/712.js +0 -15
- package/dist/743.js +0 -7
- package/dist/88.js +0 -40
- package/dist/connect.js +0 -574
- package/dist-types/helpers/color.d.ts +0 -4
- /package/dist/{131.js.LICENSE.txt → 958.js.LICENSE.txt} +0 -0
- /package/dist/client/{59.js → 797.js} +0 -0
- /package/dist/{31.js → trace-mapping.js} +0 -0
package/dist/open.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
let isDockerCached, cachedResult, canAccessPowerShellPromise, mountPoint, defaultMountPoint;
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
6
|
-
import { constants
|
|
7
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
35
|
-
if ('linux' !==
|
|
36
|
-
if (
|
|
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 (
|
|
41
|
+
if (node_fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) return !isInsideContainer();
|
|
39
42
|
} catch {}
|
|
40
|
-
return !!(
|
|
41
|
-
}, is_wsl =
|
|
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
|
|
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)=>
|
|
65
|
-
let wsl_utils_execFile =
|
|
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 =
|
|
126
|
+
let execFileAsync = promisify(external_node_child_process_execFile);
|
|
124
127
|
async function defaultBrowserId() {
|
|
125
|
-
if ('darwin' !==
|
|
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 =
|
|
136
|
+
let run_applescript_execFileAsync = promisify(external_node_child_process_execFile);
|
|
134
137
|
async function runAppleScript(script, { humanReadableOutput = !0, signal } = {}) {
|
|
135
|
-
if ('darwin' !==
|
|
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 =
|
|
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 =
|
|
235
|
+
let default_browser_execFileAsync = promisify(external_node_child_process_execFile);
|
|
233
236
|
async function default_browser_defaultBrowser() {
|
|
234
|
-
if ('darwin' ===
|
|
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' ===
|
|
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' ===
|
|
255
|
+
if ('win32' === node_process.platform) return defaultBrowser();
|
|
253
256
|
throw Error('Only macOS, Linux, and Windows are supported');
|
|
254
257
|
}
|
|
255
|
-
let isInSsh = !!(
|
|
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 =
|
|
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
|
-
|
|
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 {
|
|
438
|
+
});
|
|
439
|
+
export { open_apps as apps };
|
package/dist/range-parser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*!
|
|
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 "./
|
|
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
|
|
196
|
+
export default remapping;
|
package/dist/rslib-runtime.js
CHANGED
|
@@ -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__.
|
|
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 {
|
|
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 "./
|
|
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
|
-
|
|
8
|
-
|
|
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
|
|
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 =
|
|
47
|
-
if ((stats =
|
|
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),
|
|
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 =
|
|
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 +
|
|
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
|
|
122
|
+
export default build;
|