This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathesbuild+0.14.48.patch
79 lines (78 loc) · 2.65 KB
/
esbuild+0.14.48.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
diff --git a/node_modules/esbuild/lib/main.js b/node_modules/esbuild/lib/main.js
index 49721d1..22fdbe2 100644
--- a/node_modules/esbuild/lib/main.js
+++ b/node_modules/esbuild/lib/main.js
@@ -1845,7 +1845,13 @@ by esbuild to install the correct binary executable for your current platform.`)
}
// lib/npm/node.ts
-var child_process = require("child_process");
+// BUN NOTE: polyfill child_process with bun-utilities
+var child_process;
+if (process.versions.bun) {
+ child_process = require('bun-utilities');
+} else {
+ child_process = require("child_process");
+}
var crypto = require("crypto");
var path2 = require("path");
var fs2 = require("fs");
@@ -2038,11 +2044,24 @@ var ensureServiceIsRunning = () => {
if (longLivedService)
return longLivedService;
let [command, args] = esbuildCommandAndArgs();
- let child = child_process.spawn(command, args.concat(`--service=${"0.14.48"}`, "--ping"), {
- windowsHide: true,
- stdio: ["pipe", "pipe", "inherit"],
- cwd: defaultWD
- });
+ // BUN NOTE: Use bun-utilities compatible API
+ let child
+ if (process.versions.bun) {
+ child = child_process.spawn(command, args.concat(`--service=${"0.14.48"}`, "--ping"), {
+ // windowsHide: true,
+ // stdio: ["pipe", "pipe", "inherit"],
+ stdin: "pipe",
+ stdout: "pipe",
+ stderr: "inherit",
+ cwd: defaultWD
+ });
+ } else {
+ child = child_process.spawn(command, args.concat(`--service=${"0.14.48"}`, "--ping"), {
+ windowsHide: true,
+ stdio: ["pipe", "pipe", "inherit"],
+ cwd: defaultWD
+ });
+ }
let { readFromStdout, afterClose, service } = createChannel({
writeToStdin(bytes) {
child.stdin.write(bytes, (err) => {
@@ -2152,12 +2171,23 @@ var runServiceSync = (callback) => {
esbuild: node_exports
});
callback(service);
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.48"}`), {
- cwd: defaultWD,
- windowsHide: true,
- input: stdin,
- maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024
- });
+ // BUN NOTE: Use bun-utilities compatible API
+ let stdout;
+ if (process.versions.bun) {
+ stdout = child_process.spawn(command, args.concat(`--service=${"0.14.48"}`), {
+ cwd: defaultWD,
+ // windowsHide: true,
+ // input: stdin,
+ // maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024
+ }).stdout;
+ } else {
+ stdout = child_process.exec(command, args.concat(`--service=${"0.14.48"}`), {
+ cwd: defaultWD,
+ windowsHide: true,
+ input: stdin,
+ maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024
+ });
+ }
readFromStdout(stdout);
afterClose(null);
};