roxify 1.9.8 → 1.10.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.
@@ -1,35 +1,18 @@
1
1
  import { execSync, spawn } from 'child_process';
2
2
  import { existsSync } from 'fs';
3
3
  import { dirname, join } from 'path';
4
- import { fileURLToPath } from 'url';
5
4
  let moduleDir;
6
5
  if (typeof __dirname !== 'undefined') {
7
6
  moduleDir = __dirname;
8
7
  }
9
8
  else {
10
- try {
11
- moduleDir = dirname(fileURLToPath(import.meta.url));
12
- }
13
- catch {
14
- moduleDir = process.cwd();
15
- }
9
+ moduleDir = process.cwd();
16
10
  }
17
11
  function findRustBinary() {
18
12
  const binNames = process.platform === 'win32'
19
13
  ? ['roxify_native.exe', 'roxify-cli.exe', 'roxify_cli.exe']
20
14
  : ['roxify_native', 'roxify-cli', 'roxify_cli'];
21
- const baseDir = moduleDir;
22
- for (const name of binNames) {
23
- const sameDirPath = join(baseDir, name);
24
- if (existsSync(sameDirPath))
25
- return sameDirPath;
26
- const parentPath = join(baseDir, '..', name);
27
- if (existsSync(parentPath))
28
- return parentPath;
29
- const parentDistPath = join(baseDir, '..', 'dist', name);
30
- if (existsSync(parentDistPath))
31
- return parentDistPath;
32
- }
15
+ const baseDir = typeof moduleDir !== 'undefined' ? moduleDir : process.cwd();
33
16
  if (process.pkg) {
34
17
  const snapshotPaths = [
35
18
  join(baseDir, '..', '..', 'target', 'release'),
@@ -39,8 +22,9 @@ function findRustBinary() {
39
22
  for (const basePath of snapshotPaths) {
40
23
  for (const name of binNames) {
41
24
  const binPath = join(basePath, name);
42
- if (existsSync(binPath))
25
+ if (existsSync(binPath)) {
43
26
  return binPath;
27
+ }
44
28
  }
45
29
  }
46
30
  try {
@@ -51,35 +35,40 @@ function findRustBinary() {
51
35
  join(execDir, 'tools', 'roxify'),
52
36
  join(execDir, '..', 'tools', 'roxify', 'dist'),
53
37
  join(execDir, '..', 'tools', 'roxify'),
38
+ join(execDir, 'tools', 'roxify', 'roxify_native.exe'),
54
39
  ];
55
40
  for (const c of execCandidates) {
56
41
  for (const name of binNames) {
57
- const p = join(c, name);
58
- if (existsSync(p))
42
+ const p = c.endsWith(name) ? c : join(c, name);
43
+ if (existsSync(p)) {
59
44
  return p;
45
+ }
60
46
  }
61
47
  }
62
48
  }
63
49
  }
64
- catch { }
50
+ catch (e) { }
65
51
  }
66
52
  try {
67
53
  let paths = [];
68
54
  if (process.platform === 'win32') {
69
55
  try {
70
- const out = execSync('where rox', { encoding: 'utf-8', timeout: 5000 }).trim();
56
+ const out = execSync('where rox', { encoding: 'utf-8' }).trim();
71
57
  if (out)
72
- paths = out.split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
58
+ paths = out
59
+ .split(/\r?\n/)
60
+ .map((s) => s.trim())
61
+ .filter(Boolean);
73
62
  }
74
- catch { }
63
+ catch (e) { }
75
64
  }
76
65
  else {
77
66
  try {
78
- const out = execSync('which rox', { encoding: 'utf-8', timeout: 5000 }).trim();
67
+ const out = execSync('which rox', { encoding: 'utf-8' }).trim();
79
68
  if (out)
80
69
  paths = [out.trim()];
81
70
  }
82
- catch { }
71
+ catch (e) { }
83
72
  }
84
73
  for (const p of paths) {
85
74
  try {
@@ -89,33 +78,44 @@ function findRustBinary() {
89
78
  join(d, 'dist'),
90
79
  join(d, '..', 'dist'),
91
80
  join(d, '..'),
92
- join(d, 'node_modules', 'roxify', 'dist'),
93
81
  ];
94
82
  for (const c of candidates) {
95
83
  for (const name of binNames) {
96
84
  const candidate = join(c, name);
97
- if (existsSync(candidate))
85
+ if (existsSync(candidate)) {
98
86
  return candidate;
87
+ }
99
88
  }
100
89
  }
101
90
  }
102
- catch { }
91
+ catch (e) { }
103
92
  }
104
93
  }
105
- catch { }
94
+ catch (e) { }
106
95
  for (const name of binNames) {
96
+ const local = join(baseDir, name);
97
+ if (existsSync(local)) {
98
+ return local;
99
+ }
100
+ const parentLocal = join(baseDir, '..', name);
101
+ if (existsSync(parentLocal)) {
102
+ return parentLocal;
103
+ }
107
104
  const parentParentLocal = join(baseDir, '..', '..', name);
108
- if (existsSync(parentParentLocal))
105
+ if (existsSync(parentParentLocal)) {
109
106
  return parentParentLocal;
107
+ }
110
108
  const nodeModulesPath = join(baseDir, '..', '..', '..', '..', name);
111
- if (existsSync(nodeModulesPath))
109
+ if (existsSync(nodeModulesPath)) {
112
110
  return nodeModulesPath;
111
+ }
113
112
  }
114
113
  const targetRelease = join(baseDir, '..', '..', 'target', 'release');
115
114
  for (const name of binNames) {
116
115
  const targetPath = join(targetRelease, name);
117
- if (existsSync(targetPath))
116
+ if (existsSync(targetPath)) {
118
117
  return targetPath;
118
+ }
119
119
  }
120
120
  return null;
121
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roxify",
3
- "version": "1.9.8",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "description": "Ultra-lightweight PNG steganography with native Rust acceleration. Encode binary data into PNG images with zstd compression.",
6
6
  "main": "dist/index.js",
@@ -27,6 +27,9 @@
27
27
  "libroxify_native-aarch64-apple-darwin.node",
28
28
  "dist/roxify_native.exe",
29
29
  "dist/roxify_native",
30
+ "dist/roxify_native-macos-arm64",
31
+ "dist/roxify_native-macos-x64",
32
+ "dist/rox-macos-universal",
30
33
  "scripts/postinstall.cjs",
31
34
  "native",
32
35
  "Cargo.toml",
@@ -96,7 +99,7 @@
96
99
  "lightweight"
97
100
  ],
98
101
  "author": "",
99
- "license": "MIT",
102
+ "license": "SEE LICENSE IN LICENSE",
100
103
  "devDependencies": {
101
104
  "@types/node": "^22.0.0",
102
105
  "pkg": "^5.8.1",