@coderook/cli 0.22.0 → 0.22.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/.claude-plugin/plugin.json +1 -1
- package/dist/cli/src/cli.js +50 -41
- package/dist/cli/src/offline.js +28 -0
- package/dist/desktop-app/src/main/compress.js +6 -31
- package/dist/desktop-app/src/main/download.js +200 -4
- package/dist/desktop-app/src/main/upload.js +602 -55
- package/dist/desktop-app/src/shared/chunking.js +21 -1
- package/dist/desktop-app/src/shared/compression_policy.js +35 -0
- package/dist/desktop-app/src/shared/delta.js +772 -0
- package/dist/desktop-app/src/shared/telemetry.js +47 -0
- package/package.json +1 -1
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* means adding a new id, never changing the meaning of an existing one.
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.DEFAULT_CHUNK_PROFILE = exports.HUGE_CHUNK_PROFILE = exports.LARGE_CHUNK_PROFILE = exports.MEDIUM_CHUNK_PROFILE = exports.LEGACY_CHUNK_PROFILE = void 0;
|
|
11
|
+
exports.MICRO_CHUNK_PROFILE = exports.DEFAULT_CHUNK_PROFILE = exports.HUGE_CHUNK_PROFILE = exports.LARGE_CHUNK_PROFILE = exports.MEDIUM_CHUNK_PROFILE = exports.LEGACY_CHUNK_PROFILE = void 0;
|
|
12
12
|
exports.profileForFileSize = profileForFileSize;
|
|
13
|
+
exports.microchunkProfileForFileSize = microchunkProfileForFileSize;
|
|
13
14
|
exports.cutPoints = cutPoints;
|
|
14
15
|
exports.chunkBoundaries = chunkBoundaries;
|
|
15
16
|
exports.manifestChunking = manifestChunking;
|
|
@@ -63,6 +64,20 @@ exports.HUGE_CHUNK_PROFILE = Object.freeze({
|
|
|
63
64
|
looseMask: 0x003f_ffff,
|
|
64
65
|
});
|
|
65
66
|
exports.DEFAULT_CHUNK_PROFILE = exports.HUGE_CHUNK_PROFILE;
|
|
67
|
+
/**
|
|
68
|
+
* Fine-grained large-file transport. It uses the same portable FastCDC
|
|
69
|
+
* boundary function but keeps edit amplification near one MiB instead of
|
|
70
|
+
* four to eight MiB. Existing Versions retain their recorded chunk objects.
|
|
71
|
+
*/
|
|
72
|
+
exports.MICRO_CHUNK_PROFILE = Object.freeze({
|
|
73
|
+
id: "fastcdc-v3-micro",
|
|
74
|
+
algorithm: "fastcdc-v2",
|
|
75
|
+
minSize: 256 * KIB,
|
|
76
|
+
targetSize: 1 * MIB,
|
|
77
|
+
maxSize: 4 * MIB,
|
|
78
|
+
strictMask: 0x001f_ffff,
|
|
79
|
+
looseMask: 0x0007_ffff,
|
|
80
|
+
});
|
|
66
81
|
/** The profile repository uploads use for a file of `size` bytes. */
|
|
67
82
|
function profileForFileSize(size) {
|
|
68
83
|
if (!Number.isFinite(size) || size < 0) {
|
|
@@ -76,6 +91,11 @@ function profileForFileSize(size) {
|
|
|
76
91
|
return exports.LARGE_CHUNK_PROFILE;
|
|
77
92
|
return exports.HUGE_CHUNK_PROFILE;
|
|
78
93
|
}
|
|
94
|
+
/** New-write profile when the service advertises the microchunk map. */
|
|
95
|
+
function microchunkProfileForFileSize(size) {
|
|
96
|
+
const legacy = profileForFileSize(size);
|
|
97
|
+
return legacy ? exports.MICRO_CHUNK_PROFILE : null;
|
|
98
|
+
}
|
|
79
99
|
const GEAR = (() => {
|
|
80
100
|
const table = new Uint32Array(256);
|
|
81
101
|
let seed = 0x9e3779b9;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* The storage representation decision is a protocol rule, not a desktop UI
|
|
4
|
+
* preference. Keep the cheap, deterministic part of it in a runtime-neutral
|
|
5
|
+
* module so Desktop, CLI (through Desktop's uploader), Website and the Worker
|
|
6
|
+
* make the same decision for the same object.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.WORTHWHILE_COMPRESSION_RATIO = exports.SMALLEST_WORTH_COMPRESSING = void 0;
|
|
10
|
+
exports.looksCompressed = looksCompressed;
|
|
11
|
+
exports.shouldTryGzip = shouldTryGzip;
|
|
12
|
+
exports.gzipIsWorthKeeping = gzipIsWorthKeeping;
|
|
13
|
+
const ALREADY_COMPRESSED = new Set([
|
|
14
|
+
".7z", ".aac", ".avi", ".br", ".bz2", ".cbx", ".docx", ".flac", ".gif",
|
|
15
|
+
".gz", ".heic", ".jpeg", ".jpg", ".jxl", ".m4a", ".m4v", ".mkv", ".mov",
|
|
16
|
+
".mp3", ".mp4", ".odp", ".ods", ".odt", ".ogg", ".opus", ".pdf", ".png",
|
|
17
|
+
".pptx", ".rar", ".safetensors", ".webm", ".webp", ".xlsx", ".xz", ".zip",
|
|
18
|
+
".zst",
|
|
19
|
+
]);
|
|
20
|
+
exports.SMALLEST_WORTH_COMPRESSING = 4 * 1024;
|
|
21
|
+
exports.WORTHWHILE_COMPRESSION_RATIO = 0.95;
|
|
22
|
+
function looksCompressed(relativePath) {
|
|
23
|
+
const dot = relativePath.lastIndexOf(".");
|
|
24
|
+
if (dot < 0)
|
|
25
|
+
return false;
|
|
26
|
+
return ALREADY_COMPRESSED.has(relativePath.slice(dot).toLowerCase());
|
|
27
|
+
}
|
|
28
|
+
function shouldTryGzip(relativePath, sourceBytes, allowGzip) {
|
|
29
|
+
return (allowGzip &&
|
|
30
|
+
sourceBytes >= exports.SMALLEST_WORTH_COMPRESSING &&
|
|
31
|
+
!looksCompressed(relativePath));
|
|
32
|
+
}
|
|
33
|
+
function gzipIsWorthKeeping(sourceBytes, compressedBytes) {
|
|
34
|
+
return compressedBytes < sourceBytes * exports.WORTHWHILE_COMPRESSION_RATIO;
|
|
35
|
+
}
|