roxify 1.5.0 → 1.5.2
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/dist/utils/constants.js
CHANGED
|
@@ -19,7 +19,6 @@ export const MARKER_START = MARKER_COLORS;
|
|
|
19
19
|
export const MARKER_END = [...MARKER_COLORS].reverse();
|
|
20
20
|
export const COMPRESSION_MARKERS = {
|
|
21
21
|
zstd: [{ r: 0, g: 255, b: 0 }],
|
|
22
|
-
lzma: [{ r: 255, g: 255, b: 0 }],
|
|
23
22
|
};
|
|
24
23
|
export const FORMAT_MARKERS = {
|
|
25
24
|
png: { r: 0, g: 255, b: 255 },
|
package/dist/utils/decoder.js
CHANGED
|
@@ -10,30 +10,7 @@ import { native } from './native.js';
|
|
|
10
10
|
import { cropAndReconstitute } from './reconstitution.js';
|
|
11
11
|
import { parallelZstdDecompress, tryZstdDecompress } from './zstd.js';
|
|
12
12
|
async function tryDecompress(payload, onProgress) {
|
|
13
|
-
|
|
14
|
-
return await parallelZstdDecompress(payload, onProgress);
|
|
15
|
-
}
|
|
16
|
-
catch (e) {
|
|
17
|
-
try {
|
|
18
|
-
const mod = await import('lzma-purejs');
|
|
19
|
-
const decompressFn = mod && (mod.decompress || (mod.LZMA && mod.LZMA.decompress));
|
|
20
|
-
if (!decompressFn)
|
|
21
|
-
throw new Error('No lzma decompress');
|
|
22
|
-
const dec = await new Promise((resolve, reject) => {
|
|
23
|
-
try {
|
|
24
|
-
decompressFn(Buffer.from(payload), (out) => resolve(out));
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
reject(err);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
const dBuf = Buffer.isBuffer(dec) ? dec : Buffer.from(dec);
|
|
31
|
-
return dBuf;
|
|
32
|
-
}
|
|
33
|
-
catch (e3) {
|
|
34
|
-
throw e;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
13
|
+
return await parallelZstdDecompress(payload, onProgress);
|
|
37
14
|
}
|
|
38
15
|
function detectImageFormat(buf) {
|
|
39
16
|
if (buf.length < 12)
|
package/dist/utils/native.js
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
|
+
import { arch, platform } from 'os';
|
|
2
3
|
import { dirname, join } from 'path';
|
|
3
4
|
import { fileURLToPath } from 'url';
|
|
4
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
5
6
|
const __dirname = dirname(__filename);
|
|
6
7
|
const require = createRequire(import.meta.url);
|
|
7
|
-
|
|
8
|
+
function getNativePath() {
|
|
9
|
+
const platformMap = {
|
|
10
|
+
linux: 'x86_64-unknown-linux-gnu',
|
|
11
|
+
darwin: arch() === 'arm64' ? 'aarch64-apple-darwin' : 'x86_64-apple-darwin',
|
|
12
|
+
win32: 'x86_64-pc-windows-msvc',
|
|
13
|
+
};
|
|
14
|
+
const extMap = {
|
|
15
|
+
linux: 'so',
|
|
16
|
+
darwin: 'dylib',
|
|
17
|
+
win32: 'dll',
|
|
18
|
+
};
|
|
19
|
+
const currentPlatform = platform();
|
|
20
|
+
const target = platformMap[currentPlatform];
|
|
21
|
+
const ext = extMap[currentPlatform];
|
|
22
|
+
if (!target || !ext) {
|
|
23
|
+
throw new Error(`Unsupported platform: ${currentPlatform}`);
|
|
24
|
+
}
|
|
25
|
+
const prebuiltPath = join(__dirname, '../../libroxify_native.node');
|
|
26
|
+
const targetPath = join(__dirname, `../../libroxify_native-${target}.${ext}`);
|
|
27
|
+
try {
|
|
28
|
+
return require.resolve(prebuiltPath);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
try {
|
|
32
|
+
return require.resolve(targetPath);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
throw new Error(`Native module not found for ${currentPlatform}-${arch()}. ` +
|
|
36
|
+
`Expected: ${prebuiltPath} or ${targetPath}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const native = require(getNativePath());
|
package/libroxify_native.node
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "roxify",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Ultra-lightweight PNG steganography with native Rust acceleration. Encode binary data into PNG images with zstd compression.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,14 +12,22 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
14
14
|
"libroxify_native.node",
|
|
15
|
+
"libroxify_native-*.so",
|
|
16
|
+
"libroxify_native-*.dylib",
|
|
17
|
+
"libroxify_native-*.dll",
|
|
15
18
|
"README.md",
|
|
16
19
|
"LICENSE"
|
|
17
20
|
],
|
|
18
21
|
"scripts": {
|
|
19
22
|
"build": "tsc",
|
|
20
|
-
"build:native": "cargo build --release --lib
|
|
23
|
+
"build:native": "cargo build --release --lib",
|
|
24
|
+
"build:native:linux": "cargo build --release --lib --target x86_64-unknown-linux-gnu && cp target/x86_64-unknown-linux-gnu/release/libroxify_native.so libroxify_native-x86_64-unknown-linux-gnu.so",
|
|
25
|
+
"build:native:macos-x64": "cargo build --release --lib --target x86_64-apple-darwin && cp target/x86_64-apple-darwin/release/libroxify_native.dylib libroxify_native-x86_64-apple-darwin.dylib",
|
|
26
|
+
"build:native:macos-arm": "cargo build --release --lib --target aarch64-apple-darwin && cp target/aarch64-apple-darwin/release/libroxify_native.dylib libroxify_native-aarch64-apple-darwin.dylib",
|
|
27
|
+
"build:native:windows": "cargo build --release --lib --target x86_64-pc-windows-msvc && cp target/x86_64-pc-windows-msvc/release/roxify_native.dll libroxify_native-x86_64-pc-windows-msvc.dll",
|
|
21
28
|
"build:cli": "cargo build --release --bin roxify_native && cp target/release/roxify_native dist/roxify-cli",
|
|
22
29
|
"build:all": "npm run build:native && npm run build && npm run build:cli",
|
|
30
|
+
"postbuild:native": "node scripts/copy-native.js",
|
|
23
31
|
"prepublishOnly": "npm run build:all",
|
|
24
32
|
"test": "npm run build && node test/run-all-tests.js",
|
|
25
33
|
"cli": "node dist/cli.js"
|