@hpx7/delta-pack-cli 0.1.3 → 0.1.4
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/index.js +11 -33
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8006,7 +8006,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
8006
8006
|
// package.json
|
|
8007
8007
|
var package_default = {
|
|
8008
8008
|
name: "@hpx7/delta-pack-cli",
|
|
8009
|
-
version: "0.1.
|
|
8009
|
+
version: "0.1.4",
|
|
8010
8010
|
license: "MIT",
|
|
8011
8011
|
author: "hpx7",
|
|
8012
8012
|
repository: {
|
|
@@ -8026,7 +8026,7 @@ var package_default = {
|
|
|
8026
8026
|
test: "bun test"
|
|
8027
8027
|
},
|
|
8028
8028
|
dependencies: {
|
|
8029
|
-
"@hpx7/delta-pack": "^0.2.
|
|
8029
|
+
"@hpx7/delta-pack": "^0.2.3"
|
|
8030
8030
|
},
|
|
8031
8031
|
devDependencies: {
|
|
8032
8032
|
"@types/bun": "latest"
|
|
@@ -8247,35 +8247,11 @@ class Writer {
|
|
|
8247
8247
|
return this;
|
|
8248
8248
|
}
|
|
8249
8249
|
writeUVarint(val) {
|
|
8250
|
-
|
|
8251
|
-
this.writeUInt8(val);
|
|
8252
|
-
|
|
8253
|
-
this.writeUInt16(val & 127 | (val & 16256) << 1 | 32768);
|
|
8254
|
-
} else if (val < 2097152) {
|
|
8255
|
-
this.writeUInt8(val >> 14 | 128);
|
|
8256
|
-
this.writeUInt16(val & 127 | (val & 16256) << 1 | 32768);
|
|
8257
|
-
} else if (val < 268435456) {
|
|
8258
|
-
this.writeUInt32(val & 127 | (val & 16256) << 1 | (val & 2080768) << 2 | (val & 266338304) << 3 | 2155905024);
|
|
8259
|
-
} else if (val < 34359738368) {
|
|
8260
|
-
this.writeUInt8(Math.floor(val / 268435456) | 128);
|
|
8261
|
-
this.writeUInt32(val & 127 | (val & 16256) << 1 | (val & 2080768) << 2 | (val & 266338304) << 3 | 2155905024);
|
|
8262
|
-
} else if (val < 4398046511104) {
|
|
8263
|
-
const shiftedVal = Math.floor(val / 268435456);
|
|
8264
|
-
this.writeUInt16(shiftedVal & 127 | (shiftedVal & 16256) << 1 | 32896);
|
|
8265
|
-
this.writeUInt32(val & 127 | (val & 16256) << 1 | (val & 2080768) << 2 | (val & 266338304) << 3 | 2155905024);
|
|
8266
|
-
} else if (val < 562949953421312) {
|
|
8267
|
-
const shiftedVal = Math.floor(val / 268435456);
|
|
8268
|
-
this.writeUInt8(Math.floor(shiftedVal / 16384) & 127 | 128);
|
|
8269
|
-
this.writeUInt16(shiftedVal & 127 | (shiftedVal & 16256) << 1 | 32896);
|
|
8270
|
-
this.writeUInt32(val & 127 | (val & 16256) << 1 | (val & 2080768) << 2 | (val & 266338304) << 3 | 2155905024);
|
|
8271
|
-
} else if (val <= Number.MAX_SAFE_INTEGER) {
|
|
8272
|
-
const shiftedVal = Math.floor(val / 268435456);
|
|
8273
|
-
this.writeUInt16(Math.floor(shiftedVal / 16384) & 127 | (Math.floor(shiftedVal / 16384) & 16256) << 1 | 32896);
|
|
8274
|
-
this.writeUInt16(shiftedVal & 127 | (shiftedVal & 16256) << 1 | 32896);
|
|
8275
|
-
this.writeUInt32(val & 127 | (val & 16256) << 1 | (val & 2080768) << 2 | (val & 266338304) << 3 | 2155905024);
|
|
8276
|
-
} else {
|
|
8277
|
-
throw new Error("Value out of range");
|
|
8250
|
+
while (val >= 128) {
|
|
8251
|
+
this.writeUInt8(val & 127 | 128);
|
|
8252
|
+
val = Math.floor(val / 128);
|
|
8278
8253
|
}
|
|
8254
|
+
this.writeUInt8(val);
|
|
8279
8255
|
return this;
|
|
8280
8256
|
}
|
|
8281
8257
|
writeVarint(val) {
|
|
@@ -8403,13 +8379,15 @@ class Reader {
|
|
|
8403
8379
|
return val;
|
|
8404
8380
|
}
|
|
8405
8381
|
readUVarint() {
|
|
8406
|
-
let
|
|
8382
|
+
let result = 0;
|
|
8383
|
+
let multiplier = 1;
|
|
8407
8384
|
while (true) {
|
|
8408
8385
|
const byte = this.readUInt8();
|
|
8386
|
+
result += (byte & 127) * multiplier;
|
|
8409
8387
|
if (byte < 128) {
|
|
8410
|
-
return
|
|
8388
|
+
return result;
|
|
8411
8389
|
}
|
|
8412
|
-
|
|
8390
|
+
multiplier *= 128;
|
|
8413
8391
|
}
|
|
8414
8392
|
}
|
|
8415
8393
|
readVarint() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpx7/delta-pack-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "hpx7",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"test": "bun test"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@hpx7/delta-pack": "^0.2.
|
|
23
|
+
"@hpx7/delta-pack": "^0.2.3"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/bun": "latest"
|