@anonymous-dev/0x0 1.2.2 → 1.3.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.
Files changed (2) hide show
  1. package/package.json +13 -14
  2. package/bin/bin/0x0 +0 -109
package/package.json CHANGED
@@ -6,20 +6,19 @@
6
6
  "scripts": {
7
7
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
8
8
  },
9
- "version": "1.2.2",
9
+ "version": "1.3.0",
10
10
  "license": "MIT",
11
11
  "optionalDependencies": {
12
- "@anonymous-dev/0x0-linux-x64-baseline": "1.2.2",
13
- "@anonymous-dev/0x0-linux-x64": "1.2.2",
14
- "@anonymous-dev/0x0-darwin-arm64": "1.2.2",
15
- "@anonymous-dev/0x0-darwin-x64-baseline": "1.2.2",
16
- "@anonymous-dev/0x0-darwin-x64": "1.2.2",
17
- "@anonymous-dev/0x0": "1.2.2",
18
- "@anonymous-dev/0x0-windows-x64": "1.2.2",
19
- "@anonymous-dev/0x0-linux-x64-baseline-musl": "1.2.2",
20
- "@anonymous-dev/0x0-linux-arm64": "1.2.2",
21
- "@anonymous-dev/0x0-linux-arm64-musl": "1.2.2",
22
- "@anonymous-dev/0x0-windows-x64-baseline": "1.2.2",
23
- "@anonymous-dev/0x0-linux-x64-musl": "1.2.2"
12
+ "@anonymous-dev/0x0-linux-x64-baseline": "1.3.0",
13
+ "@anonymous-dev/0x0-linux-x64": "1.3.0",
14
+ "@anonymous-dev/0x0-darwin-arm64": "1.3.0",
15
+ "@anonymous-dev/0x0-darwin-x64-baseline": "1.3.0",
16
+ "@anonymous-dev/0x0-darwin-x64": "1.3.0",
17
+ "@anonymous-dev/0x0-windows-x64": "1.3.0",
18
+ "@anonymous-dev/0x0-linux-x64-baseline-musl": "1.3.0",
19
+ "@anonymous-dev/0x0-linux-arm64": "1.3.0",
20
+ "@anonymous-dev/0x0-linux-arm64-musl": "1.3.0",
21
+ "@anonymous-dev/0x0-windows-x64-baseline": "1.3.0",
22
+ "@anonymous-dev/0x0-linux-x64-musl": "1.3.0"
24
23
  }
25
- }
24
+ }
package/bin/bin/0x0 DELETED
@@ -1,109 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const childProcess = require("child_process")
4
- const fs = require("fs")
5
- const path = require("path")
6
- const os = require("os")
7
-
8
- function run(target) {
9
- const result = childProcess.spawnSync(target, process.argv.slice(2), {
10
- stdio: "inherit",
11
- })
12
- if (result.error) {
13
- console.error(result.error.message)
14
- process.exit(1)
15
- }
16
- const code = typeof result.status === "number" ? result.status : 0
17
- process.exit(code)
18
- }
19
-
20
- const envPath = process.env.ZEROXZERO_BIN_PATH
21
- if (envPath) {
22
- run(envPath)
23
- }
24
-
25
- const scriptPath = fs.realpathSync(__filename)
26
- const scriptDir = path.dirname(scriptPath)
27
-
28
- const platformMap = {
29
- darwin: "darwin",
30
- linux: "linux",
31
- win32: "windows",
32
- }
33
- const archMap = {
34
- x64: "x64",
35
- arm64: "arm64",
36
- arm: "arm",
37
- }
38
-
39
- let platform = platformMap[os.platform()]
40
- if (!platform) {
41
- platform = os.platform()
42
- }
43
- let arch = archMap[os.arch()]
44
- if (!arch) {
45
- arch = os.arch()
46
- }
47
- const base = "0x0-" + platform + "-" + arch
48
- const binary = platform === "windows" ? "0x0.exe" : "0x0"
49
- const scope = process.env.ZEROXZERO_NPM_SCOPE || "@anonymous-dev"
50
-
51
- function findBinary(startDir) {
52
- try {
53
- const scoped = require.resolve(scope + "/" + base + "/package.json")
54
- const candidate = path.join(path.dirname(scoped), "bin", binary)
55
- if (fs.existsSync(candidate)) {
56
- return candidate
57
- }
58
- } catch {}
59
- let current = startDir
60
- for (;;) {
61
- const modules = path.join(current, "node_modules")
62
- if (fs.existsSync(modules)) {
63
- const entries = fs.readdirSync(modules)
64
- for (const entry of entries) {
65
- if (entry.startsWith("@")) {
66
- const scoped = path.join(modules, entry)
67
- if (!fs.existsSync(scoped)) {
68
- continue
69
- }
70
- const items = fs.readdirSync(scoped)
71
- for (const item of items) {
72
- if (!item.startsWith(base)) {
73
- continue
74
- }
75
- const candidate = path.join(scoped, item, "bin", binary)
76
- if (fs.existsSync(candidate)) {
77
- return candidate
78
- }
79
- }
80
- continue
81
- }
82
- if (!entry.startsWith(base)) {
83
- continue
84
- }
85
- const candidate = path.join(modules, entry, "bin", binary)
86
- if (fs.existsSync(candidate)) {
87
- return candidate
88
- }
89
- }
90
- }
91
- const parent = path.dirname(current)
92
- if (parent === current) {
93
- return
94
- }
95
- current = parent
96
- }
97
- }
98
-
99
- const resolved = findBinary(scriptDir)
100
- if (!resolved) {
101
- console.error(
102
- 'It seems that your package manager failed to install the right version of the 0x0 CLI for your platform. You can try manually installing the "' +
103
- base +
104
- '" package',
105
- )
106
- process.exit(1)
107
- }
108
-
109
- run(resolved)