roxify 1.9.7 → 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.
- package/Cargo.toml +1 -1
- package/LICENSE +63 -21
- package/README.md +163 -163
- package/dist/rox-macos-universal +0 -0
- package/dist/roxify_native +0 -0
- package/dist/roxify_native-macos-arm64 +0 -0
- package/dist/roxify_native-macos-x64 +0 -0
- package/dist/roxify_native.exe +0 -0
- package/dist/utils/decoder.js +0 -28
- package/dist/utils/inspection.d.ts +28 -0
- package/dist/utils/inspection.js +406 -124
- package/dist/utils/native.js +9 -1
- package/dist/utils/rust-cli-wrapper.js +35 -35
- package/native/reconstitution.rs +1 -1
- package/package.json +5 -2
- package/roxify_native-aarch64-apple-darwin.node +0 -0
- package/roxify_native-aarch64-pc-windows-msvc.node +0 -0
- package/roxify_native-aarch64-unknown-linux-gnu.node +0 -0
- package/roxify_native-i686-pc-windows-msvc.node +0 -0
- package/roxify_native-i686-unknown-linux-gnu.node +0 -0
- package/roxify_native-x86_64-apple-darwin.node +0 -0
- package/roxify_native-x86_64-pc-windows-gnu.node +0 -0
- package/roxify_native-x86_64-pc-windows-msvc.node +0 -0
- package/roxify_native-x86_64-unknown-linux-gnu.node +0 -0
package/dist/utils/native.js
CHANGED
|
@@ -72,7 +72,15 @@ function getNativeModule() {
|
|
|
72
72
|
for (const triple of triples) {
|
|
73
73
|
const name = `roxify_native-${triple}.node`;
|
|
74
74
|
const libName = `libroxify_native-${triple}.node`;
|
|
75
|
-
candidates.push(
|
|
75
|
+
candidates.push(
|
|
76
|
+
// dist/ sibling (npm-installed package)
|
|
77
|
+
resolve(moduleDir, '..', name), resolve(moduleDir, '..', libName),
|
|
78
|
+
// package root
|
|
79
|
+
resolve(root, name), resolve(root, libName),
|
|
80
|
+
// node_modules/roxify/
|
|
81
|
+
resolve(root, 'node_modules', 'roxify', name), resolve(root, 'node_modules', 'roxify', libName),
|
|
82
|
+
// two levels up (global npm install)
|
|
83
|
+
resolve(moduleDir, '..', '..', name), resolve(moduleDir, '..', '..', libName));
|
|
76
84
|
}
|
|
77
85
|
// --- 2. Build output candidates (local dev) ---
|
|
78
86
|
for (const triple of triples) {
|
|
@@ -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
|
-
|
|
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'
|
|
56
|
+
const out = execSync('where rox', { encoding: 'utf-8' }).trim();
|
|
71
57
|
if (out)
|
|
72
|
-
paths = out
|
|
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'
|
|
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/native/reconstitution.rs
CHANGED
|
@@ -349,7 +349,7 @@ pub fn crop_and_reconstitute(png_data: &[u8]) -> Result<Vec<u8>, String> {
|
|
|
349
349
|
// Filtre : la zone encodée NN a des blocs monochromes → intra très bas
|
|
350
350
|
// Zone de fond aléatoire → intra ≈ lw × n_scan × 0.99 >> 0
|
|
351
351
|
// Seuil : lw/8 × n_scan pour permettre ≈ lw/8 pixels parasites
|
|
352
|
-
let intra_threshold = ((lw as u32 /
|
|
352
|
+
let intra_threshold = ((lw as u32 / 2 + 3) * n_scan).max(n_scan * 3);
|
|
353
353
|
|
|
354
354
|
if intra_final > intra_threshold {
|
|
355
355
|
continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "roxify",
|
|
3
|
-
"version": "1.
|
|
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": "
|
|
102
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
100
103
|
"devDependencies": {
|
|
101
104
|
"@types/node": "^22.0.0",
|
|
102
105
|
"pkg": "^5.8.1",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|