@hot-updater/console 0.27.1 → 0.29.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/.output/nitro.json +17 -0
- package/.output/public/apple-touch-icon.png +0 -0
- package/.output/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/.output/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/.output/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/.output/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/.output/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/.output/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/.output/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/.output/public/assets/main-Dlx8-qN-.js +61 -0
- package/.output/public/assets/routes-DB0tWmiJ.js +10 -0
- package/.output/public/assets/styles-Bfxg4M1x.css +2 -0
- package/.output/public/favicon-16x16.png +0 -0
- package/.output/public/favicon-32x32.png +0 -0
- package/.output/public/favicon.ico +0 -0
- package/.output/public/logo.svg +1 -0
- package/.output/public/manifest.json +30 -0
- package/.output/public/robots.txt +3 -0
- package/.output/server/_chunks/ssr-renderer.mjs +15 -0
- package/.output/server/_libs/@floating-ui/core+[...].mjs +698 -0
- package/.output/server/_libs/@floating-ui/dom+[...].mjs +644 -0
- package/.output/server/_libs/@floating-ui/react-dom+[...].mjs +839 -0
- package/.output/server/_libs/@radix-ui/react-alert-dialog+[...].mjs +2093 -0
- package/.output/server/_libs/@radix-ui/react-popper+[...].mjs +287 -0
- package/.output/server/_libs/@radix-ui/react-select+[...].mjs +1003 -0
- package/.output/server/_libs/@tanstack/devtools-event-client+[...].mjs +196 -0
- package/.output/server/_libs/@tanstack/form-core+[...].mjs +2396 -0
- package/.output/server/_libs/@tanstack/react-form+[...].mjs +298 -0
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +13068 -0
- package/.output/server/_libs/@tanstack/react-table+[...].mjs +2372 -0
- package/.output/server/_libs/chownr.mjs +60 -0
- package/.output/server/_libs/class-variance-authority+clsx.mjs +69 -0
- package/.output/server/_libs/core-util-is.mjs +67 -0
- package/.output/server/_libs/dayjs.mjs +408 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +1158 -0
- package/.output/server/_libs/hookable.mjs +41 -0
- package/.output/server/_libs/immediate.mjs +57 -0
- package/.output/server/_libs/inherits.mjs +39 -0
- package/.output/server/_libs/isaacs__fs-minipass+minipass.mjs +1120 -0
- package/.output/server/_libs/isarray.mjs +10 -0
- package/.output/server/_libs/jszip+[...].mjs +8311 -0
- package/.output/server/_libs/lucide-react.mjs +371 -0
- package/.output/server/_libs/minizlib.mjs +345 -0
- package/.output/server/_libs/next-themes.mjs +49 -0
- package/.output/server/_libs/radix-ui__number.mjs +6 -0
- package/.output/server/_libs/radix-ui__primitive.mjs +9 -0
- package/.output/server/_libs/radix-ui__react-arrow.mjs +23 -0
- package/.output/server/_libs/radix-ui__react-collection.mjs +78 -0
- package/.output/server/_libs/radix-ui__react-direction.mjs +11 -0
- package/.output/server/_libs/radix-ui__react-label.mjs +22 -0
- package/.output/server/_libs/radix-ui__react-separator.mjs +31 -0
- package/.output/server/_libs/radix-ui__react-slider.mjs +451 -0
- package/.output/server/_libs/radix-ui__react-switch.mjs +118 -0
- package/.output/server/_libs/radix-ui__react-tooltip.mjs +491 -0
- package/.output/server/_libs/semver.mjs +1339 -0
- package/.output/server/_libs/sonner.mjs +908 -0
- package/.output/server/_libs/tailwind-merge.mjs +1962 -0
- package/.output/server/_libs/tanstack__history.mjs +322 -0
- package/.output/server/_libs/tanstack__query-core.mjs +2073 -0
- package/.output/server/_libs/tanstack__react-query.mjs +146 -0
- package/.output/server/_libs/tanstack__router-core.mjs +6 -0
- package/.output/server/_libs/tar.mjs +1996 -0
- package/.output/server/_libs/ufo.mjs +64 -0
- package/.output/server/_runtime.mjs +26 -0
- package/.output/server/_ssr/api-rpc-D3ZehMIN.mjs +217 -0
- package/.output/server/_ssr/config.server-JUYQ7UbI.mjs +26 -0
- package/.output/server/_ssr/deleteBundle-DWUxu9-K.mjs +22 -0
- package/.output/server/_ssr/extract-timestamp-from-uuidv7-B90UBADU.mjs +24 -0
- package/.output/server/_ssr/promoteBundle-DtMHuubR.mjs +1571 -0
- package/.output/server/_ssr/router-pgc7NX76.mjs +250 -0
- package/.output/server/_ssr/routes-PqTTQSoI.mjs +1833 -0
- package/.output/server/_ssr/sidebar-DXng0IOP.mjs +439 -0
- package/.output/server/_ssr/ssr.mjs +5050 -0
- package/.output/server/_ssr/start-DQK0r85G.mjs +4 -0
- package/.output/server/_tanstack-start-manifest_v-DTbQVOpU.mjs +17 -0
- package/.output/server/index.mjs +417 -0
- package/.output/server/node_modules/tslib/modules/index.js +70 -0
- package/.output/server/node_modules/tslib/modules/package.json +3 -0
- package/.output/server/node_modules/tslib/package.json +47 -0
- package/.output/server/node_modules/tslib/tslib.js +484 -0
- package/.output/server/package.json +9 -0
- package/README.md +191 -2
- package/package.json +77 -50
- package/dist/.gitkeep +0 -0
- package/dist/assets/favicon-BkwcEHsj.ico +0 -0
- package/dist/assets/index-DUlKsori.css +0 -1
- package/dist/assets/index-ijmIcyn1.js +0 -27
- package/dist/assets/logo-BYNFyja1.png +0 -0
- package/dist/index.cjs +0 -2129
- package/dist/index.d.cts +0 -218
- package/dist/index.d.ts +0 -218
- package/dist/index.html +0 -14
- package/dist/index.js +0 -2125
|
@@ -0,0 +1,1996 @@
|
|
|
1
|
+
import { i as Minipass, n as ReadStreamSync, r as WriteStream, t as ReadStream } from "./isaacs__fs-minipass+minipass.mjs";
|
|
2
|
+
import { n as Unzip, r as ZstdDecompress, t as BrotliDecompress } from "./minizlib.mjs";
|
|
3
|
+
import { n as chownrSync, t as chownr } from "./chownr.mjs";
|
|
4
|
+
import { randomBytes } from "node:crypto";
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import path, { basename, join, posix, win32 } from "node:path";
|
|
7
|
+
import fs$1 from "node:fs/promises";
|
|
8
|
+
import { EventEmitter } from "events";
|
|
9
|
+
import fs$2 from "fs";
|
|
10
|
+
import { dirname as dirname$1, parse } from "path";
|
|
11
|
+
import assert from "node:assert";
|
|
12
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/options.js
|
|
13
|
+
var argmap = new Map([
|
|
14
|
+
["C", "cwd"],
|
|
15
|
+
["f", "file"],
|
|
16
|
+
["z", "gzip"],
|
|
17
|
+
["P", "preservePaths"],
|
|
18
|
+
["U", "unlink"],
|
|
19
|
+
["strip-components", "strip"],
|
|
20
|
+
["stripComponents", "strip"],
|
|
21
|
+
["keep-newer", "newer"],
|
|
22
|
+
["keepNewer", "newer"],
|
|
23
|
+
["keep-newer-files", "newer"],
|
|
24
|
+
["keepNewerFiles", "newer"],
|
|
25
|
+
["k", "keep"],
|
|
26
|
+
["keep-existing", "keep"],
|
|
27
|
+
["keepExisting", "keep"],
|
|
28
|
+
["m", "noMtime"],
|
|
29
|
+
["no-mtime", "noMtime"],
|
|
30
|
+
["p", "preserveOwner"],
|
|
31
|
+
["L", "follow"],
|
|
32
|
+
["h", "follow"],
|
|
33
|
+
["onentry", "onReadEntry"]
|
|
34
|
+
]);
|
|
35
|
+
var isSyncFile = (o) => !!o.sync && !!o.file;
|
|
36
|
+
var isAsyncFile = (o) => !o.sync && !!o.file;
|
|
37
|
+
var isSyncNoFile = (o) => !!o.sync && !o.file;
|
|
38
|
+
var isAsyncNoFile = (o) => !o.sync && !o.file;
|
|
39
|
+
var dealiasKey = (k) => {
|
|
40
|
+
const d = argmap.get(k);
|
|
41
|
+
if (d) return d;
|
|
42
|
+
return k;
|
|
43
|
+
};
|
|
44
|
+
var dealias = (opt = {}) => {
|
|
45
|
+
if (!opt) return {};
|
|
46
|
+
const result = {};
|
|
47
|
+
for (const [key, v] of Object.entries(opt)) {
|
|
48
|
+
const k = dealiasKey(key);
|
|
49
|
+
result[k] = v;
|
|
50
|
+
}
|
|
51
|
+
if (result.chmod === void 0 && result.noChmod === false) result.chmod = true;
|
|
52
|
+
delete result.noChmod;
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/make-command.js
|
|
57
|
+
var makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => {
|
|
58
|
+
return Object.assign((opt_ = [], entries, cb) => {
|
|
59
|
+
if (Array.isArray(opt_)) {
|
|
60
|
+
entries = opt_;
|
|
61
|
+
opt_ = {};
|
|
62
|
+
}
|
|
63
|
+
if (typeof entries === "function") {
|
|
64
|
+
cb = entries;
|
|
65
|
+
entries = void 0;
|
|
66
|
+
}
|
|
67
|
+
if (!entries) entries = [];
|
|
68
|
+
else entries = Array.from(entries);
|
|
69
|
+
const opt = dealias(opt_);
|
|
70
|
+
validate?.(opt, entries);
|
|
71
|
+
if (isSyncFile(opt)) {
|
|
72
|
+
if (typeof cb === "function") throw new TypeError("callback not supported for sync tar functions");
|
|
73
|
+
return syncFile(opt, entries);
|
|
74
|
+
} else if (isAsyncFile(opt)) {
|
|
75
|
+
const p = asyncFile(opt, entries);
|
|
76
|
+
const c = cb ? cb : void 0;
|
|
77
|
+
return c ? p.then(() => c(), c) : p;
|
|
78
|
+
} else if (isSyncNoFile(opt)) {
|
|
79
|
+
if (typeof cb === "function") throw new TypeError("callback not supported for sync tar functions");
|
|
80
|
+
return syncNoFile(opt, entries);
|
|
81
|
+
} else if (isAsyncNoFile(opt)) {
|
|
82
|
+
if (typeof cb === "function") throw new TypeError("callback only supported with file option");
|
|
83
|
+
return asyncNoFile(opt, entries);
|
|
84
|
+
} else throw new Error("impossible options??");
|
|
85
|
+
/* c8 ignore stop */
|
|
86
|
+
}, {
|
|
87
|
+
syncFile,
|
|
88
|
+
asyncFile,
|
|
89
|
+
syncNoFile,
|
|
90
|
+
asyncNoFile,
|
|
91
|
+
validate
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/large-numbers.js
|
|
96
|
+
var encode$1 = (num, buf) => {
|
|
97
|
+
if (!Number.isSafeInteger(num)) throw Error("cannot encode number outside of javascript safe integer range");
|
|
98
|
+
else if (num < 0) encodeNegative(num, buf);
|
|
99
|
+
else encodePositive(num, buf);
|
|
100
|
+
return buf;
|
|
101
|
+
};
|
|
102
|
+
var encodePositive = (num, buf) => {
|
|
103
|
+
buf[0] = 128;
|
|
104
|
+
for (var i = buf.length; i > 1; i--) {
|
|
105
|
+
buf[i - 1] = num & 255;
|
|
106
|
+
num = Math.floor(num / 256);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var encodeNegative = (num, buf) => {
|
|
110
|
+
buf[0] = 255;
|
|
111
|
+
var flipped = false;
|
|
112
|
+
num = num * -1;
|
|
113
|
+
for (var i = buf.length; i > 1; i--) {
|
|
114
|
+
var byte = num & 255;
|
|
115
|
+
num = Math.floor(num / 256);
|
|
116
|
+
if (flipped) buf[i - 1] = onesComp(byte);
|
|
117
|
+
else if (byte === 0) buf[i - 1] = 0;
|
|
118
|
+
else {
|
|
119
|
+
flipped = true;
|
|
120
|
+
buf[i - 1] = twosComp(byte);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var parse$2 = (buf) => {
|
|
125
|
+
const pre = buf[0];
|
|
126
|
+
const value = pre === 128 ? pos(buf.subarray(1, buf.length)) : pre === 255 ? twos(buf) : null;
|
|
127
|
+
if (value === null) throw Error("invalid base256 encoding");
|
|
128
|
+
if (!Number.isSafeInteger(value)) throw Error("parsed number outside of javascript safe integer range");
|
|
129
|
+
return value;
|
|
130
|
+
};
|
|
131
|
+
var twos = (buf) => {
|
|
132
|
+
var len = buf.length;
|
|
133
|
+
var sum = 0;
|
|
134
|
+
var flipped = false;
|
|
135
|
+
for (var i = len - 1; i > -1; i--) {
|
|
136
|
+
var byte = Number(buf[i]);
|
|
137
|
+
var f;
|
|
138
|
+
if (flipped) f = onesComp(byte);
|
|
139
|
+
else if (byte === 0) f = byte;
|
|
140
|
+
else {
|
|
141
|
+
flipped = true;
|
|
142
|
+
f = twosComp(byte);
|
|
143
|
+
}
|
|
144
|
+
if (f !== 0) sum -= f * Math.pow(256, len - i - 1);
|
|
145
|
+
}
|
|
146
|
+
return sum;
|
|
147
|
+
};
|
|
148
|
+
var pos = (buf) => {
|
|
149
|
+
var len = buf.length;
|
|
150
|
+
var sum = 0;
|
|
151
|
+
for (var i = len - 1; i > -1; i--) {
|
|
152
|
+
var byte = Number(buf[i]);
|
|
153
|
+
if (byte !== 0) sum += byte * Math.pow(256, len - i - 1);
|
|
154
|
+
}
|
|
155
|
+
return sum;
|
|
156
|
+
};
|
|
157
|
+
var onesComp = (byte) => (255 ^ byte) & 255;
|
|
158
|
+
var twosComp = (byte) => (255 ^ byte) + 1 & 255;
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/types.js
|
|
161
|
+
var isCode = (c) => name.has(c);
|
|
162
|
+
var name = new Map([
|
|
163
|
+
["0", "File"],
|
|
164
|
+
["", "OldFile"],
|
|
165
|
+
["1", "Link"],
|
|
166
|
+
["2", "SymbolicLink"],
|
|
167
|
+
["3", "CharacterDevice"],
|
|
168
|
+
["4", "BlockDevice"],
|
|
169
|
+
["5", "Directory"],
|
|
170
|
+
["6", "FIFO"],
|
|
171
|
+
["7", "ContiguousFile"],
|
|
172
|
+
["g", "GlobalExtendedHeader"],
|
|
173
|
+
["x", "ExtendedHeader"],
|
|
174
|
+
["A", "SolarisACL"],
|
|
175
|
+
["D", "GNUDumpDir"],
|
|
176
|
+
["I", "Inode"],
|
|
177
|
+
["K", "NextFileHasLongLinkpath"],
|
|
178
|
+
["L", "NextFileHasLongPath"],
|
|
179
|
+
["M", "ContinuationFile"],
|
|
180
|
+
["N", "OldGnuLongPath"],
|
|
181
|
+
["S", "SparseFile"],
|
|
182
|
+
["V", "TapeVolumeHeader"],
|
|
183
|
+
["X", "OldExtendedHeader"]
|
|
184
|
+
]);
|
|
185
|
+
var code = new Map(Array.from(name).map((kv) => [kv[1], kv[0]]));
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/header.js
|
|
188
|
+
var Header = class {
|
|
189
|
+
cksumValid = false;
|
|
190
|
+
needPax = false;
|
|
191
|
+
nullBlock = false;
|
|
192
|
+
block;
|
|
193
|
+
path;
|
|
194
|
+
mode;
|
|
195
|
+
uid;
|
|
196
|
+
gid;
|
|
197
|
+
size;
|
|
198
|
+
cksum;
|
|
199
|
+
#type = "Unsupported";
|
|
200
|
+
linkpath;
|
|
201
|
+
uname;
|
|
202
|
+
gname;
|
|
203
|
+
devmaj = 0;
|
|
204
|
+
devmin = 0;
|
|
205
|
+
atime;
|
|
206
|
+
ctime;
|
|
207
|
+
mtime;
|
|
208
|
+
charset;
|
|
209
|
+
comment;
|
|
210
|
+
constructor(data, off = 0, ex, gex) {
|
|
211
|
+
if (Buffer.isBuffer(data)) this.decode(data, off || 0, ex, gex);
|
|
212
|
+
else if (data) this.#slurp(data);
|
|
213
|
+
}
|
|
214
|
+
decode(buf, off, ex, gex) {
|
|
215
|
+
if (!off) off = 0;
|
|
216
|
+
if (!buf || !(buf.length >= off + 512)) throw new Error("need 512 bytes for header");
|
|
217
|
+
this.path = decString(buf, off, 100);
|
|
218
|
+
this.mode = decNumber(buf, off + 100, 8);
|
|
219
|
+
this.uid = decNumber(buf, off + 108, 8);
|
|
220
|
+
this.gid = decNumber(buf, off + 116, 8);
|
|
221
|
+
this.size = decNumber(buf, off + 124, 12);
|
|
222
|
+
this.mtime = decDate(buf, off + 136, 12);
|
|
223
|
+
this.cksum = decNumber(buf, off + 148, 12);
|
|
224
|
+
if (gex) this.#slurp(gex, true);
|
|
225
|
+
if (ex) this.#slurp(ex);
|
|
226
|
+
const t = decString(buf, off + 156, 1);
|
|
227
|
+
if (isCode(t)) this.#type = t || "0";
|
|
228
|
+
if (this.#type === "0" && this.path.slice(-1) === "/") this.#type = "5";
|
|
229
|
+
if (this.#type === "5") this.size = 0;
|
|
230
|
+
this.linkpath = decString(buf, off + 157, 100);
|
|
231
|
+
if (buf.subarray(off + 257, off + 265).toString() === "ustar\x0000") {
|
|
232
|
+
this.uname = decString(buf, off + 265, 32);
|
|
233
|
+
this.gname = decString(buf, off + 297, 32);
|
|
234
|
+
/* c8 ignore start */
|
|
235
|
+
this.devmaj = decNumber(buf, off + 329, 8) ?? 0;
|
|
236
|
+
this.devmin = decNumber(buf, off + 337, 8) ?? 0;
|
|
237
|
+
/* c8 ignore stop */
|
|
238
|
+
if (buf[off + 475] !== 0) this.path = decString(buf, off + 345, 155) + "/" + this.path;
|
|
239
|
+
else {
|
|
240
|
+
const prefix = decString(buf, off + 345, 130);
|
|
241
|
+
if (prefix) this.path = prefix + "/" + this.path;
|
|
242
|
+
this.atime = decDate(buf, off + 476, 12);
|
|
243
|
+
this.ctime = decDate(buf, off + 488, 12);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
let sum = 256;
|
|
247
|
+
for (let i = off; i < off + 148; i++) sum += buf[i];
|
|
248
|
+
for (let i = off + 156; i < off + 512; i++) sum += buf[i];
|
|
249
|
+
this.cksumValid = sum === this.cksum;
|
|
250
|
+
if (this.cksum === void 0 && sum === 256) this.nullBlock = true;
|
|
251
|
+
}
|
|
252
|
+
#slurp(ex, gex = false) {
|
|
253
|
+
Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
|
|
254
|
+
return !(v === null || v === void 0 || k === "path" && gex || k === "linkpath" && gex || k === "global");
|
|
255
|
+
})));
|
|
256
|
+
}
|
|
257
|
+
encode(buf, off = 0) {
|
|
258
|
+
if (!buf) buf = this.block = Buffer.alloc(512);
|
|
259
|
+
if (this.#type === "Unsupported") this.#type = "0";
|
|
260
|
+
if (!(buf.length >= off + 512)) throw new Error("need 512 bytes for header");
|
|
261
|
+
const prefixSize = this.ctime || this.atime ? 130 : 155;
|
|
262
|
+
const split = splitPrefix(this.path || "", prefixSize);
|
|
263
|
+
const path = split[0];
|
|
264
|
+
const prefix = split[1];
|
|
265
|
+
this.needPax = !!split[2];
|
|
266
|
+
this.needPax = encString(buf, off, 100, path) || this.needPax;
|
|
267
|
+
this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax;
|
|
268
|
+
this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax;
|
|
269
|
+
this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax;
|
|
270
|
+
this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax;
|
|
271
|
+
this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax;
|
|
272
|
+
buf[off + 156] = this.#type.charCodeAt(0);
|
|
273
|
+
this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax;
|
|
274
|
+
buf.write("ustar\x0000", off + 257, 8);
|
|
275
|
+
this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax;
|
|
276
|
+
this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax;
|
|
277
|
+
this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax;
|
|
278
|
+
this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax;
|
|
279
|
+
this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax;
|
|
280
|
+
if (buf[off + 475] !== 0) this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax;
|
|
281
|
+
else {
|
|
282
|
+
this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax;
|
|
283
|
+
this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax;
|
|
284
|
+
this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax;
|
|
285
|
+
}
|
|
286
|
+
let sum = 256;
|
|
287
|
+
for (let i = off; i < off + 148; i++) sum += buf[i];
|
|
288
|
+
for (let i = off + 156; i < off + 512; i++) sum += buf[i];
|
|
289
|
+
this.cksum = sum;
|
|
290
|
+
encNumber(buf, off + 148, 8, this.cksum);
|
|
291
|
+
this.cksumValid = true;
|
|
292
|
+
return this.needPax;
|
|
293
|
+
}
|
|
294
|
+
get type() {
|
|
295
|
+
return this.#type === "Unsupported" ? this.#type : name.get(this.#type);
|
|
296
|
+
}
|
|
297
|
+
get typeKey() {
|
|
298
|
+
return this.#type;
|
|
299
|
+
}
|
|
300
|
+
set type(type) {
|
|
301
|
+
const c = String(code.get(type));
|
|
302
|
+
if (isCode(c) || c === "Unsupported") this.#type = c;
|
|
303
|
+
else if (isCode(type)) this.#type = type;
|
|
304
|
+
else throw new TypeError("invalid entry type: " + type);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
var splitPrefix = (p, prefixSize) => {
|
|
308
|
+
const pathSize = 100;
|
|
309
|
+
let pp = p;
|
|
310
|
+
let prefix = "";
|
|
311
|
+
let ret = void 0;
|
|
312
|
+
const root = posix.parse(p).root || ".";
|
|
313
|
+
if (Buffer.byteLength(pp) < pathSize) ret = [
|
|
314
|
+
pp,
|
|
315
|
+
prefix,
|
|
316
|
+
false
|
|
317
|
+
];
|
|
318
|
+
else {
|
|
319
|
+
prefix = posix.dirname(pp);
|
|
320
|
+
pp = posix.basename(pp);
|
|
321
|
+
do
|
|
322
|
+
if (Buffer.byteLength(pp) <= pathSize && Buffer.byteLength(prefix) <= prefixSize) ret = [
|
|
323
|
+
pp,
|
|
324
|
+
prefix,
|
|
325
|
+
false
|
|
326
|
+
];
|
|
327
|
+
else if (Buffer.byteLength(pp) > pathSize && Buffer.byteLength(prefix) <= prefixSize) ret = [
|
|
328
|
+
pp.slice(0, pathSize - 1),
|
|
329
|
+
prefix,
|
|
330
|
+
true
|
|
331
|
+
];
|
|
332
|
+
else {
|
|
333
|
+
pp = posix.join(posix.basename(prefix), pp);
|
|
334
|
+
prefix = posix.dirname(prefix);
|
|
335
|
+
}
|
|
336
|
+
while (prefix !== root && ret === void 0);
|
|
337
|
+
if (!ret) ret = [
|
|
338
|
+
p.slice(0, pathSize - 1),
|
|
339
|
+
"",
|
|
340
|
+
true
|
|
341
|
+
];
|
|
342
|
+
}
|
|
343
|
+
return ret;
|
|
344
|
+
};
|
|
345
|
+
var decString = (buf, off, size) => buf.subarray(off, off + size).toString("utf8").replace(/\0.*/, "");
|
|
346
|
+
var decDate = (buf, off, size) => numToDate(decNumber(buf, off, size));
|
|
347
|
+
var numToDate = (num) => num === void 0 ? void 0 : /* @__PURE__ */ new Date(num * 1e3);
|
|
348
|
+
var decNumber = (buf, off, size) => Number(buf[off]) & 128 ? parse$2(buf.subarray(off, off + size)) : decSmallNumber(buf, off, size);
|
|
349
|
+
var nanUndef = (value) => isNaN(value) ? void 0 : value;
|
|
350
|
+
var decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf.subarray(off, off + size).toString("utf8").replace(/\0.*$/, "").trim(), 8));
|
|
351
|
+
var MAXNUM = {
|
|
352
|
+
12: 8589934591,
|
|
353
|
+
8: 2097151
|
|
354
|
+
};
|
|
355
|
+
var encNumber = (buf, off, size, num) => num === void 0 ? false : num > MAXNUM[size] || num < 0 ? (encode$1(num, buf.subarray(off, off + size)), true) : (encSmallNumber(buf, off, size, num), false);
|
|
356
|
+
var encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, "ascii");
|
|
357
|
+
var octalString = (num, size) => padOctal(Math.floor(num).toString(8), size);
|
|
358
|
+
var padOctal = (str, size) => (str.length === size - 1 ? str : new Array(size - str.length - 1).join("0") + str + " ") + "\0";
|
|
359
|
+
var encDate = (buf, off, size, date) => date === void 0 ? false : encNumber(buf, off, size, date.getTime() / 1e3);
|
|
360
|
+
var NULLS = new Array(156).join("\0");
|
|
361
|
+
var encString = (buf, off, size, str) => str === void 0 ? false : (buf.write(str + NULLS, off, size, "utf8"), str.length !== Buffer.byteLength(str) || str.length > size);
|
|
362
|
+
//#endregion
|
|
363
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/pax.js
|
|
364
|
+
var Pax = class Pax {
|
|
365
|
+
atime;
|
|
366
|
+
mtime;
|
|
367
|
+
ctime;
|
|
368
|
+
charset;
|
|
369
|
+
comment;
|
|
370
|
+
gid;
|
|
371
|
+
uid;
|
|
372
|
+
gname;
|
|
373
|
+
uname;
|
|
374
|
+
linkpath;
|
|
375
|
+
dev;
|
|
376
|
+
ino;
|
|
377
|
+
nlink;
|
|
378
|
+
path;
|
|
379
|
+
size;
|
|
380
|
+
mode;
|
|
381
|
+
global;
|
|
382
|
+
constructor(obj, global = false) {
|
|
383
|
+
this.atime = obj.atime;
|
|
384
|
+
this.charset = obj.charset;
|
|
385
|
+
this.comment = obj.comment;
|
|
386
|
+
this.ctime = obj.ctime;
|
|
387
|
+
this.dev = obj.dev;
|
|
388
|
+
this.gid = obj.gid;
|
|
389
|
+
this.global = global;
|
|
390
|
+
this.gname = obj.gname;
|
|
391
|
+
this.ino = obj.ino;
|
|
392
|
+
this.linkpath = obj.linkpath;
|
|
393
|
+
this.mtime = obj.mtime;
|
|
394
|
+
this.nlink = obj.nlink;
|
|
395
|
+
this.path = obj.path;
|
|
396
|
+
this.size = obj.size;
|
|
397
|
+
this.uid = obj.uid;
|
|
398
|
+
this.uname = obj.uname;
|
|
399
|
+
}
|
|
400
|
+
encode() {
|
|
401
|
+
const body = this.encodeBody();
|
|
402
|
+
if (body === "") return Buffer.allocUnsafe(0);
|
|
403
|
+
const bodyLen = Buffer.byteLength(body);
|
|
404
|
+
const bufLen = 512 * Math.ceil(1 + bodyLen / 512);
|
|
405
|
+
const buf = Buffer.allocUnsafe(bufLen);
|
|
406
|
+
for (let i = 0; i < 512; i++) buf[i] = 0;
|
|
407
|
+
new Header({
|
|
408
|
+
path: ("PaxHeader/" + basename(this.path ?? "")).slice(0, 99),
|
|
409
|
+
mode: this.mode || 420,
|
|
410
|
+
uid: this.uid,
|
|
411
|
+
gid: this.gid,
|
|
412
|
+
size: bodyLen,
|
|
413
|
+
mtime: this.mtime,
|
|
414
|
+
type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader",
|
|
415
|
+
linkpath: "",
|
|
416
|
+
uname: this.uname || "",
|
|
417
|
+
gname: this.gname || "",
|
|
418
|
+
devmaj: 0,
|
|
419
|
+
devmin: 0,
|
|
420
|
+
atime: this.atime,
|
|
421
|
+
ctime: this.ctime
|
|
422
|
+
}).encode(buf);
|
|
423
|
+
buf.write(body, 512, bodyLen, "utf8");
|
|
424
|
+
for (let i = bodyLen + 512; i < buf.length; i++) buf[i] = 0;
|
|
425
|
+
return buf;
|
|
426
|
+
}
|
|
427
|
+
encodeBody() {
|
|
428
|
+
return this.encodeField("path") + this.encodeField("ctime") + this.encodeField("atime") + this.encodeField("dev") + this.encodeField("ino") + this.encodeField("nlink") + this.encodeField("charset") + this.encodeField("comment") + this.encodeField("gid") + this.encodeField("gname") + this.encodeField("linkpath") + this.encodeField("mtime") + this.encodeField("size") + this.encodeField("uid") + this.encodeField("uname");
|
|
429
|
+
}
|
|
430
|
+
encodeField(field) {
|
|
431
|
+
if (this[field] === void 0) return "";
|
|
432
|
+
const r = this[field];
|
|
433
|
+
const v = r instanceof Date ? r.getTime() / 1e3 : r;
|
|
434
|
+
const s = " " + (field === "dev" || field === "ino" || field === "nlink" ? "SCHILY." : "") + field + "=" + v + "\n";
|
|
435
|
+
const byteLen = Buffer.byteLength(s);
|
|
436
|
+
let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1;
|
|
437
|
+
if (byteLen + digits >= Math.pow(10, digits)) digits += 1;
|
|
438
|
+
return digits + byteLen + s;
|
|
439
|
+
}
|
|
440
|
+
static parse(str, ex, g = false) {
|
|
441
|
+
return new Pax(merge(parseKV(str), ex), g);
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
var merge = (a, b) => b ? Object.assign({}, b, a) : a;
|
|
445
|
+
var parseKV = (str) => str.replace(/\n$/, "").split("\n").reduce(parseKVLine, Object.create(null));
|
|
446
|
+
var parseKVLine = (set, line) => {
|
|
447
|
+
const n = parseInt(line, 10);
|
|
448
|
+
if (n !== Buffer.byteLength(line) + 1) return set;
|
|
449
|
+
line = line.slice((n + " ").length);
|
|
450
|
+
const kv = line.split("=");
|
|
451
|
+
const r = kv.shift();
|
|
452
|
+
if (!r) return set;
|
|
453
|
+
const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, "$1");
|
|
454
|
+
const v = kv.join("=");
|
|
455
|
+
set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? /* @__PURE__ */ new Date(Number(v) * 1e3) : /^[0-9]+$/.test(v) ? +v : v;
|
|
456
|
+
return set;
|
|
457
|
+
};
|
|
458
|
+
var normalizeWindowsPath = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) !== "win32" ? (p) => p : (p) => p && p.replace(/\\/g, "/");
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/read-entry.js
|
|
461
|
+
var ReadEntry = class extends Minipass {
|
|
462
|
+
extended;
|
|
463
|
+
globalExtended;
|
|
464
|
+
header;
|
|
465
|
+
startBlockSize;
|
|
466
|
+
blockRemain;
|
|
467
|
+
remain;
|
|
468
|
+
type;
|
|
469
|
+
meta = false;
|
|
470
|
+
ignore = false;
|
|
471
|
+
path;
|
|
472
|
+
mode;
|
|
473
|
+
uid;
|
|
474
|
+
gid;
|
|
475
|
+
uname;
|
|
476
|
+
gname;
|
|
477
|
+
size = 0;
|
|
478
|
+
mtime;
|
|
479
|
+
atime;
|
|
480
|
+
ctime;
|
|
481
|
+
linkpath;
|
|
482
|
+
dev;
|
|
483
|
+
ino;
|
|
484
|
+
nlink;
|
|
485
|
+
invalid = false;
|
|
486
|
+
absolute;
|
|
487
|
+
unsupported = false;
|
|
488
|
+
constructor(header, ex, gex) {
|
|
489
|
+
super({});
|
|
490
|
+
this.pause();
|
|
491
|
+
this.extended = ex;
|
|
492
|
+
this.globalExtended = gex;
|
|
493
|
+
this.header = header;
|
|
494
|
+
/* c8 ignore start */
|
|
495
|
+
this.remain = header.size ?? 0;
|
|
496
|
+
/* c8 ignore stop */
|
|
497
|
+
this.startBlockSize = 512 * Math.ceil(this.remain / 512);
|
|
498
|
+
this.blockRemain = this.startBlockSize;
|
|
499
|
+
this.type = header.type;
|
|
500
|
+
switch (this.type) {
|
|
501
|
+
case "File":
|
|
502
|
+
case "OldFile":
|
|
503
|
+
case "Link":
|
|
504
|
+
case "SymbolicLink":
|
|
505
|
+
case "CharacterDevice":
|
|
506
|
+
case "BlockDevice":
|
|
507
|
+
case "Directory":
|
|
508
|
+
case "FIFO":
|
|
509
|
+
case "ContiguousFile":
|
|
510
|
+
case "GNUDumpDir": break;
|
|
511
|
+
case "NextFileHasLongLinkpath":
|
|
512
|
+
case "NextFileHasLongPath":
|
|
513
|
+
case "OldGnuLongPath":
|
|
514
|
+
case "GlobalExtendedHeader":
|
|
515
|
+
case "ExtendedHeader":
|
|
516
|
+
case "OldExtendedHeader":
|
|
517
|
+
this.meta = true;
|
|
518
|
+
break;
|
|
519
|
+
default: this.ignore = true;
|
|
520
|
+
}
|
|
521
|
+
/* c8 ignore start */
|
|
522
|
+
if (!header.path) throw new Error("no path provided for tar.ReadEntry");
|
|
523
|
+
/* c8 ignore stop */
|
|
524
|
+
this.path = normalizeWindowsPath(header.path);
|
|
525
|
+
this.mode = header.mode;
|
|
526
|
+
if (this.mode) this.mode = this.mode & 4095;
|
|
527
|
+
this.uid = header.uid;
|
|
528
|
+
this.gid = header.gid;
|
|
529
|
+
this.uname = header.uname;
|
|
530
|
+
this.gname = header.gname;
|
|
531
|
+
this.size = this.remain;
|
|
532
|
+
this.mtime = header.mtime;
|
|
533
|
+
this.atime = header.atime;
|
|
534
|
+
this.ctime = header.ctime;
|
|
535
|
+
/* c8 ignore start */
|
|
536
|
+
this.linkpath = header.linkpath ? normalizeWindowsPath(header.linkpath) : void 0;
|
|
537
|
+
/* c8 ignore stop */
|
|
538
|
+
this.uname = header.uname;
|
|
539
|
+
this.gname = header.gname;
|
|
540
|
+
if (ex) this.#slurp(ex);
|
|
541
|
+
if (gex) this.#slurp(gex, true);
|
|
542
|
+
}
|
|
543
|
+
write(data) {
|
|
544
|
+
const writeLen = data.length;
|
|
545
|
+
if (writeLen > this.blockRemain) throw new Error("writing more to entry than is appropriate");
|
|
546
|
+
const r = this.remain;
|
|
547
|
+
const br = this.blockRemain;
|
|
548
|
+
this.remain = Math.max(0, r - writeLen);
|
|
549
|
+
this.blockRemain = Math.max(0, br - writeLen);
|
|
550
|
+
if (this.ignore) return true;
|
|
551
|
+
if (r >= writeLen) return super.write(data);
|
|
552
|
+
return super.write(data.subarray(0, r));
|
|
553
|
+
}
|
|
554
|
+
#slurp(ex, gex = false) {
|
|
555
|
+
if (ex.path) ex.path = normalizeWindowsPath(ex.path);
|
|
556
|
+
if (ex.linkpath) ex.linkpath = normalizeWindowsPath(ex.linkpath);
|
|
557
|
+
Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
|
|
558
|
+
return !(v === null || v === void 0 || k === "path" && gex);
|
|
559
|
+
})));
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/warn-method.js
|
|
564
|
+
var warnMethod = (self, code, message, data = {}) => {
|
|
565
|
+
if (self.file) data.file = self.file;
|
|
566
|
+
if (self.cwd) data.cwd = self.cwd;
|
|
567
|
+
data.code = message instanceof Error && message.code || code;
|
|
568
|
+
data.tarCode = code;
|
|
569
|
+
if (!self.strict && data.recoverable !== false) {
|
|
570
|
+
if (message instanceof Error) {
|
|
571
|
+
data = Object.assign(message, data);
|
|
572
|
+
message = message.message;
|
|
573
|
+
}
|
|
574
|
+
self.emit("warn", code, message, data);
|
|
575
|
+
} else if (message instanceof Error) self.emit("error", Object.assign(message, data));
|
|
576
|
+
else self.emit("error", Object.assign(/* @__PURE__ */ new Error(`${code}: ${message}`), data));
|
|
577
|
+
};
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/parse.js
|
|
580
|
+
var maxMetaEntrySize = 1024 * 1024;
|
|
581
|
+
var gzipHeader = Buffer.from([31, 139]);
|
|
582
|
+
var zstdHeader = Buffer.from([
|
|
583
|
+
40,
|
|
584
|
+
181,
|
|
585
|
+
47,
|
|
586
|
+
253
|
|
587
|
+
]);
|
|
588
|
+
var ZIP_HEADER_LEN = Math.max(gzipHeader.length, zstdHeader.length);
|
|
589
|
+
var STATE = Symbol("state");
|
|
590
|
+
var WRITEENTRY = Symbol("writeEntry");
|
|
591
|
+
var READENTRY = Symbol("readEntry");
|
|
592
|
+
var NEXTENTRY = Symbol("nextEntry");
|
|
593
|
+
var PROCESSENTRY = Symbol("processEntry");
|
|
594
|
+
var EX = Symbol("extendedHeader");
|
|
595
|
+
var GEX = Symbol("globalExtendedHeader");
|
|
596
|
+
var META = Symbol("meta");
|
|
597
|
+
var EMITMETA = Symbol("emitMeta");
|
|
598
|
+
var BUFFER = Symbol("buffer");
|
|
599
|
+
var QUEUE = Symbol("queue");
|
|
600
|
+
var ENDED$1 = Symbol("ended");
|
|
601
|
+
var EMITTEDEND = Symbol("emittedEnd");
|
|
602
|
+
var EMIT = Symbol("emit");
|
|
603
|
+
var UNZIP = Symbol("unzip");
|
|
604
|
+
var CONSUMECHUNK = Symbol("consumeChunk");
|
|
605
|
+
var CONSUMECHUNKSUB = Symbol("consumeChunkSub");
|
|
606
|
+
var CONSUMEBODY = Symbol("consumeBody");
|
|
607
|
+
var CONSUMEMETA = Symbol("consumeMeta");
|
|
608
|
+
var CONSUMEHEADER = Symbol("consumeHeader");
|
|
609
|
+
var CONSUMING = Symbol("consuming");
|
|
610
|
+
var BUFFERCONCAT = Symbol("bufferConcat");
|
|
611
|
+
var MAYBEEND = Symbol("maybeEnd");
|
|
612
|
+
var WRITING = Symbol("writing");
|
|
613
|
+
var ABORTED = Symbol("aborted");
|
|
614
|
+
var DONE = Symbol("onDone");
|
|
615
|
+
var SAW_VALID_ENTRY = Symbol("sawValidEntry");
|
|
616
|
+
var SAW_NULL_BLOCK = Symbol("sawNullBlock");
|
|
617
|
+
var SAW_EOF = Symbol("sawEOF");
|
|
618
|
+
var CLOSESTREAM = Symbol("closeStream");
|
|
619
|
+
var noop = () => true;
|
|
620
|
+
var Parser = class extends EventEmitter {
|
|
621
|
+
file;
|
|
622
|
+
strict;
|
|
623
|
+
maxMetaEntrySize;
|
|
624
|
+
filter;
|
|
625
|
+
brotli;
|
|
626
|
+
zstd;
|
|
627
|
+
writable = true;
|
|
628
|
+
readable = false;
|
|
629
|
+
[QUEUE] = [];
|
|
630
|
+
[BUFFER];
|
|
631
|
+
[READENTRY];
|
|
632
|
+
[WRITEENTRY];
|
|
633
|
+
[STATE] = "begin";
|
|
634
|
+
[META] = "";
|
|
635
|
+
[EX];
|
|
636
|
+
[GEX];
|
|
637
|
+
[ENDED$1] = false;
|
|
638
|
+
[UNZIP];
|
|
639
|
+
[ABORTED] = false;
|
|
640
|
+
[SAW_VALID_ENTRY];
|
|
641
|
+
[SAW_NULL_BLOCK] = false;
|
|
642
|
+
[SAW_EOF] = false;
|
|
643
|
+
[WRITING] = false;
|
|
644
|
+
[CONSUMING] = false;
|
|
645
|
+
[EMITTEDEND] = false;
|
|
646
|
+
constructor(opt = {}) {
|
|
647
|
+
super();
|
|
648
|
+
this.file = opt.file || "";
|
|
649
|
+
this.on(DONE, () => {
|
|
650
|
+
if (this[STATE] === "begin" || this[SAW_VALID_ENTRY] === false) this.warn("TAR_BAD_ARCHIVE", "Unrecognized archive format");
|
|
651
|
+
});
|
|
652
|
+
if (opt.ondone) this.on(DONE, opt.ondone);
|
|
653
|
+
else this.on(DONE, () => {
|
|
654
|
+
this.emit("prefinish");
|
|
655
|
+
this.emit("finish");
|
|
656
|
+
this.emit("end");
|
|
657
|
+
});
|
|
658
|
+
this.strict = !!opt.strict;
|
|
659
|
+
this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize;
|
|
660
|
+
this.filter = typeof opt.filter === "function" ? opt.filter : noop;
|
|
661
|
+
const isTBR = opt.file && (opt.file.endsWith(".tar.br") || opt.file.endsWith(".tbr"));
|
|
662
|
+
this.brotli = !(opt.gzip || opt.zstd) && opt.brotli !== void 0 ? opt.brotli : isTBR ? void 0 : false;
|
|
663
|
+
const isTZST = opt.file && (opt.file.endsWith(".tar.zst") || opt.file.endsWith(".tzst"));
|
|
664
|
+
this.zstd = !(opt.gzip || opt.brotli) && opt.zstd !== void 0 ? opt.zstd : isTZST ? true : void 0;
|
|
665
|
+
this.on("end", () => this[CLOSESTREAM]());
|
|
666
|
+
if (typeof opt.onwarn === "function") this.on("warn", opt.onwarn);
|
|
667
|
+
if (typeof opt.onReadEntry === "function") this.on("entry", opt.onReadEntry);
|
|
668
|
+
}
|
|
669
|
+
warn(code, message, data = {}) {
|
|
670
|
+
warnMethod(this, code, message, data);
|
|
671
|
+
}
|
|
672
|
+
[CONSUMEHEADER](chunk, position) {
|
|
673
|
+
if (this[SAW_VALID_ENTRY] === void 0) this[SAW_VALID_ENTRY] = false;
|
|
674
|
+
let header;
|
|
675
|
+
try {
|
|
676
|
+
header = new Header(chunk, position, this[EX], this[GEX]);
|
|
677
|
+
} catch (er) {
|
|
678
|
+
return this.warn("TAR_ENTRY_INVALID", er);
|
|
679
|
+
}
|
|
680
|
+
if (header.nullBlock) if (this[SAW_NULL_BLOCK]) {
|
|
681
|
+
this[SAW_EOF] = true;
|
|
682
|
+
if (this[STATE] === "begin") this[STATE] = "header";
|
|
683
|
+
this[EMIT]("eof");
|
|
684
|
+
} else {
|
|
685
|
+
this[SAW_NULL_BLOCK] = true;
|
|
686
|
+
this[EMIT]("nullBlock");
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
this[SAW_NULL_BLOCK] = false;
|
|
690
|
+
if (!header.cksumValid) this.warn("TAR_ENTRY_INVALID", "checksum failure", { header });
|
|
691
|
+
else if (!header.path) this.warn("TAR_ENTRY_INVALID", "path is required", { header });
|
|
692
|
+
else {
|
|
693
|
+
const type = header.type;
|
|
694
|
+
if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath required", { header });
|
|
695
|
+
else if (!/^(Symbolic)?Link$/.test(type) && !/^(Global)?ExtendedHeader$/.test(type) && header.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath forbidden", { header });
|
|
696
|
+
else {
|
|
697
|
+
const entry = this[WRITEENTRY] = new ReadEntry(header, this[EX], this[GEX]);
|
|
698
|
+
if (!this[SAW_VALID_ENTRY]) if (entry.remain) {
|
|
699
|
+
const onend = () => {
|
|
700
|
+
if (!entry.invalid) this[SAW_VALID_ENTRY] = true;
|
|
701
|
+
};
|
|
702
|
+
entry.on("end", onend);
|
|
703
|
+
} else this[SAW_VALID_ENTRY] = true;
|
|
704
|
+
if (entry.meta) {
|
|
705
|
+
if (entry.size > this.maxMetaEntrySize) {
|
|
706
|
+
entry.ignore = true;
|
|
707
|
+
this[EMIT]("ignoredEntry", entry);
|
|
708
|
+
this[STATE] = "ignore";
|
|
709
|
+
entry.resume();
|
|
710
|
+
} else if (entry.size > 0) {
|
|
711
|
+
this[META] = "";
|
|
712
|
+
entry.on("data", (c) => this[META] += c);
|
|
713
|
+
this[STATE] = "meta";
|
|
714
|
+
}
|
|
715
|
+
} else {
|
|
716
|
+
this[EX] = void 0;
|
|
717
|
+
entry.ignore = entry.ignore || !this.filter(entry.path, entry);
|
|
718
|
+
if (entry.ignore) {
|
|
719
|
+
this[EMIT]("ignoredEntry", entry);
|
|
720
|
+
this[STATE] = entry.remain ? "ignore" : "header";
|
|
721
|
+
entry.resume();
|
|
722
|
+
} else {
|
|
723
|
+
if (entry.remain) this[STATE] = "body";
|
|
724
|
+
else {
|
|
725
|
+
this[STATE] = "header";
|
|
726
|
+
entry.end();
|
|
727
|
+
}
|
|
728
|
+
if (!this[READENTRY]) {
|
|
729
|
+
this[QUEUE].push(entry);
|
|
730
|
+
this[NEXTENTRY]();
|
|
731
|
+
} else this[QUEUE].push(entry);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
[CLOSESTREAM]() {
|
|
739
|
+
queueMicrotask(() => this.emit("close"));
|
|
740
|
+
}
|
|
741
|
+
[PROCESSENTRY](entry) {
|
|
742
|
+
let go = true;
|
|
743
|
+
if (!entry) {
|
|
744
|
+
this[READENTRY] = void 0;
|
|
745
|
+
go = false;
|
|
746
|
+
} else if (Array.isArray(entry)) {
|
|
747
|
+
const [ev, ...args] = entry;
|
|
748
|
+
this.emit(ev, ...args);
|
|
749
|
+
} else {
|
|
750
|
+
this[READENTRY] = entry;
|
|
751
|
+
this.emit("entry", entry);
|
|
752
|
+
if (!entry.emittedEnd) {
|
|
753
|
+
entry.on("end", () => this[NEXTENTRY]());
|
|
754
|
+
go = false;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
return go;
|
|
758
|
+
}
|
|
759
|
+
[NEXTENTRY]() {
|
|
760
|
+
do ;
|
|
761
|
+
while (this[PROCESSENTRY](this[QUEUE].shift()));
|
|
762
|
+
if (!this[QUEUE].length) {
|
|
763
|
+
const re = this[READENTRY];
|
|
764
|
+
if (!re || re.flowing || re.size === re.remain) {
|
|
765
|
+
if (!this[WRITING]) this.emit("drain");
|
|
766
|
+
} else re.once("drain", () => this.emit("drain"));
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
[CONSUMEBODY](chunk, position) {
|
|
770
|
+
const entry = this[WRITEENTRY];
|
|
771
|
+
/* c8 ignore start */
|
|
772
|
+
if (!entry) throw new Error("attempt to consume body without entry??");
|
|
773
|
+
const br = entry.blockRemain ?? 0;
|
|
774
|
+
/* c8 ignore stop */
|
|
775
|
+
const c = br >= chunk.length && position === 0 ? chunk : chunk.subarray(position, position + br);
|
|
776
|
+
entry.write(c);
|
|
777
|
+
if (!entry.blockRemain) {
|
|
778
|
+
this[STATE] = "header";
|
|
779
|
+
this[WRITEENTRY] = void 0;
|
|
780
|
+
entry.end();
|
|
781
|
+
}
|
|
782
|
+
return c.length;
|
|
783
|
+
}
|
|
784
|
+
[CONSUMEMETA](chunk, position) {
|
|
785
|
+
const entry = this[WRITEENTRY];
|
|
786
|
+
const ret = this[CONSUMEBODY](chunk, position);
|
|
787
|
+
if (!this[WRITEENTRY] && entry) this[EMITMETA](entry);
|
|
788
|
+
return ret;
|
|
789
|
+
}
|
|
790
|
+
[EMIT](ev, data, extra) {
|
|
791
|
+
if (!this[QUEUE].length && !this[READENTRY]) this.emit(ev, data, extra);
|
|
792
|
+
else this[QUEUE].push([
|
|
793
|
+
ev,
|
|
794
|
+
data,
|
|
795
|
+
extra
|
|
796
|
+
]);
|
|
797
|
+
}
|
|
798
|
+
[EMITMETA](entry) {
|
|
799
|
+
this[EMIT]("meta", this[META]);
|
|
800
|
+
switch (entry.type) {
|
|
801
|
+
case "ExtendedHeader":
|
|
802
|
+
case "OldExtendedHeader":
|
|
803
|
+
this[EX] = Pax.parse(this[META], this[EX], false);
|
|
804
|
+
break;
|
|
805
|
+
case "GlobalExtendedHeader":
|
|
806
|
+
this[GEX] = Pax.parse(this[META], this[GEX], true);
|
|
807
|
+
break;
|
|
808
|
+
case "NextFileHasLongPath":
|
|
809
|
+
case "OldGnuLongPath": {
|
|
810
|
+
const ex = this[EX] ?? Object.create(null);
|
|
811
|
+
this[EX] = ex;
|
|
812
|
+
ex.path = this[META].replace(/\0.*/, "");
|
|
813
|
+
break;
|
|
814
|
+
}
|
|
815
|
+
case "NextFileHasLongLinkpath": {
|
|
816
|
+
const ex = this[EX] || Object.create(null);
|
|
817
|
+
this[EX] = ex;
|
|
818
|
+
ex.linkpath = this[META].replace(/\0.*/, "");
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
default: throw new Error("unknown meta: " + entry.type);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
abort(error) {
|
|
825
|
+
this[ABORTED] = true;
|
|
826
|
+
this.emit("abort", error);
|
|
827
|
+
this.warn("TAR_ABORT", error, { recoverable: false });
|
|
828
|
+
}
|
|
829
|
+
write(chunk, encoding, cb) {
|
|
830
|
+
if (typeof encoding === "function") {
|
|
831
|
+
cb = encoding;
|
|
832
|
+
encoding = void 0;
|
|
833
|
+
}
|
|
834
|
+
if (typeof chunk === "string") chunk = Buffer.from(
|
|
835
|
+
chunk,
|
|
836
|
+
/* c8 ignore next */
|
|
837
|
+
typeof encoding === "string" ? encoding : "utf8"
|
|
838
|
+
);
|
|
839
|
+
if (this[ABORTED]) {
|
|
840
|
+
/* c8 ignore next */
|
|
841
|
+
cb?.();
|
|
842
|
+
return false;
|
|
843
|
+
}
|
|
844
|
+
if ((this[UNZIP] === void 0 || this.brotli === void 0 && this[UNZIP] === false) && chunk) {
|
|
845
|
+
if (this[BUFFER]) {
|
|
846
|
+
chunk = Buffer.concat([this[BUFFER], chunk]);
|
|
847
|
+
this[BUFFER] = void 0;
|
|
848
|
+
}
|
|
849
|
+
if (chunk.length < ZIP_HEADER_LEN) {
|
|
850
|
+
this[BUFFER] = chunk;
|
|
851
|
+
/* c8 ignore next */
|
|
852
|
+
cb?.();
|
|
853
|
+
return true;
|
|
854
|
+
}
|
|
855
|
+
for (let i = 0; this[UNZIP] === void 0 && i < gzipHeader.length; i++) if (chunk[i] !== gzipHeader[i]) this[UNZIP] = false;
|
|
856
|
+
let isZstd = false;
|
|
857
|
+
if (this[UNZIP] === false && this.zstd !== false) {
|
|
858
|
+
isZstd = true;
|
|
859
|
+
for (let i = 0; i < zstdHeader.length; i++) if (chunk[i] !== zstdHeader[i]) {
|
|
860
|
+
isZstd = false;
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
const maybeBrotli = this.brotli === void 0 && !isZstd;
|
|
865
|
+
if (this[UNZIP] === false && maybeBrotli) if (chunk.length < 512) if (this[ENDED$1]) this.brotli = true;
|
|
866
|
+
else {
|
|
867
|
+
this[BUFFER] = chunk;
|
|
868
|
+
/* c8 ignore next */
|
|
869
|
+
cb?.();
|
|
870
|
+
return true;
|
|
871
|
+
}
|
|
872
|
+
else try {
|
|
873
|
+
new Header(chunk.subarray(0, 512));
|
|
874
|
+
this.brotli = false;
|
|
875
|
+
} catch (_) {
|
|
876
|
+
this.brotli = true;
|
|
877
|
+
}
|
|
878
|
+
if (this[UNZIP] === void 0 || this[UNZIP] === false && (this.brotli || isZstd)) {
|
|
879
|
+
const ended = this[ENDED$1];
|
|
880
|
+
this[ENDED$1] = false;
|
|
881
|
+
this[UNZIP] = this[UNZIP] === void 0 ? new Unzip({}) : isZstd ? new ZstdDecompress({}) : new BrotliDecompress({});
|
|
882
|
+
this[UNZIP].on("data", (chunk) => this[CONSUMECHUNK](chunk));
|
|
883
|
+
this[UNZIP].on("error", (er) => this.abort(er));
|
|
884
|
+
this[UNZIP].on("end", () => {
|
|
885
|
+
this[ENDED$1] = true;
|
|
886
|
+
this[CONSUMECHUNK]();
|
|
887
|
+
});
|
|
888
|
+
this[WRITING] = true;
|
|
889
|
+
const ret = !!this[UNZIP][ended ? "end" : "write"](chunk);
|
|
890
|
+
this[WRITING] = false;
|
|
891
|
+
cb?.();
|
|
892
|
+
return ret;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
this[WRITING] = true;
|
|
896
|
+
if (this[UNZIP]) this[UNZIP].write(chunk);
|
|
897
|
+
else this[CONSUMECHUNK](chunk);
|
|
898
|
+
this[WRITING] = false;
|
|
899
|
+
const ret = this[QUEUE].length ? false : this[READENTRY] ? this[READENTRY].flowing : true;
|
|
900
|
+
if (!ret && !this[QUEUE].length) this[READENTRY]?.once("drain", () => this.emit("drain"));
|
|
901
|
+
/* c8 ignore next */
|
|
902
|
+
cb?.();
|
|
903
|
+
return ret;
|
|
904
|
+
}
|
|
905
|
+
[BUFFERCONCAT](c) {
|
|
906
|
+
if (c && !this[ABORTED]) this[BUFFER] = this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c;
|
|
907
|
+
}
|
|
908
|
+
[MAYBEEND]() {
|
|
909
|
+
if (this[ENDED$1] && !this[EMITTEDEND] && !this[ABORTED] && !this[CONSUMING]) {
|
|
910
|
+
this[EMITTEDEND] = true;
|
|
911
|
+
const entry = this[WRITEENTRY];
|
|
912
|
+
if (entry && entry.blockRemain) {
|
|
913
|
+
const have = this[BUFFER] ? this[BUFFER].length : 0;
|
|
914
|
+
this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry });
|
|
915
|
+
if (this[BUFFER]) entry.write(this[BUFFER]);
|
|
916
|
+
entry.end();
|
|
917
|
+
}
|
|
918
|
+
this[EMIT](DONE);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
[CONSUMECHUNK](chunk) {
|
|
922
|
+
if (this[CONSUMING] && chunk) this[BUFFERCONCAT](chunk);
|
|
923
|
+
else if (!chunk && !this[BUFFER]) this[MAYBEEND]();
|
|
924
|
+
else if (chunk) {
|
|
925
|
+
this[CONSUMING] = true;
|
|
926
|
+
if (this[BUFFER]) {
|
|
927
|
+
this[BUFFERCONCAT](chunk);
|
|
928
|
+
const c = this[BUFFER];
|
|
929
|
+
this[BUFFER] = void 0;
|
|
930
|
+
this[CONSUMECHUNKSUB](c);
|
|
931
|
+
} else this[CONSUMECHUNKSUB](chunk);
|
|
932
|
+
while (this[BUFFER] && this[BUFFER]?.length >= 512 && !this[ABORTED] && !this[SAW_EOF]) {
|
|
933
|
+
const c = this[BUFFER];
|
|
934
|
+
this[BUFFER] = void 0;
|
|
935
|
+
this[CONSUMECHUNKSUB](c);
|
|
936
|
+
}
|
|
937
|
+
this[CONSUMING] = false;
|
|
938
|
+
}
|
|
939
|
+
if (!this[BUFFER] || this[ENDED$1]) this[MAYBEEND]();
|
|
940
|
+
}
|
|
941
|
+
[CONSUMECHUNKSUB](chunk) {
|
|
942
|
+
let position = 0;
|
|
943
|
+
const length = chunk.length;
|
|
944
|
+
while (position + 512 <= length && !this[ABORTED] && !this[SAW_EOF]) switch (this[STATE]) {
|
|
945
|
+
case "begin":
|
|
946
|
+
case "header":
|
|
947
|
+
this[CONSUMEHEADER](chunk, position);
|
|
948
|
+
position += 512;
|
|
949
|
+
break;
|
|
950
|
+
case "ignore":
|
|
951
|
+
case "body":
|
|
952
|
+
position += this[CONSUMEBODY](chunk, position);
|
|
953
|
+
break;
|
|
954
|
+
case "meta":
|
|
955
|
+
position += this[CONSUMEMETA](chunk, position);
|
|
956
|
+
break;
|
|
957
|
+
default: throw new Error("invalid state: " + this[STATE]);
|
|
958
|
+
}
|
|
959
|
+
if (position < length) if (this[BUFFER]) this[BUFFER] = Buffer.concat([chunk.subarray(position), this[BUFFER]]);
|
|
960
|
+
else this[BUFFER] = chunk.subarray(position);
|
|
961
|
+
}
|
|
962
|
+
end(chunk, encoding, cb) {
|
|
963
|
+
if (typeof chunk === "function") {
|
|
964
|
+
cb = chunk;
|
|
965
|
+
encoding = void 0;
|
|
966
|
+
chunk = void 0;
|
|
967
|
+
}
|
|
968
|
+
if (typeof encoding === "function") {
|
|
969
|
+
cb = encoding;
|
|
970
|
+
encoding = void 0;
|
|
971
|
+
}
|
|
972
|
+
if (typeof chunk === "string") chunk = Buffer.from(chunk, encoding);
|
|
973
|
+
if (cb) this.once("finish", cb);
|
|
974
|
+
if (!this[ABORTED]) if (this[UNZIP]) {
|
|
975
|
+
/* c8 ignore start */
|
|
976
|
+
if (chunk) this[UNZIP].write(chunk);
|
|
977
|
+
/* c8 ignore stop */
|
|
978
|
+
this[UNZIP].end();
|
|
979
|
+
} else {
|
|
980
|
+
this[ENDED$1] = true;
|
|
981
|
+
if (this.brotli === void 0 || this.zstd === void 0) chunk = chunk || Buffer.alloc(0);
|
|
982
|
+
if (chunk) this.write(chunk);
|
|
983
|
+
this[MAYBEEND]();
|
|
984
|
+
}
|
|
985
|
+
return this;
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
//#endregion
|
|
989
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/strip-trailing-slashes.js
|
|
990
|
+
var stripTrailingSlashes = (str) => {
|
|
991
|
+
let i = str.length - 1;
|
|
992
|
+
let slashesStart = -1;
|
|
993
|
+
while (i > -1 && str.charAt(i) === "/") {
|
|
994
|
+
slashesStart = i;
|
|
995
|
+
i--;
|
|
996
|
+
}
|
|
997
|
+
return slashesStart === -1 ? str : str.slice(0, slashesStart);
|
|
998
|
+
};
|
|
999
|
+
//#endregion
|
|
1000
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/list.js
|
|
1001
|
+
var onReadEntryFunction = (opt) => {
|
|
1002
|
+
const onReadEntry = opt.onReadEntry;
|
|
1003
|
+
opt.onReadEntry = onReadEntry ? (e) => {
|
|
1004
|
+
onReadEntry(e);
|
|
1005
|
+
e.resume();
|
|
1006
|
+
} : (e) => e.resume();
|
|
1007
|
+
};
|
|
1008
|
+
var filesFilter = (opt, files) => {
|
|
1009
|
+
const map = new Map(files.map((f) => [stripTrailingSlashes(f), true]));
|
|
1010
|
+
const filter = opt.filter;
|
|
1011
|
+
const mapHas = (file, r = "") => {
|
|
1012
|
+
const root = r || parse(file).root || ".";
|
|
1013
|
+
let ret;
|
|
1014
|
+
if (file === root) ret = false;
|
|
1015
|
+
else {
|
|
1016
|
+
const m = map.get(file);
|
|
1017
|
+
if (m !== void 0) ret = m;
|
|
1018
|
+
else ret = mapHas(dirname$1(file), root);
|
|
1019
|
+
}
|
|
1020
|
+
map.set(file, ret);
|
|
1021
|
+
return ret;
|
|
1022
|
+
};
|
|
1023
|
+
opt.filter = filter ? (file, entry) => filter(file, entry) && mapHas(stripTrailingSlashes(file)) : (file) => mapHas(stripTrailingSlashes(file));
|
|
1024
|
+
};
|
|
1025
|
+
var listFileSync = (opt) => {
|
|
1026
|
+
const p = new Parser(opt);
|
|
1027
|
+
const file = opt.file;
|
|
1028
|
+
let fd;
|
|
1029
|
+
try {
|
|
1030
|
+
fd = fs.openSync(file, "r");
|
|
1031
|
+
const stat = fs.fstatSync(fd);
|
|
1032
|
+
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
|
|
1033
|
+
if (stat.size < readSize) {
|
|
1034
|
+
const buf = Buffer.allocUnsafe(stat.size);
|
|
1035
|
+
fs.readSync(fd, buf, 0, stat.size, 0);
|
|
1036
|
+
p.end(buf);
|
|
1037
|
+
} else {
|
|
1038
|
+
let pos = 0;
|
|
1039
|
+
const buf = Buffer.allocUnsafe(readSize);
|
|
1040
|
+
while (pos < stat.size) {
|
|
1041
|
+
const bytesRead = fs.readSync(fd, buf, 0, readSize, pos);
|
|
1042
|
+
pos += bytesRead;
|
|
1043
|
+
p.write(buf.subarray(0, bytesRead));
|
|
1044
|
+
}
|
|
1045
|
+
p.end();
|
|
1046
|
+
}
|
|
1047
|
+
} finally {
|
|
1048
|
+
if (typeof fd === "number") try {
|
|
1049
|
+
fs.closeSync(fd);
|
|
1050
|
+
} catch (er) {}
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
var listFile = (opt, _files) => {
|
|
1054
|
+
const parse = new Parser(opt);
|
|
1055
|
+
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
|
|
1056
|
+
const file = opt.file;
|
|
1057
|
+
return new Promise((resolve, reject) => {
|
|
1058
|
+
parse.on("error", reject);
|
|
1059
|
+
parse.on("end", resolve);
|
|
1060
|
+
fs.stat(file, (er, stat) => {
|
|
1061
|
+
if (er) reject(er);
|
|
1062
|
+
else {
|
|
1063
|
+
const stream = new ReadStream(file, {
|
|
1064
|
+
readSize,
|
|
1065
|
+
size: stat.size
|
|
1066
|
+
});
|
|
1067
|
+
stream.on("error", reject);
|
|
1068
|
+
stream.pipe(parse);
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
});
|
|
1072
|
+
};
|
|
1073
|
+
makeCommand(listFileSync, listFile, (opt) => new Parser(opt), (opt) => new Parser(opt), (opt, files) => {
|
|
1074
|
+
if (files?.length) filesFilter(opt, files);
|
|
1075
|
+
if (!opt.noResume) onReadEntryFunction(opt);
|
|
1076
|
+
});
|
|
1077
|
+
//#endregion
|
|
1078
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/strip-absolute-path.js
|
|
1079
|
+
var { isAbsolute, parse: parse$1 } = win32;
|
|
1080
|
+
var stripAbsolutePath = (path) => {
|
|
1081
|
+
let r = "";
|
|
1082
|
+
let parsed = parse$1(path);
|
|
1083
|
+
while (isAbsolute(path) || parsed.root) {
|
|
1084
|
+
const root = path.charAt(0) === "/" && path.slice(0, 4) !== "//?/" ? "/" : parsed.root;
|
|
1085
|
+
path = path.slice(root.length);
|
|
1086
|
+
r += root;
|
|
1087
|
+
parsed = parse$1(path);
|
|
1088
|
+
}
|
|
1089
|
+
return [r, path];
|
|
1090
|
+
};
|
|
1091
|
+
//#endregion
|
|
1092
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/winchars.js
|
|
1093
|
+
var raw = [
|
|
1094
|
+
"|",
|
|
1095
|
+
"<",
|
|
1096
|
+
">",
|
|
1097
|
+
"?",
|
|
1098
|
+
":"
|
|
1099
|
+
];
|
|
1100
|
+
var win = raw.map((char) => String.fromCharCode(61440 + char.charCodeAt(0)));
|
|
1101
|
+
var toWin = new Map(raw.map((char, i) => [char, win[i]]));
|
|
1102
|
+
new Map(win.map((char, i) => [char, raw[i]]));
|
|
1103
|
+
var encode = (s) => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s);
|
|
1104
|
+
//#endregion
|
|
1105
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/get-write-flag.js
|
|
1106
|
+
var isWindows$2 = (process.env.__FAKE_PLATFORM__ || process.platform) === "win32";
|
|
1107
|
+
/* c8 ignore start */
|
|
1108
|
+
var { O_CREAT, O_TRUNC, O_WRONLY } = fs$2.constants;
|
|
1109
|
+
var UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) || fs$2.constants.UV_FS_O_FILEMAP || 0;
|
|
1110
|
+
/* c8 ignore stop */
|
|
1111
|
+
var fMapEnabled = isWindows$2 && !!UV_FS_O_FILEMAP;
|
|
1112
|
+
var fMapLimit = 512 * 1024;
|
|
1113
|
+
var fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY;
|
|
1114
|
+
var getWriteFlag = !fMapEnabled ? () => "w" : (size) => size < fMapLimit ? fMapFlag : "w";
|
|
1115
|
+
//#endregion
|
|
1116
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/cwd-error.js
|
|
1117
|
+
var CwdError = class extends Error {
|
|
1118
|
+
path;
|
|
1119
|
+
code;
|
|
1120
|
+
syscall = "chdir";
|
|
1121
|
+
constructor(path, code) {
|
|
1122
|
+
super(`${code}: Cannot cd into '${path}'`);
|
|
1123
|
+
this.path = path;
|
|
1124
|
+
this.code = code;
|
|
1125
|
+
}
|
|
1126
|
+
get name() {
|
|
1127
|
+
return "CwdError";
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
//#endregion
|
|
1131
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/symlink-error.js
|
|
1132
|
+
var SymlinkError = class extends Error {
|
|
1133
|
+
path;
|
|
1134
|
+
symlink;
|
|
1135
|
+
syscall = "symlink";
|
|
1136
|
+
code = "TAR_SYMLINK_ERROR";
|
|
1137
|
+
constructor(symlink, path) {
|
|
1138
|
+
super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");
|
|
1139
|
+
this.symlink = symlink;
|
|
1140
|
+
this.path = path;
|
|
1141
|
+
}
|
|
1142
|
+
get name() {
|
|
1143
|
+
return "SymlinkError";
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
//#endregion
|
|
1147
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/mkdir.js
|
|
1148
|
+
var checkCwd = (dir, cb) => {
|
|
1149
|
+
fs.stat(dir, (er, st) => {
|
|
1150
|
+
if (er || !st.isDirectory()) er = new CwdError(dir, er?.code || "ENOTDIR");
|
|
1151
|
+
cb(er);
|
|
1152
|
+
});
|
|
1153
|
+
};
|
|
1154
|
+
/**
|
|
1155
|
+
* Wrapper around fs/promises.mkdir for tar's needs.
|
|
1156
|
+
*
|
|
1157
|
+
* The main purpose is to avoid creating directories if we know that
|
|
1158
|
+
* they already exist (and track which ones exist for this purpose),
|
|
1159
|
+
* and prevent entries from being extracted into symlinked folders,
|
|
1160
|
+
* if `preservePaths` is not set.
|
|
1161
|
+
*/
|
|
1162
|
+
var mkdir = (dir, opt, cb) => {
|
|
1163
|
+
dir = normalizeWindowsPath(dir);
|
|
1164
|
+
/* c8 ignore next */
|
|
1165
|
+
const umask = opt.umask ?? 18;
|
|
1166
|
+
const mode = opt.mode | 448;
|
|
1167
|
+
const needChmod = (mode & umask) !== 0;
|
|
1168
|
+
const uid = opt.uid;
|
|
1169
|
+
const gid = opt.gid;
|
|
1170
|
+
const doChown = typeof uid === "number" && typeof gid === "number" && (uid !== opt.processUid || gid !== opt.processGid);
|
|
1171
|
+
const preserve = opt.preserve;
|
|
1172
|
+
const unlink = opt.unlink;
|
|
1173
|
+
const cwd = normalizeWindowsPath(opt.cwd);
|
|
1174
|
+
const done = (er, created) => {
|
|
1175
|
+
if (er) cb(er);
|
|
1176
|
+
else if (created && doChown) chownr(created, uid, gid, (er) => done(er));
|
|
1177
|
+
else if (needChmod) fs.chmod(dir, mode, cb);
|
|
1178
|
+
else cb();
|
|
1179
|
+
};
|
|
1180
|
+
if (dir === cwd) return checkCwd(dir, done);
|
|
1181
|
+
if (preserve) return fs$1.mkdir(dir, {
|
|
1182
|
+
mode,
|
|
1183
|
+
recursive: true
|
|
1184
|
+
}).then((made) => done(null, made ?? void 0), done);
|
|
1185
|
+
mkdir_(cwd, normalizeWindowsPath(path.relative(cwd, dir)).split("/"), mode, unlink, cwd, void 0, done);
|
|
1186
|
+
};
|
|
1187
|
+
var mkdir_ = (base, parts, mode, unlink, cwd, created, cb) => {
|
|
1188
|
+
if (!parts.length) return cb(null, created);
|
|
1189
|
+
const p = parts.shift();
|
|
1190
|
+
const part = normalizeWindowsPath(path.resolve(base + "/" + p));
|
|
1191
|
+
fs.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb));
|
|
1192
|
+
};
|
|
1193
|
+
var onmkdir = (part, parts, mode, unlink, cwd, created, cb) => (er) => {
|
|
1194
|
+
if (er) fs.lstat(part, (statEr, st) => {
|
|
1195
|
+
if (statEr) {
|
|
1196
|
+
statEr.path = statEr.path && normalizeWindowsPath(statEr.path);
|
|
1197
|
+
cb(statEr);
|
|
1198
|
+
} else if (st.isDirectory()) mkdir_(part, parts, mode, unlink, cwd, created, cb);
|
|
1199
|
+
else if (unlink) fs.unlink(part, (er) => {
|
|
1200
|
+
if (er) return cb(er);
|
|
1201
|
+
fs.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb));
|
|
1202
|
+
});
|
|
1203
|
+
else if (st.isSymbolicLink()) return cb(new SymlinkError(part, part + "/" + parts.join("/")));
|
|
1204
|
+
else cb(er);
|
|
1205
|
+
});
|
|
1206
|
+
else {
|
|
1207
|
+
created = created || part;
|
|
1208
|
+
mkdir_(part, parts, mode, unlink, cwd, created, cb);
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1211
|
+
var checkCwdSync = (dir) => {
|
|
1212
|
+
let ok = false;
|
|
1213
|
+
let code = void 0;
|
|
1214
|
+
try {
|
|
1215
|
+
ok = fs.statSync(dir).isDirectory();
|
|
1216
|
+
} catch (er) {
|
|
1217
|
+
code = er?.code;
|
|
1218
|
+
} finally {
|
|
1219
|
+
if (!ok) throw new CwdError(dir, code ?? "ENOTDIR");
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
var mkdirSync = (dir, opt) => {
|
|
1223
|
+
dir = normalizeWindowsPath(dir);
|
|
1224
|
+
/* c8 ignore next */
|
|
1225
|
+
const umask = opt.umask ?? 18;
|
|
1226
|
+
const mode = opt.mode | 448;
|
|
1227
|
+
const needChmod = (mode & umask) !== 0;
|
|
1228
|
+
const uid = opt.uid;
|
|
1229
|
+
const gid = opt.gid;
|
|
1230
|
+
const doChown = typeof uid === "number" && typeof gid === "number" && (uid !== opt.processUid || gid !== opt.processGid);
|
|
1231
|
+
const preserve = opt.preserve;
|
|
1232
|
+
const unlink = opt.unlink;
|
|
1233
|
+
const cwd = normalizeWindowsPath(opt.cwd);
|
|
1234
|
+
const done = (created) => {
|
|
1235
|
+
if (created && doChown) chownrSync(created, uid, gid);
|
|
1236
|
+
if (needChmod) fs.chmodSync(dir, mode);
|
|
1237
|
+
};
|
|
1238
|
+
if (dir === cwd) {
|
|
1239
|
+
checkCwdSync(cwd);
|
|
1240
|
+
return done();
|
|
1241
|
+
}
|
|
1242
|
+
if (preserve) return done(fs.mkdirSync(dir, {
|
|
1243
|
+
mode,
|
|
1244
|
+
recursive: true
|
|
1245
|
+
}) ?? void 0);
|
|
1246
|
+
const parts = normalizeWindowsPath(path.relative(cwd, dir)).split("/");
|
|
1247
|
+
let created = void 0;
|
|
1248
|
+
for (let p = parts.shift(), part = cwd; p && (part += "/" + p); p = parts.shift()) {
|
|
1249
|
+
part = normalizeWindowsPath(path.resolve(part));
|
|
1250
|
+
try {
|
|
1251
|
+
fs.mkdirSync(part, mode);
|
|
1252
|
+
created = created || part;
|
|
1253
|
+
} catch (er) {
|
|
1254
|
+
const st = fs.lstatSync(part);
|
|
1255
|
+
if (st.isDirectory()) continue;
|
|
1256
|
+
else if (unlink) {
|
|
1257
|
+
fs.unlinkSync(part);
|
|
1258
|
+
fs.mkdirSync(part, mode);
|
|
1259
|
+
created = created || part;
|
|
1260
|
+
continue;
|
|
1261
|
+
} else if (st.isSymbolicLink()) return new SymlinkError(part, part + "/" + parts.join("/"));
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
return done(created);
|
|
1265
|
+
};
|
|
1266
|
+
//#endregion
|
|
1267
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/normalize-unicode.js
|
|
1268
|
+
var normalizeCache = Object.create(null);
|
|
1269
|
+
var MAX = 1e4;
|
|
1270
|
+
var cache = /* @__PURE__ */ new Set();
|
|
1271
|
+
var normalizeUnicode = (s) => {
|
|
1272
|
+
if (!cache.has(s)) normalizeCache[s] = s.normalize("NFD");
|
|
1273
|
+
else cache.delete(s);
|
|
1274
|
+
cache.add(s);
|
|
1275
|
+
const ret = normalizeCache[s];
|
|
1276
|
+
let i = cache.size - MAX;
|
|
1277
|
+
if (i > MAX / 10) for (const s of cache) {
|
|
1278
|
+
cache.delete(s);
|
|
1279
|
+
delete normalizeCache[s];
|
|
1280
|
+
if (--i <= 0) break;
|
|
1281
|
+
}
|
|
1282
|
+
return ret;
|
|
1283
|
+
};
|
|
1284
|
+
//#endregion
|
|
1285
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/path-reservations.js
|
|
1286
|
+
var isWindows$1 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
|
|
1287
|
+
var getDirs = (path) => {
|
|
1288
|
+
return path.split("/").slice(0, -1).reduce((set, path) => {
|
|
1289
|
+
const s = set[set.length - 1];
|
|
1290
|
+
if (s !== void 0) path = join(s, path);
|
|
1291
|
+
set.push(path || "/");
|
|
1292
|
+
return set;
|
|
1293
|
+
}, []);
|
|
1294
|
+
};
|
|
1295
|
+
var PathReservations = class {
|
|
1296
|
+
#queues = /* @__PURE__ */ new Map();
|
|
1297
|
+
#reservations = /* @__PURE__ */ new Map();
|
|
1298
|
+
#running = /* @__PURE__ */ new Set();
|
|
1299
|
+
reserve(paths, fn) {
|
|
1300
|
+
paths = isWindows$1 ? ["win32 parallelization disabled"] : paths.map((p) => {
|
|
1301
|
+
return stripTrailingSlashes(join(normalizeUnicode(p))).toLowerCase();
|
|
1302
|
+
});
|
|
1303
|
+
const dirs = new Set(paths.map((path) => getDirs(path)).reduce((a, b) => a.concat(b)));
|
|
1304
|
+
this.#reservations.set(fn, {
|
|
1305
|
+
dirs,
|
|
1306
|
+
paths
|
|
1307
|
+
});
|
|
1308
|
+
for (const p of paths) {
|
|
1309
|
+
const q = this.#queues.get(p);
|
|
1310
|
+
if (!q) this.#queues.set(p, [fn]);
|
|
1311
|
+
else q.push(fn);
|
|
1312
|
+
}
|
|
1313
|
+
for (const dir of dirs) {
|
|
1314
|
+
const q = this.#queues.get(dir);
|
|
1315
|
+
if (!q) this.#queues.set(dir, [new Set([fn])]);
|
|
1316
|
+
else {
|
|
1317
|
+
const l = q[q.length - 1];
|
|
1318
|
+
if (l instanceof Set) l.add(fn);
|
|
1319
|
+
else q.push(new Set([fn]));
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
return this.#run(fn);
|
|
1323
|
+
}
|
|
1324
|
+
#getQueues(fn) {
|
|
1325
|
+
const res = this.#reservations.get(fn);
|
|
1326
|
+
/* c8 ignore start */
|
|
1327
|
+
if (!res) throw new Error("function does not have any path reservations");
|
|
1328
|
+
/* c8 ignore stop */
|
|
1329
|
+
return {
|
|
1330
|
+
paths: res.paths.map((path) => this.#queues.get(path)),
|
|
1331
|
+
dirs: [...res.dirs].map((path) => this.#queues.get(path))
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1334
|
+
check(fn) {
|
|
1335
|
+
const { paths, dirs } = this.#getQueues(fn);
|
|
1336
|
+
return paths.every((q) => q && q[0] === fn) && dirs.every((q) => q && q[0] instanceof Set && q[0].has(fn));
|
|
1337
|
+
}
|
|
1338
|
+
#run(fn) {
|
|
1339
|
+
if (this.#running.has(fn) || !this.check(fn)) return false;
|
|
1340
|
+
this.#running.add(fn);
|
|
1341
|
+
fn(() => this.#clear(fn));
|
|
1342
|
+
return true;
|
|
1343
|
+
}
|
|
1344
|
+
#clear(fn) {
|
|
1345
|
+
if (!this.#running.has(fn)) return false;
|
|
1346
|
+
const res = this.#reservations.get(fn);
|
|
1347
|
+
/* c8 ignore start */
|
|
1348
|
+
if (!res) throw new Error("invalid reservation");
|
|
1349
|
+
/* c8 ignore stop */
|
|
1350
|
+
const { paths, dirs } = res;
|
|
1351
|
+
const next = /* @__PURE__ */ new Set();
|
|
1352
|
+
for (const path of paths) {
|
|
1353
|
+
const q = this.#queues.get(path);
|
|
1354
|
+
/* c8 ignore start */
|
|
1355
|
+
if (!q || q?.[0] !== fn) continue;
|
|
1356
|
+
/* c8 ignore stop */
|
|
1357
|
+
const q0 = q[1];
|
|
1358
|
+
if (!q0) {
|
|
1359
|
+
this.#queues.delete(path);
|
|
1360
|
+
continue;
|
|
1361
|
+
}
|
|
1362
|
+
q.shift();
|
|
1363
|
+
if (typeof q0 === "function") next.add(q0);
|
|
1364
|
+
else for (const f of q0) next.add(f);
|
|
1365
|
+
}
|
|
1366
|
+
for (const dir of dirs) {
|
|
1367
|
+
const q = this.#queues.get(dir);
|
|
1368
|
+
const q0 = q?.[0];
|
|
1369
|
+
/* c8 ignore next - type safety only */
|
|
1370
|
+
if (!q || !(q0 instanceof Set)) continue;
|
|
1371
|
+
if (q0.size === 1 && q.length === 1) {
|
|
1372
|
+
this.#queues.delete(dir);
|
|
1373
|
+
continue;
|
|
1374
|
+
} else if (q0.size === 1) {
|
|
1375
|
+
q.shift();
|
|
1376
|
+
const n = q[0];
|
|
1377
|
+
if (typeof n === "function") next.add(n);
|
|
1378
|
+
} else q0.delete(fn);
|
|
1379
|
+
}
|
|
1380
|
+
this.#running.delete(fn);
|
|
1381
|
+
next.forEach((fn) => this.#run(fn));
|
|
1382
|
+
return true;
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
//#endregion
|
|
1386
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/unpack.js
|
|
1387
|
+
var ONENTRY = Symbol("onEntry");
|
|
1388
|
+
var CHECKFS = Symbol("checkFs");
|
|
1389
|
+
var CHECKFS2 = Symbol("checkFs2");
|
|
1390
|
+
var ISREUSABLE = Symbol("isReusable");
|
|
1391
|
+
var MAKEFS = Symbol("makeFs");
|
|
1392
|
+
var FILE = Symbol("file");
|
|
1393
|
+
var DIRECTORY = Symbol("directory");
|
|
1394
|
+
var LINK = Symbol("link");
|
|
1395
|
+
var SYMLINK = Symbol("symlink");
|
|
1396
|
+
var HARDLINK = Symbol("hardlink");
|
|
1397
|
+
var UNSUPPORTED = Symbol("unsupported");
|
|
1398
|
+
var CHECKPATH = Symbol("checkPath");
|
|
1399
|
+
var MKDIR = Symbol("mkdir");
|
|
1400
|
+
var ONERROR = Symbol("onError");
|
|
1401
|
+
var PENDING = Symbol("pending");
|
|
1402
|
+
var PEND = Symbol("pend");
|
|
1403
|
+
var UNPEND = Symbol("unpend");
|
|
1404
|
+
var ENDED = Symbol("ended");
|
|
1405
|
+
var MAYBECLOSE = Symbol("maybeClose");
|
|
1406
|
+
var SKIP = Symbol("skip");
|
|
1407
|
+
var DOCHOWN = Symbol("doChown");
|
|
1408
|
+
var UID = Symbol("uid");
|
|
1409
|
+
var GID = Symbol("gid");
|
|
1410
|
+
var CHECKED_CWD = Symbol("checkedCwd");
|
|
1411
|
+
var isWindows = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
|
|
1412
|
+
var DEFAULT_MAX_DEPTH = 1024;
|
|
1413
|
+
/* c8 ignore start */
|
|
1414
|
+
var unlinkFile = (path, cb) => {
|
|
1415
|
+
if (!isWindows) return fs.unlink(path, cb);
|
|
1416
|
+
const name = path + ".DELETE." + randomBytes(16).toString("hex");
|
|
1417
|
+
fs.rename(path, name, (er) => {
|
|
1418
|
+
if (er) return cb(er);
|
|
1419
|
+
fs.unlink(name, cb);
|
|
1420
|
+
});
|
|
1421
|
+
};
|
|
1422
|
+
/* c8 ignore stop */
|
|
1423
|
+
/* c8 ignore start */
|
|
1424
|
+
var unlinkFileSync = (path) => {
|
|
1425
|
+
if (!isWindows) return fs.unlinkSync(path);
|
|
1426
|
+
const name = path + ".DELETE." + randomBytes(16).toString("hex");
|
|
1427
|
+
fs.renameSync(path, name);
|
|
1428
|
+
fs.unlinkSync(name);
|
|
1429
|
+
};
|
|
1430
|
+
/* c8 ignore stop */
|
|
1431
|
+
var uint32 = (a, b, c) => a !== void 0 && a === a >>> 0 ? a : b !== void 0 && b === b >>> 0 ? b : c;
|
|
1432
|
+
var Unpack = class extends Parser {
|
|
1433
|
+
[ENDED] = false;
|
|
1434
|
+
[CHECKED_CWD] = false;
|
|
1435
|
+
[PENDING] = 0;
|
|
1436
|
+
reservations = new PathReservations();
|
|
1437
|
+
transform;
|
|
1438
|
+
writable = true;
|
|
1439
|
+
readable = false;
|
|
1440
|
+
uid;
|
|
1441
|
+
gid;
|
|
1442
|
+
setOwner;
|
|
1443
|
+
preserveOwner;
|
|
1444
|
+
processGid;
|
|
1445
|
+
processUid;
|
|
1446
|
+
maxDepth;
|
|
1447
|
+
forceChown;
|
|
1448
|
+
win32;
|
|
1449
|
+
newer;
|
|
1450
|
+
keep;
|
|
1451
|
+
noMtime;
|
|
1452
|
+
preservePaths;
|
|
1453
|
+
unlink;
|
|
1454
|
+
cwd;
|
|
1455
|
+
strip;
|
|
1456
|
+
processUmask;
|
|
1457
|
+
umask;
|
|
1458
|
+
dmode;
|
|
1459
|
+
fmode;
|
|
1460
|
+
chmod;
|
|
1461
|
+
constructor(opt = {}) {
|
|
1462
|
+
opt.ondone = () => {
|
|
1463
|
+
this[ENDED] = true;
|
|
1464
|
+
this[MAYBECLOSE]();
|
|
1465
|
+
};
|
|
1466
|
+
super(opt);
|
|
1467
|
+
this.transform = opt.transform;
|
|
1468
|
+
this.chmod = !!opt.chmod;
|
|
1469
|
+
if (typeof opt.uid === "number" || typeof opt.gid === "number") {
|
|
1470
|
+
if (typeof opt.uid !== "number" || typeof opt.gid !== "number") throw new TypeError("cannot set owner without number uid and gid");
|
|
1471
|
+
if (opt.preserveOwner) throw new TypeError("cannot preserve owner in archive and also set owner explicitly");
|
|
1472
|
+
this.uid = opt.uid;
|
|
1473
|
+
this.gid = opt.gid;
|
|
1474
|
+
this.setOwner = true;
|
|
1475
|
+
} else {
|
|
1476
|
+
this.uid = void 0;
|
|
1477
|
+
this.gid = void 0;
|
|
1478
|
+
this.setOwner = false;
|
|
1479
|
+
}
|
|
1480
|
+
if (opt.preserveOwner === void 0 && typeof opt.uid !== "number") this.preserveOwner = !!(process.getuid && process.getuid() === 0);
|
|
1481
|
+
else this.preserveOwner = !!opt.preserveOwner;
|
|
1482
|
+
this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : void 0;
|
|
1483
|
+
this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : void 0;
|
|
1484
|
+
this.maxDepth = typeof opt.maxDepth === "number" ? opt.maxDepth : DEFAULT_MAX_DEPTH;
|
|
1485
|
+
this.forceChown = opt.forceChown === true;
|
|
1486
|
+
this.win32 = !!opt.win32 || isWindows;
|
|
1487
|
+
this.newer = !!opt.newer;
|
|
1488
|
+
this.keep = !!opt.keep;
|
|
1489
|
+
this.noMtime = !!opt.noMtime;
|
|
1490
|
+
this.preservePaths = !!opt.preservePaths;
|
|
1491
|
+
this.unlink = !!opt.unlink;
|
|
1492
|
+
this.cwd = normalizeWindowsPath(path.resolve(opt.cwd || process.cwd()));
|
|
1493
|
+
this.strip = Number(opt.strip) || 0;
|
|
1494
|
+
this.processUmask = !this.chmod ? 0 : typeof opt.processUmask === "number" ? opt.processUmask : process.umask();
|
|
1495
|
+
this.umask = typeof opt.umask === "number" ? opt.umask : this.processUmask;
|
|
1496
|
+
this.dmode = opt.dmode || 511 & ~this.umask;
|
|
1497
|
+
this.fmode = opt.fmode || 438 & ~this.umask;
|
|
1498
|
+
this.on("entry", (entry) => this[ONENTRY](entry));
|
|
1499
|
+
}
|
|
1500
|
+
warn(code, msg, data = {}) {
|
|
1501
|
+
if (code === "TAR_BAD_ARCHIVE" || code === "TAR_ABORT") data.recoverable = false;
|
|
1502
|
+
return super.warn(code, msg, data);
|
|
1503
|
+
}
|
|
1504
|
+
[MAYBECLOSE]() {
|
|
1505
|
+
if (this[ENDED] && this[PENDING] === 0) {
|
|
1506
|
+
this.emit("prefinish");
|
|
1507
|
+
this.emit("finish");
|
|
1508
|
+
this.emit("end");
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
[CHECKPATH](entry) {
|
|
1512
|
+
const p = normalizeWindowsPath(entry.path);
|
|
1513
|
+
const parts = p.split("/");
|
|
1514
|
+
if (this.strip) {
|
|
1515
|
+
if (parts.length < this.strip) return false;
|
|
1516
|
+
if (entry.type === "Link") {
|
|
1517
|
+
const linkparts = normalizeWindowsPath(String(entry.linkpath)).split("/");
|
|
1518
|
+
if (linkparts.length >= this.strip) entry.linkpath = linkparts.slice(this.strip).join("/");
|
|
1519
|
+
else return false;
|
|
1520
|
+
}
|
|
1521
|
+
parts.splice(0, this.strip);
|
|
1522
|
+
entry.path = parts.join("/");
|
|
1523
|
+
}
|
|
1524
|
+
if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {
|
|
1525
|
+
this.warn("TAR_ENTRY_ERROR", "path excessively deep", {
|
|
1526
|
+
entry,
|
|
1527
|
+
path: p,
|
|
1528
|
+
depth: parts.length,
|
|
1529
|
+
maxDepth: this.maxDepth
|
|
1530
|
+
});
|
|
1531
|
+
return false;
|
|
1532
|
+
}
|
|
1533
|
+
if (!this.preservePaths) {
|
|
1534
|
+
if (parts.includes("..") || isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? "")) {
|
|
1535
|
+
this.warn("TAR_ENTRY_ERROR", `path contains '..'`, {
|
|
1536
|
+
entry,
|
|
1537
|
+
path: p
|
|
1538
|
+
});
|
|
1539
|
+
return false;
|
|
1540
|
+
}
|
|
1541
|
+
const [root, stripped] = stripAbsolutePath(p);
|
|
1542
|
+
if (root) {
|
|
1543
|
+
entry.path = String(stripped);
|
|
1544
|
+
this.warn("TAR_ENTRY_INFO", `stripping ${root} from absolute path`, {
|
|
1545
|
+
entry,
|
|
1546
|
+
path: p
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
if (path.isAbsolute(entry.path)) entry.absolute = normalizeWindowsPath(path.resolve(entry.path));
|
|
1551
|
+
else entry.absolute = normalizeWindowsPath(path.resolve(this.cwd, entry.path));
|
|
1552
|
+
/* c8 ignore start - defense in depth */
|
|
1553
|
+
if (!this.preservePaths && typeof entry.absolute === "string" && entry.absolute.indexOf(this.cwd + "/") !== 0 && entry.absolute !== this.cwd) {
|
|
1554
|
+
this.warn("TAR_ENTRY_ERROR", "path escaped extraction target", {
|
|
1555
|
+
entry,
|
|
1556
|
+
path: normalizeWindowsPath(entry.path),
|
|
1557
|
+
resolvedPath: entry.absolute,
|
|
1558
|
+
cwd: this.cwd
|
|
1559
|
+
});
|
|
1560
|
+
return false;
|
|
1561
|
+
}
|
|
1562
|
+
/* c8 ignore stop */
|
|
1563
|
+
if (entry.absolute === this.cwd && entry.type !== "Directory" && entry.type !== "GNUDumpDir") return false;
|
|
1564
|
+
if (this.win32) {
|
|
1565
|
+
const { root: aRoot } = path.win32.parse(String(entry.absolute));
|
|
1566
|
+
entry.absolute = aRoot + encode(String(entry.absolute).slice(aRoot.length));
|
|
1567
|
+
const { root: pRoot } = path.win32.parse(entry.path);
|
|
1568
|
+
entry.path = pRoot + encode(entry.path.slice(pRoot.length));
|
|
1569
|
+
}
|
|
1570
|
+
return true;
|
|
1571
|
+
}
|
|
1572
|
+
[ONENTRY](entry) {
|
|
1573
|
+
if (!this[CHECKPATH](entry)) return entry.resume();
|
|
1574
|
+
assert.equal(typeof entry.absolute, "string");
|
|
1575
|
+
switch (entry.type) {
|
|
1576
|
+
case "Directory":
|
|
1577
|
+
case "GNUDumpDir": if (entry.mode) entry.mode = entry.mode | 448;
|
|
1578
|
+
case "File":
|
|
1579
|
+
case "OldFile":
|
|
1580
|
+
case "ContiguousFile":
|
|
1581
|
+
case "Link":
|
|
1582
|
+
case "SymbolicLink": return this[CHECKFS](entry);
|
|
1583
|
+
default: return this[UNSUPPORTED](entry);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
[ONERROR](er, entry) {
|
|
1587
|
+
if (er.name === "CwdError") this.emit("error", er);
|
|
1588
|
+
else {
|
|
1589
|
+
this.warn("TAR_ENTRY_ERROR", er, { entry });
|
|
1590
|
+
this[UNPEND]();
|
|
1591
|
+
entry.resume();
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
[MKDIR](dir, mode, cb) {
|
|
1595
|
+
mkdir(normalizeWindowsPath(dir), {
|
|
1596
|
+
uid: this.uid,
|
|
1597
|
+
gid: this.gid,
|
|
1598
|
+
processUid: this.processUid,
|
|
1599
|
+
processGid: this.processGid,
|
|
1600
|
+
umask: this.processUmask,
|
|
1601
|
+
preserve: this.preservePaths,
|
|
1602
|
+
unlink: this.unlink,
|
|
1603
|
+
cwd: this.cwd,
|
|
1604
|
+
mode
|
|
1605
|
+
}, cb);
|
|
1606
|
+
}
|
|
1607
|
+
[DOCHOWN](entry) {
|
|
1608
|
+
return this.forceChown || this.preserveOwner && (typeof entry.uid === "number" && entry.uid !== this.processUid || typeof entry.gid === "number" && entry.gid !== this.processGid) || typeof this.uid === "number" && this.uid !== this.processUid || typeof this.gid === "number" && this.gid !== this.processGid;
|
|
1609
|
+
}
|
|
1610
|
+
[UID](entry) {
|
|
1611
|
+
return uint32(this.uid, entry.uid, this.processUid);
|
|
1612
|
+
}
|
|
1613
|
+
[GID](entry) {
|
|
1614
|
+
return uint32(this.gid, entry.gid, this.processGid);
|
|
1615
|
+
}
|
|
1616
|
+
[FILE](entry, fullyDone) {
|
|
1617
|
+
const mode = typeof entry.mode === "number" ? entry.mode & 4095 : this.fmode;
|
|
1618
|
+
const stream = new WriteStream(String(entry.absolute), {
|
|
1619
|
+
flags: getWriteFlag(entry.size),
|
|
1620
|
+
mode,
|
|
1621
|
+
autoClose: false
|
|
1622
|
+
});
|
|
1623
|
+
stream.on("error", (er) => {
|
|
1624
|
+
if (stream.fd) fs.close(stream.fd, () => {});
|
|
1625
|
+
stream.write = () => true;
|
|
1626
|
+
this[ONERROR](er, entry);
|
|
1627
|
+
fullyDone();
|
|
1628
|
+
});
|
|
1629
|
+
let actions = 1;
|
|
1630
|
+
const done = (er) => {
|
|
1631
|
+
if (er) {
|
|
1632
|
+
/* c8 ignore start - we should always have a fd by now */
|
|
1633
|
+
if (stream.fd) fs.close(stream.fd, () => {});
|
|
1634
|
+
/* c8 ignore stop */
|
|
1635
|
+
this[ONERROR](er, entry);
|
|
1636
|
+
fullyDone();
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
if (--actions === 0) {
|
|
1640
|
+
if (stream.fd !== void 0) fs.close(stream.fd, (er) => {
|
|
1641
|
+
if (er) this[ONERROR](er, entry);
|
|
1642
|
+
else this[UNPEND]();
|
|
1643
|
+
fullyDone();
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
stream.on("finish", () => {
|
|
1648
|
+
const abs = String(entry.absolute);
|
|
1649
|
+
const fd = stream.fd;
|
|
1650
|
+
if (typeof fd === "number" && entry.mtime && !this.noMtime) {
|
|
1651
|
+
actions++;
|
|
1652
|
+
const atime = entry.atime || /* @__PURE__ */ new Date();
|
|
1653
|
+
const mtime = entry.mtime;
|
|
1654
|
+
fs.futimes(fd, atime, mtime, (er) => er ? fs.utimes(abs, atime, mtime, (er2) => done(er2 && er)) : done());
|
|
1655
|
+
}
|
|
1656
|
+
if (typeof fd === "number" && this[DOCHOWN](entry)) {
|
|
1657
|
+
actions++;
|
|
1658
|
+
const uid = this[UID](entry);
|
|
1659
|
+
const gid = this[GID](entry);
|
|
1660
|
+
if (typeof uid === "number" && typeof gid === "number") fs.fchown(fd, uid, gid, (er) => er ? fs.chown(abs, uid, gid, (er2) => done(er2 && er)) : done());
|
|
1661
|
+
}
|
|
1662
|
+
done();
|
|
1663
|
+
});
|
|
1664
|
+
const tx = this.transform ? this.transform(entry) || entry : entry;
|
|
1665
|
+
if (tx !== entry) {
|
|
1666
|
+
tx.on("error", (er) => {
|
|
1667
|
+
this[ONERROR](er, entry);
|
|
1668
|
+
fullyDone();
|
|
1669
|
+
});
|
|
1670
|
+
entry.pipe(tx);
|
|
1671
|
+
}
|
|
1672
|
+
tx.pipe(stream);
|
|
1673
|
+
}
|
|
1674
|
+
[DIRECTORY](entry, fullyDone) {
|
|
1675
|
+
const mode = typeof entry.mode === "number" ? entry.mode & 4095 : this.dmode;
|
|
1676
|
+
this[MKDIR](String(entry.absolute), mode, (er) => {
|
|
1677
|
+
if (er) {
|
|
1678
|
+
this[ONERROR](er, entry);
|
|
1679
|
+
fullyDone();
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
let actions = 1;
|
|
1683
|
+
const done = () => {
|
|
1684
|
+
if (--actions === 0) {
|
|
1685
|
+
fullyDone();
|
|
1686
|
+
this[UNPEND]();
|
|
1687
|
+
entry.resume();
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
if (entry.mtime && !this.noMtime) {
|
|
1691
|
+
actions++;
|
|
1692
|
+
fs.utimes(String(entry.absolute), entry.atime || /* @__PURE__ */ new Date(), entry.mtime, done);
|
|
1693
|
+
}
|
|
1694
|
+
if (this[DOCHOWN](entry)) {
|
|
1695
|
+
actions++;
|
|
1696
|
+
fs.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done);
|
|
1697
|
+
}
|
|
1698
|
+
done();
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
[UNSUPPORTED](entry) {
|
|
1702
|
+
entry.unsupported = true;
|
|
1703
|
+
this.warn("TAR_ENTRY_UNSUPPORTED", `unsupported entry type: ${entry.type}`, { entry });
|
|
1704
|
+
entry.resume();
|
|
1705
|
+
}
|
|
1706
|
+
[SYMLINK](entry, done) {
|
|
1707
|
+
this[LINK](entry, String(entry.linkpath), "symlink", done);
|
|
1708
|
+
}
|
|
1709
|
+
[HARDLINK](entry, done) {
|
|
1710
|
+
const linkpath = normalizeWindowsPath(path.resolve(this.cwd, String(entry.linkpath)));
|
|
1711
|
+
this[LINK](entry, linkpath, "link", done);
|
|
1712
|
+
}
|
|
1713
|
+
[PEND]() {
|
|
1714
|
+
this[PENDING]++;
|
|
1715
|
+
}
|
|
1716
|
+
[UNPEND]() {
|
|
1717
|
+
this[PENDING]--;
|
|
1718
|
+
this[MAYBECLOSE]();
|
|
1719
|
+
}
|
|
1720
|
+
[SKIP](entry) {
|
|
1721
|
+
this[UNPEND]();
|
|
1722
|
+
entry.resume();
|
|
1723
|
+
}
|
|
1724
|
+
[ISREUSABLE](entry, st) {
|
|
1725
|
+
return entry.type === "File" && !this.unlink && st.isFile() && st.nlink <= 1 && !isWindows;
|
|
1726
|
+
}
|
|
1727
|
+
[CHECKFS](entry) {
|
|
1728
|
+
this[PEND]();
|
|
1729
|
+
const paths = [entry.path];
|
|
1730
|
+
if (entry.linkpath) paths.push(entry.linkpath);
|
|
1731
|
+
this.reservations.reserve(paths, (done) => this[CHECKFS2](entry, done));
|
|
1732
|
+
}
|
|
1733
|
+
[CHECKFS2](entry, fullyDone) {
|
|
1734
|
+
const done = (er) => {
|
|
1735
|
+
fullyDone(er);
|
|
1736
|
+
};
|
|
1737
|
+
const checkCwd = () => {
|
|
1738
|
+
this[MKDIR](this.cwd, this.dmode, (er) => {
|
|
1739
|
+
if (er) {
|
|
1740
|
+
this[ONERROR](er, entry);
|
|
1741
|
+
done();
|
|
1742
|
+
return;
|
|
1743
|
+
}
|
|
1744
|
+
this[CHECKED_CWD] = true;
|
|
1745
|
+
start();
|
|
1746
|
+
});
|
|
1747
|
+
};
|
|
1748
|
+
const start = () => {
|
|
1749
|
+
if (entry.absolute !== this.cwd) {
|
|
1750
|
+
const parent = normalizeWindowsPath(path.dirname(String(entry.absolute)));
|
|
1751
|
+
if (parent !== this.cwd) return this[MKDIR](parent, this.dmode, (er) => {
|
|
1752
|
+
if (er) {
|
|
1753
|
+
this[ONERROR](er, entry);
|
|
1754
|
+
done();
|
|
1755
|
+
return;
|
|
1756
|
+
}
|
|
1757
|
+
afterMakeParent();
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
afterMakeParent();
|
|
1761
|
+
};
|
|
1762
|
+
const afterMakeParent = () => {
|
|
1763
|
+
fs.lstat(String(entry.absolute), (lstatEr, st) => {
|
|
1764
|
+
if (st && (this.keep || this.newer && st.mtime > (entry.mtime ?? st.mtime))) {
|
|
1765
|
+
this[SKIP](entry);
|
|
1766
|
+
done();
|
|
1767
|
+
return;
|
|
1768
|
+
}
|
|
1769
|
+
if (lstatEr || this[ISREUSABLE](entry, st)) return this[MAKEFS](null, entry, done);
|
|
1770
|
+
if (st.isDirectory()) {
|
|
1771
|
+
if (entry.type === "Directory") {
|
|
1772
|
+
const needChmod = this.chmod && entry.mode && (st.mode & 4095) !== entry.mode;
|
|
1773
|
+
const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done);
|
|
1774
|
+
if (!needChmod) return afterChmod();
|
|
1775
|
+
return fs.chmod(String(entry.absolute), Number(entry.mode), afterChmod);
|
|
1776
|
+
}
|
|
1777
|
+
if (entry.absolute !== this.cwd) return fs.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done));
|
|
1778
|
+
}
|
|
1779
|
+
if (entry.absolute === this.cwd) return this[MAKEFS](null, entry, done);
|
|
1780
|
+
unlinkFile(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done));
|
|
1781
|
+
});
|
|
1782
|
+
};
|
|
1783
|
+
if (this[CHECKED_CWD]) start();
|
|
1784
|
+
else checkCwd();
|
|
1785
|
+
}
|
|
1786
|
+
[MAKEFS](er, entry, done) {
|
|
1787
|
+
if (er) {
|
|
1788
|
+
this[ONERROR](er, entry);
|
|
1789
|
+
done();
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
switch (entry.type) {
|
|
1793
|
+
case "File":
|
|
1794
|
+
case "OldFile":
|
|
1795
|
+
case "ContiguousFile": return this[FILE](entry, done);
|
|
1796
|
+
case "Link": return this[HARDLINK](entry, done);
|
|
1797
|
+
case "SymbolicLink": return this[SYMLINK](entry, done);
|
|
1798
|
+
case "Directory":
|
|
1799
|
+
case "GNUDumpDir": return this[DIRECTORY](entry, done);
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
[LINK](entry, linkpath, link, done) {
|
|
1803
|
+
fs[link](linkpath, String(entry.absolute), (er) => {
|
|
1804
|
+
if (er) this[ONERROR](er, entry);
|
|
1805
|
+
else {
|
|
1806
|
+
this[UNPEND]();
|
|
1807
|
+
entry.resume();
|
|
1808
|
+
}
|
|
1809
|
+
done();
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
var callSync = (fn) => {
|
|
1814
|
+
try {
|
|
1815
|
+
return [null, fn()];
|
|
1816
|
+
} catch (er) {
|
|
1817
|
+
return [er, null];
|
|
1818
|
+
}
|
|
1819
|
+
};
|
|
1820
|
+
var UnpackSync = class extends Unpack {
|
|
1821
|
+
sync = true;
|
|
1822
|
+
[MAKEFS](er, entry) {
|
|
1823
|
+
return super[MAKEFS](er, entry, () => {});
|
|
1824
|
+
}
|
|
1825
|
+
[CHECKFS](entry) {
|
|
1826
|
+
if (!this[CHECKED_CWD]) {
|
|
1827
|
+
const er = this[MKDIR](this.cwd, this.dmode);
|
|
1828
|
+
if (er) return this[ONERROR](er, entry);
|
|
1829
|
+
this[CHECKED_CWD] = true;
|
|
1830
|
+
}
|
|
1831
|
+
if (entry.absolute !== this.cwd) {
|
|
1832
|
+
const parent = normalizeWindowsPath(path.dirname(String(entry.absolute)));
|
|
1833
|
+
if (parent !== this.cwd) {
|
|
1834
|
+
const mkParent = this[MKDIR](parent, this.dmode);
|
|
1835
|
+
if (mkParent) return this[ONERROR](mkParent, entry);
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
const [lstatEr, st] = callSync(() => fs.lstatSync(String(entry.absolute)));
|
|
1839
|
+
if (st && (this.keep || this.newer && st.mtime > (entry.mtime ?? st.mtime))) return this[SKIP](entry);
|
|
1840
|
+
if (lstatEr || this[ISREUSABLE](entry, st)) return this[MAKEFS](null, entry);
|
|
1841
|
+
if (st.isDirectory()) {
|
|
1842
|
+
if (entry.type === "Directory") {
|
|
1843
|
+
const [er] = this.chmod && entry.mode && (st.mode & 4095) !== entry.mode ? callSync(() => {
|
|
1844
|
+
fs.chmodSync(String(entry.absolute), Number(entry.mode));
|
|
1845
|
+
}) : [];
|
|
1846
|
+
return this[MAKEFS](er, entry);
|
|
1847
|
+
}
|
|
1848
|
+
const [er] = callSync(() => fs.rmdirSync(String(entry.absolute)));
|
|
1849
|
+
this[MAKEFS](er, entry);
|
|
1850
|
+
}
|
|
1851
|
+
const [er] = entry.absolute === this.cwd ? [] : callSync(() => unlinkFileSync(String(entry.absolute)));
|
|
1852
|
+
this[MAKEFS](er, entry);
|
|
1853
|
+
}
|
|
1854
|
+
[FILE](entry, done) {
|
|
1855
|
+
const mode = typeof entry.mode === "number" ? entry.mode & 4095 : this.fmode;
|
|
1856
|
+
const oner = (er) => {
|
|
1857
|
+
let closeError;
|
|
1858
|
+
try {
|
|
1859
|
+
fs.closeSync(fd);
|
|
1860
|
+
} catch (e) {
|
|
1861
|
+
closeError = e;
|
|
1862
|
+
}
|
|
1863
|
+
if (er || closeError) this[ONERROR](er || closeError, entry);
|
|
1864
|
+
done();
|
|
1865
|
+
};
|
|
1866
|
+
let fd;
|
|
1867
|
+
try {
|
|
1868
|
+
fd = fs.openSync(String(entry.absolute), getWriteFlag(entry.size), mode);
|
|
1869
|
+
} catch (er) {
|
|
1870
|
+
return oner(er);
|
|
1871
|
+
}
|
|
1872
|
+
/* c8 ignore stop */
|
|
1873
|
+
const tx = this.transform ? this.transform(entry) || entry : entry;
|
|
1874
|
+
if (tx !== entry) {
|
|
1875
|
+
tx.on("error", (er) => this[ONERROR](er, entry));
|
|
1876
|
+
entry.pipe(tx);
|
|
1877
|
+
}
|
|
1878
|
+
tx.on("data", (chunk) => {
|
|
1879
|
+
try {
|
|
1880
|
+
fs.writeSync(fd, chunk, 0, chunk.length);
|
|
1881
|
+
} catch (er) {
|
|
1882
|
+
oner(er);
|
|
1883
|
+
}
|
|
1884
|
+
});
|
|
1885
|
+
tx.on("end", () => {
|
|
1886
|
+
let er = null;
|
|
1887
|
+
if (entry.mtime && !this.noMtime) {
|
|
1888
|
+
const atime = entry.atime || /* @__PURE__ */ new Date();
|
|
1889
|
+
const mtime = entry.mtime;
|
|
1890
|
+
try {
|
|
1891
|
+
fs.futimesSync(fd, atime, mtime);
|
|
1892
|
+
} catch (futimeser) {
|
|
1893
|
+
try {
|
|
1894
|
+
fs.utimesSync(String(entry.absolute), atime, mtime);
|
|
1895
|
+
} catch (utimeser) {
|
|
1896
|
+
er = futimeser;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
if (this[DOCHOWN](entry)) {
|
|
1901
|
+
const uid = this[UID](entry);
|
|
1902
|
+
const gid = this[GID](entry);
|
|
1903
|
+
try {
|
|
1904
|
+
fs.fchownSync(fd, Number(uid), Number(gid));
|
|
1905
|
+
} catch (fchowner) {
|
|
1906
|
+
try {
|
|
1907
|
+
fs.chownSync(String(entry.absolute), Number(uid), Number(gid));
|
|
1908
|
+
} catch (chowner) {
|
|
1909
|
+
er = er || fchowner;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
oner(er);
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
[DIRECTORY](entry, done) {
|
|
1917
|
+
const mode = typeof entry.mode === "number" ? entry.mode & 4095 : this.dmode;
|
|
1918
|
+
const er = this[MKDIR](String(entry.absolute), mode);
|
|
1919
|
+
if (er) {
|
|
1920
|
+
this[ONERROR](er, entry);
|
|
1921
|
+
done();
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
if (entry.mtime && !this.noMtime) try {
|
|
1925
|
+
fs.utimesSync(String(entry.absolute), entry.atime || /* @__PURE__ */ new Date(), entry.mtime);
|
|
1926
|
+
} catch (er) {}
|
|
1927
|
+
if (this[DOCHOWN](entry)) try {
|
|
1928
|
+
fs.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)));
|
|
1929
|
+
} catch (er) {}
|
|
1930
|
+
done();
|
|
1931
|
+
entry.resume();
|
|
1932
|
+
}
|
|
1933
|
+
[MKDIR](dir, mode) {
|
|
1934
|
+
try {
|
|
1935
|
+
return mkdirSync(normalizeWindowsPath(dir), {
|
|
1936
|
+
uid: this.uid,
|
|
1937
|
+
gid: this.gid,
|
|
1938
|
+
processUid: this.processUid,
|
|
1939
|
+
processGid: this.processGid,
|
|
1940
|
+
umask: this.processUmask,
|
|
1941
|
+
preserve: this.preservePaths,
|
|
1942
|
+
unlink: this.unlink,
|
|
1943
|
+
cwd: this.cwd,
|
|
1944
|
+
mode
|
|
1945
|
+
});
|
|
1946
|
+
} catch (er) {
|
|
1947
|
+
return er;
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
[LINK](entry, linkpath, link, done) {
|
|
1951
|
+
const ls = `${link}Sync`;
|
|
1952
|
+
try {
|
|
1953
|
+
fs[ls](linkpath, String(entry.absolute));
|
|
1954
|
+
done();
|
|
1955
|
+
entry.resume();
|
|
1956
|
+
} catch (er) {
|
|
1957
|
+
return this[ONERROR](er, entry);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
};
|
|
1961
|
+
//#endregion
|
|
1962
|
+
//#region ../../node_modules/.pnpm/tar@7.5.1/node_modules/tar/dist/esm/extract.js
|
|
1963
|
+
var extractFileSync = (opt) => {
|
|
1964
|
+
const u = new UnpackSync(opt);
|
|
1965
|
+
const file = opt.file;
|
|
1966
|
+
const stat = fs.statSync(file);
|
|
1967
|
+
new ReadStreamSync(file, {
|
|
1968
|
+
readSize: opt.maxReadSize || 16 * 1024 * 1024,
|
|
1969
|
+
size: stat.size
|
|
1970
|
+
}).pipe(u);
|
|
1971
|
+
};
|
|
1972
|
+
var extractFile = (opt, _) => {
|
|
1973
|
+
const u = new Unpack(opt);
|
|
1974
|
+
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
|
|
1975
|
+
const file = opt.file;
|
|
1976
|
+
return new Promise((resolve, reject) => {
|
|
1977
|
+
u.on("error", reject);
|
|
1978
|
+
u.on("close", resolve);
|
|
1979
|
+
fs.stat(file, (er, stat) => {
|
|
1980
|
+
if (er) reject(er);
|
|
1981
|
+
else {
|
|
1982
|
+
const stream = new ReadStream(file, {
|
|
1983
|
+
readSize,
|
|
1984
|
+
size: stat.size
|
|
1985
|
+
});
|
|
1986
|
+
stream.on("error", reject);
|
|
1987
|
+
stream.pipe(u);
|
|
1988
|
+
}
|
|
1989
|
+
});
|
|
1990
|
+
});
|
|
1991
|
+
};
|
|
1992
|
+
var extract = makeCommand(extractFileSync, extractFile, (opt) => new UnpackSync(opt), (opt) => new Unpack(opt), (opt, files) => {
|
|
1993
|
+
if (files?.length) filesFilter(opt, files);
|
|
1994
|
+
});
|
|
1995
|
+
//#endregion
|
|
1996
|
+
export { extract as t };
|