17 Commits

Author SHA1 Message Date
4276b9d668 fix: skip zip test 2025-08-15 19:47:50 +10:00
4fb9bb7563 fix: manifest sizing for slow backends 2025-08-15 16:49:18 +10:00
913dc2f58d feat: add zip speed test 2025-08-15 12:17:10 +10:00
7ec5e9f215 fix: zip file reader offset 2025-08-13 16:22:48 +10:00
b67a67d809 fix: bump version 2025-08-13 11:38:09 +10:00
87b19a5c8c fix: test 2025-08-13 11:37:41 +10:00
dc3a420986 feat: performance improvements, fix zip 2025-08-13 11:35:50 +10:00
1665033fd9 test: add subdir tests 2025-07-18 22:46:42 +10:00
2969d64c45 feat: move to bigints for larger file sizes 2025-07-14 15:17:38 +10:00
e525ff44bb Merge pull request #3 from nickbabcock/rawzip-0.3
Bump rawzip to 0.3
2025-07-13 23:08:10 +10:00
52a685391a Bump rawzip to 0.3
No need for any patches ;)
2025-07-13 07:46:36 -05:00
535d5a4062 i give up, bump all versions 2025-07-02 20:54:06 +10:00
450734f5c9 bump version 2025-07-02 20:45:58 +10:00
20e2eda381 fix: regenerate lockfile 2025-07-02 20:45:02 +10:00
04d3f2dd8c fix: revert napi update 2025-07-02 20:33:53 +10:00
59ca57ee1b fix: bump napi version and commit lockfile 2025-07-02 20:20:19 +10:00
8f4b2a6c6d feat: add file peaking, 1.5.0 2025-07-02 18:03:35 +10:00
16 changed files with 1939 additions and 328 deletions

1
.gitignore vendored
View File

@ -186,7 +186,6 @@ $RECYCLE.BIN/
#Added by cargo #Added by cargo
/target /target
Cargo.lock
.pnp.* .pnp.*
.yarn/* .yarn/*

1264
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,12 +9,12 @@ crate-type = ["cdylib"]
[dependencies] [dependencies]
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "3.0.0-alpha.33", default-features = false, features = [ napi = { version = "3.0.0-beta.11", default-features = false, features = [
"napi4", "napi6",
"async", "async",
"web_stream", "web_stream",
] } ] }
napi-derive = "3.0.0-alpha.33" napi-derive = "3.0.0-beta.11"
hex = "0.4.3" hex = "0.4.3"
serde_json = "1.0.128" serde_json = "1.0.128"
md5 = "0.7.0" md5 = "0.7.0"
@ -24,14 +24,13 @@ webpki = "0.22.4"
ring = "0.17.14" ring = "0.17.14"
tokio = { version = "1.45.1", features = ["fs", "io-util"] } tokio = { version = "1.45.1", features = ["fs", "io-util"] }
tokio-util = { version = "0.7.15", features = ["codec"] } tokio-util = { version = "0.7.15", features = ["codec"] }
rawzip = "0.2.0" rawzip = "0.3.0"
dyn-clone = "1.0.20"
flate2 = "1.1.2"
[package.metadata.patch] [package.metadata.patch]
crates = ["rawzip"] crates = ["rawzip"]
[patch.crates-io]
rawzip = { path="./target/patch/rawzip-0.2.0" }
[dependencies.x509-parser] [dependencies.x509-parser]
version = "0.17.0" version = "0.17.0"
features = ["verify"] features = ["verify"]

22
__test__/debug.spec.mjs Normal file
View File

@ -0,0 +1,22 @@
import test from "ava";
import { DropletHandler, generateManifest } from "../index.js";
test.skip("debug", async (t) => {
const handler = new DropletHandler();
console.log("created handler");
const manifest = JSON.parse(
await new Promise((r, e) =>
generateManifest(
handler,
"./assets/TheGame.zip",
(_, __) => {},
(_, __) => {},
(err, manifest) => (err ? e(err) : r(manifest))
)
)
);
return t.pass();
});

View File

@ -2,7 +2,7 @@ import test from "ava";
import fs from "node:fs"; import fs from "node:fs";
import path from "path"; import path from "path";
import { generateManifest, listFiles } from "../index.js"; import { DropletHandler, generateManifest } from "../index.js";
test("numerous small file", async (t) => { test("numerous small file", async (t) => {
// Setup test dir // Setup test dir
@ -18,9 +18,12 @@ test("numerous small file", async (t) => {
fs.writeFileSync(fileName, i.toString()); fs.writeFileSync(fileName, i.toString());
} }
const dropletHandler = new DropletHandler();
const manifest = JSON.parse( const manifest = JSON.parse(
await new Promise((r, e) => await new Promise((r, e) =>
generateManifest( generateManifest(
dropletHandler,
dirName, dirName,
(_, __) => {}, (_, __) => {},
(_, __) => {}, (_, __) => {},
@ -56,7 +59,6 @@ test("numerous small file", async (t) => {
test.skip("performance test", async (t) => { test.skip("performance test", async (t) => {
t.timeout(5 * 60 * 1000); t.timeout(5 * 60 * 1000);
return t.pass();
const dirName = "./.test/pt"; const dirName = "./.test/pt";
if (fs.existsSync(dirName)) fs.rmSync(dirName, { recursive: true }); if (fs.existsSync(dirName)) fs.rmSync(dirName, { recursive: true });
fs.mkdirSync(dirName, { recursive: true }); fs.mkdirSync(dirName, { recursive: true });
@ -73,9 +75,12 @@ test.skip("performance test", async (t) => {
randomStream.on("end", r); randomStream.on("end", r);
}); });
const dropletHandler = new DropletHandler();
const start = Date.now(); const start = Date.now();
await new Promise((r, e) => await new Promise((r, e) =>
generateManifest( generateManifest(
dropletHandler,
dirName, dirName,
(_, __) => {}, (_, __) => {},
(_, __) => {}, (_, __) => {},

View File

@ -1,8 +1,9 @@
import test from "ava"; import test from "ava";
import fs from "node:fs"; import fs from "node:fs";
import path from "path"; import path from "path";
import prettyBytes from "pretty-bytes";
import droplet, { generateManifest } from "../index.js"; import droplet, { DropletHandler, generateManifest } from "../index.js";
test("check alt thread util", async (t) => { test("check alt thread util", async (t) => {
let endtime1, endtime2; let endtime1, endtime2;
@ -23,6 +24,28 @@ test("check alt thread util", async (t) => {
t.pass(); t.pass();
}); });
test("list files", async (t) => {
const dirName = "./.listfiles";
if (fs.existsSync(dirName)) fs.rmSync(dirName, { recursive: true });
fs.mkdirSync(dirName, { recursive: true });
fs.mkdirSync(dirName + "/subdir", { recursive: true });
fs.mkdirSync(dirName + "/subddir", { recursive: true });
fs.writeFileSync(dirName + "/root.txt", "root");
fs.writeFileSync(dirName + "/subdir/one.txt", "the first subdir");
fs.writeFileSync(dirName + "/subddir/two.txt", "the second");
const dropletHandler = new DropletHandler();
const files = dropletHandler.listFiles(dirName);
t.assert(
files.sort().join("\n"),
["root.txt", "subddir/two.txt", "subdir/one.txt"].join("\n")
);
fs.rmSync(dirName, { recursive: true });
});
test("read file", async (t) => { test("read file", async (t) => {
const dirName = "./.test2"; const dirName = "./.test2";
if (fs.existsSync(dirName)) fs.rmSync(dirName, { recursive: true }); if (fs.existsSync(dirName)) fs.rmSync(dirName, { recursive: true });
@ -32,11 +55,13 @@ test("read file", async (t) => {
fs.writeFileSync(dirName + "/TESTFILE", testString); fs.writeFileSync(dirName + "/TESTFILE", testString);
const stream = droplet.readFile(dirName, "TESTFILE"); const dropletHandler = new DropletHandler();
const stream = dropletHandler.readFile(dirName, "TESTFILE");
let finalString = ""; let finalString = "";
for await (const chunk of stream) { for await (const chunk of stream.getStream()) {
// Do something with each 'chunk' // Do something with each 'chunk'
finalString += String.fromCharCode.apply(null, chunk); finalString += String.fromCharCode.apply(null, chunk);
} }
@ -53,11 +78,17 @@ test("read file offset", async (t) => {
const testString = "0123456789"; const testString = "0123456789";
fs.writeFileSync(dirName + "/TESTFILE", testString); fs.writeFileSync(dirName + "/TESTFILE", testString);
const stream = droplet.readFile(dirName, "TESTFILE", 1, 4); const dropletHandler = new DropletHandler();
const stream = dropletHandler.readFile(
dirName,
"TESTFILE",
BigInt(1),
BigInt(4)
);
let finalString = ""; let finalString = "";
for await (const chunk of stream) { for await (const chunk of stream.getStream()) {
// Do something with each 'chunk' // Do something with each 'chunk'
finalString += String.fromCharCode.apply(null, chunk); finalString += String.fromCharCode.apply(null, chunk);
} }
@ -71,11 +102,50 @@ test("read file offset", async (t) => {
fs.rmSync(dirName, { recursive: true }); fs.rmSync(dirName, { recursive: true });
}); });
test("zip file reader", async (t) => { test.skip("zip speed test", async (t) => {
return t.pass(); t.timeout(100_000_000);
const dropletHandler = new DropletHandler();
const stream = dropletHandler.readFile("./assets/TheGame.zip", "setup.exe");
let totalRead = 0;
let totalSeconds = 0;
let lastTime = process.hrtime.bigint();
const timeThreshold = BigInt(1_000_000_000);
let runningTotal = 0;
let runningTime = BigInt(0);
for await (const chunk of stream.getStream()) {
// Do something with each 'chunk'
const currentTime = process.hrtime.bigint();
const timeDiff = currentTime - lastTime;
lastTime = currentTime;
runningTime += timeDiff;
runningTotal += chunk.length;
if (runningTime >= timeThreshold) {
console.log(`${prettyBytes(runningTotal)}/s`);
totalRead += runningTotal;
totalSeconds += 1;
runningTime = BigInt(0);
runningTotal = 0;
}
}
const roughAverage = totalRead / totalSeconds;
console.log(`total rough average: ${prettyBytes(roughAverage)}/s`);
t.pass();
});
test.skip("zip manifest test", async (t) => {
const dropletHandler = new DropletHandler();
const manifest = JSON.parse( const manifest = JSON.parse(
await new Promise((r, e) => await new Promise((r, e) =>
generateManifest( generateManifest(
dropletHandler,
"./assets/TheGame.zip", "./assets/TheGame.zip",
(_, __) => {}, (_, __) => {},
(_, __) => {}, (_, __) => {},
@ -84,17 +154,12 @@ test("zip file reader", async (t) => {
) )
); );
console.log(manifest); const file = manifest[Object.keys(manifest).at(0)];
const amount = file.ids.length;
return t.pass(); if(amount > 20) {
const stream = droplet.readFile("./assets/TheGame.zip", "TheGame/setup.exe"); return t.fail(`Zip manifest has ${amount} chunks, more than 20`);
let finalString;
for await (const chunk of stream) {
console.log(`read chunk ${chunk}`);
// Do something with each 'chunk'
finalString += String.fromCharCode.apply(null, chunk);
} }
console.log(finalString); t.pass();
}); });

View File

@ -1,3 +1,4 @@
# yes "droplet is awesome" | dd of=./setup.exe bs=1024 count=1000000
dd if=/dev/random of=./setup.exe bs=1024 count=1000000 dd if=/dev/random of=./setup.exe bs=1024 count=1000000
zip TheGame.zip setup.exe zip TheGame.zip setup.exe
rm setup.exe rm setup.exe

23
index.d.ts vendored
View File

@ -1,19 +1,28 @@
/* auto-generated by NAPI-RS */ /* auto-generated by NAPI-RS */
/* eslint-disable */ /* eslint-disable */
/**
* Persistent object so we can cache things between commands
*/
export declare class DropletHandler {
constructor()
hasBackendForPath(path: string): boolean
listFiles(path: string): Array<string>
peekFile(path: string, subPath: string): bigint
readFile(path: string, subPath: string, start?: bigint | undefined | null, end?: bigint | undefined | null): JsDropStreamable
}
export declare class JsDropStreamable {
getStream(): any
}
export declare function callAltThreadFunc(tsfn: ((err: Error | null, ) => any)): void export declare function callAltThreadFunc(tsfn: ((err: Error | null, ) => any)): void
export declare function generateClientCertificate(clientId: string, clientName: string, rootCa: string, rootCaPrivate: string): Array<string> export declare function generateClientCertificate(clientId: string, clientName: string, rootCa: string, rootCaPrivate: string): Array<string>
export declare function generateManifest(dir: string, progressSfn: ((err: Error | null, arg: number) => any), logSfn: ((err: Error | null, arg: string) => any), callbackSfn: ((err: Error | null, arg: string) => any)): void export declare function generateManifest(dropletHandler: DropletHandler, dir: string, progressSfn: ((err: Error | null, arg: number) => any), logSfn: ((err: Error | null, arg: string) => any), callbackSfn: ((err: Error | null, arg: string) => any)): void
export declare function generateRootCa(): Array<string> export declare function generateRootCa(): Array<string>
export declare function hasBackendForPath(path: string): boolean
export declare function listFiles(path: string): Array<string>
export declare function readFile(path: string, subPath: string, start?: number | undefined | null, end?: number | undefined | null): ReadableStream<Buffer> | null
export declare function signNonce(privateKey: string, nonce: string): string export declare function signNonce(privateKey: string, nonce: string): string
export declare function verifyClientCertificate(clientCert: string, rootCa: string): boolean export declare function verifyClientCertificate(clientCert: string, rootCa: string): boolean

View File

@ -365,23 +365,23 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
if (!nativeBinding) { if (!nativeBinding) {
if (loadErrors.length > 0) { if (loadErrors.length > 0) {
// TODO Link to documentation with potential fixes throw new Error(
// - The package owner could build/publish bindings for this arch `Cannot find native binding. ` +
// - The user may need to bundle the correct files `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
// - The user may need to re-install node_modules to get new packages 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
throw new Error('Failed to load native binding', { cause: loadErrors }) { cause: loadErrors }
)
} }
throw new Error(`Failed to load native binding`) throw new Error(`Failed to load native binding`)
} }
module.exports = nativeBinding module.exports = nativeBinding
module.exports.DropletHandler = nativeBinding.DropletHandler
module.exports.JsDropStreamable = nativeBinding.JsDropStreamable
module.exports.callAltThreadFunc = nativeBinding.callAltThreadFunc module.exports.callAltThreadFunc = nativeBinding.callAltThreadFunc
module.exports.generateClientCertificate = nativeBinding.generateClientCertificate module.exports.generateClientCertificate = nativeBinding.generateClientCertificate
module.exports.generateManifest = nativeBinding.generateManifest module.exports.generateManifest = nativeBinding.generateManifest
module.exports.generateRootCa = nativeBinding.generateRootCa module.exports.generateRootCa = nativeBinding.generateRootCa
module.exports.hasBackendForPath = nativeBinding.hasBackendForPath
module.exports.listFiles = nativeBinding.listFiles
module.exports.readFile = nativeBinding.readFile
module.exports.signNonce = nativeBinding.signNonce module.exports.signNonce = nativeBinding.signNonce
module.exports.verifyClientCertificate = nativeBinding.verifyClientCertificate module.exports.verifyClientCertificate = nativeBinding.verifyClientCertificate
module.exports.verifyNonce = nativeBinding.verifyNonce module.exports.verifyNonce = nativeBinding.verifyNonce

View File

@ -1,6 +1,6 @@
{ {
"name": "@drop-oss/droplet", "name": "@drop-oss/droplet",
"version": "1.4.3", "version": "2.1.1",
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",
"napi": { "napi": {
@ -24,10 +24,19 @@
"devDependencies": { "devDependencies": {
"@napi-rs/cli": "3.0.0-alpha.91", "@napi-rs/cli": "3.0.0-alpha.91",
"@types/node": "^22.13.10", "@types/node": "^22.13.10",
"ava": "^6.2.0" "ava": "^6.2.0",
"pretty-bytes": "^7.0.1",
"tsimp": "^2.0.12"
}, },
"ava": { "ava": {
"timeout": "3m" "timeout": "3m",
"extensions": [
"cjs",
"mjs",
"js",
"ts",
"mts"
]
}, },
"engines": { "engines": {
"node": ">= 10" "node": ">= 10"

View File

@ -1,26 +0,0 @@
diff --git a/src/archive.rs b/src/archive.rs
index 1203015..837c405 100644
--- a/src/archive.rs
+++ b/src/archive.rs
@@ -275,7 +275,7 @@ impl<'data> Iterator for ZipSliceEntries<'data> {
/// ```
#[derive(Debug, Clone)]
pub struct ZipArchive<R> {
- pub(crate) reader: R,
+ pub reader: R,
pub(crate) comment: ZipString,
pub(crate) eocd: EndOfCentralDirectory,
}
@@ -431,9 +431,9 @@ where
#[derive(Debug, Clone)]
pub struct ZipEntry<'archive, R> {
archive: &'archive ZipArchive<R>,
- body_offset: u64,
- body_end_offset: u64,
- entry: ZipArchiveEntryWayfinder,
+ pub body_offset: u64,
+ pub body_end_offset: u64,
+ pub entry: ZipArchiveEntryWayfinder,
}
impl<'archive, R> ZipEntry<'archive, R>

View File

@ -1,7 +1,6 @@
use std::{ use std::{
collections::HashMap, collections::HashMap,
io::{BufRead, BufReader}, io::{BufRead, BufReader},
path::Path,
sync::Arc, sync::Arc,
thread, thread,
}; };
@ -13,8 +12,7 @@ use napi::{
use serde_json::json; use serde_json::json;
use uuid::Uuid; use uuid::Uuid;
use crate::version::utils::create_backend_for_path; use crate::version::{types::VersionBackend, utils::DropletHandler};
const CHUNK_SIZE: usize = 1024 * 1024 * 64; const CHUNK_SIZE: usize = 1024 * 1024 * 64;
@ -36,15 +34,18 @@ pub fn call_alt_thread_func(tsfn: Arc<ThreadsafeFunction<()>>) -> Result<(), Str
} }
#[napi] #[napi]
pub fn generate_manifest( pub fn generate_manifest<'a>(
droplet_handler: &mut DropletHandler,
dir: String, dir: String,
progress_sfn: ThreadsafeFunction<i32>, progress_sfn: ThreadsafeFunction<i32>,
log_sfn: ThreadsafeFunction<String>, log_sfn: ThreadsafeFunction<String>,
callback_sfn: ThreadsafeFunction<String>, callback_sfn: ThreadsafeFunction<String>,
) -> Result<(), String> { ) -> Result<()> {
thread::spawn(move || { let backend: &mut Box<dyn VersionBackend + Send> = droplet_handler
let base_dir = Path::new(&dir); .create_backend_for_path(dir)
let mut backend = create_backend_for_path(base_dir).unwrap(); .ok_or(napi::Error::from_reason(
"Could not create backend for path.",
))?;
let files = backend.list_files(); let files = backend.list_files();
// Filepath to chunk data // Filepath to chunk data
@ -54,8 +55,8 @@ pub fn generate_manifest(
let mut i: i32 = 0; let mut i: i32 = 0;
for version_file in files { for version_file in files {
let raw_reader= backend.reader(&version_file).unwrap(); let reader = backend.reader(&version_file).unwrap();
let mut reader = BufReader::with_capacity(CHUNK_SIZE, raw_reader); let mut reader = BufReader::with_capacity(8128, reader);
let mut chunk_data = ChunkData { let mut chunk_data = ChunkData {
permissions: version_file.permission, permissions: version_file.permission,
@ -66,12 +67,28 @@ pub fn generate_manifest(
let mut chunk_index = 0; let mut chunk_index = 0;
loop { loop {
let mut length = 0;
let mut buffer: Vec<u8> = Vec::new(); let mut buffer: Vec<u8> = Vec::new();
reader.fill_buf().unwrap().clone_into(&mut buffer); let mut file_empty = false;
let length = buffer.len();
if length == 0 { loop {
break; let read_buf = reader.fill_buf().unwrap();
let buf_length = read_buf.len();
length += buf_length;
if length >= CHUNK_SIZE {
break;
}
// If we're out of data, add this chunk and then move onto the next file
if buf_length == 0 {
file_empty = true;
break;
}
buffer.extend_from_slice(read_buf);
reader.consume(length);
} }
let chunk_id = Uuid::new_v4(); let chunk_id = Uuid::new_v4();
@ -86,10 +103,14 @@ pub fn generate_manifest(
"Processed chunk {} for {}", "Processed chunk {} for {}",
chunk_index, &version_file.relative_filename chunk_index, &version_file.relative_filename
); );
log_sfn.call(Ok(log_str), ThreadsafeFunctionCallMode::Blocking); log_sfn.call(Ok(log_str), ThreadsafeFunctionCallMode::Blocking);
reader.consume(length);
chunk_index += 1; chunk_index += 1;
if file_empty {
break;
}
} }
chunks.insert(version_file.relative_filename, chunk_data); chunks.insert(version_file.relative_filename, chunk_data);
@ -103,7 +124,6 @@ pub fn generate_manifest(
Ok(json!(chunks).to_string()), Ok(json!(chunks).to_string()),
ThreadsafeFunctionCallMode::Blocking, ThreadsafeFunctionCallMode::Blocking,
); );
});
Ok(()) Ok(())
} }

View File

@ -1,24 +1,34 @@
use core::arch;
#[cfg(unix)] #[cfg(unix)]
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
use std::{ use std::{
fs::File, fs::{self, metadata, File},
io::{self, Read}, io::{self, Read, Sink},
path::PathBuf, path::{Path, PathBuf},
pin::Pin,
rc::Rc,
sync::Arc, sync::Arc,
}; };
use flate2::read::DeflateDecoder;
use rawzip::{ use rawzip::{
FileReader, ReaderAt, ZipArchive, ZipArchiveEntryWayfinder, ZipEntry, RECOMMENDED_BUFFER_SIZE, FileReader, ZipArchive, ZipArchiveEntryWayfinder, ZipEntry, ZipReader, RECOMMENDED_BUFFER_SIZE,
}; };
use crate::version::{ use crate::version::types::{MinimumFileObject, Skippable, VersionBackend, VersionFile};
types::{MinimumFileObject, Skippable, VersionBackend, VersionFile},
utils::_list_files,
};
pub fn _list_files(vec: &mut Vec<PathBuf>, path: &Path) {
if metadata(path).unwrap().is_dir() {
let paths = fs::read_dir(path).unwrap();
for path_result in paths {
let full_path = path_result.unwrap().path();
if metadata(&full_path).unwrap().is_dir() {
_list_files(vec, &full_path);
} else {
vec.push(full_path);
}
}
}
}
#[derive(Clone)]
pub struct PathVersionBackend { pub struct PathVersionBackend {
pub base_dir: PathBuf, pub base_dir: PathBuf,
} }
@ -30,39 +40,55 @@ impl VersionBackend for PathVersionBackend {
let mut results = Vec::new(); let mut results = Vec::new();
for pathbuf in vec.iter() { for pathbuf in vec.iter() {
let file = File::open(pathbuf.clone()).unwrap();
let relative = pathbuf.strip_prefix(self.base_dir.clone()).unwrap(); let relative = pathbuf.strip_prefix(self.base_dir.clone()).unwrap();
let metadata = file.try_clone().unwrap().metadata().unwrap();
let permission_object = metadata.permissions();
let permissions = {
let perm: u32;
#[cfg(target_family = "unix")]
{
perm = permission_object.mode();
}
#[cfg(not(target_family = "unix"))]
{
perm = 0
}
perm
};
results.push(VersionFile { results.push(
relative_filename: relative.to_string_lossy().to_string(), self
permission: permissions, .peek_file(relative.to_str().unwrap().to_owned())
}); .unwrap(),
);
} }
results results
} }
fn reader(&mut self, file: &VersionFile) -> Option<Box<(dyn MinimumFileObject + 'static)>> { fn reader(&mut self, file: &VersionFile) -> Option<Box<dyn MinimumFileObject + 'static>> {
let file = File::open(self.base_dir.join(file.relative_filename.clone())).ok()?; let file = File::open(self.base_dir.join(file.relative_filename.clone())).ok()?;
return Some(Box::new(file)); return Some(Box::new(file));
} }
fn peek_file(&mut self, sub_path: String) -> Option<VersionFile> {
let pathbuf = self.base_dir.join(sub_path.clone());
if !pathbuf.exists() {
return None;
};
let file = File::open(pathbuf.clone()).unwrap();
let metadata = file.try_clone().unwrap().metadata().unwrap();
let permission_object = metadata.permissions();
let permissions = {
let perm: u32;
#[cfg(target_family = "unix")]
{
perm = permission_object.mode();
}
#[cfg(not(target_family = "unix"))]
{
perm = 0
}
perm
};
Some(VersionFile {
relative_filename: sub_path,
permission: permissions,
size: metadata.len(),
})
}
} }
#[derive(Clone)]
pub struct ZipVersionBackend { pub struct ZipVersionBackend {
archive: Arc<ZipArchive<FileReader>>, archive: Arc<ZipArchive<FileReader>>,
} }
@ -74,51 +100,51 @@ impl ZipVersionBackend {
} }
} }
pub fn new_entry(&self, entry: ZipEntry<'_, FileReader>) -> ZipFileWrapper { pub fn new_entry<'archive>(
ZipFileWrapper { &self,
archive: self.archive.clone(), entry: ZipEntry<'archive, FileReader>,
wayfinder: entry.entry, ) -> ZipFileWrapper<'archive> {
offset: entry.body_offset, let deflater = DeflateDecoder::new(entry.reader());
end_offset: entry.body_end_offset, ZipFileWrapper { reader: deflater }
}
}
}
impl Drop for ZipVersionBackend {
fn drop(&mut self) {
println!("dropping archive");
} }
} }
struct ZipFileWrapper { pub struct ZipFileWrapper<'archive> {
pub archive: Arc<ZipArchive<FileReader>>, reader: DeflateDecoder<ZipReader<'archive, FileReader>>,
wayfinder: ZipArchiveEntryWayfinder,
offset: u64,
end_offset: u64,
} }
impl Read for ZipFileWrapper { impl<'a> Read for ZipFileWrapper<'a> {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
let read_size = buf.len().min((self.end_offset - self.offset) as usize); let read = self.reader.read(buf)?;
let read = self
.archive
.reader
.read_at(&mut buf[..read_size], self.offset)?;
self.offset += read as u64;
Ok(read) Ok(read)
} }
} }
impl Skippable for ZipFileWrapper { impl<'a> Skippable for ZipFileWrapper<'a> {
fn skip(&mut self, amount: u64) { fn skip(&mut self, amount: u64) {
/*io::copy( io::copy(&mut self.take(amount), &mut Sink::default()).unwrap();
&mut self.inner.reader().by_ref().take(amount),
&mut io::sink(),
)
.unwrap();
*/
} }
} }
impl MinimumFileObject for ZipFileWrapper {} impl<'a> MinimumFileObject for ZipFileWrapper<'a> {}
impl ZipVersionBackend {
fn find_wayfinder(&mut self, filename: &str) -> Option<ZipArchiveEntryWayfinder> {
let read_buffer = &mut [0u8; RECOMMENDED_BUFFER_SIZE];
let mut entries = self.archive.entries(read_buffer);
let entry = loop {
if let Some(v) = entries.next_entry().unwrap() {
if v.file_path().try_normalize().unwrap().as_ref() == filename {
break Some(v);
}
} else {
break None;
}
}?;
let wayfinder = entry.wayfinder();
Some(wayfinder)
}
}
impl VersionBackend for ZipVersionBackend { impl VersionBackend for ZipVersionBackend {
fn list_files(&mut self) -> Vec<VersionFile> { fn list_files(&mut self) -> Vec<VersionFile> {
let mut results = Vec::new(); let mut results = Vec::new();
@ -129,31 +155,30 @@ impl VersionBackend for ZipVersionBackend {
continue; continue;
} }
results.push(VersionFile { results.push(VersionFile {
relative_filename: entry.file_safe_path().unwrap().to_string(), relative_filename: String::from(entry.file_path().try_normalize().unwrap()),
permission: 744, // apparently ZIPs with permissions are not supported by this library, so we let the owner do anything permission: entry.mode().permissions(),
size: entry.uncompressed_size_hint(),
}); });
} }
results results
} }
fn reader(&mut self, file: &VersionFile) -> Option<Box<(dyn MinimumFileObject)>> { fn reader(&mut self, file: &VersionFile) -> Option<Box<dyn MinimumFileObject + '_>> {
let read_buffer = &mut [0u8; RECOMMENDED_BUFFER_SIZE]; let wayfinder = self.find_wayfinder(&file.relative_filename)?;
let mut entries = self.archive.entries(read_buffer);
let entry = loop {
if let Some(v) = entries.next_entry().unwrap() {
if v.file_safe_path().unwrap().to_string() == file.relative_filename {
break Some(v);
}
} else {
break None;
}
}?;
let wayfinder = entry.wayfinder();
let local_entry = self.archive.get_entry(wayfinder).unwrap(); let local_entry = self.archive.get_entry(wayfinder).unwrap();
let wrapper = self.new_entry(local_entry); let wrapper = self.new_entry(local_entry);
Some(Box::new(wrapper)) Some(Box::new(wrapper))
} }
fn peek_file(&mut self, sub_path: String) -> Option<VersionFile> {
let entry = self.find_wayfinder(&sub_path)?;
Some(VersionFile {
relative_filename: sub_path,
permission: 0,
size: entry.uncompressed_size_hint(),
})
}
} }

View File

@ -1,13 +1,16 @@
use std::{ use std::{
fmt::Debug, io::{Read, Seek, SeekFrom} fmt::Debug,
io::{Read, Seek, SeekFrom},
}; };
use dyn_clone::DynClone;
use tokio::io::{self, AsyncRead}; use tokio::io::{self, AsyncRead};
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct VersionFile { pub struct VersionFile {
pub relative_filename: String, pub relative_filename: String,
pub permission: u32, pub permission: u32,
pub size: u64,
} }
pub trait Skippable { pub trait Skippable {
@ -26,12 +29,11 @@ pub trait MinimumFileObject: Read + Send + Skippable {}
impl<T: Read + Send + Seek> MinimumFileObject for T {} impl<T: Read + Send + Seek> MinimumFileObject for T {}
// Intentionally not a generic, because of types in read_file // Intentionally not a generic, because of types in read_file
pub struct ReadToAsyncRead { pub struct ReadToAsyncRead<'a> {
pub inner: Box<(dyn Read + Send)>, pub inner: Box<dyn Read + Send + 'a>,
pub backend: Box<(dyn VersionBackend + Send)>,
} }
impl AsyncRead for ReadToAsyncRead { impl<'a> AsyncRead for ReadToAsyncRead<'a> {
fn poll_read( fn poll_read(
mut self: std::pin::Pin<&mut Self>, mut self: std::pin::Pin<&mut Self>,
_cx: &mut std::task::Context<'_>, _cx: &mut std::task::Context<'_>,
@ -39,13 +41,16 @@ impl AsyncRead for ReadToAsyncRead {
) -> std::task::Poll<io::Result<()>> { ) -> std::task::Poll<io::Result<()>> {
let mut read_buf = [0u8; 8192]; let mut read_buf = [0u8; 8192];
let var_name = self.inner.read(&mut read_buf).unwrap(); let var_name = self.inner.read(&mut read_buf).unwrap();
let amount = var_name; let amount = var_name.min(buf.remaining());
buf.put_slice(&read_buf[0..amount]); buf.put_slice(&read_buf[0..amount]);
std::task::Poll::Ready(Ok(())) std::task::Poll::Ready(Ok(()))
} }
} }
pub trait VersionBackend { pub trait VersionBackend: DynClone {
fn list_files(&mut self) -> Vec<VersionFile>; fn list_files(&mut self) -> Vec<VersionFile>;
fn reader(&mut self, file: &VersionFile) -> Option<Box<(dyn MinimumFileObject)>>; fn peek_file(&mut self, sub_path: String) -> Option<VersionFile>;
fn reader(&mut self, file: &VersionFile) -> Option<Box<dyn MinimumFileObject + '_>>;
} }
dyn_clone::clone_trait_object!(VersionBackend);

View File

@ -1,10 +1,6 @@
use std::{ use std::{collections::HashMap, fs::File, io::Read, path::Path};
fs::{self, metadata, File},
io::Read,
path::{Path, PathBuf},
};
use napi::{bindgen_prelude::*, tokio_stream::StreamExt}; use napi::{bindgen_prelude::*, sys::napi_value__, tokio_stream::StreamExt};
use tokio_util::codec::{BytesCodec, FramedRead}; use tokio_util::codec::{BytesCodec, FramedRead};
use crate::version::{ use crate::version::{
@ -12,99 +8,160 @@ use crate::version::{
types::{ReadToAsyncRead, VersionBackend, VersionFile}, types::{ReadToAsyncRead, VersionBackend, VersionFile},
}; };
pub fn _list_files(vec: &mut Vec<PathBuf>, path: &Path) { /**
if metadata(path).unwrap().is_dir() { * Append new backends here
let paths = fs::read_dir(path).unwrap(); */
for path_result in paths { pub fn create_backend_constructor<'a>(
let full_path = path_result.unwrap().path(); path: &Path,
if metadata(&full_path).unwrap().is_dir() { ) -> Option<Box<dyn FnOnce() -> Box<dyn VersionBackend + Send + 'a>>> {
_list_files(vec, &full_path); if !path.exists() {
} else { return None;
vec.push(full_path);
}
}
} }
}
pub fn create_backend_for_path<'a>(path: &Path) -> Option<Box<(dyn VersionBackend + Send + 'a)>> {
let is_directory = path.is_dir(); let is_directory = path.is_dir();
if is_directory { if is_directory {
return Some(Box::new(PathVersionBackend { let base_dir = path.to_path_buf();
base_dir: path.to_path_buf(), return Some(Box::new(move || Box::new(PathVersionBackend { base_dir })));
}));
}; };
if path.to_string_lossy().ends_with(".zip") { if path.to_string_lossy().ends_with(".zip") {
let f = File::open(path.to_path_buf()).unwrap(); let f = File::open(path.to_path_buf()).unwrap();
return Some(Box::new(ZipVersionBackend::new(f))); return Some(Box::new(|| Box::new(ZipVersionBackend::new(f))));
} }
None None
} }
#[napi] /**
pub fn has_backend_for_path(path: String) -> bool { * Persistent object so we can cache things between commands
let path = Path::new(&path); */
#[napi(js_name = "DropletHandler")]
let has_backend = create_backend_for_path(path).is_some(); pub struct DropletHandler<'a> {
backend_cache: HashMap<String, Box<dyn VersionBackend + Send + 'a>>,
has_backend
} }
#[napi] #[napi]
pub fn list_files(path: String) -> Result<Vec<String>> { impl<'a> DropletHandler<'a> {
let path = Path::new(&path); #[napi(constructor)]
let mut backend = pub fn new() -> Self {
create_backend_for_path(path).ok_or(napi::Error::from_reason("No backend for path"))?; DropletHandler {
let files = backend.list_files(); backend_cache: HashMap::new(),
Ok(files.into_iter().map(|e| e.relative_filename).collect()) }
}
#[napi]
pub fn read_file(
path: String,
sub_path: String,
env: &Env,
start: Option<u32>,
end: Option<u32>,
) -> Option<ReadableStream<'_, BufferSlice<'_>>> {
let path = Path::new(&path);
let mut backend = create_backend_for_path(path).unwrap();
let version_file = VersionFile {
relative_filename: sub_path,
permission: 0, // Shouldn't matter
};
// Use `?` operator for cleaner error propagation from `Option`
let mut reader = backend.reader(&version_file)?;
// Skip the 'start' amount of bytes without seek
if let Some(skip) = start {
reader.skip(skip.into());
// io::copy(&mut reader.by_ref().take(skip.into()), &mut io::sink()).unwrap();
} }
let async_reader = if let Some(limit) = end { pub fn create_backend_for_path(
let amount = limit - start.or(Some(0)).unwrap(); &mut self,
ReadToAsyncRead { path: String,
inner: Box::new(reader.take(amount.into())), ) -> Option<&mut Box<dyn VersionBackend + Send + 'a>> {
backend let fs_path = Path::new(&path);
} let constructor = create_backend_constructor(fs_path)?;
} else {
ReadToAsyncRead { inner: reader, backend }
};
// Create a FramedRead stream with BytesCodec for chunking let existing_backend = self.backend_cache.entry(path).or_insert_with(|| {
let stream = FramedRead::new(async_reader, BytesCodec::new()) let backend = constructor();
// Use StreamExt::map to transform each Result item backend
.map(|result_item| {
result_item
// Apply Result::map to transform Ok(BytesMut) to Ok(Vec<u8>)
.map(|bytes| bytes.to_vec())
// Apply Result::map_err to transform Err(std::io::Error) to Err(napi::Error)
.map_err(|e| napi::Error::from(e)) // napi::Error implements From<tokio::io::Error>
}); });
// Create the napi-rs ReadableStream from the tokio_stream::Stream
// The unwrap() here means if stream creation fails, it will panic. Some(existing_backend)
// For a production system, consider returning Result<Option<...>> and handling this. }
Some(ReadableStream::create_with_stream_bytes(env, stream).unwrap())
#[napi]
pub fn has_backend_for_path(&self, path: String) -> bool {
let path = Path::new(&path);
let has_backend = create_backend_constructor(path).is_some();
has_backend
}
#[napi]
pub fn list_files(&mut self, path: String) -> Result<Vec<String>> {
let backend = self
.create_backend_for_path(path)
.ok_or(napi::Error::from_reason("No backend for path"))?;
let files = backend.list_files();
Ok(files.into_iter().map(|e| e.relative_filename).collect())
}
#[napi]
pub fn peek_file(&mut self, path: String, sub_path: String) -> Result<u64> {
let backend = self
.create_backend_for_path(path)
.ok_or(napi::Error::from_reason("No backend for path"))?;
let file = backend
.peek_file(sub_path)
.ok_or(napi::Error::from_reason("Can't find file to peek"))?;
return Ok(file.size.try_into().unwrap());
}
#[napi]
pub fn read_file(
&mut self,
reference: Reference<DropletHandler<'static>>,
path: String,
sub_path: String,
env: Env,
start: Option<BigInt>,
end: Option<BigInt>,
) -> Result<JsDropStreamable> {
let stream = reference.share_with(env, |handler| {
let backend = handler
.create_backend_for_path(path)
.ok_or(napi::Error::from_reason("Failed to create backend."))?;
let version_file = VersionFile {
relative_filename: sub_path,
permission: 0, // Shouldn't matter
size: 0, // Shouldn't matter
};
// Use `?` operator for cleaner error propagation from `Option`
let mut reader = backend.reader(&version_file).ok_or(napi::Error::from_reason("Failed to create reader."))?;
if let Some(skip) = start.clone() {
reader.skip(skip.get_u64().1.into());
// io::copy(&mut reader.by_ref().take(skip.into()), &mut io::sink()).unwrap();
}
let async_reader = if let Some(limit) = end {
let amount = limit.get_u64().1 - start.map_or(Some(0), |v| Some(v.get_u64().1)).unwrap();
ReadToAsyncRead {
inner: Box::new(reader.take(amount.into())),
}
} else {
ReadToAsyncRead { inner: reader }
};
// Create a FramedRead stream with BytesCodec for chunking
let stream = FramedRead::new(async_reader, BytesCodec::new())
// Use StreamExt::map to transform each Result item
.map(|result_item| {
result_item
// Apply Result::map to transform Ok(BytesMut) to Ok(Vec<u8>)
.map(|bytes| bytes.to_vec())
// Apply Result::map_err to transform Err(std::io::Error) to Err(napi::Error)
.map_err(|e| napi::Error::from(e)) // napi::Error implements From<tokio::io::Error>
});
// Create the napi-rs ReadableStream from the tokio_stream::Stream
// The unwrap() here means if stream creation fails, it will panic.
// For a production system, consider returning Result<Option<...>> and handling this.
Ok(ReadableStream::create_with_stream_bytes(&env, stream).unwrap())
})?;
Ok(JsDropStreamable {
inner: stream,
})
}
}
#[napi]
pub struct JsDropStreamable {
inner: SharedReference<DropletHandler<'static>, ReadableStream<'static, BufferSlice<'static>>>,
}
#[napi]
impl JsDropStreamable {
#[napi]
pub fn get_stream(&self) -> *mut napi_value__ {
self.inner.raw()
}
} }

299
yarn.lock
View File

@ -12,6 +12,8 @@ __metadata:
"@napi-rs/cli": "npm:3.0.0-alpha.91" "@napi-rs/cli": "npm:3.0.0-alpha.91"
"@types/node": "npm:^22.13.10" "@types/node": "npm:^22.13.10"
ava: "npm:^6.2.0" ava: "npm:^6.2.0"
pretty-bytes: "npm:^7.0.1"
tsimp: "npm:^2.0.12"
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@ -43,11 +45,11 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/checkbox@npm:^4.1.8": "@inquirer/checkbox@npm:^4.1.9":
version: 4.1.8 version: 4.1.9
resolution: "@inquirer/checkbox@npm:4.1.8" resolution: "@inquirer/checkbox@npm:4.1.9"
dependencies: dependencies:
"@inquirer/core": "npm:^10.1.13" "@inquirer/core": "npm:^10.1.14"
"@inquirer/figures": "npm:^1.0.12" "@inquirer/figures": "npm:^1.0.12"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
ansi-escapes: "npm:^4.3.2" ansi-escapes: "npm:^4.3.2"
@ -57,28 +59,28 @@ __metadata:
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/6d726420b179c55b2f0001aaf6e339fa56e9e939afcbda31c386ab2e5d029ef6f2d392ec99c6a6950af1776a399791bbb88a635e4d047f1170b2ed8c5bba1e4c checksum: 10c0/d1a93c31f3dad37f060bfdb6a8ba53f2cd36cfca7766c464c34aa95ecf691956c32be2f5b71cc8633ed7581452a04ab7b3a025d662270460d21b25069651ed42
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/confirm@npm:^5.1.12": "@inquirer/confirm@npm:^5.1.13":
version: 5.1.12 version: 5.1.13
resolution: "@inquirer/confirm@npm:5.1.12" resolution: "@inquirer/confirm@npm:5.1.13"
dependencies: dependencies:
"@inquirer/core": "npm:^10.1.13" "@inquirer/core": "npm:^10.1.14"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
peerDependencies: peerDependencies:
"@types/node": ">=18" "@types/node": ">=18"
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/581aedfe8ce45e177fb4470a12f874f5162a4396636bf4140edc5812ffc8ed0d1fa7e9bbc3a7af618203089a084f489e0b32112947eedc6930a766fad992449e checksum: 10c0/e09af25c4b4f51fdc7c6780e2325217515d3970a8baab3597ae27ea8d0ed68527c19b3ae95f85eeb62d880f6e8a0f3bff91277f0f46e092e993ca18ad17e4993
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/core@npm:^10.1.13": "@inquirer/core@npm:^10.1.14":
version: 10.1.13 version: 10.1.14
resolution: "@inquirer/core@npm:10.1.13" resolution: "@inquirer/core@npm:10.1.14"
dependencies: dependencies:
"@inquirer/figures": "npm:^1.0.12" "@inquirer/figures": "npm:^1.0.12"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
@ -93,15 +95,15 @@ __metadata:
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/919208a31307297d5a07a44b9ebe69a999ce1470b31a2e1b5a04538bc36624d2053808cd6c677637a61690af09bdbdd635bd7031b64e3dd86c5b18df3ca7c3f9 checksum: 10c0/2553eb059201ebb182eb8e55a278ce3f2848a3abdfcf26e651b57b146f35baa19a286af0365ee5968b4459a1be93864ebf205a7af32fed8f995b394750a1d1f4
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/editor@npm:^4.2.13": "@inquirer/editor@npm:^4.2.14":
version: 4.2.13 version: 4.2.14
resolution: "@inquirer/editor@npm:4.2.13" resolution: "@inquirer/editor@npm:4.2.14"
dependencies: dependencies:
"@inquirer/core": "npm:^10.1.13" "@inquirer/core": "npm:^10.1.14"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
external-editor: "npm:^3.1.0" external-editor: "npm:^3.1.0"
peerDependencies: peerDependencies:
@ -109,15 +111,15 @@ __metadata:
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/e1a27d75f737d7847905c14cf04d66d864eeb0f3e4cb2d36e34b51993741c5b70c22754171820c5d880a740765471455a8a98874285fd4a10b162342898f6c6b checksum: 10c0/40e85b4a598f3541f96185c61f0a5ba9abf9385f28cef8b8a1f9570729bbb98f32c80e98e4ce63bd3d07d4011b770d945587d9c6eecce3b03eb2ec08bd7f37ea
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/expand@npm:^4.0.15": "@inquirer/expand@npm:^4.0.16":
version: 4.0.15 version: 4.0.16
resolution: "@inquirer/expand@npm:4.0.15" resolution: "@inquirer/expand@npm:4.0.16"
dependencies: dependencies:
"@inquirer/core": "npm:^10.1.13" "@inquirer/core": "npm:^10.1.14"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
yoctocolors-cjs: "npm:^2.1.2" yoctocolors-cjs: "npm:^2.1.2"
peerDependencies: peerDependencies:
@ -125,7 +127,7 @@ __metadata:
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/d558e367995a38a31d830de45d1e6831b73a798d6076c7fc8bdb639d3fac947a5d15810f7336b45c7712fc0e21fe8a2728f7f594550a20b6b4a839a18f9086cb checksum: 10c0/919e314c5bd86b957b491eff6aa79c990908b7898fc5d02968920be7866449d9dbf9bc33831eab922682e60b98553d753d1a3de6667fa6b1aa6443f457732713
languageName: node languageName: node
linkType: hard linkType: hard
@ -136,41 +138,41 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/input@npm:^4.1.12": "@inquirer/input@npm:^4.2.0":
version: 4.1.12 version: 4.2.0
resolution: "@inquirer/input@npm:4.1.12" resolution: "@inquirer/input@npm:4.2.0"
dependencies: dependencies:
"@inquirer/core": "npm:^10.1.13" "@inquirer/core": "npm:^10.1.14"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
peerDependencies: peerDependencies:
"@types/node": ">=18" "@types/node": ">=18"
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/17b59547432f54a18ec573fde96c2c13c827f04faf694fc58239ec97e993ac6af151ed2a0521029c9199a4f422742dbe5dc23c20705748eafdc7dd26c7adca3a checksum: 10c0/c9b671bbb8c8079e975c9138951b7abb6b06e04a44e47286b659569080140f5f18015ba3f2d55e90c5060a313a3c3e9e115138feced7abe7a94a43190a052199
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/number@npm:^3.0.15": "@inquirer/number@npm:^3.0.16":
version: 3.0.15 version: 3.0.16
resolution: "@inquirer/number@npm:3.0.15" resolution: "@inquirer/number@npm:3.0.16"
dependencies: dependencies:
"@inquirer/core": "npm:^10.1.13" "@inquirer/core": "npm:^10.1.14"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
peerDependencies: peerDependencies:
"@types/node": ">=18" "@types/node": ">=18"
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/724fc0d10611a0a9ea43280a94ed9194b8bb22d9a2af940eb37592d0cebc9e6e219edc4f79d8c176f53fd1b078543a9e4773037c7bde4b8d929a3034406eec90 checksum: 10c0/066230f02cd253fe26cd78493c7c20b59063c8c2de5c8f5fadcaf4eb8650efc9e6555ba7d3703cc9ba7a751663f60e62e24b4a319d9536afa7ced7459e9b2320
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/password@npm:^4.0.15": "@inquirer/password@npm:^4.0.16":
version: 4.0.15 version: 4.0.16
resolution: "@inquirer/password@npm:4.0.15" resolution: "@inquirer/password@npm:4.0.16"
dependencies: dependencies:
"@inquirer/core": "npm:^10.1.13" "@inquirer/core": "npm:^10.1.14"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
ansi-escapes: "npm:^4.3.2" ansi-escapes: "npm:^4.3.2"
peerDependencies: peerDependencies:
@ -178,38 +180,38 @@ __metadata:
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/673d7c33dd0ee951c96f349d4fb66f8762f31c62188546da4d7af544202b638eecef6b8c78e62f43a46c72a5fa0712d94a56ed56f12e1badbb1001128bc991bd checksum: 10c0/b77c57ba152b50c640cd77637d1ed23662059689546e33b235937e7e108fbbf72b9b5c61834c545f74f1d18d5c836ef5a0dc78da31ea6affe9842c3471a27325
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/prompts@npm:^7.4.0": "@inquirer/prompts@npm:^7.4.0":
version: 7.5.3 version: 7.6.0
resolution: "@inquirer/prompts@npm:7.5.3" resolution: "@inquirer/prompts@npm:7.6.0"
dependencies: dependencies:
"@inquirer/checkbox": "npm:^4.1.8" "@inquirer/checkbox": "npm:^4.1.9"
"@inquirer/confirm": "npm:^5.1.12" "@inquirer/confirm": "npm:^5.1.13"
"@inquirer/editor": "npm:^4.2.13" "@inquirer/editor": "npm:^4.2.14"
"@inquirer/expand": "npm:^4.0.15" "@inquirer/expand": "npm:^4.0.16"
"@inquirer/input": "npm:^4.1.12" "@inquirer/input": "npm:^4.2.0"
"@inquirer/number": "npm:^3.0.15" "@inquirer/number": "npm:^3.0.16"
"@inquirer/password": "npm:^4.0.15" "@inquirer/password": "npm:^4.0.16"
"@inquirer/rawlist": "npm:^4.1.3" "@inquirer/rawlist": "npm:^4.1.4"
"@inquirer/search": "npm:^3.0.15" "@inquirer/search": "npm:^3.0.16"
"@inquirer/select": "npm:^4.2.3" "@inquirer/select": "npm:^4.2.4"
peerDependencies: peerDependencies:
"@types/node": ">=18" "@types/node": ">=18"
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/14ba6f4a3bf1610d7c46399cd8367db8da1ab8c051ab7ff55003a5b36b5121429e3995e202c08156b7b6e7d4d9d032f39add98764c5ae3a7b4b657eb4926137f checksum: 10c0/a00186a71388308a1bc83bd96fef14c702b6cfa34ecd7c7cf880405295b25aefd18a3b79363d788c9c31a2aa5e30732d21467a5b716fc35cc5fd303745ff2218
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/rawlist@npm:^4.1.3": "@inquirer/rawlist@npm:^4.1.4":
version: 4.1.3 version: 4.1.4
resolution: "@inquirer/rawlist@npm:4.1.3" resolution: "@inquirer/rawlist@npm:4.1.4"
dependencies: dependencies:
"@inquirer/core": "npm:^10.1.13" "@inquirer/core": "npm:^10.1.14"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
yoctocolors-cjs: "npm:^2.1.2" yoctocolors-cjs: "npm:^2.1.2"
peerDependencies: peerDependencies:
@ -217,15 +219,15 @@ __metadata:
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/d653e730188e6849df540186cf7cb0f37f06c64d03f075b5a617145671fb015c27aeb60adb003d1a05a925795968efff0a3ae5a737a8d04c5679aa6fdc423662 checksum: 10c0/2ee08bbdd982e4d565dc37b38b4f45e5a040ea1e60e3f8ec808106c1b541585e9a5c3a18f795ae2168820695ad55fb88b2e391c3a0d616a4e74620250292e2d3
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/search@npm:^3.0.15": "@inquirer/search@npm:^3.0.16":
version: 3.0.15 version: 3.0.16
resolution: "@inquirer/search@npm:3.0.15" resolution: "@inquirer/search@npm:3.0.16"
dependencies: dependencies:
"@inquirer/core": "npm:^10.1.13" "@inquirer/core": "npm:^10.1.14"
"@inquirer/figures": "npm:^1.0.12" "@inquirer/figures": "npm:^1.0.12"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
yoctocolors-cjs: "npm:^2.1.2" yoctocolors-cjs: "npm:^2.1.2"
@ -234,15 +236,15 @@ __metadata:
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/32b29789e72e53a7b6cfdbc1803bd9e466c424d9f0368a145bef9e25c6fbde72af29cdd4667a785fee79de213f11fa76453f8120ea02ac5158dce259565ce7fd checksum: 10c0/34330cec50dd72669cdee14a413e7b43dee0e09c8f181a86ccfbdac424b6296e39dcc3c5992168d06c8f5e4cab54644913d5281723fa7a0f454c2c3cafeea192
languageName: node languageName: node
linkType: hard linkType: hard
"@inquirer/select@npm:^4.2.3": "@inquirer/select@npm:^4.2.4":
version: 4.2.3 version: 4.2.4
resolution: "@inquirer/select@npm:4.2.3" resolution: "@inquirer/select@npm:4.2.4"
dependencies: dependencies:
"@inquirer/core": "npm:^10.1.13" "@inquirer/core": "npm:^10.1.14"
"@inquirer/figures": "npm:^1.0.12" "@inquirer/figures": "npm:^1.0.12"
"@inquirer/type": "npm:^3.0.7" "@inquirer/type": "npm:^3.0.7"
ansi-escapes: "npm:^4.3.2" ansi-escapes: "npm:^4.3.2"
@ -252,7 +254,7 @@ __metadata:
peerDependenciesMeta: peerDependenciesMeta:
"@types/node": "@types/node":
optional: true optional: true
checksum: 10c0/376535f50a9c2e19e27a5c81930cd1b5afa0b7d86228e5789782955a2d0a89bf5a8890a97943042e1b393094fe236ce97c9ff4bb777c9b44b22c1424f883b063 checksum: 10c0/8c2dff78f331a52862252ffbc2ad1b8b91cbc556c2af1e6acc5878855ffff7048bb45eefa53e0ef4fbf5310361d9986d10c2882c2355f815e05d635cab9bb679
languageName: node languageName: node
linkType: hard linkType: hard
@ -268,6 +270,38 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@isaacs/balanced-match@npm:^4.0.1":
version: 4.0.1
resolution: "@isaacs/balanced-match@npm:4.0.1"
checksum: 10c0/7da011805b259ec5c955f01cee903da72ad97c5e6f01ca96197267d3f33103d5b2f8a1af192140f3aa64526c593c8d098ae366c2b11f7f17645d12387c2fd420
languageName: node
linkType: hard
"@isaacs/brace-expansion@npm:^5.0.0":
version: 5.0.0
resolution: "@isaacs/brace-expansion@npm:5.0.0"
dependencies:
"@isaacs/balanced-match": "npm:^4.0.1"
checksum: 10c0/b4d4812f4be53afc2c5b6c545001ff7a4659af68d4484804e9d514e183d20269bb81def8682c01a22b17c4d6aed14292c8494f7d2ac664e547101c1a905aa977
languageName: node
linkType: hard
"@isaacs/cached@npm:^1.0.1":
version: 1.0.1
resolution: "@isaacs/cached@npm:1.0.1"
dependencies:
"@isaacs/catcher": "npm:^1.0.0"
checksum: 10c0/1c15dc2a60873f2c73f4b04ed59ecfc8d9679976ff09af1b5b45e7273a590a4f86a339cc4c785c2d22309277ca47293611af20dd7d41550cdcfb53e06a04ac65
languageName: node
linkType: hard
"@isaacs/catcher@npm:^1.0.0, @isaacs/catcher@npm:^1.0.4":
version: 1.0.4
resolution: "@isaacs/catcher@npm:1.0.4"
checksum: 10c0/d8b77e2c6b84a6301d390d0b2badea1b4a321f2e8ba662645b045efc42f20a54a6c760f3181fab4ed0d90da58f2cb084a93490a892c53b4da21ec05278b8ba4f
languageName: node
linkType: hard
"@isaacs/cliui@npm:^8.0.2": "@isaacs/cliui@npm:^8.0.2":
version: 8.0.2 version: 8.0.2
resolution: "@isaacs/cliui@npm:8.0.2" resolution: "@isaacs/cliui@npm:8.0.2"
@ -725,13 +759,13 @@ __metadata:
linkType: hard linkType: hard
"@napi-rs/wasm-runtime@npm:^0.2.10, @napi-rs/wasm-runtime@npm:^0.2.7, @napi-rs/wasm-runtime@npm:^0.2.9": "@napi-rs/wasm-runtime@npm:^0.2.10, @napi-rs/wasm-runtime@npm:^0.2.7, @napi-rs/wasm-runtime@npm:^0.2.9":
version: 0.2.10 version: 0.2.11
resolution: "@napi-rs/wasm-runtime@npm:0.2.10" resolution: "@napi-rs/wasm-runtime@npm:0.2.11"
dependencies: dependencies:
"@emnapi/core": "npm:^1.4.3" "@emnapi/core": "npm:^1.4.3"
"@emnapi/runtime": "npm:^1.4.3" "@emnapi/runtime": "npm:^1.4.3"
"@tybys/wasm-util": "npm:^0.9.0" "@tybys/wasm-util": "npm:^0.9.0"
checksum: 10c0/4dce9bbb94a8969805574e1b55fdbeb7623348190265d77f6507ba32e535610deeb53a33ba0bb8b05a6520f379d418b92e8a01c5cd7b9486b136d2c0c26be0bd checksum: 10c0/049bd14c58b99fbe0967b95e9921c5503df196b59be22948d2155f17652eb305cff6728efd8685338b855da7e476dd2551fbe3a313fc2d810938f0717478441e
languageName: node languageName: node
linkType: hard linkType: hard
@ -1756,7 +1790,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"foreground-child@npm:^3.1.0": "foreground-child@npm:^3.1.0, foreground-child@npm:^3.1.1, foreground-child@npm:^3.3.1":
version: 3.3.1 version: 3.3.1
resolution: "foreground-child@npm:3.3.1" resolution: "foreground-child@npm:3.3.1"
dependencies: dependencies:
@ -1812,6 +1846,22 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"glob@npm:^11.0.0":
version: 11.0.3
resolution: "glob@npm:11.0.3"
dependencies:
foreground-child: "npm:^3.3.1"
jackspeak: "npm:^4.1.1"
minimatch: "npm:^10.0.3"
minipass: "npm:^7.1.2"
package-json-from-dist: "npm:^1.0.0"
path-scurry: "npm:^2.0.0"
bin:
glob: dist/esm/bin.mjs
checksum: 10c0/7d24457549ec2903920dfa3d8e76850e7c02aa709122f0164b240c712f5455c0b457e6f2a1eee39344c6148e39895be8094ae8cfef7ccc3296ed30bce250c661
languageName: node
linkType: hard
"glob@npm:^7.1.3": "glob@npm:^7.1.3":
version: 7.2.3 version: 7.2.3
resolution: "glob@npm:7.2.3" resolution: "glob@npm:7.2.3"
@ -1996,6 +2046,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"jackspeak@npm:^4.1.1":
version: 4.1.1
resolution: "jackspeak@npm:4.1.1"
dependencies:
"@isaacs/cliui": "npm:^8.0.2"
checksum: 10c0/84ec4f8e21d6514db24737d9caf65361511f75e5e424980eebca4199f400874f45e562ac20fa8aeb1dd20ca2f3f81f0788b6e9c3e64d216a5794fd6f30e0e042
languageName: node
linkType: hard
"js-string-escape@npm:^1.0.1": "js-string-escape@npm:^1.0.1":
version: 1.0.1 version: 1.0.1
resolution: "js-string-escape@npm:1.0.1" resolution: "js-string-escape@npm:1.0.1"
@ -2063,6 +2122,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"lru-cache@npm:^11.0.0":
version: 11.1.0
resolution: "lru-cache@npm:11.1.0"
checksum: 10c0/85c312f7113f65fae6a62de7985348649937eb34fb3d212811acbf6704dc322a421788aca253b62838f1f07049a84cc513d88f494e373d3756514ad263670a64
languageName: node
linkType: hard
"matcher@npm:^5.0.0": "matcher@npm:^5.0.0":
version: 5.0.0 version: 5.0.0
resolution: "matcher@npm:5.0.0" resolution: "matcher@npm:5.0.0"
@ -2114,6 +2180,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"minimatch@npm:^10.0.3":
version: 10.0.3
resolution: "minimatch@npm:10.0.3"
dependencies:
"@isaacs/brace-expansion": "npm:^5.0.0"
checksum: 10c0/e43e4a905c5d70ac4cec8530ceaeccb9c544b1ba8ac45238e2a78121a01c17ff0c373346472d221872563204eabe929ad02669bb575cb1f0cc30facab369f70f
languageName: node
linkType: hard
"minimatch@npm:^3.1.1": "minimatch@npm:^3.1.1":
version: 3.1.2 version: 3.1.2
resolution: "minimatch@npm:3.1.2" resolution: "minimatch@npm:3.1.2"
@ -2311,6 +2386,16 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"path-scurry@npm:^2.0.0":
version: 2.0.0
resolution: "path-scurry@npm:2.0.0"
dependencies:
lru-cache: "npm:^11.0.0"
minipass: "npm:^7.1.2"
checksum: 10c0/3da4adedaa8e7ef8d6dc4f35a0ff8f05a9b4d8365f2b28047752b62d4c1ad73eec21e37b1579ef2d075920157856a3b52ae8309c480a6f1a8bbe06ff8e52b33c
languageName: node
linkType: hard
"path-type@npm:^6.0.0": "path-type@npm:^6.0.0":
version: 6.0.0 version: 6.0.0
resolution: "path-type@npm:6.0.0" resolution: "path-type@npm:6.0.0"
@ -2332,6 +2417,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"pirates@npm:^4.0.6":
version: 4.0.7
resolution: "pirates@npm:4.0.7"
checksum: 10c0/a51f108dd811beb779d58a76864bbd49e239fa40c7984cd11596c75a121a8cc789f1c8971d8bb15f0dbf9d48b76c05bb62fcbce840f89b688c0fa64b37e8478a
languageName: node
linkType: hard
"plur@npm:^5.1.0": "plur@npm:^5.1.0":
version: 5.1.0 version: 5.1.0
resolution: "plur@npm:5.1.0" resolution: "plur@npm:5.1.0"
@ -2341,6 +2433,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"pretty-bytes@npm:^7.0.1":
version: 7.0.1
resolution: "pretty-bytes@npm:7.0.1"
checksum: 10c0/14ffb503d2de3588042c722848062a4897e6faece1694e0c83ba5669ec003d73311d946d50d2b3c6099a6a306760011b8446ee3cf9cf86eca13a454a8f1c47cb
languageName: node
linkType: hard
"pretty-ms@npm:^9.1.0": "pretty-ms@npm:^9.1.0":
version: 9.2.0 version: 9.2.0
resolution: "pretty-ms@npm:9.2.0" resolution: "pretty-ms@npm:9.2.0"
@ -2398,6 +2497,18 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"rimraf@npm:^6.0.1":
version: 6.0.1
resolution: "rimraf@npm:6.0.1"
dependencies:
glob: "npm:^11.0.0"
package-json-from-dist: "npm:^1.0.0"
bin:
rimraf: dist/esm/bin.mjs
checksum: 10c0/b30b6b072771f0d1e73b4ca5f37bb2944ee09375be9db5f558fcd3310000d29dfcfa93cf7734d75295ad5a7486dc8e40f63089ced1722a664539ffc0c3ece8c6
languageName: node
linkType: hard
"run-parallel@npm:^1.1.9": "run-parallel@npm:^1.1.9":
version: 1.2.0 version: 1.2.0
resolution: "run-parallel@npm:1.2.0" resolution: "run-parallel@npm:1.2.0"
@ -2481,6 +2592,24 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"sock-daemon@npm:^1.4.2":
version: 1.4.2
resolution: "sock-daemon@npm:1.4.2"
dependencies:
rimraf: "npm:^5.0.5"
signal-exit: "npm:^4.1.0"
socket-post-message: "npm:^1.0.3"
checksum: 10c0/1b5e0b02fdd8cd5454fc7de80557c11aac5d88085d0cee80ead08b8f4df5e3c0a4b50ebb2ae2113dab94f36dc88b5d3b7d4b1c2c8e53bbcfbddfc741abf3bd00
languageName: node
linkType: hard
"socket-post-message@npm:^1.0.3":
version: 1.0.3
resolution: "socket-post-message@npm:1.0.3"
checksum: 10c0/d3ffb51dad97754856aaa6709e036196f4b8b674f00366b71591ead122bcdbc073827f67d17c8b03c9a28c921b2c7cb277c581f6ca318d472034eae7afc169d1
languageName: node
linkType: hard
"sprintf-js@npm:~1.0.2": "sprintf-js@npm:~1.0.2":
version: 1.0.3 version: 1.0.3
resolution: "sprintf-js@npm:1.0.3" resolution: "sprintf-js@npm:1.0.3"
@ -2613,6 +2742,27 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"tsimp@npm:^2.0.12":
version: 2.0.12
resolution: "tsimp@npm:2.0.12"
dependencies:
"@isaacs/cached": "npm:^1.0.1"
"@isaacs/catcher": "npm:^1.0.4"
foreground-child: "npm:^3.1.1"
mkdirp: "npm:^3.0.1"
pirates: "npm:^4.0.6"
rimraf: "npm:^6.0.1"
signal-exit: "npm:^4.1.0"
sock-daemon: "npm:^1.4.2"
walk-up-path: "npm:^4.0.0"
peerDependencies:
typescript: ^5.1.0
bin:
tsimp: dist/esm/bin.mjs
checksum: 10c0/c56c03a6a4df3ab5ebcefcc0b473992cbb7150173c331be6bda01670d5ae3965e65f30c42757cd391100a1c21485e167a05a350d875f41826b35c45008e5fac8
languageName: node
linkType: hard
"tslib@npm:^2.4.0": "tslib@npm:^2.4.0":
version: 2.8.1 version: 2.8.1
resolution: "tslib@npm:2.8.1" resolution: "tslib@npm:2.8.1"
@ -2669,6 +2819,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"walk-up-path@npm:^4.0.0":
version: 4.0.0
resolution: "walk-up-path@npm:4.0.0"
checksum: 10c0/fabe344f91387d1d41df230af962ef18bf703dd4178006d55cd6412caacd187b54440002d4d53a982d4f7f0455567dcffb6d3884533c8b2268928eca3ebd8a19
languageName: node
linkType: hard
"wasm-sjlj@npm:^1.0.6": "wasm-sjlj@npm:^1.0.6":
version: 1.0.6 version: 1.0.6
resolution: "wasm-sjlj@npm:1.0.6" resolution: "wasm-sjlj@npm:1.0.6"