@hot-updater/cli-tools 0.31.4 → 0.32.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/{chunk-hT5z_Zn9.mjs → chunk-BEJ448es.mjs} +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +52 -417
- package/package.json +4 -4
|
@@ -6,7 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod ||
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
10
10
|
var __exportAll = (all, no_symbols) => {
|
|
11
11
|
let target = {};
|
|
12
12
|
for (var name in all) __defProp(target, name, {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Readable } from "stream";
|
|
2
2
|
import { Key as Key$1 } from "node:readline";
|
|
3
3
|
import { Readable as Readable$1, Writable } from "node:stream";
|
|
4
|
+
import * as _$_hot_updater_core0 from "@hot-updater/core";
|
|
4
5
|
import { Bundle, ConfigInput, DatabasePlugin, NodeStoragePlugin, Platform, RequiredDeep } from "@hot-updater/plugin-core";
|
|
5
6
|
|
|
6
7
|
//#region src/BuildLogger.d.ts
|
|
@@ -393,7 +394,7 @@ declare function createCopiedBundleArchive({
|
|
|
393
394
|
channel: string;
|
|
394
395
|
storageUri: string;
|
|
395
396
|
fileHash: string;
|
|
396
|
-
metadata:
|
|
397
|
+
metadata: _$_hot_updater_core0.BundleMetadata | undefined;
|
|
397
398
|
assetBaseStorageUri: string;
|
|
398
399
|
patches: never[];
|
|
399
400
|
patchBaseBundleId: null;
|
|
@@ -402,7 +403,7 @@ declare function createCopiedBundleArchive({
|
|
|
402
403
|
patchBaseFileHash: null;
|
|
403
404
|
patchFileHash: null;
|
|
404
405
|
patchStorageUri: null;
|
|
405
|
-
platform:
|
|
406
|
+
platform: _$_hot_updater_core0.Platform;
|
|
406
407
|
shouldForceUpdate: boolean;
|
|
407
408
|
enabled: boolean;
|
|
408
409
|
gitCommitHash: string | null;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-
|
|
1
|
+
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-BEJ448es.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import path, { dirname, parse } from "path";
|
|
4
4
|
import { createInterface } from "readline";
|
|
5
5
|
import { PassThrough } from "stream";
|
|
6
|
-
import fs from "fs";
|
|
6
|
+
import fs, { createWriteStream } from "fs";
|
|
7
7
|
import EE, { EventEmitter } from "events";
|
|
8
8
|
import fs$1 from "fs/promises";
|
|
9
9
|
import assert from "assert";
|
|
@@ -13,12 +13,13 @@ import process$1, { execArgv, execPath, hrtime, platform, stdin, stdout } from "
|
|
|
13
13
|
import * as k from "node:readline";
|
|
14
14
|
import ot from "node:readline";
|
|
15
15
|
import tty, { ReadStream } from "node:tty";
|
|
16
|
-
import fs$2, { appendFileSync, createReadStream, createWriteStream, existsSync, lstatSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
16
|
+
import fs$2, { appendFileSync, createReadStream, createWriteStream as createWriteStream$1, existsSync, lstatSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
17
17
|
import path$1, { basename, dirname as dirname$1, join, posix, win32 } from "node:path";
|
|
18
18
|
import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
|
|
19
19
|
import os, { constants } from "node:os";
|
|
20
|
+
import { pipeline } from "stream/promises";
|
|
20
21
|
import * as realZlib$1 from "zlib";
|
|
21
|
-
import realZlib, {
|
|
22
|
+
import realZlib, { constants as constants$1, createBrotliCompress } from "zlib";
|
|
22
23
|
import { EventEmitter as EventEmitter$1, addAbortListener, on, once, setMaxListeners } from "node:events";
|
|
23
24
|
import Stream, { Duplex, PassThrough as PassThrough$1, Readable as Readable$1, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
|
|
24
25
|
import { StringDecoder } from "node:string_decoder";
|
|
@@ -3018,9 +3019,6 @@ var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3018
3019
|
CHAR_VERTICAL_LINE: 124,
|
|
3019
3020
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
3020
3021
|
SEP: path$12.sep,
|
|
3021
|
-
/**
|
|
3022
|
-
* Create EXTGLOB_CHARS
|
|
3023
|
-
*/
|
|
3024
3022
|
extglobChars(chars) {
|
|
3025
3023
|
return {
|
|
3026
3024
|
"!": {
|
|
@@ -3050,9 +3048,6 @@ var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3050
3048
|
}
|
|
3051
3049
|
};
|
|
3052
3050
|
},
|
|
3053
|
-
/**
|
|
3054
|
-
* Create GLOB_CHARS
|
|
3055
|
-
*/
|
|
3056
3051
|
globChars(win32) {
|
|
3057
3052
|
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
3058
3053
|
}
|
|
@@ -19020,8 +19015,7 @@ var Vt$1 = class extends x$1 {
|
|
|
19020
19015
|
this.#s = e;
|
|
19021
19016
|
const s = this.options;
|
|
19022
19017
|
e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
|
|
19023
|
-
|
|
19024
|
-
this.#t = B(i, 0, this.filteredOptions);
|
|
19018
|
+
this.#t = B(wt$1(this.focusedValue, this.filteredOptions), 0, this.filteredOptions);
|
|
19025
19019
|
const r = this.filteredOptions[this.#t];
|
|
19026
19020
|
r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
19027
19021
|
}
|
|
@@ -19060,10 +19054,7 @@ var yt$1 = class extends x$1 {
|
|
|
19060
19054
|
if (this.value === void 0 && (this.value = []), e.group === !0) {
|
|
19061
19055
|
const s = e.value, i = this.getGroupItems(s);
|
|
19062
19056
|
this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
|
|
19063
|
-
} else
|
|
19064
|
-
const s = this.value.includes(e.value);
|
|
19065
|
-
this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
|
|
19066
|
-
}
|
|
19057
|
+
} else this.value = this.value.includes(e.value) ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
|
|
19067
19058
|
}
|
|
19068
19059
|
constructor(e) {
|
|
19069
19060
|
super(e, !1);
|
|
@@ -19108,19 +19099,17 @@ var Lt$1 = class extends x$1 {
|
|
|
19108
19099
|
return this.options.filter((e) => e.disabled !== !0);
|
|
19109
19100
|
}
|
|
19110
19101
|
toggleAll() {
|
|
19111
|
-
const e = this._enabledOptions
|
|
19112
|
-
this.value =
|
|
19102
|
+
const e = this._enabledOptions;
|
|
19103
|
+
this.value = this.value !== void 0 && this.value.length === e.length ? [] : e.map((i) => i.value);
|
|
19113
19104
|
}
|
|
19114
19105
|
toggleInvert() {
|
|
19115
19106
|
const e = this.value;
|
|
19116
19107
|
if (!e) return;
|
|
19117
|
-
|
|
19118
|
-
this.value = s.map((i) => i.value);
|
|
19108
|
+
this.value = this._enabledOptions.filter((i) => !e.includes(i.value)).map((i) => i.value);
|
|
19119
19109
|
}
|
|
19120
19110
|
toggleValue() {
|
|
19121
19111
|
this.value === void 0 && (this.value = []);
|
|
19122
|
-
|
|
19123
|
-
this.value = e ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
|
|
19112
|
+
this.value = this.value.includes(this._value) ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
|
|
19124
19113
|
}
|
|
19125
19114
|
constructor(e) {
|
|
19126
19115
|
super(e, !1), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
@@ -20529,7 +20518,6 @@ const resolveNextCompletedStage = ({ line, progressStages, completedStages }) =>
|
|
|
20529
20518
|
return nextCompletedStages;
|
|
20530
20519
|
};
|
|
20531
20520
|
var BuildLogger = class {
|
|
20532
|
-
config;
|
|
20533
20521
|
state = createInitialState();
|
|
20534
20522
|
logWriter;
|
|
20535
20523
|
promptProgress;
|
|
@@ -23837,10 +23825,8 @@ var Header = class {
|
|
|
23837
23825
|
this.devmaj = decNumber(buf, off + 329, 8) ?? 0;
|
|
23838
23826
|
this.devmin = decNumber(buf, off + 337, 8) ?? 0;
|
|
23839
23827
|
/* c8 ignore stop */
|
|
23840
|
-
if (buf[off + 475] !== 0)
|
|
23841
|
-
|
|
23842
|
-
this.path = prefix + "/" + this.path;
|
|
23843
|
-
} else {
|
|
23828
|
+
if (buf[off + 475] !== 0) this.path = decString(buf, off + 345, 155) + "/" + this.path;
|
|
23829
|
+
else {
|
|
23844
23830
|
const prefix = decString(buf, off + 345, 130);
|
|
23845
23831
|
if (prefix) this.path = prefix + "/" + this.path;
|
|
23846
23832
|
this.atime = decDate(buf, off + 476, 12);
|
|
@@ -24009,9 +23995,7 @@ var Pax = class Pax {
|
|
|
24009
23995
|
const buf = Buffer.allocUnsafe(bufLen);
|
|
24010
23996
|
for (let i = 0; i < 512; i++) buf[i] = 0;
|
|
24011
23997
|
new Header({
|
|
24012
|
-
/* c8 ignore start */
|
|
24013
23998
|
path: ("PaxHeader/" + basename(this.path ?? "")).slice(0, 99),
|
|
24014
|
-
/* c8 ignore stop */
|
|
24015
23999
|
mode: this.mode || 420,
|
|
24016
24000
|
uid: this.uid,
|
|
24017
24001
|
gid: this.gid,
|
|
@@ -24424,7 +24408,6 @@ while (this[PROCESSENTRY](this[QUEUE$1].shift()));
|
|
|
24424
24408
|
ex.linkpath = this[META].replace(/\0.*/, "");
|
|
24425
24409
|
break;
|
|
24426
24410
|
}
|
|
24427
|
-
/* c8 ignore start */
|
|
24428
24411
|
default: throw new Error("unknown meta: " + entry.type);
|
|
24429
24412
|
}
|
|
24430
24413
|
}
|
|
@@ -24561,7 +24544,6 @@ while (this[PROCESSENTRY](this[QUEUE$1].shift()));
|
|
|
24561
24544
|
case "meta":
|
|
24562
24545
|
position += this[CONSUMEMETA](chunk, position);
|
|
24563
24546
|
break;
|
|
24564
|
-
/* c8 ignore start */
|
|
24565
24547
|
default: throw new Error("invalid state: " + this[STATE]);
|
|
24566
24548
|
}
|
|
24567
24549
|
if (position < length) if (this[BUFFER]) this[BUFFER] = Buffer.concat([chunk.subarray(position), this[BUFFER]]);
|
|
@@ -24868,7 +24850,6 @@ var WriteEntry = class extends Minipass {
|
|
|
24868
24850
|
gid: this.portable ? void 0 : this.stat.gid,
|
|
24869
24851
|
size: this.stat.size,
|
|
24870
24852
|
mtime: this.noMtime ? void 0 : this.mtime || this.stat.mtime,
|
|
24871
|
-
/* c8 ignore next */
|
|
24872
24853
|
type: this.type === "Unsupported" ? void 0 : this.type,
|
|
24873
24854
|
uname: this.portable ? void 0 : this.stat.uid === this.myuid ? this.myuser : "",
|
|
24874
24855
|
atime: this.portable ? void 0 : this.stat.atime,
|
|
@@ -26991,21 +26972,16 @@ const createTarBrTargetFiles = async ({ outfile, targetFiles }) => {
|
|
|
26991
26972
|
if ((await fs$1.stat(sourcePath)).isDirectory()) await copyDir$1(sourcePath, destPath);
|
|
26992
26973
|
else await fs$1.copyFile(sourcePath, destPath);
|
|
26993
26974
|
}
|
|
26994
|
-
|
|
26995
|
-
await create({
|
|
26996
|
-
file: tmpTarFile,
|
|
26975
|
+
await fs$1.mkdir(path.dirname(outfile), { recursive: true });
|
|
26976
|
+
await pipeline(create({
|
|
26997
26977
|
cwd: tmpDir,
|
|
26998
26978
|
portable: true,
|
|
26999
26979
|
mtime: /* @__PURE__ */ new Date(0),
|
|
27000
26980
|
gzip: false
|
|
27001
|
-
}, await fs$1.readdir(tmpDir))
|
|
27002
|
-
const compressedData = brotliCompressSync(await fs$1.readFile(tmpTarFile), { params: {
|
|
26981
|
+
}, await fs$1.readdir(tmpDir)), createBrotliCompress({ params: {
|
|
27003
26982
|
[constants$1.BROTLI_PARAM_QUALITY]: 11,
|
|
27004
26983
|
[constants$1.BROTLI_PARAM_LGWIN]: 24
|
|
27005
|
-
} });
|
|
27006
|
-
await fs$1.mkdir(path.dirname(outfile), { recursive: true });
|
|
27007
|
-
await fs$1.writeFile(outfile, compressedData);
|
|
27008
|
-
await fs$1.rm(tmpTarFile, { force: true });
|
|
26984
|
+
} }), createWriteStream(outfile));
|
|
27009
26985
|
return outfile;
|
|
27010
26986
|
} finally {
|
|
27011
26987
|
await fs$1.rm(tmpDir, {
|
|
@@ -27024,9 +27000,20 @@ async function copyDir$1(src, dest) {
|
|
|
27024
27000
|
else await fs$1.copyFile(srcPath, destPath);
|
|
27025
27001
|
}
|
|
27026
27002
|
}
|
|
27003
|
+
const createBrotliTar = async ({ cwd, files, outfile }) => {
|
|
27004
|
+
await fs$1.mkdir(path.dirname(outfile), { recursive: true });
|
|
27005
|
+
await pipeline(create({
|
|
27006
|
+
cwd,
|
|
27007
|
+
portable: true,
|
|
27008
|
+
mtime: /* @__PURE__ */ new Date(0),
|
|
27009
|
+
gzip: false
|
|
27010
|
+
}, files), createBrotliCompress({ params: {
|
|
27011
|
+
[constants$1.BROTLI_PARAM_QUALITY]: 11,
|
|
27012
|
+
[constants$1.BROTLI_PARAM_LGWIN]: 24
|
|
27013
|
+
} }), createWriteStream(outfile));
|
|
27014
|
+
};
|
|
27027
27015
|
const createTarBr = async ({ outfile, targetDir, excludeExts = [] }) => {
|
|
27028
27016
|
await fs$1.rm(outfile, { force: true });
|
|
27029
|
-
const tmpTarFile = outfile.replace(/\.tar\.br$/, ".tar");
|
|
27030
27017
|
async function getFiles(dir, baseDir = "") {
|
|
27031
27018
|
const entries = await fs$1.readdir(dir, { withFileTypes: true });
|
|
27032
27019
|
const files = [];
|
|
@@ -27043,19 +27030,11 @@ const createTarBr = async ({ outfile, targetDir, excludeExts = [] }) => {
|
|
|
27043
27030
|
}
|
|
27044
27031
|
const filesToInclude = await getFiles(targetDir);
|
|
27045
27032
|
filesToInclude.sort();
|
|
27046
|
-
await
|
|
27047
|
-
file: tmpTarFile,
|
|
27033
|
+
await createBrotliTar({
|
|
27048
27034
|
cwd: targetDir,
|
|
27049
|
-
|
|
27050
|
-
|
|
27051
|
-
|
|
27052
|
-
}, filesToInclude);
|
|
27053
|
-
const compressedData = brotliCompressSync(await fs$1.readFile(tmpTarFile), { params: {
|
|
27054
|
-
[constants$1.BROTLI_PARAM_QUALITY]: 11,
|
|
27055
|
-
[constants$1.BROTLI_PARAM_LGWIN]: 24
|
|
27056
|
-
} });
|
|
27057
|
-
await fs$1.writeFile(outfile, compressedData);
|
|
27058
|
-
await fs$1.rm(tmpTarFile, { force: true });
|
|
27035
|
+
files: filesToInclude,
|
|
27036
|
+
outfile
|
|
27037
|
+
});
|
|
27059
27038
|
return outfile;
|
|
27060
27039
|
};
|
|
27061
27040
|
//#endregion
|
|
@@ -27499,8 +27478,7 @@ var require__stream_writable = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
27499
27478
|
this.ended = false;
|
|
27500
27479
|
this.finished = false;
|
|
27501
27480
|
this.destroyed = false;
|
|
27502
|
-
|
|
27503
|
-
this.decodeStrings = !noDecode;
|
|
27481
|
+
this.decodeStrings = !(options.decodeStrings === false);
|
|
27504
27482
|
this.defaultEncoding = options.defaultEncoding || "utf8";
|
|
27505
27483
|
this.length = 0;
|
|
27506
27484
|
this.writing = false;
|
|
@@ -28986,18 +28964,7 @@ var require_base64 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
28986
28964
|
//#region ../../node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/lib/nodejsUtils.js
|
|
28987
28965
|
var require_nodejsUtils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28988
28966
|
module.exports = {
|
|
28989
|
-
/**
|
|
28990
|
-
* True if this is running in Nodejs, will be undefined in a browser.
|
|
28991
|
-
* In a browser, browserify won't include this file and the whole module
|
|
28992
|
-
* will be resolved an empty object.
|
|
28993
|
-
*/
|
|
28994
28967
|
isNode: typeof Buffer !== "undefined",
|
|
28995
|
-
/**
|
|
28996
|
-
* Create a new nodejs Buffer from an existing content.
|
|
28997
|
-
* @param {Object} data the data to pass to the constructor.
|
|
28998
|
-
* @param {String} encoding the encoding to use.
|
|
28999
|
-
* @return {Buffer} a new Buffer.
|
|
29000
|
-
*/
|
|
29001
28968
|
newBufferFrom: function(data, encoding) {
|
|
29002
28969
|
if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(data, encoding);
|
|
29003
28970
|
else {
|
|
@@ -29005,11 +28972,6 @@ var require_nodejsUtils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29005
28972
|
return new Buffer(data, encoding);
|
|
29006
28973
|
}
|
|
29007
28974
|
},
|
|
29008
|
-
/**
|
|
29009
|
-
* Create a new nodejs Buffer with the specified size.
|
|
29010
|
-
* @param {Integer} size the size of the buffer.
|
|
29011
|
-
* @return {Buffer} a new Buffer.
|
|
29012
|
-
*/
|
|
29013
28975
|
allocBuffer: function(size) {
|
|
29014
28976
|
if (Buffer.alloc) return Buffer.alloc(size);
|
|
29015
28977
|
else {
|
|
@@ -29018,11 +28980,6 @@ var require_nodejsUtils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
29018
28980
|
return buf;
|
|
29019
28981
|
}
|
|
29020
28982
|
},
|
|
29021
|
-
/**
|
|
29022
|
-
* Find out if an object is a Buffer.
|
|
29023
|
-
* @param {Object} b the object to test.
|
|
29024
|
-
* @return {Boolean} true if the object is a Buffer, false otherwise.
|
|
29025
|
-
*/
|
|
29026
28983
|
isBuffer: function(b) {
|
|
29027
28984
|
return Buffer.isBuffer(b);
|
|
29028
28985
|
},
|
|
@@ -29515,15 +29472,6 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
29515
29472
|
* can be optimized by the browser JIT compiler.
|
|
29516
29473
|
*/
|
|
29517
29474
|
var arrayToStringHelper = {
|
|
29518
|
-
/**
|
|
29519
|
-
* Transform an array of int into a string, chunk by chunk.
|
|
29520
|
-
* See the performances notes on arrayLikeToString.
|
|
29521
|
-
* @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
|
|
29522
|
-
* @param {String} type the type of the array.
|
|
29523
|
-
* @param {Integer} chunk the chunk size.
|
|
29524
|
-
* @return {String} the resulting string.
|
|
29525
|
-
* @throws Error if the chunk is too big for the stack.
|
|
29526
|
-
*/
|
|
29527
29475
|
stringifyByChunk: function(array, type, chunk) {
|
|
29528
29476
|
var result = [], k = 0, len = array.length;
|
|
29529
29477
|
if (len <= chunk) return String.fromCharCode.apply(null, array);
|
|
@@ -29534,22 +29482,12 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
29534
29482
|
}
|
|
29535
29483
|
return result.join("");
|
|
29536
29484
|
},
|
|
29537
|
-
/**
|
|
29538
|
-
* Call String.fromCharCode on every item in the array.
|
|
29539
|
-
* This is the naive implementation, which generate A LOT of intermediate string.
|
|
29540
|
-
* This should be used when everything else fail.
|
|
29541
|
-
* @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
|
|
29542
|
-
* @return {String} the result.
|
|
29543
|
-
*/
|
|
29544
29485
|
stringifyByChar: function(array) {
|
|
29545
29486
|
var resultStr = "";
|
|
29546
29487
|
for (var i = 0; i < array.length; i++) resultStr += String.fromCharCode(array[i]);
|
|
29547
29488
|
return resultStr;
|
|
29548
29489
|
},
|
|
29549
29490
|
applyCanBeUsed: {
|
|
29550
|
-
/**
|
|
29551
|
-
* true if the browser accepts to use String.fromCharCode on Uint8Array
|
|
29552
|
-
*/
|
|
29553
29491
|
uint8array: (function() {
|
|
29554
29492
|
try {
|
|
29555
29493
|
return support.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1;
|
|
@@ -29557,9 +29495,6 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
29557
29495
|
return false;
|
|
29558
29496
|
}
|
|
29559
29497
|
})(),
|
|
29560
|
-
/**
|
|
29561
|
-
* true if the browser accepts to use String.fromCharCode on nodejs Buffer.
|
|
29562
|
-
*/
|
|
29563
29498
|
nodebuffer: (function() {
|
|
29564
29499
|
try {
|
|
29565
29500
|
return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1;
|
|
@@ -29836,17 +29771,9 @@ var require_GenericWorker = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
29836
29771
|
this.previous = null;
|
|
29837
29772
|
}
|
|
29838
29773
|
GenericWorker.prototype = {
|
|
29839
|
-
/**
|
|
29840
|
-
* Push a chunk to the next workers.
|
|
29841
|
-
* @param {Object} chunk the chunk to push
|
|
29842
|
-
*/
|
|
29843
29774
|
push: function(chunk) {
|
|
29844
29775
|
this.emit("data", chunk);
|
|
29845
29776
|
},
|
|
29846
|
-
/**
|
|
29847
|
-
* End the stream.
|
|
29848
|
-
* @return {Boolean} true if this call ended the worker, false otherwise.
|
|
29849
|
-
*/
|
|
29850
29777
|
end: function() {
|
|
29851
29778
|
if (this.isFinished) return false;
|
|
29852
29779
|
this.flush();
|
|
@@ -29859,11 +29786,6 @@ var require_GenericWorker = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
29859
29786
|
}
|
|
29860
29787
|
return true;
|
|
29861
29788
|
},
|
|
29862
|
-
/**
|
|
29863
|
-
* End the stream with an error.
|
|
29864
|
-
* @param {Error} e the error which caused the premature end.
|
|
29865
|
-
* @return {Boolean} true if this call ended the worker with an error, false otherwise.
|
|
29866
|
-
*/
|
|
29867
29789
|
error: function(e) {
|
|
29868
29790
|
if (this.isFinished) return false;
|
|
29869
29791
|
if (this.isPaused) this.generatedError = e;
|
|
@@ -29875,47 +29797,20 @@ var require_GenericWorker = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
29875
29797
|
}
|
|
29876
29798
|
return true;
|
|
29877
29799
|
},
|
|
29878
|
-
/**
|
|
29879
|
-
* Add a callback on an event.
|
|
29880
|
-
* @param {String} name the name of the event (data, end, error)
|
|
29881
|
-
* @param {Function} listener the function to call when the event is triggered
|
|
29882
|
-
* @return {GenericWorker} the current object for chainability
|
|
29883
|
-
*/
|
|
29884
29800
|
on: function(name, listener) {
|
|
29885
29801
|
this._listeners[name].push(listener);
|
|
29886
29802
|
return this;
|
|
29887
29803
|
},
|
|
29888
|
-
/**
|
|
29889
|
-
* Clean any references when a worker is ending.
|
|
29890
|
-
*/
|
|
29891
29804
|
cleanUp: function() {
|
|
29892
29805
|
this.streamInfo = this.generatedError = this.extraStreamInfo = null;
|
|
29893
29806
|
this._listeners = [];
|
|
29894
29807
|
},
|
|
29895
|
-
/**
|
|
29896
|
-
* Trigger an event. This will call registered callback with the provided arg.
|
|
29897
|
-
* @param {String} name the name of the event (data, end, error)
|
|
29898
|
-
* @param {Object} arg the argument to call the callback with.
|
|
29899
|
-
*/
|
|
29900
29808
|
emit: function(name, arg) {
|
|
29901
29809
|
if (this._listeners[name]) for (var i = 0; i < this._listeners[name].length; i++) this._listeners[name][i].call(this, arg);
|
|
29902
29810
|
},
|
|
29903
|
-
/**
|
|
29904
|
-
* Chain a worker with an other.
|
|
29905
|
-
* @param {Worker} next the worker receiving events from the current one.
|
|
29906
|
-
* @return {worker} the next worker for chainability
|
|
29907
|
-
*/
|
|
29908
29811
|
pipe: function(next) {
|
|
29909
29812
|
return next.registerPrevious(this);
|
|
29910
29813
|
},
|
|
29911
|
-
/**
|
|
29912
|
-
* Same as `pipe` in the other direction.
|
|
29913
|
-
* Using an API with `pipe(next)` is very easy.
|
|
29914
|
-
* Implementing the API with the point of view of the next one registering
|
|
29915
|
-
* a source is easier, see the ZipFileWorker.
|
|
29916
|
-
* @param {Worker} previous the previous worker, sending events to this one
|
|
29917
|
-
* @return {Worker} the current worker for chainability
|
|
29918
|
-
*/
|
|
29919
29814
|
registerPrevious: function(previous) {
|
|
29920
29815
|
if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
|
|
29921
29816
|
this.streamInfo = previous.streamInfo;
|
|
@@ -29933,20 +29828,12 @@ var require_GenericWorker = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
29933
29828
|
});
|
|
29934
29829
|
return this;
|
|
29935
29830
|
},
|
|
29936
|
-
/**
|
|
29937
|
-
* Pause the stream so it doesn't send events anymore.
|
|
29938
|
-
* @return {Boolean} true if this call paused the worker, false otherwise.
|
|
29939
|
-
*/
|
|
29940
29831
|
pause: function() {
|
|
29941
29832
|
if (this.isPaused || this.isFinished) return false;
|
|
29942
29833
|
this.isPaused = true;
|
|
29943
29834
|
if (this.previous) this.previous.pause();
|
|
29944
29835
|
return true;
|
|
29945
29836
|
},
|
|
29946
|
-
/**
|
|
29947
|
-
* Resume a paused stream.
|
|
29948
|
-
* @return {Boolean} true if this call resumed the worker, false otherwise.
|
|
29949
|
-
*/
|
|
29950
29837
|
resume: function() {
|
|
29951
29838
|
if (!this.isPaused || this.isFinished) return false;
|
|
29952
29839
|
this.isPaused = false;
|
|
@@ -29958,50 +29845,26 @@ var require_GenericWorker = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
29958
29845
|
if (this.previous) this.previous.resume();
|
|
29959
29846
|
return !withError;
|
|
29960
29847
|
},
|
|
29961
|
-
/**
|
|
29962
|
-
* Flush any remaining bytes as the stream is ending.
|
|
29963
|
-
*/
|
|
29964
29848
|
flush: function() {},
|
|
29965
|
-
/**
|
|
29966
|
-
* Process a chunk. This is usually the method overridden.
|
|
29967
|
-
* @param {Object} chunk the chunk to process.
|
|
29968
|
-
*/
|
|
29969
29849
|
processChunk: function(chunk) {
|
|
29970
29850
|
this.push(chunk);
|
|
29971
29851
|
},
|
|
29972
|
-
/**
|
|
29973
|
-
* Add a key/value to be added in the workers chain streamInfo once activated.
|
|
29974
|
-
* @param {String} key the key to use
|
|
29975
|
-
* @param {Object} value the associated value
|
|
29976
|
-
* @return {Worker} the current worker for chainability
|
|
29977
|
-
*/
|
|
29978
29852
|
withStreamInfo: function(key, value) {
|
|
29979
29853
|
this.extraStreamInfo[key] = value;
|
|
29980
29854
|
this.mergeStreamInfo();
|
|
29981
29855
|
return this;
|
|
29982
29856
|
},
|
|
29983
|
-
/**
|
|
29984
|
-
* Merge this worker's streamInfo into the chain's streamInfo.
|
|
29985
|
-
*/
|
|
29986
29857
|
mergeStreamInfo: function() {
|
|
29987
29858
|
for (var key in this.extraStreamInfo) {
|
|
29988
29859
|
if (!Object.prototype.hasOwnProperty.call(this.extraStreamInfo, key)) continue;
|
|
29989
29860
|
this.streamInfo[key] = this.extraStreamInfo[key];
|
|
29990
29861
|
}
|
|
29991
29862
|
},
|
|
29992
|
-
/**
|
|
29993
|
-
* Lock the stream to prevent further updates on the workers chain.
|
|
29994
|
-
* After calling this method, all calls to pipe will fail.
|
|
29995
|
-
*/
|
|
29996
29863
|
lock: function() {
|
|
29997
29864
|
if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
|
|
29998
29865
|
this.isLocked = true;
|
|
29999
29866
|
if (this.previous) this.previous.lock();
|
|
30000
29867
|
},
|
|
30001
|
-
/**
|
|
30002
|
-
*
|
|
30003
|
-
* Pretty print the workers chain.
|
|
30004
|
-
*/
|
|
30005
29868
|
toString: function() {
|
|
30006
29869
|
var me = "Worker " + this.name;
|
|
30007
29870
|
if (this.previous) return this.previous + " -> " + me;
|
|
@@ -30371,21 +30234,9 @@ var require_StreamHelper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30371
30234
|
}
|
|
30372
30235
|
}
|
|
30373
30236
|
StreamHelper.prototype = {
|
|
30374
|
-
/**
|
|
30375
|
-
* Listen a StreamHelper, accumulate its content and concatenate it into a
|
|
30376
|
-
* complete block.
|
|
30377
|
-
* @param {Function} updateCb the update callback.
|
|
30378
|
-
* @return Promise the promise for the accumulation.
|
|
30379
|
-
*/
|
|
30380
30237
|
accumulate: function(updateCb) {
|
|
30381
30238
|
return accumulate(this, updateCb);
|
|
30382
30239
|
},
|
|
30383
|
-
/**
|
|
30384
|
-
* Add a listener on an event triggered on a stream.
|
|
30385
|
-
* @param {String} evt the name of the event
|
|
30386
|
-
* @param {Function} fn the listener
|
|
30387
|
-
* @return {StreamHelper} the current helper.
|
|
30388
|
-
*/
|
|
30389
30240
|
on: function(evt, fn) {
|
|
30390
30241
|
var self = this;
|
|
30391
30242
|
if (evt === "data") this._worker.on(evt, function(chunk) {
|
|
@@ -30396,27 +30247,14 @@ var require_StreamHelper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30396
30247
|
});
|
|
30397
30248
|
return this;
|
|
30398
30249
|
},
|
|
30399
|
-
/**
|
|
30400
|
-
* Resume the flow of chunks.
|
|
30401
|
-
* @return {StreamHelper} the current helper.
|
|
30402
|
-
*/
|
|
30403
30250
|
resume: function() {
|
|
30404
30251
|
utils.delay(this._worker.resume, [], this._worker);
|
|
30405
30252
|
return this;
|
|
30406
30253
|
},
|
|
30407
|
-
/**
|
|
30408
|
-
* Pause the flow of chunks.
|
|
30409
|
-
* @return {StreamHelper} the current helper.
|
|
30410
|
-
*/
|
|
30411
30254
|
pause: function() {
|
|
30412
30255
|
this._worker.pause();
|
|
30413
30256
|
return this;
|
|
30414
30257
|
},
|
|
30415
|
-
/**
|
|
30416
|
-
* Return a nodejs stream for this helper.
|
|
30417
|
-
* @param {Function} updateCb the update callback.
|
|
30418
|
-
* @return {NodejsStreamOutputAdapter} the nodejs stream.
|
|
30419
|
-
*/
|
|
30420
30258
|
toNodejsStream: function(updateCb) {
|
|
30421
30259
|
utils.checkSupport("nodestream");
|
|
30422
30260
|
if (this._outputType !== "nodebuffer") throw new Error(this._outputType + " is not supported by this method");
|
|
@@ -30652,10 +30490,6 @@ var require_compressedObject = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
30652
30490
|
this.compressedContent = data;
|
|
30653
30491
|
}
|
|
30654
30492
|
CompressedObject.prototype = {
|
|
30655
|
-
/**
|
|
30656
|
-
* Create a worker to get the uncompressed content.
|
|
30657
|
-
* @return {GenericWorker} the worker.
|
|
30658
|
-
*/
|
|
30659
30493
|
getContentWorker: function() {
|
|
30660
30494
|
var worker = new DataWorker(external.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new DataLengthProbe("data_length"));
|
|
30661
30495
|
var that = this;
|
|
@@ -30664,10 +30498,6 @@ var require_compressedObject = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
30664
30498
|
});
|
|
30665
30499
|
return worker;
|
|
30666
30500
|
},
|
|
30667
|
-
/**
|
|
30668
|
-
* Create a worker to get the compressed content.
|
|
30669
|
-
* @return {GenericWorker} the worker.
|
|
30670
|
-
*/
|
|
30671
30501
|
getCompressedWorker: function() {
|
|
30672
30502
|
return new DataWorker(external.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
|
|
30673
30503
|
}
|
|
@@ -30715,11 +30545,6 @@ var require_zipObject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30715
30545
|
};
|
|
30716
30546
|
};
|
|
30717
30547
|
ZipObject.prototype = {
|
|
30718
|
-
/**
|
|
30719
|
-
* Create an internal stream for the content of this object.
|
|
30720
|
-
* @param {String} type the type of each chunk.
|
|
30721
|
-
* @return StreamHelper the stream.
|
|
30722
|
-
*/
|
|
30723
30548
|
internalStream: function(type) {
|
|
30724
30549
|
var result = null, outputType = "string";
|
|
30725
30550
|
try {
|
|
@@ -30737,31 +30562,12 @@ var require_zipObject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30737
30562
|
}
|
|
30738
30563
|
return new StreamHelper(result, outputType, "");
|
|
30739
30564
|
},
|
|
30740
|
-
/**
|
|
30741
|
-
* Prepare the content in the asked type.
|
|
30742
|
-
* @param {String} type the type of the result.
|
|
30743
|
-
* @param {Function} onUpdate a function to call on each internal update.
|
|
30744
|
-
* @return Promise the promise of the result.
|
|
30745
|
-
*/
|
|
30746
30565
|
async: function(type, onUpdate) {
|
|
30747
30566
|
return this.internalStream(type).accumulate(onUpdate);
|
|
30748
30567
|
},
|
|
30749
|
-
/**
|
|
30750
|
-
* Prepare the content as a nodejs stream.
|
|
30751
|
-
* @param {String} type the type of each chunk.
|
|
30752
|
-
* @param {Function} onUpdate a function to call on each internal update.
|
|
30753
|
-
* @return Stream the stream.
|
|
30754
|
-
*/
|
|
30755
30568
|
nodeStream: function(type, onUpdate) {
|
|
30756
30569
|
return this.internalStream(type || "nodebuffer").toNodejsStream(onUpdate);
|
|
30757
30570
|
},
|
|
30758
|
-
/**
|
|
30759
|
-
* Return a worker for the compressed content.
|
|
30760
|
-
* @private
|
|
30761
|
-
* @param {Object} compression the compression object to use.
|
|
30762
|
-
* @param {Object} compressionOptions the options to use when compressing.
|
|
30763
|
-
* @return Worker the worker.
|
|
30764
|
-
*/
|
|
30765
30571
|
_compressWorker: function(compression, compressionOptions) {
|
|
30766
30572
|
if (this._data instanceof CompressedObject && this._data.compression.magic === compression.magic) return this._data.getCompressedWorker();
|
|
30767
30573
|
else {
|
|
@@ -30770,11 +30576,6 @@ var require_zipObject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30770
30576
|
return CompressedObject.createWorkerFrom(result, compression, compressionOptions);
|
|
30771
30577
|
}
|
|
30772
30578
|
},
|
|
30773
|
-
/**
|
|
30774
|
-
* Return a worker for the decompressed content.
|
|
30775
|
-
* @private
|
|
30776
|
-
* @return Worker the worker.
|
|
30777
|
-
*/
|
|
30778
30579
|
_decompressWorker: function() {
|
|
30779
30580
|
if (this._data instanceof CompressedObject) return this._data.getContentWorker();
|
|
30780
30581
|
else if (this._data instanceof GenericWorker) return this._data;
|
|
@@ -35314,18 +35115,9 @@ var require_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35314
35115
|
return Object.prototype.toString.call(object) === "[object RegExp]";
|
|
35315
35116
|
}
|
|
35316
35117
|
module.exports = {
|
|
35317
|
-
/**
|
|
35318
|
-
* @see loadAsync
|
|
35319
|
-
*/
|
|
35320
35118
|
load: function() {
|
|
35321
35119
|
throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
|
|
35322
35120
|
},
|
|
35323
|
-
/**
|
|
35324
|
-
* Call a callback function for each entry at this folder level.
|
|
35325
|
-
* @param {Function} cb the callback function:
|
|
35326
|
-
* function (relativePath, file) {...}
|
|
35327
|
-
* It takes 2 arguments : the relative path and the file.
|
|
35328
|
-
*/
|
|
35329
35121
|
forEach: function(cb) {
|
|
35330
35122
|
var filename, relativePath, file;
|
|
35331
35123
|
for (filename in this.files) {
|
|
@@ -35334,13 +35126,6 @@ var require_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35334
35126
|
if (relativePath && filename.slice(0, this.root.length) === this.root) cb(relativePath, file);
|
|
35335
35127
|
}
|
|
35336
35128
|
},
|
|
35337
|
-
/**
|
|
35338
|
-
* Filter nested files/folders with the specified function.
|
|
35339
|
-
* @param {Function} search the predicate to use :
|
|
35340
|
-
* function (relativePath, file) {...}
|
|
35341
|
-
* It takes 2 arguments : the relative path and the file.
|
|
35342
|
-
* @return {Array} An array of matching elements.
|
|
35343
|
-
*/
|
|
35344
35129
|
filter: function(search) {
|
|
35345
35130
|
var result = [];
|
|
35346
35131
|
this.forEach(function(relativePath, entry) {
|
|
@@ -35348,15 +35133,6 @@ var require_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35348
35133
|
});
|
|
35349
35134
|
return result;
|
|
35350
35135
|
},
|
|
35351
|
-
/**
|
|
35352
|
-
* Add a file to the zip file, or search a file.
|
|
35353
|
-
* @param {string|RegExp} name The name of the file to add (if data is defined),
|
|
35354
|
-
* the name of the file to find (if no data) or a regex to match files.
|
|
35355
|
-
* @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded
|
|
35356
|
-
* @param {Object} o File options
|
|
35357
|
-
* @return {JSZip|Object|Array} this JSZip object (when adding a file),
|
|
35358
|
-
* a file (when searching by string) or an array of files (when searching by regex).
|
|
35359
|
-
*/
|
|
35360
35136
|
file: function(name, data, o) {
|
|
35361
35137
|
if (arguments.length === 1) if (isRegExp(name)) {
|
|
35362
35138
|
var regexp = name;
|
|
@@ -35374,11 +35150,6 @@ var require_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35374
35150
|
}
|
|
35375
35151
|
return this;
|
|
35376
35152
|
},
|
|
35377
|
-
/**
|
|
35378
|
-
* Add a directory to the zip file, or search.
|
|
35379
|
-
* @param {String|RegExp} arg The name of the directory to add, or a regex to search folders.
|
|
35380
|
-
* @return {JSZip} an object with the new directory as the root, or an array containing matching folders.
|
|
35381
|
-
*/
|
|
35382
35153
|
folder: function(arg) {
|
|
35383
35154
|
if (!arg) return this;
|
|
35384
35155
|
if (isRegExp(arg)) return this.filter(function(relativePath, file) {
|
|
@@ -35390,11 +35161,6 @@ var require_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35390
35161
|
ret.root = newFolder.name;
|
|
35391
35162
|
return ret;
|
|
35392
35163
|
},
|
|
35393
|
-
/**
|
|
35394
|
-
* Delete a file, or a directory and all sub-files, from the zip
|
|
35395
|
-
* @param {string} name the name of the file to delete
|
|
35396
|
-
* @return {JSZip} this JSZip object
|
|
35397
|
-
*/
|
|
35398
35164
|
remove: function(name) {
|
|
35399
35165
|
name = this.root + name;
|
|
35400
35166
|
var file = this.files[name];
|
|
@@ -35411,19 +35177,9 @@ var require_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35411
35177
|
}
|
|
35412
35178
|
return this;
|
|
35413
35179
|
},
|
|
35414
|
-
/**
|
|
35415
|
-
* @deprecated This method has been removed in JSZip 3.0, please check the upgrade guide.
|
|
35416
|
-
*/
|
|
35417
35180
|
generate: function() {
|
|
35418
35181
|
throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
|
|
35419
35182
|
},
|
|
35420
|
-
/**
|
|
35421
|
-
* Generate the complete zip file as an internal stream.
|
|
35422
|
-
* @param {Object} options the options to generate the zip file :
|
|
35423
|
-
* - compression, "STORE" by default.
|
|
35424
|
-
* - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob.
|
|
35425
|
-
* @return {StreamHelper} the streamed zip file.
|
|
35426
|
-
*/
|
|
35427
35183
|
generateInternalStream: function(options) {
|
|
35428
35184
|
var worker, opts = {};
|
|
35429
35185
|
try {
|
|
@@ -35452,17 +35208,9 @@ var require_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35452
35208
|
}
|
|
35453
35209
|
return new StreamHelper(worker, opts.type || "string", opts.mimeType);
|
|
35454
35210
|
},
|
|
35455
|
-
/**
|
|
35456
|
-
* Generate the complete zip file asynchronously.
|
|
35457
|
-
* @see generateInternalStream
|
|
35458
|
-
*/
|
|
35459
35211
|
generateAsync: function(options, onUpdate) {
|
|
35460
35212
|
return this.generateInternalStream(options).accumulate(onUpdate);
|
|
35461
35213
|
},
|
|
35462
|
-
/**
|
|
35463
|
-
* Generate the complete zip file asynchronously.
|
|
35464
|
-
* @see generateInternalStream
|
|
35465
|
-
*/
|
|
35466
35214
|
generateNodeStream: function(options, onUpdate) {
|
|
35467
35215
|
options = options || {};
|
|
35468
35216
|
if (!options.type) options.type = "nodebuffer";
|
|
@@ -35481,50 +35229,20 @@ var require_DataReader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35481
35229
|
this.zero = 0;
|
|
35482
35230
|
}
|
|
35483
35231
|
DataReader.prototype = {
|
|
35484
|
-
/**
|
|
35485
|
-
* Check that the offset will not go too far.
|
|
35486
|
-
* @param {string} offset the additional offset to check.
|
|
35487
|
-
* @throws {Error} an Error if the offset is out of bounds.
|
|
35488
|
-
*/
|
|
35489
35232
|
checkOffset: function(offset) {
|
|
35490
35233
|
this.checkIndex(this.index + offset);
|
|
35491
35234
|
},
|
|
35492
|
-
/**
|
|
35493
|
-
* Check that the specified index will not be too far.
|
|
35494
|
-
* @param {string} newIndex the index to check.
|
|
35495
|
-
* @throws {Error} an Error if the index is out of bounds.
|
|
35496
|
-
*/
|
|
35497
35235
|
checkIndex: function(newIndex) {
|
|
35498
35236
|
if (this.length < this.zero + newIndex || newIndex < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + newIndex + "). Corrupted zip ?");
|
|
35499
35237
|
},
|
|
35500
|
-
/**
|
|
35501
|
-
* Change the index.
|
|
35502
|
-
* @param {number} newIndex The new index.
|
|
35503
|
-
* @throws {Error} if the new index is out of the data.
|
|
35504
|
-
*/
|
|
35505
35238
|
setIndex: function(newIndex) {
|
|
35506
35239
|
this.checkIndex(newIndex);
|
|
35507
35240
|
this.index = newIndex;
|
|
35508
35241
|
},
|
|
35509
|
-
/**
|
|
35510
|
-
* Skip the next n bytes.
|
|
35511
|
-
* @param {number} n the number of bytes to skip.
|
|
35512
|
-
* @throws {Error} if the new index is out of the data.
|
|
35513
|
-
*/
|
|
35514
35242
|
skip: function(n) {
|
|
35515
35243
|
this.setIndex(this.index + n);
|
|
35516
35244
|
},
|
|
35517
|
-
/**
|
|
35518
|
-
* Get the byte at the specified index.
|
|
35519
|
-
* @param {number} i the index to use.
|
|
35520
|
-
* @return {number} a byte.
|
|
35521
|
-
*/
|
|
35522
35245
|
byteAt: function() {},
|
|
35523
|
-
/**
|
|
35524
|
-
* Get the next number with a given byte size.
|
|
35525
|
-
* @param {number} size the number of bytes to read.
|
|
35526
|
-
* @return {number} the corresponding number.
|
|
35527
|
-
*/
|
|
35528
35246
|
readInt: function(size) {
|
|
35529
35247
|
var result = 0, i;
|
|
35530
35248
|
this.checkOffset(size);
|
|
@@ -35532,36 +35250,12 @@ var require_DataReader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35532
35250
|
this.index += size;
|
|
35533
35251
|
return result;
|
|
35534
35252
|
},
|
|
35535
|
-
/**
|
|
35536
|
-
* Get the next string with a given byte size.
|
|
35537
|
-
* @param {number} size the number of bytes to read.
|
|
35538
|
-
* @return {string} the corresponding string.
|
|
35539
|
-
*/
|
|
35540
35253
|
readString: function(size) {
|
|
35541
35254
|
return utils.transformTo("string", this.readData(size));
|
|
35542
35255
|
},
|
|
35543
|
-
/**
|
|
35544
|
-
* Get raw data without conversion, <size> bytes.
|
|
35545
|
-
* @param {number} size the number of bytes to read.
|
|
35546
|
-
* @return {Object} the raw data, implementation specific.
|
|
35547
|
-
*/
|
|
35548
35256
|
readData: function() {},
|
|
35549
|
-
/**
|
|
35550
|
-
* Find the last occurrence of a zip signature (4 bytes).
|
|
35551
|
-
* @param {string} sig the signature to find.
|
|
35552
|
-
* @return {number} the index of the last occurrence, -1 if not found.
|
|
35553
|
-
*/
|
|
35554
35257
|
lastIndexOfSignature: function() {},
|
|
35555
|
-
/**
|
|
35556
|
-
* Read the signature (4 bytes) at the current position and compare it with sig.
|
|
35557
|
-
* @param {string} sig the expected signature
|
|
35558
|
-
* @return {boolean} true if the signature matches, false otherwise.
|
|
35559
|
-
*/
|
|
35560
35258
|
readAndCheckSignature: function() {},
|
|
35561
|
-
/**
|
|
35562
|
-
* Get the next date.
|
|
35563
|
-
* @return {Date} the date.
|
|
35564
|
-
*/
|
|
35565
35259
|
readDate: function() {
|
|
35566
35260
|
var dostime = this.readInt(4);
|
|
35567
35261
|
return new Date(Date.UTC((dostime >> 25 & 127) + 1980, (dostime >> 21 & 15) - 1, dostime >> 16 & 31, dostime >> 11 & 31, dostime >> 5 & 63, (dostime & 31) << 1));
|
|
@@ -35749,24 +35443,12 @@ var require_zipEntry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35749
35443
|
this.loadOptions = loadOptions;
|
|
35750
35444
|
}
|
|
35751
35445
|
ZipEntry.prototype = {
|
|
35752
|
-
/**
|
|
35753
|
-
* say if the file is encrypted.
|
|
35754
|
-
* @return {boolean} true if the file is encrypted, false otherwise.
|
|
35755
|
-
*/
|
|
35756
35446
|
isEncrypted: function() {
|
|
35757
35447
|
return (this.bitFlag & 1) === 1;
|
|
35758
35448
|
},
|
|
35759
|
-
/**
|
|
35760
|
-
* say if the file has utf-8 filename/comment.
|
|
35761
|
-
* @return {boolean} true if the filename/comment is in utf-8, false otherwise.
|
|
35762
|
-
*/
|
|
35763
35449
|
useUTF8: function() {
|
|
35764
35450
|
return (this.bitFlag & 2048) === 2048;
|
|
35765
35451
|
},
|
|
35766
|
-
/**
|
|
35767
|
-
* Read the local part of a zip file and add the info in this object.
|
|
35768
|
-
* @param {DataReader} reader the reader to use.
|
|
35769
|
-
*/
|
|
35770
35452
|
readLocalPart: function(reader) {
|
|
35771
35453
|
var compression, localExtraFieldsLength;
|
|
35772
35454
|
reader.skip(22);
|
|
@@ -35779,10 +35461,6 @@ var require_zipEntry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35779
35461
|
if (compression === null) throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")");
|
|
35780
35462
|
this.decompressed = new CompressedObject(this.compressedSize, this.uncompressedSize, this.crc32, compression, reader.readData(this.compressedSize));
|
|
35781
35463
|
},
|
|
35782
|
-
/**
|
|
35783
|
-
* Read the central part of a zip file and add the info in this object.
|
|
35784
|
-
* @param {DataReader} reader the reader to use.
|
|
35785
|
-
*/
|
|
35786
35464
|
readCentralPart: function(reader) {
|
|
35787
35465
|
this.versionMadeBy = reader.readInt(2);
|
|
35788
35466
|
reader.skip(2);
|
|
@@ -35805,9 +35483,6 @@ var require_zipEntry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35805
35483
|
this.parseZIP64ExtraField(reader);
|
|
35806
35484
|
this.fileComment = reader.readData(this.fileCommentLength);
|
|
35807
35485
|
},
|
|
35808
|
-
/**
|
|
35809
|
-
* Parse the external file attributes and get the unix/dos permissions.
|
|
35810
|
-
*/
|
|
35811
35486
|
processAttributes: function() {
|
|
35812
35487
|
this.unixPermissions = null;
|
|
35813
35488
|
this.dosPermissions = null;
|
|
@@ -35817,10 +35492,6 @@ var require_zipEntry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35817
35492
|
if (madeBy === MADE_BY_UNIX) this.unixPermissions = this.externalFileAttributes >> 16 & 65535;
|
|
35818
35493
|
if (!this.dir && this.fileNameStr.slice(-1) === "/") this.dir = true;
|
|
35819
35494
|
},
|
|
35820
|
-
/**
|
|
35821
|
-
* Parse the ZIP64 extra field and merge the info in the current ZipEntry.
|
|
35822
|
-
* @param {DataReader} reader the reader to use.
|
|
35823
|
-
*/
|
|
35824
35495
|
parseZIP64ExtraField: function() {
|
|
35825
35496
|
if (!this.extraFields[1]) return;
|
|
35826
35497
|
var extraReader = readerFor(this.extraFields[1].value);
|
|
@@ -35829,10 +35500,6 @@ var require_zipEntry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35829
35500
|
if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) this.localHeaderOffset = extraReader.readInt(8);
|
|
35830
35501
|
if (this.diskNumberStart === utils.MAX_VALUE_32BITS) this.diskNumberStart = extraReader.readInt(4);
|
|
35831
35502
|
},
|
|
35832
|
-
/**
|
|
35833
|
-
* Read the central part of a zip file and add the info in this object.
|
|
35834
|
-
* @param {DataReader} reader the reader to use.
|
|
35835
|
-
*/
|
|
35836
35503
|
readExtraFields: function(reader) {
|
|
35837
35504
|
var end = reader.index + this.extraFieldsLength, extraFieldId, extraFieldLength, extraFieldValue;
|
|
35838
35505
|
if (!this.extraFields) this.extraFields = {};
|
|
@@ -35848,9 +35515,6 @@ var require_zipEntry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35848
35515
|
}
|
|
35849
35516
|
reader.setIndex(end);
|
|
35850
35517
|
},
|
|
35851
|
-
/**
|
|
35852
|
-
* Apply an UTF8 transformation if needed.
|
|
35853
|
-
*/
|
|
35854
35518
|
handleUTF8: function() {
|
|
35855
35519
|
var decodeParamType = support.uint8array ? "uint8array" : "array";
|
|
35856
35520
|
if (this.useUTF8()) {
|
|
@@ -35871,10 +35535,6 @@ var require_zipEntry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35871
35535
|
}
|
|
35872
35536
|
}
|
|
35873
35537
|
},
|
|
35874
|
-
/**
|
|
35875
|
-
* Find the unicode path declared in the extra field, if any.
|
|
35876
|
-
* @return {String} the unicode path, null otherwise.
|
|
35877
|
-
*/
|
|
35878
35538
|
findExtraFieldUnicodePath: function() {
|
|
35879
35539
|
var upathField = this.extraFields[28789];
|
|
35880
35540
|
if (upathField) {
|
|
@@ -35885,10 +35545,6 @@ var require_zipEntry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35885
35545
|
}
|
|
35886
35546
|
return null;
|
|
35887
35547
|
},
|
|
35888
|
-
/**
|
|
35889
|
-
* Find the unicode comment declared in the extra field, if any.
|
|
35890
|
-
* @return {String} the unicode comment, null otherwise.
|
|
35891
|
-
*/
|
|
35892
35548
|
findExtraFieldUnicodeComment: function() {
|
|
35893
35549
|
var ucommentField = this.extraFields[25461];
|
|
35894
35550
|
if (ucommentField) {
|
|
@@ -35920,11 +35576,6 @@ var require_zipEntries = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35920
35576
|
this.loadOptions = loadOptions;
|
|
35921
35577
|
}
|
|
35922
35578
|
ZipEntries.prototype = {
|
|
35923
|
-
/**
|
|
35924
|
-
* Check that the reader is on the specified signature.
|
|
35925
|
-
* @param {string} expectedSignature the expected signature.
|
|
35926
|
-
* @throws {Error} if it is an other signature.
|
|
35927
|
-
*/
|
|
35928
35579
|
checkSignature: function(expectedSignature) {
|
|
35929
35580
|
if (!this.reader.readAndCheckSignature(expectedSignature)) {
|
|
35930
35581
|
this.reader.index -= 4;
|
|
@@ -35932,12 +35583,6 @@ var require_zipEntries = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35932
35583
|
throw new Error("Corrupted zip or bug: unexpected signature (" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")");
|
|
35933
35584
|
}
|
|
35934
35585
|
},
|
|
35935
|
-
/**
|
|
35936
|
-
* Check if the given signature is at the given index.
|
|
35937
|
-
* @param {number} askedIndex the index to check.
|
|
35938
|
-
* @param {string} expectedSignature the signature to expect.
|
|
35939
|
-
* @return {boolean} true if the signature is here, false otherwise.
|
|
35940
|
-
*/
|
|
35941
35586
|
isSignature: function(askedIndex, expectedSignature) {
|
|
35942
35587
|
var currentIndex = this.reader.index;
|
|
35943
35588
|
this.reader.setIndex(askedIndex);
|
|
@@ -35945,9 +35590,6 @@ var require_zipEntries = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35945
35590
|
this.reader.setIndex(currentIndex);
|
|
35946
35591
|
return result;
|
|
35947
35592
|
},
|
|
35948
|
-
/**
|
|
35949
|
-
* Read the end of the central directory.
|
|
35950
|
-
*/
|
|
35951
35593
|
readBlockEndOfCentral: function() {
|
|
35952
35594
|
this.diskNumber = this.reader.readInt(2);
|
|
35953
35595
|
this.diskWithCentralDirStart = this.reader.readInt(2);
|
|
@@ -35961,12 +35603,6 @@ var require_zipEntries = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35961
35603
|
var decodeContent = utils.transformTo(decodeParamType, zipComment);
|
|
35962
35604
|
this.zipComment = this.loadOptions.decodeFileName(decodeContent);
|
|
35963
35605
|
},
|
|
35964
|
-
/**
|
|
35965
|
-
* Read the end of the Zip 64 central directory.
|
|
35966
|
-
* Not merged with the method readEndOfCentral :
|
|
35967
|
-
* The end of central can coexist with its Zip64 brother,
|
|
35968
|
-
* I don't want to read the wrong number of bytes !
|
|
35969
|
-
*/
|
|
35970
35606
|
readBlockZip64EndOfCentral: function() {
|
|
35971
35607
|
this.zip64EndOfCentralSize = this.reader.readInt(8);
|
|
35972
35608
|
this.reader.skip(4);
|
|
@@ -35989,18 +35625,12 @@ var require_zipEntries = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
35989
35625
|
};
|
|
35990
35626
|
}
|
|
35991
35627
|
},
|
|
35992
|
-
/**
|
|
35993
|
-
* Read the end of the Zip 64 central directory locator.
|
|
35994
|
-
*/
|
|
35995
35628
|
readBlockZip64EndOfCentralLocator: function() {
|
|
35996
35629
|
this.diskWithZip64CentralDirStart = this.reader.readInt(4);
|
|
35997
35630
|
this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8);
|
|
35998
35631
|
this.disksCount = this.reader.readInt(4);
|
|
35999
35632
|
if (this.disksCount > 1) throw new Error("Multi-volumes zip are not supported");
|
|
36000
35633
|
},
|
|
36001
|
-
/**
|
|
36002
|
-
* Read the local files, based on the offset read in the central part.
|
|
36003
|
-
*/
|
|
36004
35634
|
readLocalFiles: function() {
|
|
36005
35635
|
var i, file;
|
|
36006
35636
|
for (i = 0; i < this.files.length; i++) {
|
|
@@ -36012,9 +35642,6 @@ var require_zipEntries = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
36012
35642
|
file.processAttributes();
|
|
36013
35643
|
}
|
|
36014
35644
|
},
|
|
36015
|
-
/**
|
|
36016
|
-
* Read the central directory.
|
|
36017
|
-
*/
|
|
36018
35645
|
readCentralDir: function() {
|
|
36019
35646
|
var file;
|
|
36020
35647
|
this.reader.setIndex(this.centralDirOffset);
|
|
@@ -36027,9 +35654,6 @@ var require_zipEntries = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
36027
35654
|
if (this.centralDirRecords !== 0 && this.files.length === 0) throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
|
|
36028
35655
|
}
|
|
36029
35656
|
},
|
|
36030
|
-
/**
|
|
36031
|
-
* Read the end of central directory.
|
|
36032
|
-
*/
|
|
36033
35657
|
readEndOfCentral: function() {
|
|
36034
35658
|
var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);
|
|
36035
35659
|
if (offset < 0) if (!this.isSignature(0, sig.LOCAL_FILE_HEADER)) throw new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");
|
|
@@ -36065,10 +35689,6 @@ var require_zipEntries = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
36065
35689
|
prepareReader: function(data) {
|
|
36066
35690
|
this.reader = readerFor(data);
|
|
36067
35691
|
},
|
|
36068
|
-
/**
|
|
36069
|
-
* Read a zip file and create ZipEntries.
|
|
36070
|
-
* @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file.
|
|
36071
|
-
*/
|
|
36072
35692
|
load: function(data) {
|
|
36073
35693
|
this.prepareReader(data);
|
|
36074
35694
|
this.readEndOfCentral();
|
|
@@ -36240,6 +35860,7 @@ const createZip = async ({ outfile, targetDir, excludeExts = [] }) => {
|
|
|
36240
35860
|
compressionOptions: { level: 9 },
|
|
36241
35861
|
platform: "UNIX"
|
|
36242
35862
|
});
|
|
35863
|
+
await fs$1.mkdir(path.dirname(outfile), { recursive: true });
|
|
36243
35864
|
await fs$1.writeFile(outfile, content);
|
|
36244
35865
|
return outfile;
|
|
36245
35866
|
};
|
|
@@ -40768,8 +40389,8 @@ const addPropertiesAsync = {
|
|
|
40768
40389
|
},
|
|
40769
40390
|
output: {
|
|
40770
40391
|
...addProperties,
|
|
40771
|
-
fileUrl: ({ value }) => ({ stream: createWriteStream(value) }),
|
|
40772
|
-
filePath: ({ value: { file, append } }) => ({ stream: createWriteStream(file, append ? { flags: "a" } : {}) }),
|
|
40392
|
+
fileUrl: ({ value }) => ({ stream: createWriteStream$1(value) }),
|
|
40393
|
+
filePath: ({ value: { file, append } }) => ({ stream: createWriteStream$1(file, append ? { flags: "a" } : {}) }),
|
|
40773
40394
|
webStream: ({ value }) => ({ stream: Writable.fromWeb(value) }),
|
|
40774
40395
|
iterable: forbiddenIfAsync,
|
|
40775
40396
|
asyncIterable: forbiddenIfAsync,
|
|
@@ -43291,6 +42912,16 @@ const getDefaultPlatformConfig = () => {
|
|
|
43291
42912
|
});
|
|
43292
42913
|
if (plistFiles.length > 0) infoPlistPaths = plistFiles.map((file) => `ios/${file}`);
|
|
43293
42914
|
} catch {}
|
|
42915
|
+
let androidManifestPaths = [];
|
|
42916
|
+
try {
|
|
42917
|
+
const manifestFiles = import_out.default.sync(path.join("**", "AndroidManifest.xml"), {
|
|
42918
|
+
cwd: path.join(getCwd(), "android"),
|
|
42919
|
+
absolute: false,
|
|
42920
|
+
onlyFiles: true,
|
|
42921
|
+
ignore: ["**/build/**", "**/.gradle/**"]
|
|
42922
|
+
});
|
|
42923
|
+
if (manifestFiles.length > 0) androidManifestPaths = manifestFiles.map((file) => path.join("android", file));
|
|
42924
|
+
} catch {}
|
|
43294
42925
|
let stringResourcePaths = [];
|
|
43295
42926
|
try {
|
|
43296
42927
|
const stringsFiles = import_out.default.sync(path.join("**", "strings.xml"), {
|
|
@@ -43301,12 +42932,16 @@ const getDefaultPlatformConfig = () => {
|
|
|
43301
42932
|
if (stringsFiles.length > 0) stringResourcePaths = stringsFiles.map((file) => path.join("android", file));
|
|
43302
42933
|
} catch {}
|
|
43303
42934
|
return {
|
|
43304
|
-
android: {
|
|
42935
|
+
android: {
|
|
42936
|
+
androidManifestPaths,
|
|
42937
|
+
stringResourcePaths
|
|
42938
|
+
},
|
|
43305
42939
|
ios: { infoPlistPaths }
|
|
43306
42940
|
};
|
|
43307
42941
|
};
|
|
43308
42942
|
const getDefaultConfig = () => {
|
|
43309
42943
|
return {
|
|
42944
|
+
cacheDir: path.join("node_modules", ".hot-updater"),
|
|
43310
42945
|
releaseChannel: "production",
|
|
43311
42946
|
updateStrategy: "appVersion",
|
|
43312
42947
|
compressStrategy: "zip",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/cli-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"oxc-transform": "0.121.0",
|
|
47
47
|
"typescript": "6.0.2",
|
|
48
48
|
"unconfig": "7.5.0",
|
|
49
|
-
"@hot-updater/core": "0.
|
|
50
|
-
"@hot-updater/
|
|
49
|
+
"@hot-updater/plugin-core": "0.32.0",
|
|
50
|
+
"@hot-updater/core": "0.32.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@clack/prompts": "1.0.1",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"semver": "^7.6.3",
|
|
63
63
|
"tar": "^7.5.1",
|
|
64
64
|
"workspace-tools": "^0.36.4",
|
|
65
|
-
"@hot-updater/test-utils": "0.
|
|
65
|
+
"@hot-updater/test-utils": "0.32.0"
|
|
66
66
|
},
|
|
67
67
|
"inlinedDependencies": {
|
|
68
68
|
"@babel/code-frame": "7.29.0",
|