@rsbuild/core 1.4.1 → 1.4.2

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.
@@ -1,409 +0,0 @@
1
- (() => {
2
- var __webpack_modules__ = {
3
- 932: (module) => {
4
- "use strict";
5
- module.exports = (object, propertyName, fn) => {
6
- const define = (value) =>
7
- Object.defineProperty(object, propertyName, {
8
- value,
9
- enumerable: true,
10
- writable: true,
11
- });
12
- Object.defineProperty(object, propertyName, {
13
- configurable: true,
14
- enumerable: true,
15
- get() {
16
- const result = fn();
17
- define(result);
18
- return result;
19
- },
20
- set(value) {
21
- define(value);
22
- },
23
- });
24
- return object;
25
- };
26
- },
27
- 293: (module, __unused_webpack_exports, __nccwpck_require__) => {
28
- "use strict";
29
- const fs = __nccwpck_require__(896);
30
- let isDocker;
31
- function hasDockerEnv() {
32
- try {
33
- fs.statSync("/.dockerenv");
34
- return true;
35
- } catch (_) {
36
- return false;
37
- }
38
- }
39
- function hasDockerCGroup() {
40
- try {
41
- return fs
42
- .readFileSync("/proc/self/cgroup", "utf8")
43
- .includes("docker");
44
- } catch (_) {
45
- return false;
46
- }
47
- }
48
- module.exports = () => {
49
- if (isDocker === undefined) {
50
- isDocker = hasDockerEnv() || hasDockerCGroup();
51
- }
52
- return isDocker;
53
- };
54
- },
55
- 622: (module, __unused_webpack_exports, __nccwpck_require__) => {
56
- "use strict";
57
- const os = __nccwpck_require__(857);
58
- const fs = __nccwpck_require__(896);
59
- const isDocker = __nccwpck_require__(293);
60
- const isWsl = () => {
61
- if (process.platform !== "linux") {
62
- return false;
63
- }
64
- if (os.release().toLowerCase().includes("microsoft")) {
65
- if (isDocker()) {
66
- return false;
67
- }
68
- return true;
69
- }
70
- try {
71
- return fs
72
- .readFileSync("/proc/version", "utf8")
73
- .toLowerCase()
74
- .includes("microsoft")
75
- ? !isDocker()
76
- : false;
77
- } catch (_) {
78
- return false;
79
- }
80
- };
81
- if (process.env.__IS_WSL_TEST__) {
82
- module.exports = isWsl;
83
- } else {
84
- module.exports = isWsl();
85
- }
86
- },
87
- 820: (module, __unused_webpack_exports, __nccwpck_require__) => {
88
- const path = __nccwpck_require__(928);
89
- const childProcess = __nccwpck_require__(317);
90
- const { promises: fs, constants: fsConstants } = __nccwpck_require__(896);
91
- const isWsl = __nccwpck_require__(622);
92
- const isDocker = __nccwpck_require__(293);
93
- const defineLazyProperty = __nccwpck_require__(932);
94
- const localXdgOpenPath = __nccwpck_require__.ab + "xdg-open";
95
- const { platform, arch } = process;
96
- const hasContainerEnv = () => {
97
- try {
98
- fs.statSync("/run/.containerenv");
99
- return true;
100
- } catch {
101
- return false;
102
- }
103
- };
104
- let cachedResult;
105
- function isInsideContainer() {
106
- if (cachedResult === undefined) {
107
- cachedResult = hasContainerEnv() || isDocker();
108
- }
109
- return cachedResult;
110
- }
111
- const getWslDrivesMountPoint = (() => {
112
- const defaultMountPoint = "/mnt/";
113
- let mountPoint;
114
- return async function () {
115
- if (mountPoint) {
116
- return mountPoint;
117
- }
118
- const configFilePath = "/etc/wsl.conf";
119
- let isConfigFileExists = false;
120
- try {
121
- await fs.access(configFilePath, fsConstants.F_OK);
122
- isConfigFileExists = true;
123
- } catch {}
124
- if (!isConfigFileExists) {
125
- return defaultMountPoint;
126
- }
127
- const configContent = await fs.readFile(configFilePath, {
128
- encoding: "utf8",
129
- });
130
- const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(
131
- configContent,
132
- );
133
- if (!configMountPoint) {
134
- return defaultMountPoint;
135
- }
136
- mountPoint = configMountPoint.groups.mountPoint.trim();
137
- mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
138
- return mountPoint;
139
- };
140
- })();
141
- const pTryEach = async (array, mapper) => {
142
- let latestError;
143
- for (const item of array) {
144
- try {
145
- return await mapper(item);
146
- } catch (error) {
147
- latestError = error;
148
- }
149
- }
150
- throw latestError;
151
- };
152
- const baseOpen = async (options) => {
153
- options = {
154
- wait: false,
155
- background: false,
156
- newInstance: false,
157
- allowNonzeroExitCode: false,
158
- ...options,
159
- };
160
- if (Array.isArray(options.app)) {
161
- return pTryEach(options.app, (singleApp) =>
162
- baseOpen({ ...options, app: singleApp }),
163
- );
164
- }
165
- let { name: app, arguments: appArguments = [] } = options.app || {};
166
- appArguments = [...appArguments];
167
- if (Array.isArray(app)) {
168
- return pTryEach(app, (appName) =>
169
- baseOpen({
170
- ...options,
171
- app: { name: appName, arguments: appArguments },
172
- }),
173
- );
174
- }
175
- let command;
176
- const cliArguments = [];
177
- const childProcessOptions = {};
178
- if (platform === "darwin") {
179
- command = "open";
180
- if (options.wait) {
181
- cliArguments.push("--wait-apps");
182
- }
183
- if (options.background) {
184
- cliArguments.push("--background");
185
- }
186
- if (options.newInstance) {
187
- cliArguments.push("--new");
188
- }
189
- if (app) {
190
- cliArguments.push("-a", app);
191
- }
192
- } else if (
193
- platform === "win32" ||
194
- (isWsl && !isInsideContainer() && !app)
195
- ) {
196
- const mountPoint = await getWslDrivesMountPoint();
197
- command = isWsl
198
- ? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`
199
- : `${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
200
- cliArguments.push(
201
- "-NoProfile",
202
- "-NonInteractive",
203
- "–ExecutionPolicy",
204
- "Bypass",
205
- "-EncodedCommand",
206
- );
207
- if (!isWsl) {
208
- childProcessOptions.windowsVerbatimArguments = true;
209
- }
210
- const encodedArguments = ["Start"];
211
- if (options.wait) {
212
- encodedArguments.push("-Wait");
213
- }
214
- if (app) {
215
- encodedArguments.push(`"\`"${app}\`""`, "-ArgumentList");
216
- if (options.target) {
217
- appArguments.unshift(options.target);
218
- }
219
- } else if (options.target) {
220
- encodedArguments.push(`"${options.target}"`);
221
- }
222
- if (appArguments.length > 0) {
223
- appArguments = appArguments.map((arg) => `"\`"${arg}\`""`);
224
- encodedArguments.push(appArguments.join(","));
225
- }
226
- options.target = Buffer.from(
227
- encodedArguments.join(" "),
228
- "utf16le",
229
- ).toString("base64");
230
- } else {
231
- if (app) {
232
- command = app;
233
- } else {
234
- const isBundled = !__dirname || __dirname === "/";
235
- let exeLocalXdgOpen = false;
236
- try {
237
- await fs.access(
238
- __nccwpck_require__.ab + "xdg-open",
239
- fsConstants.X_OK,
240
- );
241
- exeLocalXdgOpen = true;
242
- } catch {}
243
- const useSystemXdgOpen =
244
- process.versions.electron ||
245
- platform === "android" ||
246
- isBundled ||
247
- !exeLocalXdgOpen;
248
- command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
249
- }
250
- if (appArguments.length > 0) {
251
- cliArguments.push(...appArguments);
252
- }
253
- if (!options.wait) {
254
- childProcessOptions.stdio = "ignore";
255
- childProcessOptions.detached = true;
256
- }
257
- }
258
- if (options.target) {
259
- cliArguments.push(options.target);
260
- }
261
- if (platform === "darwin" && appArguments.length > 0) {
262
- cliArguments.push("--args", ...appArguments);
263
- }
264
- const subprocess = childProcess.spawn(
265
- command,
266
- cliArguments,
267
- childProcessOptions,
268
- );
269
- if (options.wait) {
270
- return new Promise((resolve, reject) => {
271
- subprocess.once("error", reject);
272
- subprocess.once("close", (exitCode) => {
273
- if (!options.allowNonzeroExitCode && exitCode > 0) {
274
- reject(new Error(`Exited with code ${exitCode}`));
275
- return;
276
- }
277
- resolve(subprocess);
278
- });
279
- });
280
- }
281
- subprocess.unref();
282
- return subprocess;
283
- };
284
- const open = (target, options) => {
285
- if (typeof target !== "string") {
286
- throw new TypeError("Expected a `target`");
287
- }
288
- return baseOpen({ ...options, target });
289
- };
290
- const openApp = (name, options) => {
291
- if (typeof name !== "string") {
292
- throw new TypeError("Expected a `name`");
293
- }
294
- const { arguments: appArguments = [] } = options || {};
295
- if (
296
- appArguments !== undefined &&
297
- appArguments !== null &&
298
- !Array.isArray(appArguments)
299
- ) {
300
- throw new TypeError("Expected `appArguments` as Array type");
301
- }
302
- return baseOpen({ ...options, app: { name, arguments: appArguments } });
303
- };
304
- function detectArchBinary(binary) {
305
- if (typeof binary === "string" || Array.isArray(binary)) {
306
- return binary;
307
- }
308
- const { [arch]: archBinary } = binary;
309
- if (!archBinary) {
310
- throw new Error(`${arch} is not supported`);
311
- }
312
- return archBinary;
313
- }
314
- function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
315
- if (wsl && isWsl) {
316
- return detectArchBinary(wsl);
317
- }
318
- if (!platformBinary) {
319
- throw new Error(`${platform} is not supported`);
320
- }
321
- return detectArchBinary(platformBinary);
322
- }
323
- const apps = {};
324
- defineLazyProperty(apps, "chrome", () =>
325
- detectPlatformBinary(
326
- {
327
- darwin: "google chrome",
328
- win32: "chrome",
329
- linux: ["google-chrome", "google-chrome-stable", "chromium"],
330
- },
331
- {
332
- wsl: {
333
- ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
334
- x64: [
335
- "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe",
336
- "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
337
- ],
338
- },
339
- },
340
- ),
341
- );
342
- defineLazyProperty(apps, "firefox", () =>
343
- detectPlatformBinary(
344
- {
345
- darwin: "firefox",
346
- win32: "C:\\Program Files\\Mozilla Firefox\\firefox.exe",
347
- linux: "firefox",
348
- },
349
- { wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" },
350
- ),
351
- );
352
- defineLazyProperty(apps, "edge", () =>
353
- detectPlatformBinary(
354
- {
355
- darwin: "microsoft edge",
356
- win32: "msedge",
357
- linux: ["microsoft-edge", "microsoft-edge-dev"],
358
- },
359
- {
360
- wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
361
- },
362
- ),
363
- );
364
- open.apps = apps;
365
- open.openApp = openApp;
366
- module.exports = open;
367
- },
368
- 317: (module) => {
369
- "use strict";
370
- module.exports = require("child_process");
371
- },
372
- 896: (module) => {
373
- "use strict";
374
- module.exports = require("fs");
375
- },
376
- 857: (module) => {
377
- "use strict";
378
- module.exports = require("os");
379
- },
380
- 928: (module) => {
381
- "use strict";
382
- module.exports = require("path");
383
- },
384
- };
385
- var __webpack_module_cache__ = {};
386
- function __nccwpck_require__(moduleId) {
387
- var cachedModule = __webpack_module_cache__[moduleId];
388
- if (cachedModule !== undefined) {
389
- return cachedModule.exports;
390
- }
391
- var module = (__webpack_module_cache__[moduleId] = { exports: {} });
392
- var threw = true;
393
- try {
394
- __webpack_modules__[moduleId](
395
- module,
396
- module.exports,
397
- __nccwpck_require__,
398
- );
399
- threw = false;
400
- } finally {
401
- if (threw) delete __webpack_module_cache__[moduleId];
402
- }
403
- return module.exports;
404
- }
405
- if (typeof __nccwpck_require__ !== "undefined")
406
- __nccwpck_require__.ab = __dirname + "/";
407
- var __webpack_exports__ = __nccwpck_require__(820);
408
- module.exports = __webpack_exports__;
409
- })();
@@ -1 +0,0 @@
1
- {"name":"open","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"version":"8.4.2","funding":"https://github.com/sponsors/sindresorhus","license":"MIT","types":"index.d.ts","type":"commonjs"}