oxfmt 0.2.0 → 0.4.0
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/README.md +2 -0
- package/bin/oxfmt +13 -13
- package/package.json +11 -11
package/README.md
CHANGED
package/bin/oxfmt
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { readFileSync } from "fs";
|
|
4
|
+
import { spawnSync, execSync } from "child_process";
|
|
5
|
+
import { createRequire } from "module";
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
|
|
3
9
|
const isMusl = () => {
|
|
4
10
|
let musl = false;
|
|
5
11
|
if (process.platform === "linux") {
|
|
@@ -17,10 +23,9 @@ const isMusl = () => {
|
|
|
17
23
|
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
18
24
|
|
|
19
25
|
const isMuslFromFilesystem = () => {
|
|
20
|
-
const { readFileSync } = require("fs");
|
|
21
26
|
try {
|
|
22
27
|
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
|
|
23
|
-
} catch
|
|
28
|
+
} catch {
|
|
24
29
|
return null;
|
|
25
30
|
}
|
|
26
31
|
};
|
|
@@ -46,8 +51,7 @@ const isMuslFromReport = () => {
|
|
|
46
51
|
|
|
47
52
|
const isMuslFromChildProcess = () => {
|
|
48
53
|
try {
|
|
49
|
-
return
|
|
50
|
-
.execSync("ldd --version", { encoding: "utf8" })
|
|
54
|
+
return execSync("ldd --version", { encoding: "utf8" })
|
|
51
55
|
.includes("musl");
|
|
52
56
|
} catch (e) {
|
|
53
57
|
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
@@ -90,25 +94,21 @@ const PLATFORMS = {
|
|
|
90
94
|
},
|
|
91
95
|
};
|
|
92
96
|
|
|
93
|
-
let binPath = (
|
|
94
|
-
PLATFORMS &&
|
|
95
|
-
PLATFORMS[platform] &&
|
|
96
|
-
PLATFORMS[platform][arch] &&
|
|
97
|
-
PLATFORMS[platform][arch][isMusl() ? "musl" : "gnu"]
|
|
98
|
-
) || null;
|
|
97
|
+
let binPath = PLATFORMS[platform]?.[arch]?.[isMusl() ? "musl" : "gnu"];
|
|
99
98
|
|
|
100
99
|
if (binPath) {
|
|
101
|
-
const result =
|
|
100
|
+
const result = spawnSync(
|
|
102
101
|
require.resolve(binPath),
|
|
103
102
|
process.argv.slice(2),
|
|
104
103
|
{
|
|
105
104
|
shell: false,
|
|
106
105
|
stdio: "inherit",
|
|
107
|
-
env:
|
|
106
|
+
env: {
|
|
107
|
+
...env,
|
|
108
108
|
JS_RUNTIME_VERSION: version,
|
|
109
109
|
JS_RUNTIME_NAME: release.name,
|
|
110
110
|
NODE_PACKAGE_MANAGER: detectPackageManager(),
|
|
111
|
-
}
|
|
111
|
+
},
|
|
112
112
|
}
|
|
113
113
|
);
|
|
114
114
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxfmt",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"description": "Formatter for the JavaScript Oxidation Compiler",
|
|
6
6
|
"keywords": [],
|
|
7
7
|
"author": "Boshen and oxc contributors",
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
"url": "https://github.com/sponsors/Boshen"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"bin/oxfmt",
|
|
27
27
|
"README.md"
|
|
28
28
|
],
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@oxfmt/win32-x64": "0.
|
|
31
|
-
"@oxfmt/win32-arm64": "0.
|
|
32
|
-
"@oxfmt/linux-x64-gnu": "0.
|
|
33
|
-
"@oxfmt/linux-arm64-gnu": "0.
|
|
34
|
-
"@oxfmt/linux-x64-musl": "0.
|
|
35
|
-
"@oxfmt/linux-arm64-musl": "0.
|
|
36
|
-
"@oxfmt/darwin-x64": "0.
|
|
37
|
-
"@oxfmt/darwin-arm64": "0.
|
|
30
|
+
"@oxfmt/win32-x64": "0.4.0",
|
|
31
|
+
"@oxfmt/win32-arm64": "0.4.0",
|
|
32
|
+
"@oxfmt/linux-x64-gnu": "0.4.0",
|
|
33
|
+
"@oxfmt/linux-arm64-gnu": "0.4.0",
|
|
34
|
+
"@oxfmt/linux-x64-musl": "0.4.0",
|
|
35
|
+
"@oxfmt/linux-arm64-musl": "0.4.0",
|
|
36
|
+
"@oxfmt/darwin-x64": "0.4.0",
|
|
37
|
+
"@oxfmt/darwin-arm64": "0.4.0"
|
|
38
38
|
}
|
|
39
39
|
}
|