roxify 1.13.8 → 1.14.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/dist/cli.js +23 -21
- package/dist/stub-progress.d.ts +4 -4
- package/dist/stub-progress.js +4 -4
- package/dist/utils/decoder.d.ts +10 -1
- package/dist/utils/decoder.js +111 -7
- package/dist/utils/ecc.js +0 -1
- package/dist/utils/inspection.d.ts +1 -1
- package/dist/utils/inspection.js +2 -2
- package/dist/utils/robust-audio.js +0 -13
- package/dist/utils/robust-image.js +0 -26
- package/package.json +12 -29
- 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/{dist/rox-macos-universal → roxify_native-universal-apple-darwin.node} +0 -0
- package/roxify_native-x86_64-apple-darwin.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/scripts/postinstall.cjs +23 -2
- package/Cargo.toml +0 -91
- 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/native/archive.rs +0 -220
- package/native/audio.rs +0 -151
- package/native/bench_hybrid.rs +0 -145
- package/native/bwt.rs +0 -56
- package/native/context_mixing.rs +0 -117
- package/native/core.rs +0 -378
- package/native/crypto.rs +0 -209
- package/native/encoder.rs +0 -405
- package/native/hybrid.rs +0 -297
- package/native/image_utils.rs +0 -82
- package/native/io_advice.rs +0 -43
- package/native/io_ntfs_optimized.rs +0 -99
- package/native/lib.rs +0 -480
- package/native/main.rs +0 -842
- package/native/mtf.rs +0 -106
- package/native/packer.rs +0 -604
- package/native/png_chunk_writer.rs +0 -146
- package/native/png_utils.rs +0 -554
- package/native/pool.rs +0 -101
- package/native/progress.rs +0 -142
- package/native/rans.rs +0 -149
- package/native/rans_byte.rs +0 -286
- package/native/reconstitution.rs +0 -623
- package/native/streaming.rs +0 -189
- package/native/streaming_decode.rs +0 -625
- package/native/streaming_encode.rs +0 -684
- package/native/test_small_bwt.rs +0 -31
- package/native/test_stages.rs +0 -70
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readdirSync, readFileSync, statSync, writeFileSync } from 'fs';
|
|
|
3
3
|
import { open } from 'fs/promises';
|
|
4
4
|
import { basename, dirname, join, resolve } from 'path';
|
|
5
5
|
import * as cliProgress from './stub-progress.js';
|
|
6
|
-
import {
|
|
6
|
+
import { encodeWithRustCLI, havepassphraseWithRustCLI, isRustBinaryAvailable, listWithRustCLI, } from './utils/rust-cli-wrapper.js';
|
|
7
7
|
async function loadJsEngine() {
|
|
8
8
|
const indexMod = await import('./index.js');
|
|
9
9
|
const packMod = await import('./pack.js');
|
|
@@ -20,7 +20,7 @@ async function loadJsEngine() {
|
|
|
20
20
|
VFSIndexEntry: undefined,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const VERSION = '1.
|
|
23
|
+
const VERSION = '1.14.0';
|
|
24
24
|
function getDirectorySize(dirPath) {
|
|
25
25
|
let totalSize = 0;
|
|
26
26
|
try {
|
|
@@ -315,13 +315,6 @@ async function encodeCommand(args) {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
catch (e) { }
|
|
318
|
-
let anyInputDir = false;
|
|
319
|
-
try {
|
|
320
|
-
anyInputDir = resolvedInputs.some((p) => statSync(p).isDirectory());
|
|
321
|
-
}
|
|
322
|
-
catch (e) {
|
|
323
|
-
anyInputDir = false;
|
|
324
|
-
}
|
|
325
318
|
if (isRustBinaryAvailable() && !parsed.forceTs && containerMode !== 'sound' && parsed.compression !== 'bwt-ans') {
|
|
326
319
|
try {
|
|
327
320
|
console.log(`Encoding to ${resolvedOutput} (Using native Rust encoder)\n`);
|
|
@@ -598,24 +591,33 @@ async function decodeCommand(args) {
|
|
|
598
591
|
}
|
|
599
592
|
const resolvedInput = resolve(inputPath);
|
|
600
593
|
const resolvedOutput = parsed.output || outputPath || '.';
|
|
601
|
-
if (!isRustBinaryAvailable()) {
|
|
602
|
-
console.error('Error: Rust decoder binary not found');
|
|
603
|
-
process.exit(1);
|
|
604
|
-
}
|
|
605
594
|
try {
|
|
606
595
|
console.log(' ');
|
|
607
596
|
console.log('Decoding... (Using native Rust decoder)\n');
|
|
608
597
|
const startTime = Date.now();
|
|
609
598
|
const decodeBar = new cliProgress.SingleBar({ format: ' {bar} {percentage}% | {step} | {elapsed}s' }, cliProgress.Presets.shades_classic);
|
|
610
599
|
decodeBar.start(100, 0, { step: 'Decoding', elapsed: '0' });
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
600
|
+
const js = await loadJsEngine();
|
|
601
|
+
const result = await js.decodePngToBinary(readFileSync(resolvedInput));
|
|
602
|
+
if (result.files && result.files.length > 0) {
|
|
603
|
+
const outputDir = resolve(resolvedOutput);
|
|
604
|
+
for (const file of result.files) {
|
|
605
|
+
const dest = join(outputDir, file.path);
|
|
606
|
+
const parent = dirname(dest);
|
|
607
|
+
try {
|
|
608
|
+
await import('fs/promises').then(({ mkdir }) => mkdir(parent, { recursive: true }));
|
|
609
|
+
}
|
|
610
|
+
catch { }
|
|
611
|
+
writeFileSync(dest, file.buf);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
else if (result.buf) {
|
|
615
|
+
const outputFile = resolvedOutput === '.' ? join(process.cwd(), result.meta?.name || basename(resolvedInput).replace(/\.[^.]+$/, '')) : resolvedOutput;
|
|
616
|
+
writeFileSync(outputFile, result.buf);
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
throw new Error('Decoded result is empty');
|
|
620
|
+
}
|
|
619
621
|
const decodeTime = Date.now() - startTime;
|
|
620
622
|
decodeBar.update(100, { step: 'done', elapsed: String(Math.floor(decodeTime / 1000)) });
|
|
621
623
|
decodeBar.stop();
|
package/dist/stub-progress.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare class SingleBar {
|
|
2
|
-
constructor(...
|
|
3
|
-
start(...
|
|
4
|
-
update(...
|
|
5
|
-
stop(...
|
|
2
|
+
constructor(..._args: any[]);
|
|
3
|
+
start(..._args: any[]): void;
|
|
4
|
+
update(..._args: any[]): void;
|
|
5
|
+
stop(..._args: any[]): void;
|
|
6
6
|
}
|
|
7
7
|
export declare const Presets: {
|
|
8
8
|
shades_classic: {};
|
package/dist/stub-progress.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export class SingleBar {
|
|
2
|
-
constructor(...
|
|
3
|
-
start(...
|
|
4
|
-
update(...
|
|
5
|
-
stop(...
|
|
2
|
+
constructor(..._args) { }
|
|
3
|
+
start(..._args) { }
|
|
4
|
+
update(..._args) { }
|
|
5
|
+
stop(..._args) { }
|
|
6
6
|
}
|
|
7
7
|
export const Presets = {
|
|
8
8
|
shades_classic: {},
|
package/dist/utils/decoder.d.ts
CHANGED
|
@@ -42,4 +42,13 @@ import { DecodeOptions, DecodeResult } from './types.js';
|
|
|
42
42
|
* @param opts - Optional decode options.
|
|
43
43
|
* @returns A Promise resolving to DecodeResult ({ buf, meta } or { files }).
|
|
44
44
|
*/
|
|
45
|
-
export declare function decodePngToBinary(input: Buffer | string,
|
|
45
|
+
export declare function decodePngToBinary(input: Buffer | string, _opts?: DecodeOptions): Promise<DecodeResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Detect and reverse simple pixel-stretching where each logical pixel
|
|
48
|
+
* is repeated in an Fx×Fy block. Returns { width, height, data } or null.
|
|
49
|
+
*/
|
|
50
|
+
export declare function unstretchImage(pixels: Buffer, width: number, height: number): {
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
data: Buffer<ArrayBuffer>;
|
|
54
|
+
} | null;
|
package/dist/utils/decoder.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'fs';
|
|
2
2
|
import { native } from './native.js';
|
|
3
3
|
import { unpackBuffer } from '../pack.js';
|
|
4
|
-
const PXL1_MAGIC = Buffer.from([0x50, 0x58, 0x4c, 0x31]); // "PXL1"
|
|
5
4
|
/**
|
|
6
5
|
* Find PXL1 magic in pixel buffer
|
|
7
6
|
*/
|
|
@@ -116,7 +115,7 @@ function extractPayloadFromPixels(pixels) {
|
|
|
116
115
|
* @param opts - Optional decode options.
|
|
117
116
|
* @returns A Promise resolving to DecodeResult ({ buf, meta } or { files }).
|
|
118
117
|
*/
|
|
119
|
-
export async function decodePngToBinary(input,
|
|
118
|
+
export async function decodePngToBinary(input, _opts = {}) {
|
|
120
119
|
// Get PNG buffer
|
|
121
120
|
let pngBuf;
|
|
122
121
|
if (Buffer.isBuffer(input)) {
|
|
@@ -125,11 +124,14 @@ export async function decodePngToBinary(input, opts = {}) {
|
|
|
125
124
|
else {
|
|
126
125
|
pngBuf = readFileSync(input);
|
|
127
126
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
const payload = Buffer.from(native.extractPayloadFromPng(pngBuf));
|
|
128
|
+
let name;
|
|
129
|
+
try {
|
|
130
|
+
const rgbResult = native.pngToRgb(pngBuf);
|
|
131
|
+
const pixels = Buffer.from(rgbResult.pixels);
|
|
132
|
+
({ name } = extractPayloadFromPixels(pixels));
|
|
133
|
+
}
|
|
134
|
+
catch { }
|
|
133
135
|
if (payload.length === 0) {
|
|
134
136
|
throw new Error('Empty payload extracted');
|
|
135
137
|
}
|
|
@@ -171,3 +173,105 @@ export async function decodePngToBinary(input, opts = {}) {
|
|
|
171
173
|
}
|
|
172
174
|
return { buf: decompressed, meta: { name } };
|
|
173
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Detect and reverse simple pixel-stretching where each logical pixel
|
|
178
|
+
* is repeated in an Fx×Fy block. Returns { width, height, data } or null.
|
|
179
|
+
*/
|
|
180
|
+
export function unstretchImage(pixels, width, height) {
|
|
181
|
+
if (!Buffer.isBuffer(pixels))
|
|
182
|
+
return null;
|
|
183
|
+
if (pixels.length !== width * height * 3)
|
|
184
|
+
return null;
|
|
185
|
+
try {
|
|
186
|
+
let allWhite = true;
|
|
187
|
+
for (let i = 0; i < pixels.length; i += 3) {
|
|
188
|
+
if (!(pixels[i] === 255 && pixels[i + 1] === 255 && pixels[i + 2] === 255)) {
|
|
189
|
+
allWhite = false;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (allWhite)
|
|
194
|
+
return null;
|
|
195
|
+
let minX = width, minY = height, maxX = -1, maxY = -1;
|
|
196
|
+
for (let y = 0; y < height; y++) {
|
|
197
|
+
for (let x = 0; x < width; x++) {
|
|
198
|
+
const idx = (y * width + x) * 3;
|
|
199
|
+
if (!(pixels[idx] === 255 && pixels[idx + 1] === 255 && pixels[idx + 2] === 255)) {
|
|
200
|
+
if (x < minX)
|
|
201
|
+
minX = x;
|
|
202
|
+
if (y < minY)
|
|
203
|
+
minY = y;
|
|
204
|
+
if (x > maxX)
|
|
205
|
+
maxX = x;
|
|
206
|
+
if (y > maxY)
|
|
207
|
+
maxY = y;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (maxX < 0)
|
|
212
|
+
return null;
|
|
213
|
+
const cropW = maxX - minX + 1;
|
|
214
|
+
const cropH = maxY - minY + 1;
|
|
215
|
+
const colSig = [];
|
|
216
|
+
for (let x = 0; x < cropW; x++) {
|
|
217
|
+
const parts = [];
|
|
218
|
+
for (let y = 0; y < cropH; y++) {
|
|
219
|
+
const idx = ((minY + y) * width + (minX + x)) * 3;
|
|
220
|
+
parts.push(pixels[idx], pixels[idx + 1], pixels[idx + 2]);
|
|
221
|
+
}
|
|
222
|
+
colSig.push(parts.join(','));
|
|
223
|
+
}
|
|
224
|
+
const colGroups = [];
|
|
225
|
+
for (let x = 0; x < colSig.length; x++) {
|
|
226
|
+
if (x === 0 || colSig[x] !== colSig[x - 1])
|
|
227
|
+
colGroups.push({ start: x, len: 1 });
|
|
228
|
+
else
|
|
229
|
+
colGroups[colGroups.length - 1].len++;
|
|
230
|
+
}
|
|
231
|
+
const rowSig = [];
|
|
232
|
+
for (let y = 0; y < cropH; y++) {
|
|
233
|
+
const parts = [];
|
|
234
|
+
for (let x = 0; x < cropW; x++) {
|
|
235
|
+
const idx = ((minY + y) * width + (minX + x)) * 3;
|
|
236
|
+
parts.push(pixels[idx], pixels[idx + 1], pixels[idx + 2]);
|
|
237
|
+
}
|
|
238
|
+
rowSig.push(parts.join(','));
|
|
239
|
+
}
|
|
240
|
+
const rowGroups = [];
|
|
241
|
+
for (let y = 0; y < rowSig.length; y++) {
|
|
242
|
+
if (y === 0 || rowSig[y] !== rowSig[y - 1])
|
|
243
|
+
rowGroups.push({ start: y, len: 1 });
|
|
244
|
+
else
|
|
245
|
+
rowGroups[rowGroups.length - 1].len++;
|
|
246
|
+
}
|
|
247
|
+
const outW = colGroups.length;
|
|
248
|
+
const outH = rowGroups.length;
|
|
249
|
+
const hasRun = colGroups.some(g => g.len > 1) || rowGroups.some(g => g.len > 1);
|
|
250
|
+
if (!hasRun)
|
|
251
|
+
return null;
|
|
252
|
+
const out = Buffer.alloc(outW * outH * 3);
|
|
253
|
+
for (let gy = 0; gy < outH; gy++) {
|
|
254
|
+
for (let gx = 0; gx < outW; gx++) {
|
|
255
|
+
const sx = minX + colGroups[gx].start;
|
|
256
|
+
const sy = minY + rowGroups[gy].start;
|
|
257
|
+
const baseIdx = (sy * width + sx) * 3;
|
|
258
|
+
const r = pixels[baseIdx], g = pixels[baseIdx + 1], b = pixels[baseIdx + 2];
|
|
259
|
+
for (let ry = 0; ry < rowGroups[gy].len; ry++) {
|
|
260
|
+
for (let rx = 0; rx < colGroups[gx].len; rx++) {
|
|
261
|
+
const ix = ((sy + ry) * width + (sx + rx)) * 3;
|
|
262
|
+
if (pixels[ix] !== r || pixels[ix + 1] !== g || pixels[ix + 2] !== b)
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const outIdx = (gy * outW + gx) * 3;
|
|
267
|
+
out[outIdx] = r;
|
|
268
|
+
out[outIdx + 1] = g;
|
|
269
|
+
out[outIdx + 2] = b;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return { width: outW, height: outH, data: out };
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
}
|
package/dist/utils/ecc.js
CHANGED
|
@@ -429,7 +429,6 @@ export function eccDecode(protected_) {
|
|
|
429
429
|
// RS-decode each block
|
|
430
430
|
let totalCorrected = 0;
|
|
431
431
|
const decoded = [];
|
|
432
|
-
const k = dataPerBlock(nsym);
|
|
433
432
|
for (let i = 0; i < numBlocks; i++) {
|
|
434
433
|
const { data, corrected } = rsDecode(blocks[i], nsym);
|
|
435
434
|
totalCorrected += corrected;
|
package/dist/utils/inspection.js
CHANGED
|
@@ -30,7 +30,7 @@ function tryExtractFileListFromChunks(chunks) {
|
|
|
30
30
|
}
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
|
-
export async function listFilesInPng(pngBuf,
|
|
33
|
+
export async function listFilesInPng(pngBuf, _opts = {}) {
|
|
34
34
|
try {
|
|
35
35
|
const chunks = native.extractPngChunks(pngBuf);
|
|
36
36
|
const result = tryExtractFileListFromChunks(chunks);
|
|
@@ -210,7 +210,7 @@ export async function hasPassphraseInPng(pngBuf) {
|
|
|
210
210
|
idx += nameLen;
|
|
211
211
|
if (valid.length < idx + 4 + 1)
|
|
212
212
|
return;
|
|
213
|
-
|
|
213
|
+
valid.readUInt32BE(idx);
|
|
214
214
|
idx += 4;
|
|
215
215
|
if (valid.length < idx + 1)
|
|
216
216
|
return;
|
|
@@ -109,19 +109,6 @@ const GOERTZEL_COEFFS = CARRIERS.map(freq => {
|
|
|
109
109
|
return { k, coeff: 2 * Math.cos(w) };
|
|
110
110
|
});
|
|
111
111
|
// ─── Signal Processing Primitives ───────────────────────────────────────────
|
|
112
|
-
/**
|
|
113
|
-
* Generate a raised-cosine windowed tone burst.
|
|
114
|
-
*/
|
|
115
|
-
function generateTone(freq, numSamples, amplitude) {
|
|
116
|
-
const out = new Float64Array(numSamples);
|
|
117
|
-
const w = (2 * Math.PI * freq) / SAMPLE_RATE;
|
|
118
|
-
for (let n = 0; n < numSamples; n++) {
|
|
119
|
-
// Raised cosine window (Hann)
|
|
120
|
-
const window = 0.5 * (1 - Math.cos((2 * Math.PI * n) / (numSamples - 1)));
|
|
121
|
-
out[n] = amplitude * window * Math.sin(w * n);
|
|
122
|
-
}
|
|
123
|
-
return out;
|
|
124
|
-
}
|
|
125
112
|
/**
|
|
126
113
|
* Goertzel algorithm: compute energy at a specific frequency.
|
|
127
114
|
* Returns normalized power (0–1 range for unit-amplitude input).
|
|
@@ -17,12 +17,8 @@ import { native } from './native.js';
|
|
|
17
17
|
// ─── Configuration ──────────────────────────────────────────────────────────
|
|
18
18
|
/** Finder pattern (7×7 blocks, like QR codes). */
|
|
19
19
|
const FINDER_SIZE = 7;
|
|
20
|
-
/** Alignment pattern (5×5 blocks). */
|
|
21
|
-
const ALIGNMENT_SIZE = 5;
|
|
22
20
|
/** Quiet zone around finder patterns (blocks). */
|
|
23
21
|
const QUIET_ZONE = 1;
|
|
24
|
-
/** Header area width in blocks (next to top-left finder). */
|
|
25
|
-
const HEADER_BLOCKS = 20;
|
|
26
22
|
/** Magic bytes for robust image format. */
|
|
27
23
|
const ROBUST_IMG_MAGIC = Buffer.from('RBI1');
|
|
28
24
|
// ─── Finder Pattern ─────────────────────────────────────────────────────────
|
|
@@ -43,22 +39,6 @@ function finderPattern() {
|
|
|
43
39
|
}
|
|
44
40
|
return p;
|
|
45
41
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Generate a 5×5 alignment pattern.
|
|
48
|
-
*/
|
|
49
|
-
function alignmentPattern() {
|
|
50
|
-
const p = [];
|
|
51
|
-
for (let y = 0; y < ALIGNMENT_SIZE; y++) {
|
|
52
|
-
const row = [];
|
|
53
|
-
for (let x = 0; x < ALIGNMENT_SIZE; x++) {
|
|
54
|
-
const border = y === 0 || y === 4 || x === 0 || x === 4;
|
|
55
|
-
const center = y === 2 && x === 2;
|
|
56
|
-
row.push(border || center);
|
|
57
|
-
}
|
|
58
|
-
p.push(row);
|
|
59
|
-
}
|
|
60
|
-
return p;
|
|
61
|
-
}
|
|
62
42
|
/**
|
|
63
43
|
* Compute grid layout: place finder patterns, quiet zones, and determine
|
|
64
44
|
* which block positions are available for data.
|
|
@@ -294,12 +274,6 @@ const ECC_LEVEL_MAP = {
|
|
|
294
274
|
quartile: 2,
|
|
295
275
|
high: 3,
|
|
296
276
|
};
|
|
297
|
-
const ECC_LEVEL_REVERSE = {
|
|
298
|
-
0: 'low',
|
|
299
|
-
1: 'medium',
|
|
300
|
-
2: 'quartile',
|
|
301
|
-
3: 'high',
|
|
302
|
-
};
|
|
303
277
|
/**
|
|
304
278
|
* Encode binary data into a lossy-resilient PNG image.
|
|
305
279
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "roxify",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.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",
|
|
@@ -10,34 +10,17 @@
|
|
|
10
10
|
"roxify": "dist/cli.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
|
-
"dist",
|
|
14
|
-
"
|
|
15
|
-
"roxify_native-i686-unknown-linux-gnu.node",
|
|
16
|
-
"roxify_native-aarch64-unknown-linux-gnu.node",
|
|
17
|
-
"roxify_native-x86_64-apple-darwin.node",
|
|
18
|
-
"roxify_native-aarch64-apple-darwin.node",
|
|
19
|
-
"roxify_native-x86_64-pc-windows-msvc.node",
|
|
20
|
-
"roxify_native-i686-pc-windows-msvc.node",
|
|
21
|
-
"roxify_native-aarch64-pc-windows-msvc.node",
|
|
22
|
-
"roxify_native-x86_64-pc-windows-gnu.node",
|
|
23
|
-
"libroxify_native-x86_64-unknown-linux-gnu.node",
|
|
24
|
-
"libroxify_native-i686-unknown-linux-gnu.node",
|
|
25
|
-
"libroxify_native-aarch64-unknown-linux-gnu.node",
|
|
26
|
-
"libroxify_native-x86_64-apple-darwin.node",
|
|
27
|
-
"libroxify_native-aarch64-apple-darwin.node",
|
|
28
|
-
"dist/roxify_native.exe",
|
|
29
|
-
"dist/roxify_native",
|
|
30
|
-
"dist/roxify_native-macos-arm64",
|
|
31
|
-
"dist/roxify_native-macos-x64",
|
|
32
|
-
"dist/rox-macos-universal",
|
|
13
|
+
"dist/**/*.js",
|
|
14
|
+
"dist/**/*.d.ts",
|
|
33
15
|
"scripts/postinstall.cjs",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
16
|
+
"roxify_native-*.node",
|
|
17
|
+
"libroxify_native-*.node",
|
|
36
18
|
"README.md",
|
|
37
19
|
"LICENSE"
|
|
38
20
|
],
|
|
39
21
|
"scripts": {
|
|
40
22
|
"build": "tsc",
|
|
23
|
+
"bundle": "esbuild src/cli.ts --bundle --platform=node --target=node18 --outfile=dist/cli.js --format=esm --minify --external:./index.js --external:./pack.js && tsc --emitDeclarationOnly --declaration --declarationDir dist",
|
|
41
24
|
"prebuild:pkg": "node scripts/copy-cli-binary.js",
|
|
42
25
|
"build:native": "cargo build --release --lib",
|
|
43
26
|
"build:native:linux": "cargo build --release --lib --target x86_64-unknown-linux-gnu",
|
|
@@ -59,7 +42,7 @@
|
|
|
59
42
|
"clean:targets": "node scripts/clean-artifacts.js",
|
|
60
43
|
"release:prepare": "npm run build && npm run build:native:targets && node scripts/prepare-release.cjs",
|
|
61
44
|
"release:github": "npm run release:prepare && node scripts/create-gh-release.cjs",
|
|
62
|
-
"package:prepare": "npm run build && npm run build:native:targets && node scripts/pack-npm.cjs",
|
|
45
|
+
"package:prepare": "npm run build && npm run bundle && npm run build:native:targets && node scripts/pack-npm.cjs",
|
|
63
46
|
"publish:npm": "npm run package:prepare && echo 'Run npm publish --access public'",
|
|
64
47
|
"release:flow": "node scripts/release-flow.cjs",
|
|
65
48
|
"release:flow:auto": "AUTO_PUBLISH=1 node scripts/release-flow.cjs",
|
|
@@ -103,12 +86,12 @@
|
|
|
103
86
|
"devDependencies": {
|
|
104
87
|
"@types/node": "^22.0.0",
|
|
105
88
|
"pkg": "^5.8.1",
|
|
106
|
-
"typescript": "^5.9.3"
|
|
89
|
+
"typescript": "^5.9.3",
|
|
90
|
+
"esbuild": "^0.18.0",
|
|
91
|
+
"pngjs": "^7.0.0"
|
|
107
92
|
},
|
|
108
93
|
"engines": {
|
|
109
94
|
"node": ">=18.0.0"
|
|
110
95
|
},
|
|
111
|
-
"dependencies": {
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
}
|
|
96
|
+
"dependencies": {}
|
|
97
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/scripts/postinstall.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { execSync } = require('child_process');
|
|
2
|
-
const { existsSync, copyFileSync, mkdirSync } = require('fs');
|
|
2
|
+
const { existsSync, copyFileSync, mkdirSync, readdirSync, unlinkSync } = require('fs');
|
|
3
3
|
const { join } = require('path');
|
|
4
4
|
const { platform, arch } = require('os');
|
|
5
5
|
|
|
@@ -157,5 +157,26 @@ function ensureNativeLib() {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
if (process.env.ROXIFY_ENABLE_RUST_CLI === '1') {
|
|
161
|
+
ensureCliBinary();
|
|
162
|
+
}
|
|
161
163
|
ensureNativeLib();
|
|
164
|
+
|
|
165
|
+
// Cleanup: remove other platform .node artifacts to reduce disk usage after install
|
|
166
|
+
try {
|
|
167
|
+
const triples = getTriples();
|
|
168
|
+
if (triples && triples.length) {
|
|
169
|
+
const files = readdirSync(root);
|
|
170
|
+
for (const f of files) {
|
|
171
|
+
// match roxify_native-<triple>.node or libroxify_native-<triple>.node
|
|
172
|
+
const m = f.match(/^(lib)?roxify_native-(.+)\.node$/);
|
|
173
|
+
if (m) {
|
|
174
|
+
const fileTriple = m[2];
|
|
175
|
+
// keep if fileTriple is one of the allowed triples
|
|
176
|
+
if (!triples.includes(fileTriple)) {
|
|
177
|
+
try { unlinkSync(join(root, f)); console.log(`roxify: removed ${f}`); } catch (e) { }
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
} catch (e) { }
|
package/Cargo.toml
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "roxify_native"
|
|
3
|
-
version = "1.13.8"
|
|
4
|
-
edition = "2021"
|
|
5
|
-
publish = false
|
|
6
|
-
|
|
7
|
-
[lib]
|
|
8
|
-
name = "roxify_native"
|
|
9
|
-
crate-type = ["cdylib"]
|
|
10
|
-
path = "native/lib.rs"
|
|
11
|
-
|
|
12
|
-
[[bin]]
|
|
13
|
-
name = "roxify_native"
|
|
14
|
-
path = "native/main.rs"
|
|
15
|
-
|
|
16
|
-
[[bin]]
|
|
17
|
-
name = "bench_hybrid"
|
|
18
|
-
path = "native/bench_hybrid.rs"
|
|
19
|
-
|
|
20
|
-
[[bin]]
|
|
21
|
-
name = "test_stages"
|
|
22
|
-
path = "native/test_stages.rs"
|
|
23
|
-
|
|
24
|
-
[[bin]]
|
|
25
|
-
name = "test_small_bwt"
|
|
26
|
-
path = "native/test_small_bwt.rs"
|
|
27
|
-
|
|
28
|
-
[dev-dependencies]
|
|
29
|
-
|
|
30
|
-
[dependencies]
|
|
31
|
-
napi = "2"
|
|
32
|
-
napi-derive = "2"
|
|
33
|
-
rayon = "1.7"
|
|
34
|
-
zstd = { version = "0.11", features = ["zstdmt"] }
|
|
35
|
-
crc32fast = "1.3"
|
|
36
|
-
num_cpus = "1.16"
|
|
37
|
-
clap = { version = "4", features = ["derive"] }
|
|
38
|
-
serde = { version = "1.0", features = ["derive"] }
|
|
39
|
-
serde_json = "1.0"
|
|
40
|
-
anyhow = "1.0"
|
|
41
|
-
png = "0.18.0"
|
|
42
|
-
image = { version = "0.25", default-features = false, features = ["png"] }
|
|
43
|
-
# indicatif removed from default deps to reduce heavy build graph
|
|
44
|
-
walkdir = "2.5.0"
|
|
45
|
-
tar = "0.4"
|
|
46
|
-
aes-gcm = "0.10"
|
|
47
|
-
aes = "0.8"
|
|
48
|
-
ctr = "0.9"
|
|
49
|
-
cipher = { version = "0.4", features = ["std"] }
|
|
50
|
-
hmac = "0.12"
|
|
51
|
-
pbkdf2 = "0.12"
|
|
52
|
-
rand = "0.8"
|
|
53
|
-
sha2 = "0.10"
|
|
54
|
-
mimalloc = "0.1"
|
|
55
|
-
simd-adler32 = "0.3"
|
|
56
|
-
|
|
57
|
-
memmap2 = "0.9"
|
|
58
|
-
bytemuck = { version = "1.14", features = ["derive"] }
|
|
59
|
-
tokio = { version = "1", features = ["sync", "rt"], optional = true }
|
|
60
|
-
parking_lot = "0.12"
|
|
61
|
-
libsais = { version = "0.2.0", default-features = false }
|
|
62
|
-
libc = "0.2"
|
|
63
|
-
|
|
64
|
-
[features]
|
|
65
|
-
default = []
|
|
66
|
-
async = ["tokio"]
|
|
67
|
-
|
|
68
|
-
[profile.release]
|
|
69
|
-
opt-level = 3
|
|
70
|
-
lto = "fat"
|
|
71
|
-
codegen-units = 1
|
|
72
|
-
strip = true
|
|
73
|
-
panic = "abort"
|
|
74
|
-
|
|
75
|
-
[profile.release-size]
|
|
76
|
-
inherits = "release"
|
|
77
|
-
opt-level = "z"
|
|
78
|
-
lto = true
|
|
79
|
-
strip = true
|
|
80
|
-
|
|
81
|
-
[profile.fastdev]
|
|
82
|
-
# Fast development profile for minimal user CPU and fast compilation.
|
|
83
|
-
# Lower optimization and high codegen units to parallelize compilation work,
|
|
84
|
-
# enable incremental to speed up subsequent incremental builds.
|
|
85
|
-
inherits = "release"
|
|
86
|
-
opt-level = 1
|
|
87
|
-
lto = false
|
|
88
|
-
codegen-units = 16
|
|
89
|
-
debug = false
|
|
90
|
-
incremental = true
|
|
91
|
-
panic = "abort"
|
package/dist/roxify_native
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/roxify_native.exe
DELETED
|
Binary file
|