sandcovery 0.7.0 → 0.10.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/README.md +11 -8
- package/dist/cli/index.mjs +13025 -19868
- package/dist/cli/sandcovery-docker.mjs +8550 -3
- package/dist/cli/sandcovery-kubectl.mjs +7 -4
- package/dist/cli/sandcovery-t3.mjs +143 -61
- package/dist/index.d.mts +9072 -135
- package/dist/index.mjs +1 -1
- package/dist/{kubectl-ClFWX65x.mjs → kubectl-BZIzN5z0.mjs} +131 -97
- package/dist/saved-sandboxes-XNeQ5SEm.mjs +389 -0
- package/dist/{x-account-BSasf-z-.mjs → src-Ce-b80jJ.mjs} +19731 -8599
- package/dist/sync-KX0CReEd.mjs +4171 -0
- package/dist/third-party-licenses.md +630 -0
- package/dist/types-DotsDqXt.d.mts +1264 -0
- package/dist/types.d.mts +2 -2
- package/package.json +4 -4
- package/dist/src-gAv6vIvE.mjs +0 -566
- package/dist/tool-B8KvfvY5.mjs +0 -12890
- package/dist/types-B52jOW9v.d.mts +0 -853
|
@@ -0,0 +1,4171 @@
|
|
|
1
|
+
import { $a as exists, $o as identity, Ba as succeed, Ia as isFailure, Ko as ownEnumerableKeys, La as isResult, Mt as Struct, Ot as Record, Pa as fail, Ra as isSuccess, Ro as isNotNullish, Va as try_, W as runForEach, Wt as decodeUnknownOption, Xr as runPromiseExit, _o as match, bo as some, co as getOrElse, dt as ArraySchema, eo as filter, fo as isNone, go as map, ho as liftThrowable, j as fromAsyncIterable, jt as String$1, lt as updateAndGet, no as flatMap, ns as pipeArguments, oo as fromNullishOr, ot as make, po as isSome, qt as fromJsonString, si as tryPromise, so as fromUndefinedOr, vo as none, xo as toArray, yt as Literal } from "./src-Ce-b80jJ.mjs";
|
|
2
|
+
import { f as writePrivateFile, p as v7, u as stopSignalOf } from "./saved-sandboxes-XNeQ5SEm.mjs";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import Cs from "node:stream";
|
|
6
|
+
import { StringDecoder } from "node:string_decoder";
|
|
7
|
+
import Qr, { EventEmitter } from "events";
|
|
8
|
+
import en, * as Ps from "zlib";
|
|
9
|
+
import { Buffer as Buffer$1 } from "buffer";
|
|
10
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
11
|
+
import fs from "node:fs";
|
|
12
|
+
import path, { basename, join, posix, win32 } from "node:path";
|
|
13
|
+
import { EventEmitter as EventEmitter$1 } from "node:events";
|
|
14
|
+
import co from "node:assert";
|
|
15
|
+
import ar, { dirname, parse } from "path";
|
|
16
|
+
import I from "fs";
|
|
17
|
+
import zi from "assert";
|
|
18
|
+
import ro from "node:fs/promises";
|
|
19
|
+
// \0rolldown/runtime.js
|
|
20
|
+
var __create = Object.create;
|
|
21
|
+
var __defProp = Object.defineProperty;
|
|
22
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
23
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
24
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
25
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
26
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
29
|
+
key = keys[i];
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
31
|
+
get: ((k) => from[k]).bind(null, key),
|
|
32
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
38
|
+
value: mod,
|
|
39
|
+
enumerable: true
|
|
40
|
+
}) : target, mod));
|
|
41
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
42
|
+
const ValueMatcherProto = {
|
|
43
|
+
["~effect/Match/Matcher"]: {
|
|
44
|
+
_input: identity,
|
|
45
|
+
_filters: identity,
|
|
46
|
+
_result: identity,
|
|
47
|
+
_return: identity,
|
|
48
|
+
_flavor: identity
|
|
49
|
+
},
|
|
50
|
+
_tag: "ValueMatcher",
|
|
51
|
+
add(_case) {
|
|
52
|
+
if (isSuccess(this.value)) return this;
|
|
53
|
+
if (_case._tag === "When" && _case.guard(this.provided) === true) return makeValueMatcher(this.provided, succeed(_case.evaluate(this.provided)));
|
|
54
|
+
else if (_case._tag === "Not" && _case.guard(this.provided) === false) return makeValueMatcher(this.provided, succeed(_case.evaluate(this.provided)));
|
|
55
|
+
return this;
|
|
56
|
+
},
|
|
57
|
+
pipe() {
|
|
58
|
+
return pipeArguments(this, arguments);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function makeValueMatcher(provided, value) {
|
|
62
|
+
const matcher = Object.create(ValueMatcherProto);
|
|
63
|
+
matcher.provided = provided;
|
|
64
|
+
matcher.value = value;
|
|
65
|
+
return matcher;
|
|
66
|
+
}
|
|
67
|
+
const makeWhen = (guard, evaluate) => ({
|
|
68
|
+
_tag: "When",
|
|
69
|
+
guard,
|
|
70
|
+
evaluate
|
|
71
|
+
});
|
|
72
|
+
const makePredicate = (pattern) => {
|
|
73
|
+
if (typeof pattern === "function") return pattern;
|
|
74
|
+
else if (Array.isArray(pattern)) {
|
|
75
|
+
const predicates = pattern.map(makePredicate);
|
|
76
|
+
const len = predicates.length;
|
|
77
|
+
return (u) => {
|
|
78
|
+
if (!Array.isArray(u) || u.length < len) return false;
|
|
79
|
+
for (let i = 0; i < len; i++) if (predicates[i](u[i]) === false) return false;
|
|
80
|
+
return true;
|
|
81
|
+
};
|
|
82
|
+
} else if (pattern !== null && typeof pattern === "object") {
|
|
83
|
+
const keysAndPredicates = ownEnumerableKeys(pattern).map((key) => [key, makePredicate(pattern[key])]);
|
|
84
|
+
const len = keysAndPredicates.length;
|
|
85
|
+
return (u) => {
|
|
86
|
+
if (typeof u !== "object" || u === null) return false;
|
|
87
|
+
for (let i = 0; i < len; i++) {
|
|
88
|
+
const [key, predicate] = keysAndPredicates[i];
|
|
89
|
+
if (!(key in u) || predicate(u[key]) === false) return false;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return (u) => u === pattern;
|
|
95
|
+
};
|
|
96
|
+
/** @internal */
|
|
97
|
+
const value$1 = (i) => makeValueMatcher(i, fail(i));
|
|
98
|
+
/** @internal */
|
|
99
|
+
const when$1 = (pattern, f) => (self) => self.add(makeWhen(makePredicate(pattern), f));
|
|
100
|
+
/** @internal */
|
|
101
|
+
const discriminator = (field) => (...pattern) => {
|
|
102
|
+
const f = pattern[pattern.length - 1];
|
|
103
|
+
const values = pattern.slice(0, -1);
|
|
104
|
+
const pred = values.length === 1 ? (_) => _ != null && _[field] === values[0] : (_) => _ != null && values.includes(_[field]);
|
|
105
|
+
return (self) => self.add(makeWhen(pred, f));
|
|
106
|
+
};
|
|
107
|
+
/** @internal */
|
|
108
|
+
const tag$1 = /*#__PURE__*/ discriminator("_tag");
|
|
109
|
+
/** @internal */
|
|
110
|
+
const orElse$1 = (f) => (self) => {
|
|
111
|
+
const toResult = result(self);
|
|
112
|
+
if (isResult(toResult)) return toResult._tag === "Success" ? toResult.success : f(toResult.failure);
|
|
113
|
+
return (...args) => {
|
|
114
|
+
const a = toResult(...args);
|
|
115
|
+
return isSuccess(a) ? a.success : f(a.failure, ...args);
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
/** @internal */
|
|
119
|
+
const result = (self) => {
|
|
120
|
+
if (self._tag === "ValueMatcher") return self.value;
|
|
121
|
+
const len = self.cases.length;
|
|
122
|
+
if (len === 1) {
|
|
123
|
+
const _case = self.cases[0];
|
|
124
|
+
return (...args) => {
|
|
125
|
+
const input = self.select(...args);
|
|
126
|
+
if (_case._tag === "When" && _case.guard(input) === true) return succeed(_case.evaluate(input, ...args));
|
|
127
|
+
else if (_case._tag === "Not" && _case.guard(input) === false) return succeed(_case.evaluate(input, ...args));
|
|
128
|
+
return fail(input);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return (...args) => {
|
|
132
|
+
const input = self.select(...args);
|
|
133
|
+
for (let i = 0; i < len; i++) {
|
|
134
|
+
const _case = self.cases[i];
|
|
135
|
+
if (_case._tag === "When" && _case.guard(input) === true) return succeed(_case.evaluate(input, ...args));
|
|
136
|
+
else if (_case._tag === "Not" && _case.guard(input) === false) return succeed(_case.evaluate(input, ...args));
|
|
137
|
+
}
|
|
138
|
+
return fail(input);
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
const getExhaustiveAbsurdErrorMessage = "effect/match/Match/exhaustive: absurd";
|
|
142
|
+
/** @internal */
|
|
143
|
+
const exhaustive$1 = (self) => {
|
|
144
|
+
const toResult = result(self);
|
|
145
|
+
if (isResult(toResult)) {
|
|
146
|
+
if (isSuccess(toResult)) return toResult.success;
|
|
147
|
+
throw new Error(getExhaustiveAbsurdErrorMessage);
|
|
148
|
+
}
|
|
149
|
+
return (...args) => {
|
|
150
|
+
const result = toResult(...args);
|
|
151
|
+
if (isSuccess(result)) return result.success;
|
|
152
|
+
throw new Error(getExhaustiveAbsurdErrorMessage);
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
// ../../node_modules/.pnpm/effect@4.1.5/node_modules/effect/dist/Match.js
|
|
156
|
+
/**
|
|
157
|
+
* Builds pattern matchers for TypeScript values.
|
|
158
|
+
*
|
|
159
|
+
* `Match` lets you add ordered cases and then finish them with a result,
|
|
160
|
+
* fallback, `Option`, or exhaustive check. Use `Match.type` to define a
|
|
161
|
+
* reusable matcher for a type, or `Match.value` to match one value immediately.
|
|
162
|
+
* Cases can match literal values, predicates, object shapes, tags, negated
|
|
163
|
+
* patterns, and common checks such as strings, numbers, records, and class
|
|
164
|
+
* instances.
|
|
165
|
+
*
|
|
166
|
+
* Object patterns use their own enumerable string and symbol properties.
|
|
167
|
+
* Non-enumerable and inherited pattern properties are ignored. The selected
|
|
168
|
+
* properties may be non-enumerable or inherited on the value being matched.
|
|
169
|
+
*
|
|
170
|
+
* @stability stable
|
|
171
|
+
* @since 4.0.0
|
|
172
|
+
*/
|
|
173
|
+
/**
|
|
174
|
+
* Creates a matcher from a specific value.
|
|
175
|
+
*
|
|
176
|
+
* **When to use**
|
|
177
|
+
*
|
|
178
|
+
* Use to match one concrete input immediately.
|
|
179
|
+
*
|
|
180
|
+
* **Details**
|
|
181
|
+
*
|
|
182
|
+
* This function allows you to define a `Matcher` directly from a given value,
|
|
183
|
+
* rather than from a type. This is useful when working with known values,
|
|
184
|
+
* enabling structured pattern matching on objects, primitives, or any data
|
|
185
|
+
* structure.
|
|
186
|
+
*
|
|
187
|
+
* Once the matcher is created, you can use pattern-matching functions like
|
|
188
|
+
* {@link when} to define how different cases should be handled.
|
|
189
|
+
*
|
|
190
|
+
* **Example** (Matching an Object by Property)
|
|
191
|
+
*
|
|
192
|
+
* ```ts import.meta.vitest
|
|
193
|
+
* import { Match } from "effect"
|
|
194
|
+
*
|
|
195
|
+
* const input = { name: "John", age: 30 }
|
|
196
|
+
*
|
|
197
|
+
* // Create a matcher for the specific object
|
|
198
|
+
* const result = Match.value(input).pipe(
|
|
199
|
+
* // Match when the 'name' property is "John"
|
|
200
|
+
* Match.when(
|
|
201
|
+
* { name: "John" },
|
|
202
|
+
* (user) => `${user.name} is ${user.age} years old`
|
|
203
|
+
* ),
|
|
204
|
+
* // Provide a fallback if no match is found
|
|
205
|
+
* Match.orElse(() => "Oh, not John")
|
|
206
|
+
* )
|
|
207
|
+
*
|
|
208
|
+
* result // => "John is 30 years old"
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* @see {@link type} for creating a matcher from a specific type.
|
|
212
|
+
*
|
|
213
|
+
* @stability stable
|
|
214
|
+
* @category constructors
|
|
215
|
+
* @since 4.0.0
|
|
216
|
+
*/
|
|
217
|
+
const value = value$1;
|
|
218
|
+
/**
|
|
219
|
+
* Defines a condition for matching values.
|
|
220
|
+
*
|
|
221
|
+
* **When to use**
|
|
222
|
+
*
|
|
223
|
+
* Use to add one positive pattern case to a `Match.type` or `Match.value`
|
|
224
|
+
* pipeline when a direct value, predicate, or structured object pattern should
|
|
225
|
+
* run a handler for matching input.
|
|
226
|
+
*
|
|
227
|
+
* **Details**
|
|
228
|
+
*
|
|
229
|
+
* Supports both direct value comparisons and predicate functions. If the
|
|
230
|
+
* pattern matches, the associated function is executed and the matched input is
|
|
231
|
+
* removed from the remaining cases tracked by the matcher.
|
|
232
|
+
* Object patterns, including nested patterns, use only own enumerable string
|
|
233
|
+
* and symbol properties. Non-enumerable and inherited pattern properties are
|
|
234
|
+
* ignored. Selected properties on the input may be non-enumerable or inherited.
|
|
235
|
+
*
|
|
236
|
+
* **Example** (Matching with values and predicates)
|
|
237
|
+
*
|
|
238
|
+
* ```ts import.meta.vitest
|
|
239
|
+
* import { Match } from "effect"
|
|
240
|
+
*
|
|
241
|
+
* // Create a matcher for objects with an "age" property
|
|
242
|
+
* const match = Match.type<{ age: number }>().pipe(
|
|
243
|
+
* // Match when age is greater than 18
|
|
244
|
+
* Match.when(
|
|
245
|
+
* { age: (age: number) => age > 18 },
|
|
246
|
+
* (user: { age: number }) => `Age: ${user.age}`
|
|
247
|
+
* ),
|
|
248
|
+
* // Match when age is exactly 18
|
|
249
|
+
* Match.when({ age: 18 }, () => "You can vote"),
|
|
250
|
+
* // Fallback case for all other ages
|
|
251
|
+
* Match.orElse((user: { age: number }) => `${user.age} is too young`)
|
|
252
|
+
* )
|
|
253
|
+
*
|
|
254
|
+
* match({ age: 20 }) // => "Age: 20"
|
|
255
|
+
*
|
|
256
|
+
* match({ age: 18 }) // => "You can vote"
|
|
257
|
+
*
|
|
258
|
+
* match({ age: 4 }) // => "4 is too young"
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* @see {@link whenOr} for handling any one of several patterns with the same handler
|
|
262
|
+
* @see {@link whenAnd} for requiring all provided patterns to match before running a handler
|
|
263
|
+
* @see {@link not} for handling inputs that do not match a pattern
|
|
264
|
+
* @see {@link orElse} for providing a fallback when no pattern case matches
|
|
265
|
+
*
|
|
266
|
+
* @stability stable
|
|
267
|
+
* @category defining patterns
|
|
268
|
+
* @since 4.0.0
|
|
269
|
+
*/
|
|
270
|
+
const when = when$1;
|
|
271
|
+
/**
|
|
272
|
+
* Matches discriminated union members by their `_tag` field.
|
|
273
|
+
*
|
|
274
|
+
* **When to use**
|
|
275
|
+
*
|
|
276
|
+
* Use to handle one or more `_tag` cases with the same matcher branch.
|
|
277
|
+
*
|
|
278
|
+
* **Details**
|
|
279
|
+
*
|
|
280
|
+
* This helper follows the Effect convention that discriminated unions use
|
|
281
|
+
* `"_tag"` as their discriminator field. Use {@link discriminator} for a
|
|
282
|
+
* different discriminator field.
|
|
283
|
+
*
|
|
284
|
+
* **Example** (Matching a discriminated union by tag)
|
|
285
|
+
*
|
|
286
|
+
* ```ts import.meta.vitest
|
|
287
|
+
* import { Match } from "effect"
|
|
288
|
+
*
|
|
289
|
+
* type Event =
|
|
290
|
+
* | { readonly _tag: "fetch" }
|
|
291
|
+
* | { readonly _tag: "success"; readonly data: string }
|
|
292
|
+
* | { readonly _tag: "error"; readonly error: Error }
|
|
293
|
+
* | { readonly _tag: "cancel" }
|
|
294
|
+
*
|
|
295
|
+
* const match = Match.type<Event>().pipe(
|
|
296
|
+
* // Match either "fetch" or "success"
|
|
297
|
+
* Match.tag("fetch", "success", () => `Ok!`),
|
|
298
|
+
* // Match "error" and extract the error message
|
|
299
|
+
* Match.tag("error", (event) => `Error: ${event.error.message}`),
|
|
300
|
+
* // Match "cancel"
|
|
301
|
+
* Match.tag("cancel", () => "Cancelled"),
|
|
302
|
+
* Match.exhaustive
|
|
303
|
+
* )
|
|
304
|
+
*
|
|
305
|
+
* match({ _tag: "success", data: "Hello" }) // => "Ok!"
|
|
306
|
+
*
|
|
307
|
+
* match({ _tag: "error", error: new Error("Oops!") }) // => "Error: Oops!"
|
|
308
|
+
* ```
|
|
309
|
+
*
|
|
310
|
+
* @stability stable
|
|
311
|
+
* @category defining patterns
|
|
312
|
+
* @since 4.0.0
|
|
313
|
+
*/
|
|
314
|
+
const tag = tag$1;
|
|
315
|
+
/**
|
|
316
|
+
* Provides a fallback value when no patterns match.
|
|
317
|
+
*
|
|
318
|
+
* **When to use**
|
|
319
|
+
*
|
|
320
|
+
* Use to finalize a matcher with a fallback for unmatched input.
|
|
321
|
+
*
|
|
322
|
+
* **Details**
|
|
323
|
+
*
|
|
324
|
+
* This function ensures that a matcher always returns a valid result, even if
|
|
325
|
+
* no defined patterns match. It acts as a default case, similar to the
|
|
326
|
+
* `default` clause in a `switch` statement or the final `else` in an `if-else`
|
|
327
|
+
* chain.
|
|
328
|
+
*
|
|
329
|
+
* **Example** (Providing a default value when no patterns match)
|
|
330
|
+
*
|
|
331
|
+
* ```ts import.meta.vitest
|
|
332
|
+
* import { Match } from "effect"
|
|
333
|
+
*
|
|
334
|
+
* // Create a matcher for string or number values
|
|
335
|
+
* const match = Match.type<string | number>().pipe(
|
|
336
|
+
* // Match when the value is "a"
|
|
337
|
+
* Match.when("a", () => "ok"),
|
|
338
|
+
* // Fallback when no patterns match
|
|
339
|
+
* Match.orElse(() => "fallback")
|
|
340
|
+
* )
|
|
341
|
+
*
|
|
342
|
+
* match("a") // => "ok"
|
|
343
|
+
*
|
|
344
|
+
* match("b") // => "fallback"
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* @see {@link option} for finalizing unmatched input as `Option.none`
|
|
348
|
+
* @see {@link result} for returning unmatched input as a `Result` failure
|
|
349
|
+
* @see {@link orElseAbsurd} for finalizing when unmatched input should be impossible
|
|
350
|
+
*
|
|
351
|
+
* @stability stable
|
|
352
|
+
* @category completion
|
|
353
|
+
* @since 4.0.0
|
|
354
|
+
*/
|
|
355
|
+
const orElse = orElse$1;
|
|
356
|
+
/**
|
|
357
|
+
* Completes a matcher that handles every remaining input case.
|
|
358
|
+
*
|
|
359
|
+
* **When to use**
|
|
360
|
+
*
|
|
361
|
+
* Use to require TypeScript to reject incomplete matcher definitions before the
|
|
362
|
+
* matcher is turned into a function.
|
|
363
|
+
*
|
|
364
|
+
* **Details**
|
|
365
|
+
*
|
|
366
|
+
* If any case is still unmatched, the matcher does not type-check as
|
|
367
|
+
* exhaustive.
|
|
368
|
+
*
|
|
369
|
+
* **Example** (Ensuring all cases are covered)
|
|
370
|
+
*
|
|
371
|
+
* ```ts import.meta.vitest
|
|
372
|
+
* import { Match } from "effect"
|
|
373
|
+
*
|
|
374
|
+
* // Create a matcher for string or number values
|
|
375
|
+
* const match = Match.type<string | number>().pipe(
|
|
376
|
+
* // Match when the value is a number
|
|
377
|
+
* Match.when(Match.number, (n) => `number: ${n}`),
|
|
378
|
+
* // Mark the match as exhaustive, ensuring all cases are handled
|
|
379
|
+
* // TypeScript will throw an error if any case is missing
|
|
380
|
+
* // @ts-expect-error Type 'string' is not assignable to type 'never'
|
|
381
|
+
* Match.exhaustive
|
|
382
|
+
* )
|
|
383
|
+
* ```
|
|
384
|
+
*
|
|
385
|
+
* @stability stable
|
|
386
|
+
* @category completion
|
|
387
|
+
* @since 4.0.0
|
|
388
|
+
*/
|
|
389
|
+
const exhaustive = exhaustive$1;
|
|
390
|
+
// ../../node_modules/.pnpm/es-toolkit@1.53.2/node_modules/es-toolkit/dist/array/difference.mjs
|
|
391
|
+
/**
|
|
392
|
+
* Computes the difference between two arrays.
|
|
393
|
+
*
|
|
394
|
+
* This function takes two arrays and returns a new array containing the elements
|
|
395
|
+
* that are present in the first array but not in the second array. It effectively
|
|
396
|
+
* filters out any elements from the first array that also appear in the second array.
|
|
397
|
+
*
|
|
398
|
+
* @template T
|
|
399
|
+
* @param firstArr - The array from which to derive the difference. This is the primary array
|
|
400
|
+
* from which elements will be compared and filtered.
|
|
401
|
+
* @param secondArr - The array containing elements to be excluded from the first array.
|
|
402
|
+
* Each element in this array will be checked against the first array, and if a match is found,
|
|
403
|
+
* that element will be excluded from the result.
|
|
404
|
+
* @returns A new array containing the elements that are present in the first array but not
|
|
405
|
+
* in the second array.
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* const array1 = [1, 2, 3, 4, 5];
|
|
409
|
+
* const array2 = [2, 4];
|
|
410
|
+
* const result = difference(array1, array2);
|
|
411
|
+
* // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.
|
|
412
|
+
*/
|
|
413
|
+
function difference(firstArr, secondArr) {
|
|
414
|
+
const secondSet = new Set(secondArr);
|
|
415
|
+
return firstArr.filter((item) => !secondSet.has(item));
|
|
416
|
+
}
|
|
417
|
+
// ../../node_modules/.pnpm/es-toolkit@1.53.2/node_modules/es-toolkit/dist/array/uniq.mjs
|
|
418
|
+
/**
|
|
419
|
+
* Creates a duplicate-free version of an array.
|
|
420
|
+
*
|
|
421
|
+
* This function takes an array and returns a new array containing only the unique values
|
|
422
|
+
* from the original array, preserving the order of first occurrence.
|
|
423
|
+
*
|
|
424
|
+
* @template T - The type of elements in the array.
|
|
425
|
+
* @param arr - The array to process.
|
|
426
|
+
* @returns A new array with only unique values from the original array.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* const array = [1, 2, 2, 3, 4, 4, 5];
|
|
430
|
+
* const result = uniq(array);
|
|
431
|
+
* // result will be [1, 2, 3, 4, 5]
|
|
432
|
+
*/
|
|
433
|
+
function uniq(arr) {
|
|
434
|
+
return [...new Set(arr)];
|
|
435
|
+
}
|
|
436
|
+
// ../../node_modules/.pnpm/es-toolkit@1.53.2/node_modules/es-toolkit/dist/array/union.mjs
|
|
437
|
+
/**
|
|
438
|
+
* Creates an array of unique values from all given arrays.
|
|
439
|
+
*
|
|
440
|
+
* This function takes two arrays, merges them into a single array, and returns a new array
|
|
441
|
+
* containing only the unique values from the merged array.
|
|
442
|
+
*
|
|
443
|
+
* @template T - The type of elements in the array.
|
|
444
|
+
* @param arr1 - The first array to merge and filter for unique values.
|
|
445
|
+
* @param arr2 - The second array to merge and filter for unique values.
|
|
446
|
+
* @returns A new array of unique values.
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* const array1 = [1, 2, 3];
|
|
450
|
+
* const array2 = [3, 4, 5];
|
|
451
|
+
* const result = union(array1, array2);
|
|
452
|
+
* // result will be [1, 2, 3, 4, 5]
|
|
453
|
+
*/
|
|
454
|
+
function union(arr1, arr2) {
|
|
455
|
+
return uniq(arr1.concat(arr2));
|
|
456
|
+
}
|
|
457
|
+
// src/cli/commands/processes.ts
|
|
458
|
+
const DEFAULT_COLUMNS = 80;
|
|
459
|
+
const DEFAULT_ROWS = 24;
|
|
460
|
+
const MAX_EXIT_CODE = 255;
|
|
461
|
+
const exitCodeOf = (code) => Number.isInteger(code) && code >= 0 && code <= MAX_EXIT_CODE ? code : 1;
|
|
462
|
+
const cellsOf = (stdout, side, fallback) => getOrElse(filter(fromUndefinedOr(stdout[side]), (cells) => cells >= 1), () => fallback);
|
|
463
|
+
const sizeOf = (stdout) => ({
|
|
464
|
+
cols: cellsOf(stdout, "columns", DEFAULT_COLUMNS),
|
|
465
|
+
rows: cellsOf(stdout, "rows", DEFAULT_ROWS)
|
|
466
|
+
});
|
|
467
|
+
const terminalOf = (tool, streams) => ({
|
|
468
|
+
...sizeOf(tool.io.stdout),
|
|
469
|
+
...streams
|
|
470
|
+
});
|
|
471
|
+
const follow = async ({ attachment, forwards, terminal, tool }) => {
|
|
472
|
+
const { signal } = tool;
|
|
473
|
+
const { stdin, stdout } = tool.io;
|
|
474
|
+
const raw = terminal?.stdin === true && stdin.isTTY === true;
|
|
475
|
+
const following = new AbortController();
|
|
476
|
+
const resized = () => {
|
|
477
|
+
const { cols, rows } = sizeOf(stdout);
|
|
478
|
+
attachment.resize(cols, rows);
|
|
479
|
+
};
|
|
480
|
+
const forwardStdin = async () => {
|
|
481
|
+
await runPromiseExit(fromAsyncIterable(stdin, (cause) => cause).pipe(runForEach((chunk) => tryPromise(async () => {
|
|
482
|
+
await attachment.write(chunk);
|
|
483
|
+
}))));
|
|
484
|
+
attachment.endStdin();
|
|
485
|
+
};
|
|
486
|
+
signal.addEventListener("abort", () => {
|
|
487
|
+
attachment.sendSignal(getOrElse(stopSignalOf(signal), () => "SIGINT"));
|
|
488
|
+
}, { signal: following.signal });
|
|
489
|
+
if (terminal !== null) stdout.on("resize", resized);
|
|
490
|
+
if (raw) stdin.setRawMode(true);
|
|
491
|
+
if (forwards) forwardStdin();
|
|
492
|
+
else attachment.endStdin();
|
|
493
|
+
try {
|
|
494
|
+
const { code } = await attachment.exit;
|
|
495
|
+
return exitCodeOf(code);
|
|
496
|
+
} finally {
|
|
497
|
+
if (raw) stdin.setRawMode(false);
|
|
498
|
+
if (terminal !== null) stdout.off("resize", resized);
|
|
499
|
+
following.abort();
|
|
500
|
+
if (forwards) stdin.destroy();
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
const runAttached = async ({ forwards, id, request, tool }) => {
|
|
504
|
+
const started = await tool.client.sandboxes.startProcess(id, request, { signal: tool.signal });
|
|
505
|
+
const attachment = tool.client.sandboxes.attachProcess(id, started.id, {
|
|
506
|
+
signal: null,
|
|
507
|
+
stderr: (data) => {
|
|
508
|
+
tool.io.stderr.write(data);
|
|
509
|
+
},
|
|
510
|
+
stdout: (data) => {
|
|
511
|
+
tool.io.stdout.write(data);
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
return await follow({
|
|
515
|
+
attachment,
|
|
516
|
+
forwards,
|
|
517
|
+
tool,
|
|
518
|
+
terminal: request.terminal
|
|
519
|
+
});
|
|
520
|
+
};
|
|
521
|
+
/**
|
|
522
|
+
* @license
|
|
523
|
+
* Copyright 2020 Balena Ltd.
|
|
524
|
+
*
|
|
525
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
526
|
+
* you may not use this file except in compliance with the License.
|
|
527
|
+
* You may obtain a copy of the License at
|
|
528
|
+
*
|
|
529
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
530
|
+
*
|
|
531
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
532
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
533
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
534
|
+
* See the License for the specific language governing permissions and
|
|
535
|
+
* limitations under the License.
|
|
536
|
+
*
|
|
537
|
+
* ------------------------------------------------------------------------
|
|
538
|
+
*
|
|
539
|
+
* Copyright 2018 Zeit, Inc.
|
|
540
|
+
* Licensed under the MIT License. See file LICENSE.md for a full copy.
|
|
541
|
+
*
|
|
542
|
+
* ------------------------------------------------------------------------
|
|
543
|
+
*/
|
|
544
|
+
// ../../node_modules/.pnpm/tar@7.5.23/node_modules/tar/dist/esm/index.min.js
|
|
545
|
+
var import_ignore = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
546
|
+
/**
|
|
547
|
+
* This module implements the [dockerignore
|
|
548
|
+
* spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file),
|
|
549
|
+
* closely following Docker's (Moby) Golang implementation:
|
|
550
|
+
* https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go
|
|
551
|
+
* https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go
|
|
552
|
+
* https://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825
|
|
553
|
+
*
|
|
554
|
+
* Something the spec is not clear about, but we discovered by reading source code
|
|
555
|
+
* and testing against the "docker build" command, is the handling of backslashes and
|
|
556
|
+
* forward slashes as path separators and escape characters in the .dockerignore file
|
|
557
|
+
* across platforms including Windows, Linux and macOS:
|
|
558
|
+
*
|
|
559
|
+
* * On Linux and macOS, only forward slashes can be used as path separators in the
|
|
560
|
+
* .dockerignore file, and the backslash works as an escape character.
|
|
561
|
+
* * On Windows, both forward slashes and backslashes are allowed as path separators
|
|
562
|
+
* in the .dockerignore file, and the backslash is not used as an escape character.
|
|
563
|
+
*
|
|
564
|
+
* This is consistent with how Windows works generally: both forward slashes and
|
|
565
|
+
* backslashes are accepted as path separators by the cmd.exe Command Prompt or
|
|
566
|
+
* PowerShell, and by library functions like the Golang filepath.Clean or the
|
|
567
|
+
* Node.js path.normalize.
|
|
568
|
+
*
|
|
569
|
+
* Similarly, path strings provided to the IgnoreBase.ignores() and IgnoreBase.filter()
|
|
570
|
+
* methods can use either forward slashes or backslashes as path separators on Windows,
|
|
571
|
+
* but only forward slashes are accepted as path separators on Linux and macOS.
|
|
572
|
+
*/
|
|
573
|
+
const path = __require("path");
|
|
574
|
+
const factory = (options) => new IgnoreBase(options);
|
|
575
|
+
factory.default = factory;
|
|
576
|
+
module.exports = factory;
|
|
577
|
+
function make_array(subject) {
|
|
578
|
+
return Array.isArray(subject) ? subject : [subject];
|
|
579
|
+
}
|
|
580
|
+
const REGEX_TRAILING_PATH_SEP = path.sep === "\\" ? /(?<=.)\\$/ : /(?<=.)\/$/;
|
|
581
|
+
const KEY_IGNORE = typeof Symbol !== "undefined" ? Symbol.for("dockerignore") : "dockerignore";
|
|
582
|
+
function cleanPath(file) {
|
|
583
|
+
return path.normalize(file).replace(REGEX_TRAILING_PATH_SEP, "");
|
|
584
|
+
}
|
|
585
|
+
function toSlash(file) {
|
|
586
|
+
if (path.sep === "/") return file;
|
|
587
|
+
return file.replace(/\\/g, "/");
|
|
588
|
+
}
|
|
589
|
+
function fromSlash(file) {
|
|
590
|
+
if (path.sep === "/") return file;
|
|
591
|
+
return file.replace(/\//g, path.sep);
|
|
592
|
+
}
|
|
593
|
+
var IgnoreBase = class {
|
|
594
|
+
constructor({ ignorecase = true } = {}) {
|
|
595
|
+
this._rules = [];
|
|
596
|
+
this._ignorecase = ignorecase;
|
|
597
|
+
this[KEY_IGNORE] = true;
|
|
598
|
+
this._initCache();
|
|
599
|
+
}
|
|
600
|
+
_initCache() {
|
|
601
|
+
this._cache = {};
|
|
602
|
+
}
|
|
603
|
+
add(pattern) {
|
|
604
|
+
this._added = false;
|
|
605
|
+
if (typeof pattern === "string") pattern = pattern.split(/\r?\n/g);
|
|
606
|
+
make_array(pattern).forEach(this._addPattern, this);
|
|
607
|
+
if (this._added) this._initCache();
|
|
608
|
+
return this;
|
|
609
|
+
}
|
|
610
|
+
addPattern(pattern) {
|
|
611
|
+
return this.add(pattern);
|
|
612
|
+
}
|
|
613
|
+
_addPattern(pattern) {
|
|
614
|
+
if (pattern && pattern[KEY_IGNORE]) {
|
|
615
|
+
this._rules = this._rules.concat(pattern._rules);
|
|
616
|
+
this._added = true;
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
if (this._checkPattern(pattern)) {
|
|
620
|
+
const rule = this._createRule(pattern.trim());
|
|
621
|
+
if (rule !== null) {
|
|
622
|
+
this._added = true;
|
|
623
|
+
this._rules.push(rule);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
_checkPattern(pattern) {
|
|
628
|
+
return pattern && typeof pattern === "string" && pattern.indexOf("#") !== 0 && pattern.trim() !== "";
|
|
629
|
+
}
|
|
630
|
+
filter(paths) {
|
|
631
|
+
return make_array(paths).filter((path) => this._filter(path));
|
|
632
|
+
}
|
|
633
|
+
createFilter() {
|
|
634
|
+
return (path) => this._filter(path);
|
|
635
|
+
}
|
|
636
|
+
ignores(path) {
|
|
637
|
+
return !this._filter(path);
|
|
638
|
+
}
|
|
639
|
+
_createRule(pattern) {
|
|
640
|
+
const origin = pattern;
|
|
641
|
+
let negative = false;
|
|
642
|
+
if (pattern[0] === "!") {
|
|
643
|
+
negative = true;
|
|
644
|
+
pattern = pattern.substring(1).trim();
|
|
645
|
+
}
|
|
646
|
+
if (pattern.length > 0) {
|
|
647
|
+
pattern = cleanPath(pattern);
|
|
648
|
+
pattern = toSlash(pattern);
|
|
649
|
+
if (pattern.length > 1 && pattern[0] === "/") pattern = pattern.slice(1);
|
|
650
|
+
}
|
|
651
|
+
if (negative) pattern = "!" + pattern;
|
|
652
|
+
pattern = pattern.trim();
|
|
653
|
+
if (pattern === "") return null;
|
|
654
|
+
pattern = cleanPath(pattern);
|
|
655
|
+
if (pattern[0] === "!") {
|
|
656
|
+
if (pattern.length === 1) return null;
|
|
657
|
+
negative = true;
|
|
658
|
+
pattern = pattern.substring(1);
|
|
659
|
+
} else negative = false;
|
|
660
|
+
return {
|
|
661
|
+
origin,
|
|
662
|
+
pattern,
|
|
663
|
+
dirs: pattern.split(path.sep),
|
|
664
|
+
negative
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
_filter(path) {
|
|
668
|
+
if (!path) return false;
|
|
669
|
+
if (path in this._cache) return this._cache[path];
|
|
670
|
+
return this._cache[path] = this._test(path);
|
|
671
|
+
}
|
|
672
|
+
_test(file) {
|
|
673
|
+
file = fromSlash(file);
|
|
674
|
+
const parentPath = cleanPath(path.dirname(file));
|
|
675
|
+
const parentPathDirs = parentPath.split(path.sep);
|
|
676
|
+
let matched = false;
|
|
677
|
+
this._rules.forEach((rule) => {
|
|
678
|
+
let match = this._match(file, rule);
|
|
679
|
+
if (!match && parentPath !== ".") {
|
|
680
|
+
if (rule.dirs.includes("**")) for (let i = rule.dirs.filter((x) => x !== "**").length; i <= parentPathDirs.length; i++) match = match || this._match(parentPathDirs.slice(0, i).join(path.sep), rule);
|
|
681
|
+
else if (rule.dirs.length <= parentPathDirs.length) match = this._match(parentPathDirs.slice(0, rule.dirs.length).join(path.sep), rule);
|
|
682
|
+
}
|
|
683
|
+
if (match) matched = !rule.negative;
|
|
684
|
+
});
|
|
685
|
+
return !matched;
|
|
686
|
+
}
|
|
687
|
+
_match(file, rule) {
|
|
688
|
+
return this._compile(rule).regexp.test(file);
|
|
689
|
+
}
|
|
690
|
+
_compile(rule) {
|
|
691
|
+
if (rule.regexp) return rule;
|
|
692
|
+
let regStr = "^";
|
|
693
|
+
let escapedSlash = path.sep === "\\" ? "\\\\" : path.sep;
|
|
694
|
+
for (let i = 0; i < rule.pattern.length; i++) {
|
|
695
|
+
const ch = rule.pattern[i];
|
|
696
|
+
if (ch === "*") {
|
|
697
|
+
if (rule.pattern[i + 1] === "*") {
|
|
698
|
+
i++;
|
|
699
|
+
if (rule.pattern[i + 1] === path.sep) i++;
|
|
700
|
+
if (rule.pattern[i + 1] === void 0) regStr += ".*";
|
|
701
|
+
else regStr += `(.*${escapedSlash})?`;
|
|
702
|
+
} else regStr += `[^${escapedSlash}]*`;
|
|
703
|
+
} else if (ch === "?") regStr += `[^${escapedSlash}]`;
|
|
704
|
+
else if (ch === "." || ch === "$") regStr += `\\${ch}`;
|
|
705
|
+
else if (ch === "\\") {
|
|
706
|
+
if (path.sep === "\\") {
|
|
707
|
+
regStr += escapedSlash;
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
if (rule.pattern[i + 1] !== void 0) {
|
|
711
|
+
regStr += "\\" + rule.pattern[i + 1];
|
|
712
|
+
i++;
|
|
713
|
+
} else regStr += "\\";
|
|
714
|
+
} else regStr += ch;
|
|
715
|
+
}
|
|
716
|
+
regStr += "$";
|
|
717
|
+
rule.regexp = new RegExp(regStr, this._ignorecase ? "i" : "");
|
|
718
|
+
return rule;
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
})))(), 1);
|
|
722
|
+
var zr = Object.defineProperty;
|
|
723
|
+
var Ur = (s, t) => {
|
|
724
|
+
for (var e in t) zr(s, e, {
|
|
725
|
+
get: t[e],
|
|
726
|
+
enumerable: !0
|
|
727
|
+
});
|
|
728
|
+
};
|
|
729
|
+
var Ds = typeof process == "object" && process ? process : {
|
|
730
|
+
stdout: null,
|
|
731
|
+
stderr: null
|
|
732
|
+
};
|
|
733
|
+
var Wr = (s) => !!s && typeof s == "object" && (s instanceof A || s instanceof Cs || Gr(s) || Zr(s));
|
|
734
|
+
var Gr = (s) => !!s && typeof s == "object" && s instanceof EventEmitter$1 && typeof s.pipe == "function" && s.pipe !== Cs.Writable.prototype.pipe;
|
|
735
|
+
var Zr = (s) => !!s && typeof s == "object" && s instanceof EventEmitter$1 && typeof s.write == "function" && typeof s.end == "function";
|
|
736
|
+
var Q = Symbol("EOF");
|
|
737
|
+
var J = Symbol("maybeEmitEnd");
|
|
738
|
+
var nt = Symbol("emittedEnd");
|
|
739
|
+
var De = Symbol("emittingEnd");
|
|
740
|
+
var qt = Symbol("emittedError");
|
|
741
|
+
var Ne = Symbol("closed");
|
|
742
|
+
var Ns = Symbol("read");
|
|
743
|
+
var Ae = Symbol("flush");
|
|
744
|
+
var As = Symbol("flushChunk");
|
|
745
|
+
var z = Symbol("encoding");
|
|
746
|
+
var Mt = Symbol("decoder");
|
|
747
|
+
var g = Symbol("flowing");
|
|
748
|
+
var Qt = Symbol("paused");
|
|
749
|
+
var Bt = Symbol("resume");
|
|
750
|
+
var b = Symbol("buffer");
|
|
751
|
+
var N = Symbol("pipes");
|
|
752
|
+
var _ = Symbol("bufferLength");
|
|
753
|
+
var bi = Symbol("bufferPush");
|
|
754
|
+
var Ie = Symbol("bufferShift");
|
|
755
|
+
var L = Symbol("objectMode");
|
|
756
|
+
var S = Symbol("destroyed");
|
|
757
|
+
var _i = Symbol("error");
|
|
758
|
+
var Oi = Symbol("emitData");
|
|
759
|
+
var Is = Symbol("emitEnd");
|
|
760
|
+
var Ti = Symbol("emitEnd2");
|
|
761
|
+
var Z = Symbol("async");
|
|
762
|
+
var xi = Symbol("abort");
|
|
763
|
+
var Ce = Symbol("aborted");
|
|
764
|
+
var Jt = Symbol("signal");
|
|
765
|
+
var Rt = Symbol("dataListeners");
|
|
766
|
+
var C = Symbol("discarded");
|
|
767
|
+
var jt = (s) => Promise.resolve().then(s);
|
|
768
|
+
var Yr = (s) => s();
|
|
769
|
+
var Kr = (s) => s === "end" || s === "finish" || s === "prefinish";
|
|
770
|
+
var Vr = (s) => s instanceof ArrayBuffer || !!s && typeof s == "object" && s.constructor && s.constructor.name === "ArrayBuffer" && s.byteLength >= 0;
|
|
771
|
+
var $r = (s) => !Buffer.isBuffer(s) && ArrayBuffer.isView(s);
|
|
772
|
+
var Fe = class {
|
|
773
|
+
src;
|
|
774
|
+
dest;
|
|
775
|
+
opts;
|
|
776
|
+
ondrain;
|
|
777
|
+
constructor(t, e, i) {
|
|
778
|
+
this.src = t, this.dest = e, this.opts = i, this.ondrain = () => t[Bt](), this.dest.on("drain", this.ondrain);
|
|
779
|
+
}
|
|
780
|
+
unpipe() {
|
|
781
|
+
this.dest.removeListener("drain", this.ondrain);
|
|
782
|
+
}
|
|
783
|
+
proxyErrors(t) {}
|
|
784
|
+
end() {
|
|
785
|
+
this.unpipe(), this.opts.end && this.dest.end();
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
var Li = class extends Fe {
|
|
789
|
+
unpipe() {
|
|
790
|
+
this.src.removeListener("error", this.proxyErrors), super.unpipe();
|
|
791
|
+
}
|
|
792
|
+
constructor(t, e, i) {
|
|
793
|
+
super(t, e, i), this.proxyErrors = (r) => this.dest.emit("error", r), t.on("error", this.proxyErrors);
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
var Xr = (s) => !!s.objectMode;
|
|
797
|
+
var qr = (s) => !s.objectMode && !!s.encoding && s.encoding !== "buffer";
|
|
798
|
+
var A = class extends EventEmitter$1 {
|
|
799
|
+
[g] = !1;
|
|
800
|
+
[Qt] = !1;
|
|
801
|
+
[N] = [];
|
|
802
|
+
[b] = [];
|
|
803
|
+
[L];
|
|
804
|
+
[z];
|
|
805
|
+
[Z];
|
|
806
|
+
[Mt];
|
|
807
|
+
[Q] = !1;
|
|
808
|
+
[nt] = !1;
|
|
809
|
+
[De] = !1;
|
|
810
|
+
[Ne] = !1;
|
|
811
|
+
[qt] = null;
|
|
812
|
+
[_] = 0;
|
|
813
|
+
[S] = !1;
|
|
814
|
+
[Jt];
|
|
815
|
+
[Ce] = !1;
|
|
816
|
+
[Rt] = 0;
|
|
817
|
+
[C] = !1;
|
|
818
|
+
writable = !0;
|
|
819
|
+
readable = !0;
|
|
820
|
+
constructor(...t) {
|
|
821
|
+
let e = t[0] || {};
|
|
822
|
+
if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
|
|
823
|
+
Xr(e) ? (this[L] = !0, this[z] = null) : qr(e) ? (this[z] = e.encoding, this[L] = !1) : (this[L] = !1, this[z] = null), this[Z] = !!e.async, this[Mt] = this[z] ? new StringDecoder(this[z]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[b] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[N] });
|
|
824
|
+
let { signal: i } = e;
|
|
825
|
+
i && (this[Jt] = i, i.aborted ? this[xi]() : i.addEventListener("abort", () => this[xi]()));
|
|
826
|
+
}
|
|
827
|
+
get bufferLength() {
|
|
828
|
+
return this[_];
|
|
829
|
+
}
|
|
830
|
+
get encoding() {
|
|
831
|
+
return this[z];
|
|
832
|
+
}
|
|
833
|
+
set encoding(t) {
|
|
834
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
835
|
+
}
|
|
836
|
+
setEncoding(t) {
|
|
837
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
838
|
+
}
|
|
839
|
+
get objectMode() {
|
|
840
|
+
return this[L];
|
|
841
|
+
}
|
|
842
|
+
set objectMode(t) {
|
|
843
|
+
throw new Error("objectMode must be set at instantiation time");
|
|
844
|
+
}
|
|
845
|
+
get async() {
|
|
846
|
+
return this[Z];
|
|
847
|
+
}
|
|
848
|
+
set async(t) {
|
|
849
|
+
this[Z] = this[Z] || !!t;
|
|
850
|
+
}
|
|
851
|
+
[xi]() {
|
|
852
|
+
this[Ce] = !0, this.emit("abort", this[Jt]?.reason), this.destroy(this[Jt]?.reason);
|
|
853
|
+
}
|
|
854
|
+
get aborted() {
|
|
855
|
+
return this[Ce];
|
|
856
|
+
}
|
|
857
|
+
set aborted(t) {}
|
|
858
|
+
write(t, e, i) {
|
|
859
|
+
if (this[Ce]) return !1;
|
|
860
|
+
if (this[Q]) throw new Error("write after end");
|
|
861
|
+
if (this[S]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
|
|
862
|
+
typeof e == "function" && (i = e, e = "utf8"), e || (e = "utf8");
|
|
863
|
+
let r = this[Z] ? jt : Yr;
|
|
864
|
+
if (!this[L] && !Buffer.isBuffer(t)) {
|
|
865
|
+
if ($r(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
|
|
866
|
+
else if (Vr(t)) t = Buffer.from(t);
|
|
867
|
+
else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
868
|
+
}
|
|
869
|
+
return this[L] ? (this[g] && this[_] !== 0 && this[Ae](!0), this[g] ? this.emit("data", t) : this[bi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : t.length ? (typeof t == "string" && (e !== this[z] || this[Mt]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[z] && (t = this[Mt].write(t)), this[g] && this[_] !== 0 && this[Ae](!0), this[g] ? this.emit("data", t) : this[bi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : (this[_] !== 0 && this.emit("readable"), i && r(i), this[g]);
|
|
870
|
+
}
|
|
871
|
+
read(t) {
|
|
872
|
+
if (this[S]) return null;
|
|
873
|
+
if (this[C] = !1, this[_] === 0 || t === 0 || t && t > this[_]) return this[J](), null;
|
|
874
|
+
this[L] && (t = null), this[b].length > 1 && !this[L] && (this[b] = [this[z] ? this[b].join("") : Buffer.concat(this[b], this[_])]);
|
|
875
|
+
let e = this[Ns](t || null, this[b][0]);
|
|
876
|
+
return this[J](), e;
|
|
877
|
+
}
|
|
878
|
+
[Ns](t, e) {
|
|
879
|
+
if (this[L]) this[Ie]();
|
|
880
|
+
else {
|
|
881
|
+
let i = e;
|
|
882
|
+
t === i.length || t === null ? this[Ie]() : typeof i == "string" ? (this[b][0] = i.slice(t), e = i.slice(0, t), this[_] -= t) : (this[b][0] = i.subarray(t), e = i.subarray(0, t), this[_] -= t);
|
|
883
|
+
}
|
|
884
|
+
return this.emit("data", e), !this[b].length && !this[Q] && this.emit("drain"), e;
|
|
885
|
+
}
|
|
886
|
+
end(t, e, i) {
|
|
887
|
+
return typeof t == "function" && (i = t, t = void 0), typeof e == "function" && (i = e, e = "utf8"), t !== void 0 && this.write(t, e), i && this.once("end", i), this[Q] = !0, this.writable = !1, (this[g] || !this[Qt]) && this[J](), this;
|
|
888
|
+
}
|
|
889
|
+
[Bt]() {
|
|
890
|
+
this[S] || (!this[Rt] && !this[N].length && (this[C] = !0), this[Qt] = !1, this[g] = !0, this.emit("resume"), this[b].length ? this[Ae]() : this[Q] ? this[J]() : this.emit("drain"));
|
|
891
|
+
}
|
|
892
|
+
resume() {
|
|
893
|
+
return this[Bt]();
|
|
894
|
+
}
|
|
895
|
+
pause() {
|
|
896
|
+
this[g] = !1, this[Qt] = !0, this[C] = !1;
|
|
897
|
+
}
|
|
898
|
+
get destroyed() {
|
|
899
|
+
return this[S];
|
|
900
|
+
}
|
|
901
|
+
get flowing() {
|
|
902
|
+
return this[g];
|
|
903
|
+
}
|
|
904
|
+
get paused() {
|
|
905
|
+
return this[Qt];
|
|
906
|
+
}
|
|
907
|
+
[bi](t) {
|
|
908
|
+
this[L] ? this[_] += 1 : this[_] += t.length, this[b].push(t);
|
|
909
|
+
}
|
|
910
|
+
[Ie]() {
|
|
911
|
+
return this[L] ? this[_] -= 1 : this[_] -= this[b][0].length, this[b].shift();
|
|
912
|
+
}
|
|
913
|
+
[Ae](t = !1) {
|
|
914
|
+
do;
|
|
915
|
+
while (this[As](this[Ie]()) && this[b].length);
|
|
916
|
+
!t && !this[b].length && !this[Q] && this.emit("drain");
|
|
917
|
+
}
|
|
918
|
+
[As](t) {
|
|
919
|
+
return this.emit("data", t), this[g];
|
|
920
|
+
}
|
|
921
|
+
pipe(t, e) {
|
|
922
|
+
if (this[S]) return t;
|
|
923
|
+
this[C] = !1;
|
|
924
|
+
let i = this[nt];
|
|
925
|
+
return e = e || {}, t === Ds.stdout || t === Ds.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, i ? e.end && t.end() : (this[N].push(e.proxyErrors ? new Li(this, t, e) : new Fe(this, t, e)), this[Z] ? jt(() => this[Bt]()) : this[Bt]()), t;
|
|
926
|
+
}
|
|
927
|
+
unpipe(t) {
|
|
928
|
+
let e = this[N].find((i) => i.dest === t);
|
|
929
|
+
e && (this[N].length === 1 ? (this[g] && this[Rt] === 0 && (this[g] = !1), this[N] = []) : this[N].splice(this[N].indexOf(e), 1), e.unpipe());
|
|
930
|
+
}
|
|
931
|
+
addListener(t, e) {
|
|
932
|
+
return this.on(t, e);
|
|
933
|
+
}
|
|
934
|
+
on(t, e) {
|
|
935
|
+
let i = super.on(t, e);
|
|
936
|
+
if (t === "data") this[C] = !1, this[Rt]++, !this[N].length && !this[g] && this[Bt]();
|
|
937
|
+
else if (t === "readable" && this[_] !== 0) super.emit("readable");
|
|
938
|
+
else if (Kr(t) && this[nt]) super.emit(t), this.removeAllListeners(t);
|
|
939
|
+
else if (t === "error" && this[qt]) {
|
|
940
|
+
let r = e;
|
|
941
|
+
this[Z] ? jt(() => r.call(this, this[qt])) : r.call(this, this[qt]);
|
|
942
|
+
}
|
|
943
|
+
return i;
|
|
944
|
+
}
|
|
945
|
+
removeListener(t, e) {
|
|
946
|
+
return this.off(t, e);
|
|
947
|
+
}
|
|
948
|
+
off(t, e) {
|
|
949
|
+
let i = super.off(t, e);
|
|
950
|
+
return t === "data" && (this[Rt] = this.listeners("data").length, this[Rt] === 0 && !this[C] && !this[N].length && (this[g] = !1)), i;
|
|
951
|
+
}
|
|
952
|
+
removeAllListeners(t) {
|
|
953
|
+
let e = super.removeAllListeners(t);
|
|
954
|
+
return (t === "data" || t === void 0) && (this[Rt] = 0, !this[C] && !this[N].length && (this[g] = !1)), e;
|
|
955
|
+
}
|
|
956
|
+
get emittedEnd() {
|
|
957
|
+
return this[nt];
|
|
958
|
+
}
|
|
959
|
+
[J]() {
|
|
960
|
+
!this[De] && !this[nt] && !this[S] && this[b].length === 0 && this[Q] && (this[De] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Ne] && this.emit("close"), this[De] = !1);
|
|
961
|
+
}
|
|
962
|
+
emit(t, ...e) {
|
|
963
|
+
let i = e[0];
|
|
964
|
+
if (t !== "error" && t !== "close" && t !== S && this[S]) return !1;
|
|
965
|
+
if (t === "data") return !this[L] && !i ? !1 : this[Z] ? (jt(() => this[Oi](i)), !0) : this[Oi](i);
|
|
966
|
+
if (t === "end") return this[Is]();
|
|
967
|
+
if (t === "close") {
|
|
968
|
+
if (this[Ne] = !0, !this[nt] && !this[S]) return !1;
|
|
969
|
+
let n = super.emit("close");
|
|
970
|
+
return this.removeAllListeners("close"), n;
|
|
971
|
+
} else if (t === "error") {
|
|
972
|
+
this[qt] = i, super.emit(_i, i);
|
|
973
|
+
let n = !this[Jt] || this.listeners("error").length ? super.emit("error", i) : !1;
|
|
974
|
+
return this[J](), n;
|
|
975
|
+
} else if (t === "resume") {
|
|
976
|
+
let n = super.emit("resume");
|
|
977
|
+
return this[J](), n;
|
|
978
|
+
} else if (t === "finish" || t === "prefinish") {
|
|
979
|
+
let n = super.emit(t);
|
|
980
|
+
return this.removeAllListeners(t), n;
|
|
981
|
+
}
|
|
982
|
+
let r = super.emit(t, ...e);
|
|
983
|
+
return this[J](), r;
|
|
984
|
+
}
|
|
985
|
+
[Oi](t) {
|
|
986
|
+
for (let i of this[N]) i.dest.write(t) === !1 && this.pause();
|
|
987
|
+
let e = this[C] ? !1 : super.emit("data", t);
|
|
988
|
+
return this[J](), e;
|
|
989
|
+
}
|
|
990
|
+
[Is]() {
|
|
991
|
+
return this[nt] ? !1 : (this[nt] = !0, this.readable = !1, this[Z] ? (jt(() => this[Ti]()), !0) : this[Ti]());
|
|
992
|
+
}
|
|
993
|
+
[Ti]() {
|
|
994
|
+
if (this[Mt]) {
|
|
995
|
+
let e = this[Mt].end();
|
|
996
|
+
if (e) {
|
|
997
|
+
for (let i of this[N]) i.dest.write(e);
|
|
998
|
+
this[C] || super.emit("data", e);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
for (let e of this[N]) e.end();
|
|
1002
|
+
let t = super.emit("end");
|
|
1003
|
+
return this.removeAllListeners("end"), t;
|
|
1004
|
+
}
|
|
1005
|
+
async collect() {
|
|
1006
|
+
let t = Object.assign([], { dataLength: 0 });
|
|
1007
|
+
this[L] || (t.dataLength = 0);
|
|
1008
|
+
let e = this.promise();
|
|
1009
|
+
return this.on("data", (i) => {
|
|
1010
|
+
t.push(i), this[L] || (t.dataLength += i.length);
|
|
1011
|
+
}), await e, t;
|
|
1012
|
+
}
|
|
1013
|
+
async concat() {
|
|
1014
|
+
if (this[L]) throw new Error("cannot concat in objectMode");
|
|
1015
|
+
let t = await this.collect();
|
|
1016
|
+
return this[z] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
1017
|
+
}
|
|
1018
|
+
async promise() {
|
|
1019
|
+
return new Promise((t, e) => {
|
|
1020
|
+
this.on(S, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (i) => e(i)), this.on("end", () => t());
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
[Symbol.asyncIterator]() {
|
|
1024
|
+
this[C] = !1;
|
|
1025
|
+
let t = !1, e = async () => (this.pause(), t = !0, {
|
|
1026
|
+
value: void 0,
|
|
1027
|
+
done: !0
|
|
1028
|
+
});
|
|
1029
|
+
return {
|
|
1030
|
+
next: () => {
|
|
1031
|
+
if (t) return e();
|
|
1032
|
+
let r = this.read();
|
|
1033
|
+
if (r !== null) return Promise.resolve({
|
|
1034
|
+
done: !1,
|
|
1035
|
+
value: r
|
|
1036
|
+
});
|
|
1037
|
+
if (this[Q]) return e();
|
|
1038
|
+
let n, o, h = (d) => {
|
|
1039
|
+
this.off("data", a), this.off("end", l), this.off(S, c), e(), o(d);
|
|
1040
|
+
}, a = (d) => {
|
|
1041
|
+
this.off("error", h), this.off("end", l), this.off(S, c), this.pause(), n({
|
|
1042
|
+
value: d,
|
|
1043
|
+
done: !!this[Q]
|
|
1044
|
+
});
|
|
1045
|
+
}, l = () => {
|
|
1046
|
+
this.off("error", h), this.off("data", a), this.off(S, c), e(), n({
|
|
1047
|
+
done: !0,
|
|
1048
|
+
value: void 0
|
|
1049
|
+
});
|
|
1050
|
+
}, c = () => h(/* @__PURE__ */ new Error("stream destroyed"));
|
|
1051
|
+
return new Promise((d, y) => {
|
|
1052
|
+
o = y, n = d, this.once(S, c), this.once("error", h), this.once("end", l), this.once("data", a);
|
|
1053
|
+
});
|
|
1054
|
+
},
|
|
1055
|
+
throw: e,
|
|
1056
|
+
return: e,
|
|
1057
|
+
[Symbol.asyncIterator]() {
|
|
1058
|
+
return this;
|
|
1059
|
+
},
|
|
1060
|
+
[Symbol.asyncDispose]: async () => {}
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
[Symbol.iterator]() {
|
|
1064
|
+
this[C] = !1;
|
|
1065
|
+
let t = !1, e = () => (this.pause(), this.off(_i, e), this.off(S, e), this.off("end", e), t = !0, {
|
|
1066
|
+
done: !0,
|
|
1067
|
+
value: void 0
|
|
1068
|
+
}), i = () => {
|
|
1069
|
+
if (t) return e();
|
|
1070
|
+
let r = this.read();
|
|
1071
|
+
return r === null ? e() : {
|
|
1072
|
+
done: !1,
|
|
1073
|
+
value: r
|
|
1074
|
+
};
|
|
1075
|
+
};
|
|
1076
|
+
return this.once("end", e), this.once(_i, e), this.once(S, e), {
|
|
1077
|
+
next: i,
|
|
1078
|
+
throw: e,
|
|
1079
|
+
return: e,
|
|
1080
|
+
[Symbol.iterator]() {
|
|
1081
|
+
return this;
|
|
1082
|
+
},
|
|
1083
|
+
[Symbol.dispose]: () => {}
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
destroy(t) {
|
|
1087
|
+
if (this[S]) return t ? this.emit("error", t) : this.emit(S), this;
|
|
1088
|
+
this[S] = !0, this[C] = !0, this[b].length = 0, this[_] = 0;
|
|
1089
|
+
let e = this;
|
|
1090
|
+
return typeof e.close == "function" && !this[Ne] && e.close(), t ? this.emit("error", t) : this.emit(S), this;
|
|
1091
|
+
}
|
|
1092
|
+
static get isStream() {
|
|
1093
|
+
return Wr;
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
var Jr = I.writev;
|
|
1097
|
+
var ht = Symbol("_autoClose");
|
|
1098
|
+
var H = Symbol("_close");
|
|
1099
|
+
var te = Symbol("_ended");
|
|
1100
|
+
var m = Symbol("_fd");
|
|
1101
|
+
var Ni = Symbol("_finished");
|
|
1102
|
+
var tt = Symbol("_flags");
|
|
1103
|
+
var Ai = Symbol("_flush");
|
|
1104
|
+
var ki = Symbol("_handleChunk");
|
|
1105
|
+
var vi = Symbol("_makeBuf");
|
|
1106
|
+
var ie = Symbol("_mode");
|
|
1107
|
+
var ke = Symbol("_needDrain");
|
|
1108
|
+
var Ut = Symbol("_onerror");
|
|
1109
|
+
var Ht = Symbol("_onopen");
|
|
1110
|
+
var Ii = Symbol("_onread");
|
|
1111
|
+
var Pt = Symbol("_onwrite");
|
|
1112
|
+
var at = Symbol("_open");
|
|
1113
|
+
var U = Symbol("_path");
|
|
1114
|
+
var ot = Symbol("_pos");
|
|
1115
|
+
var Y = Symbol("_queue");
|
|
1116
|
+
var zt = Symbol("_read");
|
|
1117
|
+
var Ci = Symbol("_readSize");
|
|
1118
|
+
var j = Symbol("_reading");
|
|
1119
|
+
var ee = Symbol("_remain");
|
|
1120
|
+
var Fi = Symbol("_size");
|
|
1121
|
+
var ve = Symbol("_write");
|
|
1122
|
+
var gt = Symbol("_writing");
|
|
1123
|
+
var Me = Symbol("_defaultFlag");
|
|
1124
|
+
var bt = Symbol("_errored");
|
|
1125
|
+
var _t = class extends A {
|
|
1126
|
+
[bt] = !1;
|
|
1127
|
+
[m];
|
|
1128
|
+
[U];
|
|
1129
|
+
[Ci];
|
|
1130
|
+
[j] = !1;
|
|
1131
|
+
[Fi];
|
|
1132
|
+
[ee];
|
|
1133
|
+
[ht];
|
|
1134
|
+
constructor(t, e) {
|
|
1135
|
+
if (e = e || {}, super(e), this.readable = !0, this.writable = !1, typeof t != "string") throw new TypeError("path must be a string");
|
|
1136
|
+
this[bt] = !1, this[m] = typeof e.fd == "number" ? e.fd : void 0, this[U] = t, this[Ci] = e.readSize || 16777216, this[j] = !1, this[Fi] = typeof e.size == "number" ? e.size : 1 / 0, this[ee] = this[Fi], this[ht] = typeof e.autoClose == "boolean" ? e.autoClose : !0, typeof this[m] == "number" ? this[zt]() : this[at]();
|
|
1137
|
+
}
|
|
1138
|
+
get fd() {
|
|
1139
|
+
return this[m];
|
|
1140
|
+
}
|
|
1141
|
+
get path() {
|
|
1142
|
+
return this[U];
|
|
1143
|
+
}
|
|
1144
|
+
write() {
|
|
1145
|
+
throw new TypeError("this is a readable stream");
|
|
1146
|
+
}
|
|
1147
|
+
end() {
|
|
1148
|
+
throw new TypeError("this is a readable stream");
|
|
1149
|
+
}
|
|
1150
|
+
[at]() {
|
|
1151
|
+
I.open(this[U], "r", (t, e) => this[Ht](t, e));
|
|
1152
|
+
}
|
|
1153
|
+
[Ht](t, e) {
|
|
1154
|
+
t ? this[Ut](t) : (this[m] = e, this.emit("open", e), this[zt]());
|
|
1155
|
+
}
|
|
1156
|
+
[vi]() {
|
|
1157
|
+
return Buffer.allocUnsafe(Math.min(this[Ci], this[ee]));
|
|
1158
|
+
}
|
|
1159
|
+
[zt]() {
|
|
1160
|
+
if (!this[j]) {
|
|
1161
|
+
this[j] = !0;
|
|
1162
|
+
let t = this[vi]();
|
|
1163
|
+
if (t.length === 0) return process.nextTick(() => this[Ii](null, 0, t));
|
|
1164
|
+
I.read(this[m], t, 0, t.length, null, (e, i, r) => this[Ii](e, i, r));
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
[Ii](t, e, i) {
|
|
1168
|
+
this[j] = !1, t ? this[Ut](t) : this[ki](e, i) && this[zt]();
|
|
1169
|
+
}
|
|
1170
|
+
[H]() {
|
|
1171
|
+
if (this[ht] && typeof this[m] == "number") {
|
|
1172
|
+
let t = this[m];
|
|
1173
|
+
this[m] = void 0, I.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
[Ut](t) {
|
|
1177
|
+
this[j] = !0, this[H](), this.emit("error", t);
|
|
1178
|
+
}
|
|
1179
|
+
[ki](t, e) {
|
|
1180
|
+
let i = !1;
|
|
1181
|
+
return this[ee] -= t, t > 0 && (i = super.write(t < e.length ? e.subarray(0, t) : e)), (t === 0 || this[ee] <= 0) && (i = !1, this[H](), super.end()), i;
|
|
1182
|
+
}
|
|
1183
|
+
emit(t, ...e) {
|
|
1184
|
+
switch (t) {
|
|
1185
|
+
case "prefinish":
|
|
1186
|
+
case "finish": return !1;
|
|
1187
|
+
case "drain": return typeof this[m] == "number" && this[zt](), !1;
|
|
1188
|
+
case "error": return this[bt] ? !1 : (this[bt] = !0, super.emit(t, ...e));
|
|
1189
|
+
default: return super.emit(t, ...e);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
var Be = class extends _t {
|
|
1194
|
+
[at]() {
|
|
1195
|
+
let t = !0;
|
|
1196
|
+
try {
|
|
1197
|
+
this[Ht](null, I.openSync(this[U], "r")), t = !1;
|
|
1198
|
+
} finally {
|
|
1199
|
+
t && this[H]();
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
[zt]() {
|
|
1203
|
+
let t = !0;
|
|
1204
|
+
try {
|
|
1205
|
+
if (!this[j]) {
|
|
1206
|
+
this[j] = !0;
|
|
1207
|
+
do {
|
|
1208
|
+
let e = this[vi](), i = e.length === 0 ? 0 : I.readSync(this[m], e, 0, e.length, null);
|
|
1209
|
+
if (!this[ki](i, e)) break;
|
|
1210
|
+
} while (!0);
|
|
1211
|
+
this[j] = !1;
|
|
1212
|
+
}
|
|
1213
|
+
t = !1;
|
|
1214
|
+
} finally {
|
|
1215
|
+
t && this[H]();
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
[H]() {
|
|
1219
|
+
if (this[ht] && typeof this[m] == "number") {
|
|
1220
|
+
let t = this[m];
|
|
1221
|
+
this[m] = void 0, I.closeSync(t), this.emit("close");
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
var et = class extends Qr {
|
|
1226
|
+
readable = !1;
|
|
1227
|
+
writable = !0;
|
|
1228
|
+
[bt] = !1;
|
|
1229
|
+
[gt] = !1;
|
|
1230
|
+
[te] = !1;
|
|
1231
|
+
[Y] = [];
|
|
1232
|
+
[ke] = !1;
|
|
1233
|
+
[U];
|
|
1234
|
+
[ie];
|
|
1235
|
+
[ht];
|
|
1236
|
+
[m];
|
|
1237
|
+
[Me];
|
|
1238
|
+
[tt];
|
|
1239
|
+
[Ni] = !1;
|
|
1240
|
+
[ot];
|
|
1241
|
+
constructor(t, e) {
|
|
1242
|
+
e = e || {}, super(e), this[U] = t, this[m] = typeof e.fd == "number" ? e.fd : void 0, this[ie] = e.mode === void 0 ? 438 : e.mode, this[ot] = typeof e.start == "number" ? e.start : void 0, this[ht] = typeof e.autoClose == "boolean" ? e.autoClose : !0;
|
|
1243
|
+
let i = this[ot] !== void 0 ? "r+" : "w";
|
|
1244
|
+
this[Me] = e.flags === void 0, this[tt] = e.flags === void 0 ? i : e.flags, this[m] === void 0 && this[at]();
|
|
1245
|
+
}
|
|
1246
|
+
emit(t, ...e) {
|
|
1247
|
+
if (t === "error") {
|
|
1248
|
+
if (this[bt]) return !1;
|
|
1249
|
+
this[bt] = !0;
|
|
1250
|
+
}
|
|
1251
|
+
return super.emit(t, ...e);
|
|
1252
|
+
}
|
|
1253
|
+
get fd() {
|
|
1254
|
+
return this[m];
|
|
1255
|
+
}
|
|
1256
|
+
get path() {
|
|
1257
|
+
return this[U];
|
|
1258
|
+
}
|
|
1259
|
+
[Ut](t) {
|
|
1260
|
+
this[H](), this[gt] = !0, this.emit("error", t);
|
|
1261
|
+
}
|
|
1262
|
+
[at]() {
|
|
1263
|
+
I.open(this[U], this[tt], this[ie], (t, e) => this[Ht](t, e));
|
|
1264
|
+
}
|
|
1265
|
+
[Ht](t, e) {
|
|
1266
|
+
this[Me] && this[tt] === "r+" && t && t.code === "ENOENT" ? (this[tt] = "w", this[at]()) : t ? this[Ut](t) : (this[m] = e, this.emit("open", e), this[gt] || this[Ai]());
|
|
1267
|
+
}
|
|
1268
|
+
end(t, e) {
|
|
1269
|
+
return t && this.write(t, e), this[te] = !0, !this[gt] && !this[Y].length && typeof this[m] == "number" && this[Pt](null, 0), this;
|
|
1270
|
+
}
|
|
1271
|
+
write(t, e) {
|
|
1272
|
+
return typeof t == "string" && (t = Buffer.from(t, e)), this[te] ? (this.emit("error", /* @__PURE__ */ new Error("write() after end()")), !1) : this[m] === void 0 || this[gt] || this[Y].length ? (this[Y].push(t), this[ke] = !0, !1) : (this[gt] = !0, this[ve](t), !0);
|
|
1273
|
+
}
|
|
1274
|
+
[ve](t) {
|
|
1275
|
+
I.write(this[m], t, 0, t.length, this[ot], (e, i) => this[Pt](e, i));
|
|
1276
|
+
}
|
|
1277
|
+
[Pt](t, e) {
|
|
1278
|
+
t ? this[Ut](t) : (this[ot] !== void 0 && typeof e == "number" && (this[ot] += e), this[Y].length ? this[Ai]() : (this[gt] = !1, this[te] && !this[Ni] ? (this[Ni] = !0, this[H](), this.emit("finish")) : this[ke] && (this[ke] = !1, this.emit("drain"))));
|
|
1279
|
+
}
|
|
1280
|
+
[Ai]() {
|
|
1281
|
+
if (this[Y].length === 0) this[te] && this[Pt](null, 0);
|
|
1282
|
+
else if (this[Y].length === 1) this[ve](this[Y].pop());
|
|
1283
|
+
else {
|
|
1284
|
+
let t = this[Y];
|
|
1285
|
+
this[Y] = [], Jr(this[m], t, this[ot], (e, i) => this[Pt](e, i));
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
[H]() {
|
|
1289
|
+
if (this[ht] && typeof this[m] == "number") {
|
|
1290
|
+
let t = this[m];
|
|
1291
|
+
this[m] = void 0, I.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
var Wt = class extends et {
|
|
1296
|
+
[at]() {
|
|
1297
|
+
let t;
|
|
1298
|
+
if (this[Me] && this[tt] === "r+") try {
|
|
1299
|
+
t = I.openSync(this[U], this[tt], this[ie]);
|
|
1300
|
+
} catch (e) {
|
|
1301
|
+
if (e?.code === "ENOENT") return this[tt] = "w", this[at]();
|
|
1302
|
+
throw e;
|
|
1303
|
+
}
|
|
1304
|
+
else t = I.openSync(this[U], this[tt], this[ie]);
|
|
1305
|
+
this[Ht](null, t);
|
|
1306
|
+
}
|
|
1307
|
+
[H]() {
|
|
1308
|
+
if (this[ht] && typeof this[m] == "number") {
|
|
1309
|
+
let t = this[m];
|
|
1310
|
+
this[m] = void 0, I.closeSync(t), this.emit("close");
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
[ve](t) {
|
|
1314
|
+
let e = !0;
|
|
1315
|
+
try {
|
|
1316
|
+
this[Pt](null, I.writeSync(this[m], t, 0, t.length, this[ot])), e = !1;
|
|
1317
|
+
} finally {
|
|
1318
|
+
if (e) try {
|
|
1319
|
+
this[H]();
|
|
1320
|
+
} catch {}
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
var jr = /* @__PURE__ */ new Map([
|
|
1325
|
+
["C", "cwd"],
|
|
1326
|
+
["f", "file"],
|
|
1327
|
+
["z", "gzip"],
|
|
1328
|
+
["P", "preservePaths"],
|
|
1329
|
+
["U", "unlink"],
|
|
1330
|
+
["strip-components", "strip"],
|
|
1331
|
+
["stripComponents", "strip"],
|
|
1332
|
+
["keep-newer", "newer"],
|
|
1333
|
+
["keepNewer", "newer"],
|
|
1334
|
+
["keep-newer-files", "newer"],
|
|
1335
|
+
["keepNewerFiles", "newer"],
|
|
1336
|
+
["k", "keep"],
|
|
1337
|
+
["keep-existing", "keep"],
|
|
1338
|
+
["keepExisting", "keep"],
|
|
1339
|
+
["m", "noMtime"],
|
|
1340
|
+
["no-mtime", "noMtime"],
|
|
1341
|
+
["p", "preserveOwner"],
|
|
1342
|
+
["L", "follow"],
|
|
1343
|
+
["h", "follow"],
|
|
1344
|
+
["onentry", "onReadEntry"]
|
|
1345
|
+
]);
|
|
1346
|
+
var Fs = (s) => !!s.sync && !!s.file;
|
|
1347
|
+
var ks = (s) => !s.sync && !!s.file;
|
|
1348
|
+
var vs = (s) => !!s.sync && !s.file;
|
|
1349
|
+
var Ms = (s) => !s.sync && !s.file;
|
|
1350
|
+
var Bs = (s) => !!s.file;
|
|
1351
|
+
var tn = (s) => {
|
|
1352
|
+
return jr.get(s) || s;
|
|
1353
|
+
};
|
|
1354
|
+
var se = (s = {}) => {
|
|
1355
|
+
if (!s) return {};
|
|
1356
|
+
let t = {};
|
|
1357
|
+
for (let [e, i] of Object.entries(s)) {
|
|
1358
|
+
let r = tn(e);
|
|
1359
|
+
t[r] = i;
|
|
1360
|
+
}
|
|
1361
|
+
return t.chmod === void 0 && t.noChmod === !1 && (t.chmod = !0), delete t.noChmod, t;
|
|
1362
|
+
};
|
|
1363
|
+
var K = (s, t, e, i, r) => Object.assign((n = [], o, h) => {
|
|
1364
|
+
Array.isArray(n) && (o = n, n = {}), typeof o == "function" && (h = o, o = void 0), o = o ? Array.from(o) : [];
|
|
1365
|
+
let a = se(n);
|
|
1366
|
+
if (r?.(a, o), Fs(a)) {
|
|
1367
|
+
if (typeof h == "function") throw new TypeError("callback not supported for sync tar functions");
|
|
1368
|
+
return s(a, o);
|
|
1369
|
+
} else if (ks(a)) {
|
|
1370
|
+
let l = t(a, o);
|
|
1371
|
+
return h ? l.then(() => h(), h) : l;
|
|
1372
|
+
} else if (vs(a)) {
|
|
1373
|
+
if (typeof h == "function") throw new TypeError("callback not supported for sync tar functions");
|
|
1374
|
+
return e(a, o);
|
|
1375
|
+
} else if (Ms(a)) {
|
|
1376
|
+
if (typeof h == "function") throw new TypeError("callback only supported with file option");
|
|
1377
|
+
return i(a, o);
|
|
1378
|
+
}
|
|
1379
|
+
throw new Error("impossible options??");
|
|
1380
|
+
}, {
|
|
1381
|
+
syncFile: s,
|
|
1382
|
+
asyncFile: t,
|
|
1383
|
+
syncNoFile: e,
|
|
1384
|
+
asyncNoFile: i,
|
|
1385
|
+
validate: r
|
|
1386
|
+
});
|
|
1387
|
+
var sn = en.constants || { ZLIB_VERNUM: 4736 };
|
|
1388
|
+
var M = Object.freeze(Object.assign(Object.create(null), {
|
|
1389
|
+
Z_NO_FLUSH: 0,
|
|
1390
|
+
Z_PARTIAL_FLUSH: 1,
|
|
1391
|
+
Z_SYNC_FLUSH: 2,
|
|
1392
|
+
Z_FULL_FLUSH: 3,
|
|
1393
|
+
Z_FINISH: 4,
|
|
1394
|
+
Z_BLOCK: 5,
|
|
1395
|
+
Z_OK: 0,
|
|
1396
|
+
Z_STREAM_END: 1,
|
|
1397
|
+
Z_NEED_DICT: 2,
|
|
1398
|
+
Z_ERRNO: -1,
|
|
1399
|
+
Z_STREAM_ERROR: -2,
|
|
1400
|
+
Z_DATA_ERROR: -3,
|
|
1401
|
+
Z_MEM_ERROR: -4,
|
|
1402
|
+
Z_BUF_ERROR: -5,
|
|
1403
|
+
Z_VERSION_ERROR: -6,
|
|
1404
|
+
Z_NO_COMPRESSION: 0,
|
|
1405
|
+
Z_BEST_SPEED: 1,
|
|
1406
|
+
Z_BEST_COMPRESSION: 9,
|
|
1407
|
+
Z_DEFAULT_COMPRESSION: -1,
|
|
1408
|
+
Z_FILTERED: 1,
|
|
1409
|
+
Z_HUFFMAN_ONLY: 2,
|
|
1410
|
+
Z_RLE: 3,
|
|
1411
|
+
Z_FIXED: 4,
|
|
1412
|
+
Z_DEFAULT_STRATEGY: 0,
|
|
1413
|
+
DEFLATE: 1,
|
|
1414
|
+
INFLATE: 2,
|
|
1415
|
+
GZIP: 3,
|
|
1416
|
+
GUNZIP: 4,
|
|
1417
|
+
DEFLATERAW: 5,
|
|
1418
|
+
INFLATERAW: 6,
|
|
1419
|
+
UNZIP: 7,
|
|
1420
|
+
BROTLI_DECODE: 8,
|
|
1421
|
+
BROTLI_ENCODE: 9,
|
|
1422
|
+
Z_MIN_WINDOWBITS: 8,
|
|
1423
|
+
Z_MAX_WINDOWBITS: 15,
|
|
1424
|
+
Z_DEFAULT_WINDOWBITS: 15,
|
|
1425
|
+
Z_MIN_CHUNK: 64,
|
|
1426
|
+
Z_MAX_CHUNK: 1 / 0,
|
|
1427
|
+
Z_DEFAULT_CHUNK: 16384,
|
|
1428
|
+
Z_MIN_MEMLEVEL: 1,
|
|
1429
|
+
Z_MAX_MEMLEVEL: 9,
|
|
1430
|
+
Z_DEFAULT_MEMLEVEL: 8,
|
|
1431
|
+
Z_MIN_LEVEL: -1,
|
|
1432
|
+
Z_MAX_LEVEL: 9,
|
|
1433
|
+
Z_DEFAULT_LEVEL: -1,
|
|
1434
|
+
BROTLI_OPERATION_PROCESS: 0,
|
|
1435
|
+
BROTLI_OPERATION_FLUSH: 1,
|
|
1436
|
+
BROTLI_OPERATION_FINISH: 2,
|
|
1437
|
+
BROTLI_OPERATION_EMIT_METADATA: 3,
|
|
1438
|
+
BROTLI_MODE_GENERIC: 0,
|
|
1439
|
+
BROTLI_MODE_TEXT: 1,
|
|
1440
|
+
BROTLI_MODE_FONT: 2,
|
|
1441
|
+
BROTLI_DEFAULT_MODE: 0,
|
|
1442
|
+
BROTLI_MIN_QUALITY: 0,
|
|
1443
|
+
BROTLI_MAX_QUALITY: 11,
|
|
1444
|
+
BROTLI_DEFAULT_QUALITY: 11,
|
|
1445
|
+
BROTLI_MIN_WINDOW_BITS: 10,
|
|
1446
|
+
BROTLI_MAX_WINDOW_BITS: 24,
|
|
1447
|
+
BROTLI_LARGE_MAX_WINDOW_BITS: 30,
|
|
1448
|
+
BROTLI_DEFAULT_WINDOW: 22,
|
|
1449
|
+
BROTLI_MIN_INPUT_BLOCK_BITS: 16,
|
|
1450
|
+
BROTLI_MAX_INPUT_BLOCK_BITS: 24,
|
|
1451
|
+
BROTLI_PARAM_MODE: 0,
|
|
1452
|
+
BROTLI_PARAM_QUALITY: 1,
|
|
1453
|
+
BROTLI_PARAM_LGWIN: 2,
|
|
1454
|
+
BROTLI_PARAM_LGBLOCK: 3,
|
|
1455
|
+
BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
|
|
1456
|
+
BROTLI_PARAM_SIZE_HINT: 5,
|
|
1457
|
+
BROTLI_PARAM_LARGE_WINDOW: 6,
|
|
1458
|
+
BROTLI_PARAM_NPOSTFIX: 7,
|
|
1459
|
+
BROTLI_PARAM_NDIRECT: 8,
|
|
1460
|
+
BROTLI_DECODER_RESULT_ERROR: 0,
|
|
1461
|
+
BROTLI_DECODER_RESULT_SUCCESS: 1,
|
|
1462
|
+
BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
|
|
1463
|
+
BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
|
|
1464
|
+
BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
|
|
1465
|
+
BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
|
|
1466
|
+
BROTLI_DECODER_NO_ERROR: 0,
|
|
1467
|
+
BROTLI_DECODER_SUCCESS: 1,
|
|
1468
|
+
BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
|
|
1469
|
+
BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
|
|
1470
|
+
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
|
|
1471
|
+
BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
|
|
1472
|
+
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
|
|
1473
|
+
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
|
|
1474
|
+
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
|
|
1475
|
+
BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
|
|
1476
|
+
BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
|
|
1477
|
+
BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
|
|
1478
|
+
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
|
|
1479
|
+
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
|
|
1480
|
+
BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
|
|
1481
|
+
BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
|
|
1482
|
+
BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
|
|
1483
|
+
BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
|
|
1484
|
+
BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
|
|
1485
|
+
BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
|
|
1486
|
+
BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
|
|
1487
|
+
BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
|
|
1488
|
+
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
|
|
1489
|
+
BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
|
|
1490
|
+
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
|
|
1491
|
+
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
|
|
1492
|
+
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
|
|
1493
|
+
BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
|
|
1494
|
+
BROTLI_DECODER_ERROR_UNREACHABLE: -31
|
|
1495
|
+
}, sn));
|
|
1496
|
+
var rn = Buffer$1.concat;
|
|
1497
|
+
var zs = Object.getOwnPropertyDescriptor(Buffer$1, "concat");
|
|
1498
|
+
var nn = (s) => s;
|
|
1499
|
+
var Bi = zs?.writable === !0 || zs?.set !== void 0 ? (s) => {
|
|
1500
|
+
Buffer$1.concat = s ? nn : rn;
|
|
1501
|
+
} : (s) => {};
|
|
1502
|
+
var Tt = Symbol("_superWrite");
|
|
1503
|
+
var Gt = class extends Error {
|
|
1504
|
+
code;
|
|
1505
|
+
errno;
|
|
1506
|
+
constructor(t, e) {
|
|
1507
|
+
super("zlib: " + t.message, { cause: t }), this.code = t.code, this.errno = t.errno, this.code || (this.code = "ZLIB_ERROR"), this.message = "zlib: " + t.message, Error.captureStackTrace(this, e ?? this.constructor);
|
|
1508
|
+
}
|
|
1509
|
+
get name() {
|
|
1510
|
+
return "ZlibError";
|
|
1511
|
+
}
|
|
1512
|
+
};
|
|
1513
|
+
var Pi = Symbol("flushFlag");
|
|
1514
|
+
var re = class extends A {
|
|
1515
|
+
#t = !1;
|
|
1516
|
+
#i = !1;
|
|
1517
|
+
#s;
|
|
1518
|
+
#n;
|
|
1519
|
+
#r;
|
|
1520
|
+
#e;
|
|
1521
|
+
#o;
|
|
1522
|
+
get sawError() {
|
|
1523
|
+
return this.#t;
|
|
1524
|
+
}
|
|
1525
|
+
get handle() {
|
|
1526
|
+
return this.#e;
|
|
1527
|
+
}
|
|
1528
|
+
get flushFlag() {
|
|
1529
|
+
return this.#s;
|
|
1530
|
+
}
|
|
1531
|
+
constructor(t, e) {
|
|
1532
|
+
if (!t || typeof t != "object") throw new TypeError("invalid options for ZlibBase constructor");
|
|
1533
|
+
if (super(t), this.#s = t.flush ?? 0, this.#n = t.finishFlush ?? 0, this.#r = t.fullFlushFlag ?? 0, typeof Ps[e] != "function") throw new TypeError("Compression method not supported: " + e);
|
|
1534
|
+
try {
|
|
1535
|
+
this.#e = new Ps[e](t);
|
|
1536
|
+
} catch (i) {
|
|
1537
|
+
throw new Gt(i, this.constructor);
|
|
1538
|
+
}
|
|
1539
|
+
this.#o = (i) => {
|
|
1540
|
+
this.#t || (this.#t = !0, this.close(), this.emit("error", i));
|
|
1541
|
+
}, this.#e?.on("error", (i) => this.#o(new Gt(i))), this.once("end", () => this.close);
|
|
1542
|
+
}
|
|
1543
|
+
close() {
|
|
1544
|
+
this.#e && (this.#e.close(), this.#e = void 0, this.emit("close"));
|
|
1545
|
+
}
|
|
1546
|
+
reset() {
|
|
1547
|
+
if (!this.#t) return zi(this.#e, "zlib binding closed"), this.#e.reset?.();
|
|
1548
|
+
}
|
|
1549
|
+
flush(t) {
|
|
1550
|
+
this.ended || (typeof t != "number" && (t = this.#r), this.write(Object.assign(Buffer$1.alloc(0), { [Pi]: t })));
|
|
1551
|
+
}
|
|
1552
|
+
end(t, e, i) {
|
|
1553
|
+
return typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), t && (e ? this.write(t, e) : this.write(t)), this.flush(this.#n), this.#i = !0, super.end(i);
|
|
1554
|
+
}
|
|
1555
|
+
get ended() {
|
|
1556
|
+
return this.#i;
|
|
1557
|
+
}
|
|
1558
|
+
[Tt](t) {
|
|
1559
|
+
return super.write(t);
|
|
1560
|
+
}
|
|
1561
|
+
write(t, e, i) {
|
|
1562
|
+
if (typeof e == "function" && (i = e, e = "utf8"), typeof t == "string" && (t = Buffer$1.from(t, e)), this.#t) return;
|
|
1563
|
+
zi(this.#e, "zlib binding closed");
|
|
1564
|
+
let r = this.#e._handle, n = r.close;
|
|
1565
|
+
r.close = () => {};
|
|
1566
|
+
let o = this.#e.close;
|
|
1567
|
+
this.#e.close = () => {}, Bi(!0);
|
|
1568
|
+
let h;
|
|
1569
|
+
try {
|
|
1570
|
+
let l = typeof t[Pi] == "number" ? t[Pi] : this.#s;
|
|
1571
|
+
h = this.#e._processChunk(t, l), Bi(!1);
|
|
1572
|
+
} catch (l) {
|
|
1573
|
+
Bi(!1), this.#o(new Gt(l, this.write));
|
|
1574
|
+
} finally {
|
|
1575
|
+
this.#e && (this.#e._handle = r, r.close = n, this.#e.close = o, this.#e.removeAllListeners("error"));
|
|
1576
|
+
}
|
|
1577
|
+
this.#e && this.#e.on("error", (l) => this.#o(new Gt(l, this.write)));
|
|
1578
|
+
let a;
|
|
1579
|
+
if (h) if (Array.isArray(h) && h.length > 0) {
|
|
1580
|
+
let l = h[0];
|
|
1581
|
+
a = this[Tt](Buffer$1.from(l));
|
|
1582
|
+
for (let c = 1; c < h.length; c++) a = this[Tt](h[c]);
|
|
1583
|
+
} else a = this[Tt](Buffer$1.from(h));
|
|
1584
|
+
return i && i(), a;
|
|
1585
|
+
}
|
|
1586
|
+
};
|
|
1587
|
+
var Pe = class extends re {
|
|
1588
|
+
#t;
|
|
1589
|
+
#i;
|
|
1590
|
+
constructor(t, e) {
|
|
1591
|
+
t = t || {}, t.flush = t.flush || M.Z_NO_FLUSH, t.finishFlush = t.finishFlush || M.Z_FINISH, t.fullFlushFlag = M.Z_FULL_FLUSH, super(t, e), this.#t = t.level, this.#i = t.strategy;
|
|
1592
|
+
}
|
|
1593
|
+
params(t, e) {
|
|
1594
|
+
if (!this.sawError) {
|
|
1595
|
+
if (!this.handle) throw new Error("cannot switch params when binding is closed");
|
|
1596
|
+
if (!this.handle.params) throw new Error("not supported in this implementation");
|
|
1597
|
+
if (this.#t !== t || this.#i !== e) {
|
|
1598
|
+
this.flush(M.Z_SYNC_FLUSH), zi(this.handle, "zlib binding closed");
|
|
1599
|
+
let i = this.handle.flush;
|
|
1600
|
+
this.handle.flush = (r, n) => {
|
|
1601
|
+
typeof r == "function" && (n = r, r = this.flushFlag), this.flush(r), n?.();
|
|
1602
|
+
};
|
|
1603
|
+
try {
|
|
1604
|
+
this.handle.params(t, e);
|
|
1605
|
+
} finally {
|
|
1606
|
+
this.handle.flush = i;
|
|
1607
|
+
}
|
|
1608
|
+
this.handle && (this.#t = t, this.#i = e);
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
var ze = class extends Pe {
|
|
1614
|
+
#t;
|
|
1615
|
+
constructor(t) {
|
|
1616
|
+
super(t, "Gzip"), this.#t = t && !!t.portable;
|
|
1617
|
+
}
|
|
1618
|
+
[Tt](t) {
|
|
1619
|
+
return this.#t ? (this.#t = !1, t[9] = 255, super[Tt](t)) : super[Tt](t);
|
|
1620
|
+
}
|
|
1621
|
+
};
|
|
1622
|
+
var Ue = class extends Pe {
|
|
1623
|
+
constructor(t) {
|
|
1624
|
+
super(t, "Unzip");
|
|
1625
|
+
}
|
|
1626
|
+
};
|
|
1627
|
+
var He = class extends re {
|
|
1628
|
+
constructor(t, e) {
|
|
1629
|
+
t = t || {}, t.flush = t.flush || M.BROTLI_OPERATION_PROCESS, t.finishFlush = t.finishFlush || M.BROTLI_OPERATION_FINISH, t.fullFlushFlag = M.BROTLI_OPERATION_FLUSH, super(t, e);
|
|
1630
|
+
}
|
|
1631
|
+
};
|
|
1632
|
+
var We = class extends He {
|
|
1633
|
+
constructor(t) {
|
|
1634
|
+
super(t, "BrotliCompress");
|
|
1635
|
+
}
|
|
1636
|
+
};
|
|
1637
|
+
var Ge = class extends He {
|
|
1638
|
+
constructor(t) {
|
|
1639
|
+
super(t, "BrotliDecompress");
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
var Ze = class extends re {
|
|
1643
|
+
constructor(t, e) {
|
|
1644
|
+
t = t || {}, t.flush = t.flush || M.ZSTD_e_continue, t.finishFlush = t.finishFlush || M.ZSTD_e_end, t.fullFlushFlag = M.ZSTD_e_flush, super(t, e);
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
var Ye = class extends Ze {
|
|
1648
|
+
constructor(t) {
|
|
1649
|
+
super(t, "ZstdCompress");
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
var Ke = class extends Ze {
|
|
1653
|
+
constructor(t) {
|
|
1654
|
+
super(t, "ZstdDecompress");
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
var Us = (s, t) => {
|
|
1658
|
+
if (Number.isSafeInteger(s)) s < 0 ? an(s, t) : hn(s, t);
|
|
1659
|
+
else throw Error("cannot encode number outside of javascript safe integer range");
|
|
1660
|
+
return t;
|
|
1661
|
+
};
|
|
1662
|
+
var hn = (s, t) => {
|
|
1663
|
+
t[0] = 128;
|
|
1664
|
+
for (var e = t.length; e > 1; e--) t[e - 1] = s & 255, s = Math.floor(s / 256);
|
|
1665
|
+
};
|
|
1666
|
+
var an = (s, t) => {
|
|
1667
|
+
t[0] = 255;
|
|
1668
|
+
var e = !1;
|
|
1669
|
+
s = s * -1;
|
|
1670
|
+
for (var i = t.length; i > 1; i--) {
|
|
1671
|
+
var r = s & 255;
|
|
1672
|
+
s = Math.floor(s / 256), e ? t[i - 1] = Ws(r) : r === 0 ? t[i - 1] = 0 : (e = !0, t[i - 1] = Gs(r));
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
var Hs = (s) => {
|
|
1676
|
+
let t = s[0], e = t === 128 ? cn(s.subarray(1, s.length)) : t === 255 ? ln(s) : null;
|
|
1677
|
+
if (e === null) throw Error("invalid base256 encoding");
|
|
1678
|
+
if (!Number.isSafeInteger(e)) throw Error("parsed number outside of javascript safe integer range");
|
|
1679
|
+
return e;
|
|
1680
|
+
};
|
|
1681
|
+
var ln = (s) => {
|
|
1682
|
+
for (var t = s.length, e = 0, i = !1, r = t - 1; r > -1; r--) {
|
|
1683
|
+
var n = Number(s[r]), o;
|
|
1684
|
+
i ? o = Ws(n) : n === 0 ? o = n : (i = !0, o = Gs(n)), o !== 0 && (e -= o * Math.pow(256, t - r - 1));
|
|
1685
|
+
}
|
|
1686
|
+
return e;
|
|
1687
|
+
};
|
|
1688
|
+
var cn = (s) => {
|
|
1689
|
+
for (var t = s.length, e = 0, i = t - 1; i > -1; i--) {
|
|
1690
|
+
var r = Number(s[i]);
|
|
1691
|
+
r !== 0 && (e += r * Math.pow(256, t - i - 1));
|
|
1692
|
+
}
|
|
1693
|
+
return e;
|
|
1694
|
+
};
|
|
1695
|
+
var Ws = (s) => (255 ^ s) & 255;
|
|
1696
|
+
var Gs = (s) => (255 ^ s) + 1 & 255;
|
|
1697
|
+
Ur({}, {
|
|
1698
|
+
code: () => Ve,
|
|
1699
|
+
isCode: () => ne,
|
|
1700
|
+
isName: () => dn,
|
|
1701
|
+
name: () => oe,
|
|
1702
|
+
normalFsTypes: () => Ui
|
|
1703
|
+
});
|
|
1704
|
+
var ne = (s) => oe.has(s);
|
|
1705
|
+
var dn = (s) => Ve.has(s);
|
|
1706
|
+
var Ui = /* @__PURE__ */ new Set([
|
|
1707
|
+
"0",
|
|
1708
|
+
"",
|
|
1709
|
+
"1",
|
|
1710
|
+
"2",
|
|
1711
|
+
"3",
|
|
1712
|
+
"4",
|
|
1713
|
+
"5",
|
|
1714
|
+
"6",
|
|
1715
|
+
"7",
|
|
1716
|
+
"D"
|
|
1717
|
+
]);
|
|
1718
|
+
var oe = /* @__PURE__ */ new Map([
|
|
1719
|
+
["0", "File"],
|
|
1720
|
+
["", "OldFile"],
|
|
1721
|
+
["1", "Link"],
|
|
1722
|
+
["2", "SymbolicLink"],
|
|
1723
|
+
["3", "CharacterDevice"],
|
|
1724
|
+
["4", "BlockDevice"],
|
|
1725
|
+
["5", "Directory"],
|
|
1726
|
+
["6", "FIFO"],
|
|
1727
|
+
["7", "ContiguousFile"],
|
|
1728
|
+
["g", "GlobalExtendedHeader"],
|
|
1729
|
+
["x", "ExtendedHeader"],
|
|
1730
|
+
["A", "SolarisACL"],
|
|
1731
|
+
["D", "GNUDumpDir"],
|
|
1732
|
+
["I", "Inode"],
|
|
1733
|
+
["K", "NextFileHasLongLinkpath"],
|
|
1734
|
+
["L", "NextFileHasLongPath"],
|
|
1735
|
+
["M", "ContinuationFile"],
|
|
1736
|
+
["N", "OldGnuLongPath"],
|
|
1737
|
+
["S", "SparseFile"],
|
|
1738
|
+
["V", "TapeVolumeHeader"],
|
|
1739
|
+
["X", "OldExtendedHeader"]
|
|
1740
|
+
]);
|
|
1741
|
+
var Ve = new Map(Array.from(oe).map((s) => [s[1], s[0]]));
|
|
1742
|
+
var un = (s) => s === void 0 || s < 0 ? void 0 : s;
|
|
1743
|
+
var F = class {
|
|
1744
|
+
cksumValid = !1;
|
|
1745
|
+
needPax = !1;
|
|
1746
|
+
nullBlock = !1;
|
|
1747
|
+
block;
|
|
1748
|
+
path;
|
|
1749
|
+
mode;
|
|
1750
|
+
uid;
|
|
1751
|
+
gid;
|
|
1752
|
+
size;
|
|
1753
|
+
cksum;
|
|
1754
|
+
#t = "Unsupported";
|
|
1755
|
+
linkpath;
|
|
1756
|
+
uname;
|
|
1757
|
+
gname;
|
|
1758
|
+
devmaj = 0;
|
|
1759
|
+
devmin = 0;
|
|
1760
|
+
atime;
|
|
1761
|
+
ctime;
|
|
1762
|
+
mtime;
|
|
1763
|
+
charset;
|
|
1764
|
+
comment;
|
|
1765
|
+
constructor(t, e = 0, i, r) {
|
|
1766
|
+
Buffer.isBuffer(t) ? this.decode(t, e || 0, i, r) : t && this.#i(t);
|
|
1767
|
+
}
|
|
1768
|
+
decode(t, e, i, r) {
|
|
1769
|
+
if (e || (e = 0), !t || !(t.length >= e + 512)) throw new Error("need 512 bytes for header");
|
|
1770
|
+
let n = xt(t, e + 156, 1), o = Ui.has(n), h = o ? i : void 0, a = o ? r : void 0;
|
|
1771
|
+
if (this.path = h?.path ?? xt(t, e, 100), this.mode = h?.mode ?? a?.mode ?? lt(t, e + 100, 8), this.uid = h?.uid ?? a?.uid ?? lt(t, e + 108, 8), this.gid = h?.gid ?? a?.gid ?? lt(t, e + 116, 8), this.size = un(h?.size ?? a?.size ?? lt(t, e + 124, 12)), this.mtime = h?.mtime ?? a?.mtime ?? Wi(t, e + 136, 12), this.cksum = lt(t, e + 148, 12), a && this.#i(a, !0), h && this.#i(h), ne(n) && (this.#t = n || "0"), this.#t === "0" && this.path.slice(-1) === "/" && (this.#t = "5"), this.#t === "5" && (this.size = 0), this.linkpath = xt(t, e + 157, 100), t.subarray(e + 257, e + 265).toString() === "ustar\x0000") if (this.uname = h?.uname ?? a?.uname ?? xt(t, e + 265, 32), this.gname = h?.gname ?? a?.gname ?? xt(t, e + 297, 32), this.devmaj = h?.devmaj ?? a?.devmaj ?? lt(t, e + 329, 8) ?? 0, this.devmin = h?.devmin ?? a?.devmin ?? lt(t, e + 337, 8) ?? 0, t[e + 475] !== 0) {
|
|
1772
|
+
let c = xt(t, e + 345, 155);
|
|
1773
|
+
this.path = c + "/" + this.path;
|
|
1774
|
+
} else {
|
|
1775
|
+
let c = xt(t, e + 345, 130);
|
|
1776
|
+
c && (this.path = c + "/" + this.path), this.atime = i?.atime ?? r?.atime ?? Wi(t, e + 476, 12), this.ctime = i?.ctime ?? r?.ctime ?? Wi(t, e + 488, 12);
|
|
1777
|
+
}
|
|
1778
|
+
let l = 256;
|
|
1779
|
+
for (let c = e; c < e + 148; c++) l += t[c];
|
|
1780
|
+
for (let c = e + 156; c < e + 512; c++) l += t[c];
|
|
1781
|
+
this.cksumValid = l === this.cksum, this.cksum === void 0 && l === 256 && (this.nullBlock = !0);
|
|
1782
|
+
}
|
|
1783
|
+
#i(t, e = !1) {
|
|
1784
|
+
Object.assign(this, Object.fromEntries(Object.entries(t).filter(([i, r]) => !(r == null || i === "size" && Number(r) < 0 || i === "path" && e || i === "linkpath" && e || i === "global"))));
|
|
1785
|
+
}
|
|
1786
|
+
encode(t, e = 0) {
|
|
1787
|
+
if (t || (t = this.block = Buffer.alloc(512)), this.#t === "Unsupported" && (this.#t = "0"), !(t.length >= e + 512)) throw new Error("need 512 bytes for header");
|
|
1788
|
+
let i = this.ctime || this.atime ? 130 : 155, r = mn(this.path || "", i), n = r[0], o = r[1];
|
|
1789
|
+
this.needPax = !!r[2], this.needPax = Lt(t, e, 100, n) || this.needPax, this.needPax = ct(t, e + 100, 8, this.mode) || this.needPax, this.needPax = ct(t, e + 108, 8, this.uid) || this.needPax, this.needPax = ct(t, e + 116, 8, this.gid) || this.needPax, this.needPax = ct(t, e + 124, 12, this.size) || this.needPax, this.needPax = Gi(t, e + 136, 12, this.mtime) || this.needPax, t[e + 156] = Number(this.#t.codePointAt(0)), this.needPax = Lt(t, e + 157, 100, this.linkpath) || this.needPax, t.write("ustar\x0000", e + 257, 8), this.needPax = Lt(t, e + 265, 32, this.uname) || this.needPax, this.needPax = Lt(t, e + 297, 32, this.gname) || this.needPax, this.needPax = ct(t, e + 329, 8, this.devmaj) || this.needPax, this.needPax = ct(t, e + 337, 8, this.devmin) || this.needPax, this.needPax = Lt(t, e + 345, i, o) || this.needPax, t[e + 475] !== 0 ? this.needPax = Lt(t, e + 345, 155, o) || this.needPax : (this.needPax = Lt(t, e + 345, 130, o) || this.needPax, this.needPax = Gi(t, e + 476, 12, this.atime) || this.needPax, this.needPax = Gi(t, e + 488, 12, this.ctime) || this.needPax);
|
|
1790
|
+
let h = 256;
|
|
1791
|
+
for (let a = e; a < e + 148; a++) h += t[a];
|
|
1792
|
+
for (let a = e + 156; a < e + 512; a++) h += t[a];
|
|
1793
|
+
return this.cksum = h, ct(t, e + 148, 8, this.cksum), this.cksumValid = !0, this.needPax;
|
|
1794
|
+
}
|
|
1795
|
+
get type() {
|
|
1796
|
+
return this.#t === "Unsupported" ? this.#t : oe.get(this.#t);
|
|
1797
|
+
}
|
|
1798
|
+
get typeKey() {
|
|
1799
|
+
return this.#t;
|
|
1800
|
+
}
|
|
1801
|
+
set type(t) {
|
|
1802
|
+
let e = String(Ve.get(t));
|
|
1803
|
+
if (ne(e) || e === "Unsupported") this.#t = e;
|
|
1804
|
+
else if (ne(t)) this.#t = t;
|
|
1805
|
+
else throw new TypeError("invalid entry type: " + t);
|
|
1806
|
+
}
|
|
1807
|
+
};
|
|
1808
|
+
var mn = (s, t) => {
|
|
1809
|
+
let i = s, r = "", n, o = posix.parse(s).root || ".";
|
|
1810
|
+
if (Buffer.byteLength(i) < 100) n = [
|
|
1811
|
+
i,
|
|
1812
|
+
r,
|
|
1813
|
+
!1
|
|
1814
|
+
];
|
|
1815
|
+
else {
|
|
1816
|
+
r = posix.dirname(i), i = posix.basename(i);
|
|
1817
|
+
do
|
|
1818
|
+
Buffer.byteLength(i) <= 100 && Buffer.byteLength(r) <= t ? n = [
|
|
1819
|
+
i,
|
|
1820
|
+
r,
|
|
1821
|
+
!1
|
|
1822
|
+
] : Buffer.byteLength(i) > 100 && Buffer.byteLength(r) <= t ? n = [
|
|
1823
|
+
i.slice(0, 99),
|
|
1824
|
+
r,
|
|
1825
|
+
!0
|
|
1826
|
+
] : (i = posix.join(posix.basename(r), i), r = posix.dirname(r));
|
|
1827
|
+
while (r !== o && n === void 0);
|
|
1828
|
+
n || (n = [
|
|
1829
|
+
s.slice(0, 99),
|
|
1830
|
+
"",
|
|
1831
|
+
!0
|
|
1832
|
+
]);
|
|
1833
|
+
}
|
|
1834
|
+
return n;
|
|
1835
|
+
};
|
|
1836
|
+
var xt = (s, t, e) => s.subarray(t, t + e).toString("utf8").replace(/\0.*/, "");
|
|
1837
|
+
var Wi = (s, t, e) => pn(lt(s, t, e));
|
|
1838
|
+
var pn = (s) => s === void 0 ? void 0 : /* @__PURE__ */ new Date(s * 1e3);
|
|
1839
|
+
var lt = (s, t, e) => Number(s[t]) & 128 ? Hs(s.subarray(t, t + e)) : wn(s, t, e);
|
|
1840
|
+
var En = (s) => isNaN(s) ? void 0 : s;
|
|
1841
|
+
var wn = (s, t, e) => En(parseInt(s.subarray(t, t + e).toString("utf8").replace(/\0.*$/, "").trim(), 8));
|
|
1842
|
+
var Sn = {
|
|
1843
|
+
12: 8589934591,
|
|
1844
|
+
8: 2097151
|
|
1845
|
+
};
|
|
1846
|
+
var ct = (s, t, e, i) => i === void 0 ? !1 : i > Sn[e] || i < 0 ? (Us(i, s.subarray(t, t + e)), !0) : (yn(s, t, e, i), !1);
|
|
1847
|
+
var yn = (s, t, e, i) => s.write(Rn(i, e), t, e, "ascii");
|
|
1848
|
+
var Rn = (s, t) => gn(Math.floor(s).toString(8), t);
|
|
1849
|
+
var gn = (s, t) => (s.length === t - 1 ? s : new Array(t - s.length - 1).join("0") + s + " ") + "\0";
|
|
1850
|
+
var Gi = (s, t, e, i) => i === void 0 ? !1 : ct(s, t, e, i.getTime() / 1e3);
|
|
1851
|
+
var bn = new Array(156).join("\0");
|
|
1852
|
+
var Lt = (s, t, e, i) => i === void 0 ? !1 : (s.write(i + bn, t, e, "utf8"), i.length !== Buffer.byteLength(i) || i.length > e);
|
|
1853
|
+
var ft = class s {
|
|
1854
|
+
atime;
|
|
1855
|
+
mtime;
|
|
1856
|
+
ctime;
|
|
1857
|
+
charset;
|
|
1858
|
+
comment;
|
|
1859
|
+
gid;
|
|
1860
|
+
uid;
|
|
1861
|
+
gname;
|
|
1862
|
+
uname;
|
|
1863
|
+
linkpath;
|
|
1864
|
+
dev;
|
|
1865
|
+
ino;
|
|
1866
|
+
nlink;
|
|
1867
|
+
path;
|
|
1868
|
+
size;
|
|
1869
|
+
mode;
|
|
1870
|
+
global;
|
|
1871
|
+
constructor(t, e = !1) {
|
|
1872
|
+
this.atime = t.atime, this.charset = t.charset, this.comment = t.comment, this.ctime = t.ctime, this.dev = t.dev, this.gid = t.gid, this.global = e, this.gname = t.gname, this.ino = t.ino, this.linkpath = t.linkpath, this.mtime = t.mtime, this.nlink = t.nlink, this.path = t.path, this.size = t.size, this.uid = t.uid, this.uname = t.uname;
|
|
1873
|
+
}
|
|
1874
|
+
encode() {
|
|
1875
|
+
let t = this.encodeBody();
|
|
1876
|
+
if (t === "") return Buffer.allocUnsafe(0);
|
|
1877
|
+
let e = Buffer.byteLength(t), i = 512 * Math.ceil(1 + e / 512), r = Buffer.allocUnsafe(i);
|
|
1878
|
+
for (let n = 0; n < 512; n++) r[n] = 0;
|
|
1879
|
+
new F({
|
|
1880
|
+
path: ("PaxHeader/" + basename(this.path ?? "")).slice(0, 99),
|
|
1881
|
+
mode: this.mode || 420,
|
|
1882
|
+
uid: this.uid,
|
|
1883
|
+
gid: this.gid,
|
|
1884
|
+
size: e,
|
|
1885
|
+
mtime: this.mtime,
|
|
1886
|
+
type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader",
|
|
1887
|
+
linkpath: "",
|
|
1888
|
+
uname: this.uname || "",
|
|
1889
|
+
gname: this.gname || "",
|
|
1890
|
+
devmaj: 0,
|
|
1891
|
+
devmin: 0,
|
|
1892
|
+
atime: this.atime,
|
|
1893
|
+
ctime: this.ctime
|
|
1894
|
+
}).encode(r), r.write(t, 512, e, "utf8");
|
|
1895
|
+
for (let n = e + 512; n < r.length; n++) r[n] = 0;
|
|
1896
|
+
return r;
|
|
1897
|
+
}
|
|
1898
|
+
encodeBody() {
|
|
1899
|
+
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");
|
|
1900
|
+
}
|
|
1901
|
+
encodeField(t) {
|
|
1902
|
+
if (this[t] === void 0) return "";
|
|
1903
|
+
let e = this[t], i = e instanceof Date ? e.getTime() / 1e3 : e, r = " " + (t === "dev" || t === "ino" || t === "nlink" ? "SCHILY." : "") + t + "=" + i + `
|
|
1904
|
+
`, n = Buffer.byteLength(r), o = Math.floor(Math.log(n) / Math.log(10)) + 1;
|
|
1905
|
+
return n + o >= Math.pow(10, o) && (o += 1), o + n + r;
|
|
1906
|
+
}
|
|
1907
|
+
static parse(t, e, i = !1) {
|
|
1908
|
+
return new s(On(Tn(t), e), i);
|
|
1909
|
+
}
|
|
1910
|
+
};
|
|
1911
|
+
var On = (s, t) => t ? Object.assign({}, t, s) : s;
|
|
1912
|
+
var Tn = (s) => s.replace(/\n$/, "").split(`
|
|
1913
|
+
`).reduce(xn, Object.create(null));
|
|
1914
|
+
var xn = (s, t) => {
|
|
1915
|
+
let e = parseInt(t, 10);
|
|
1916
|
+
if (e !== Buffer.byteLength(t) + 1) return s;
|
|
1917
|
+
t = t.slice((e + " ").length);
|
|
1918
|
+
let i = t.split("="), r = i.shift();
|
|
1919
|
+
if (!r) return s;
|
|
1920
|
+
let n = r.replace(/^SCHILY\.(dev|ino|nlink)/, "$1"), o = i.join("=").replace(/\0.*/, "");
|
|
1921
|
+
switch (n) {
|
|
1922
|
+
case "path":
|
|
1923
|
+
case "linkpath":
|
|
1924
|
+
case "type":
|
|
1925
|
+
case "charset":
|
|
1926
|
+
case "comment":
|
|
1927
|
+
case "gname":
|
|
1928
|
+
case "uname":
|
|
1929
|
+
s[n] = o;
|
|
1930
|
+
break;
|
|
1931
|
+
case "ctime":
|
|
1932
|
+
case "atime":
|
|
1933
|
+
case "mtime":
|
|
1934
|
+
s[n] = /* @__PURE__ */ new Date(Number(o) * 1e3);
|
|
1935
|
+
break;
|
|
1936
|
+
case "size":
|
|
1937
|
+
let h = +o;
|
|
1938
|
+
h >= 0 && (s[n] = h);
|
|
1939
|
+
break;
|
|
1940
|
+
case "gid":
|
|
1941
|
+
case "uid":
|
|
1942
|
+
case "dev":
|
|
1943
|
+
case "ino":
|
|
1944
|
+
case "nlink":
|
|
1945
|
+
case "mode": s[n] = +o;
|
|
1946
|
+
}
|
|
1947
|
+
return s;
|
|
1948
|
+
};
|
|
1949
|
+
var f = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) !== "win32" ? (s) => String(s) : (s) => String(s).replaceAll(/\\/g, "/");
|
|
1950
|
+
var $e = class extends A {
|
|
1951
|
+
extended;
|
|
1952
|
+
globalExtended;
|
|
1953
|
+
header;
|
|
1954
|
+
startBlockSize;
|
|
1955
|
+
blockRemain;
|
|
1956
|
+
remain;
|
|
1957
|
+
type;
|
|
1958
|
+
meta = !1;
|
|
1959
|
+
ignore = !1;
|
|
1960
|
+
path;
|
|
1961
|
+
mode;
|
|
1962
|
+
uid;
|
|
1963
|
+
gid;
|
|
1964
|
+
uname;
|
|
1965
|
+
gname;
|
|
1966
|
+
size = 0;
|
|
1967
|
+
mtime;
|
|
1968
|
+
atime;
|
|
1969
|
+
ctime;
|
|
1970
|
+
linkpath;
|
|
1971
|
+
dev;
|
|
1972
|
+
ino;
|
|
1973
|
+
nlink;
|
|
1974
|
+
invalid = !1;
|
|
1975
|
+
absolute;
|
|
1976
|
+
unsupported = !1;
|
|
1977
|
+
constructor(t, e, i) {
|
|
1978
|
+
switch (super({}), this.pause(), this.extended = e, this.globalExtended = i, this.header = t, this.remain = t.size ?? 0, this.startBlockSize = 512 * Math.ceil(this.remain / 512), this.blockRemain = this.startBlockSize, this.type = t.type, this.type) {
|
|
1979
|
+
case "File":
|
|
1980
|
+
case "OldFile":
|
|
1981
|
+
case "Link":
|
|
1982
|
+
case "SymbolicLink":
|
|
1983
|
+
case "CharacterDevice":
|
|
1984
|
+
case "BlockDevice":
|
|
1985
|
+
case "Directory":
|
|
1986
|
+
case "FIFO":
|
|
1987
|
+
case "ContiguousFile":
|
|
1988
|
+
case "GNUDumpDir": break;
|
|
1989
|
+
case "NextFileHasLongLinkpath":
|
|
1990
|
+
case "NextFileHasLongPath":
|
|
1991
|
+
case "OldGnuLongPath":
|
|
1992
|
+
case "GlobalExtendedHeader":
|
|
1993
|
+
case "ExtendedHeader":
|
|
1994
|
+
case "OldExtendedHeader":
|
|
1995
|
+
this.meta = !0;
|
|
1996
|
+
break;
|
|
1997
|
+
default: this.ignore = !0;
|
|
1998
|
+
}
|
|
1999
|
+
if (!t.path) throw new Error("no path provided for tar.ReadEntry");
|
|
2000
|
+
this.path = f(t.path), this.mode = t.mode, this.mode && (this.mode = this.mode & 4095), this.uid = t.uid, this.gid = t.gid, this.uname = t.uname, this.gname = t.gname, this.size = this.remain, this.mtime = t.mtime, this.atime = t.atime, this.ctime = t.ctime, this.linkpath = t.linkpath ? f(t.linkpath) : void 0, this.uname = t.uname, this.gname = t.gname, e && this.#t(e), i && this.#t(i, !0);
|
|
2001
|
+
}
|
|
2002
|
+
write(t) {
|
|
2003
|
+
let e = t.length;
|
|
2004
|
+
if (e > this.blockRemain) throw new Error("writing more to entry than is appropriate");
|
|
2005
|
+
let i = this.remain, r = this.blockRemain;
|
|
2006
|
+
return this.remain = Math.max(0, i - e), this.blockRemain = Math.max(0, r - e), this.ignore ? !0 : i >= e ? super.write(t) : super.write(t.subarray(0, i));
|
|
2007
|
+
}
|
|
2008
|
+
#t(t, e = !1) {
|
|
2009
|
+
t.path && (t.path = f(t.path)), t.linkpath && (t.linkpath = f(t.linkpath)), Object.assign(this, Object.fromEntries(Object.entries(t).filter(([i, r]) => !(r == null || i === "path" && e))));
|
|
2010
|
+
}
|
|
2011
|
+
};
|
|
2012
|
+
var Dt = (s, t, e, i = {}) => {
|
|
2013
|
+
s.file && (i.file = s.file), s.cwd && (i.cwd = s.cwd), i.code = e instanceof Error && e.code || t, i.tarCode = t, !s.strict && i.recoverable !== !1 ? (e instanceof Error && (i = Object.assign(e, i), e = e.message), s.emit("warn", t, e, i)) : e instanceof Error ? s.emit("error", Object.assign(e, i)) : s.emit("error", Object.assign(/* @__PURE__ */ new Error(`${t}: ${e}`), i));
|
|
2014
|
+
};
|
|
2015
|
+
var Nn = 1048576;
|
|
2016
|
+
var Xi = Buffer.from([31, 139]);
|
|
2017
|
+
var qi = Buffer.from([
|
|
2018
|
+
40,
|
|
2019
|
+
181,
|
|
2020
|
+
47,
|
|
2021
|
+
253
|
|
2022
|
+
]);
|
|
2023
|
+
var An = Math.max(Xi.length, qi.length);
|
|
2024
|
+
var B = Symbol("state");
|
|
2025
|
+
var Nt = Symbol("writeEntry");
|
|
2026
|
+
var it = Symbol("readEntry");
|
|
2027
|
+
var Zi = Symbol("nextEntry");
|
|
2028
|
+
var Zs = Symbol("processEntry");
|
|
2029
|
+
var V = Symbol("extendedHeader");
|
|
2030
|
+
var he = Symbol("globalExtendedHeader");
|
|
2031
|
+
var dt = Symbol("meta");
|
|
2032
|
+
var Ys = Symbol("emitMeta");
|
|
2033
|
+
var p = Symbol("buffer");
|
|
2034
|
+
var st = Symbol("queue");
|
|
2035
|
+
var ut = Symbol("ended");
|
|
2036
|
+
var Yi = Symbol("emittedEnd");
|
|
2037
|
+
var At = Symbol("emit");
|
|
2038
|
+
var w = Symbol("unzip");
|
|
2039
|
+
var Xe = Symbol("consumeChunk");
|
|
2040
|
+
var qe = Symbol("consumeChunkSub");
|
|
2041
|
+
var Ki = Symbol("consumeBody");
|
|
2042
|
+
var Ks = Symbol("consumeMeta");
|
|
2043
|
+
var Vs = Symbol("consumeHeader");
|
|
2044
|
+
var ae = Symbol("consuming");
|
|
2045
|
+
var Vi = Symbol("bufferConcat");
|
|
2046
|
+
var Qe = Symbol("maybeEnd");
|
|
2047
|
+
var Yt = Symbol("writing");
|
|
2048
|
+
var $ = Symbol("aborted");
|
|
2049
|
+
var Je = Symbol("onDone");
|
|
2050
|
+
var It = Symbol("sawValidEntry");
|
|
2051
|
+
var je = Symbol("sawNullBlock");
|
|
2052
|
+
var ti = Symbol("sawEOF");
|
|
2053
|
+
var $s = Symbol("closeStream");
|
|
2054
|
+
var In = 1e3;
|
|
2055
|
+
var le = Symbol("compressedBytesRead");
|
|
2056
|
+
var $i = Symbol("decompressedBytesRead");
|
|
2057
|
+
var Xs = Symbol("checkDecompressionRatio");
|
|
2058
|
+
var Cn = () => !0;
|
|
2059
|
+
var rt = class extends EventEmitter {
|
|
2060
|
+
file;
|
|
2061
|
+
strict;
|
|
2062
|
+
maxMetaEntrySize;
|
|
2063
|
+
filter;
|
|
2064
|
+
brotli;
|
|
2065
|
+
zstd;
|
|
2066
|
+
maxDecompressionRatio;
|
|
2067
|
+
writable = !0;
|
|
2068
|
+
readable = !1;
|
|
2069
|
+
[st] = [];
|
|
2070
|
+
[p];
|
|
2071
|
+
[it];
|
|
2072
|
+
[Nt];
|
|
2073
|
+
[B] = "begin";
|
|
2074
|
+
[dt] = "";
|
|
2075
|
+
[V];
|
|
2076
|
+
[he];
|
|
2077
|
+
[ut] = !1;
|
|
2078
|
+
[w];
|
|
2079
|
+
[$] = !1;
|
|
2080
|
+
[It];
|
|
2081
|
+
[je] = !1;
|
|
2082
|
+
[ti] = !1;
|
|
2083
|
+
[Yt] = !1;
|
|
2084
|
+
[ae] = !1;
|
|
2085
|
+
[Yi] = !1;
|
|
2086
|
+
[le] = 0;
|
|
2087
|
+
[$i] = 0;
|
|
2088
|
+
constructor(t = {}) {
|
|
2089
|
+
super(), this.file = t.file || "", this.on(Je, () => {
|
|
2090
|
+
(this[B] === "begin" || this[It] === !1) && this.warn("TAR_BAD_ARCHIVE", "Unrecognized archive format");
|
|
2091
|
+
}), t.ondone ? this.on(Je, t.ondone) : this.on(Je, () => {
|
|
2092
|
+
this.emit("prefinish"), this.emit("finish"), this.emit("end");
|
|
2093
|
+
}), this.strict = !!t.strict, this.maxDecompressionRatio = typeof t.maxDecompressionRatio == "number" ? t.maxDecompressionRatio : In, this.maxMetaEntrySize = t.maxMetaEntrySize || Nn, this.filter = typeof t.filter == "function" ? t.filter : Cn;
|
|
2094
|
+
let e = t.file && (t.file.endsWith(".tar.br") || t.file.endsWith(".tbr"));
|
|
2095
|
+
this.brotli = !(t.gzip || t.zstd) && t.brotli !== void 0 ? t.brotli : e ? void 0 : !1;
|
|
2096
|
+
let i = t.file && (t.file.endsWith(".tar.zst") || t.file.endsWith(".tzst"));
|
|
2097
|
+
this.zstd = !(t.gzip || t.brotli) && t.zstd !== void 0 ? t.zstd : i ? !0 : void 0, this.on("end", () => this[$s]()), typeof t.onwarn == "function" && this.on("warn", t.onwarn), typeof t.onReadEntry == "function" && this.on("entry", t.onReadEntry);
|
|
2098
|
+
}
|
|
2099
|
+
warn(t, e, i = {}) {
|
|
2100
|
+
Dt(this, t, e, i);
|
|
2101
|
+
}
|
|
2102
|
+
[Vs](t, e) {
|
|
2103
|
+
this[It] === void 0 && (this[It] = !1);
|
|
2104
|
+
let i;
|
|
2105
|
+
try {
|
|
2106
|
+
i = new F(t, e, this[V], this[he]);
|
|
2107
|
+
} catch (r) {
|
|
2108
|
+
return this.warn("TAR_ENTRY_INVALID", r);
|
|
2109
|
+
}
|
|
2110
|
+
if (i.nullBlock) this[je] ? (this[ti] = !0, this[B] === "begin" && (this[B] = "header"), this[At]("eof")) : (this[je] = !0, this[At]("nullBlock"));
|
|
2111
|
+
else if (this[je] = !1, !i.cksumValid) this.warn("TAR_ENTRY_INVALID", "checksum failure", { header: i });
|
|
2112
|
+
else if (!i.path) this.warn("TAR_ENTRY_INVALID", "path is required", { header: i });
|
|
2113
|
+
else {
|
|
2114
|
+
let r = i.type;
|
|
2115
|
+
if (/^(Symbolic)?Link$/.test(r) && !i.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath required", { header: i });
|
|
2116
|
+
else if (!/^(Symbolic)?Link$/.test(r) && !/^(Global)?ExtendedHeader$/.test(r) && i.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath forbidden", { header: i });
|
|
2117
|
+
else {
|
|
2118
|
+
let n = this[Nt] = new $e(i, this[V], this[he]);
|
|
2119
|
+
if (!this[It]) if (n.remain) {
|
|
2120
|
+
let o = () => {
|
|
2121
|
+
n.invalid || (this[It] = !0);
|
|
2122
|
+
};
|
|
2123
|
+
n.on("end", o);
|
|
2124
|
+
} else this[It] = !0;
|
|
2125
|
+
n.meta ? n.size > this.maxMetaEntrySize ? (n.ignore = !0, this[At]("ignoredEntry", n), this[B] = "ignore", n.resume()) : n.size > 0 && (this[dt] = "", n.on("data", (o) => this[dt] += o), this[B] = "meta") : (this[V] = void 0, n.ignore = n.ignore || !this.filter(n.path, n), n.ignore ? (this[At]("ignoredEntry", n), this[B] = n.remain ? "ignore" : "header", n.resume()) : (n.remain ? this[B] = "body" : (this[B] = "header", n.end()), this[it] ? this[st].push(n) : (this[st].push(n), this[Zi]())));
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
[$s]() {
|
|
2130
|
+
queueMicrotask(() => this.emit("close"));
|
|
2131
|
+
}
|
|
2132
|
+
[Zs](t) {
|
|
2133
|
+
let e = !0;
|
|
2134
|
+
if (!t) this[it] = void 0, e = !1;
|
|
2135
|
+
else if (Array.isArray(t)) {
|
|
2136
|
+
let [i, ...r] = t;
|
|
2137
|
+
this.emit(i, ...r);
|
|
2138
|
+
} else this[it] = t, this.emit("entry", t), t.emittedEnd || (t.on("end", () => this[Zi]()), e = !1);
|
|
2139
|
+
return e;
|
|
2140
|
+
}
|
|
2141
|
+
[Zi]() {
|
|
2142
|
+
do;
|
|
2143
|
+
while (this[Zs](this[st].shift()));
|
|
2144
|
+
if (this[st].length === 0) {
|
|
2145
|
+
let t = this[it];
|
|
2146
|
+
!t || t.flowing || t.size === t.remain ? this[Yt] || this.emit("drain") : t.once("drain", () => this.emit("drain"));
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
[Ki](t, e) {
|
|
2150
|
+
let i = this[Nt];
|
|
2151
|
+
if (!i) throw new Error("attempt to consume body without entry??");
|
|
2152
|
+
let r = i.blockRemain ?? 0, n = r >= t.length && e === 0 ? t : t.subarray(e, e + r);
|
|
2153
|
+
return i.write(n), i.blockRemain || (this[B] = "header", this[Nt] = void 0, i.end()), n.length;
|
|
2154
|
+
}
|
|
2155
|
+
[Ks](t, e) {
|
|
2156
|
+
let i = this[Nt], r = this[Ki](t, e);
|
|
2157
|
+
return !this[Nt] && i && this[Ys](i), r;
|
|
2158
|
+
}
|
|
2159
|
+
[At](t, e, i) {
|
|
2160
|
+
this[st].length === 0 && !this[it] ? this.emit(t, e, i) : this[st].push([
|
|
2161
|
+
t,
|
|
2162
|
+
e,
|
|
2163
|
+
i
|
|
2164
|
+
]);
|
|
2165
|
+
}
|
|
2166
|
+
[Ys](t) {
|
|
2167
|
+
switch (this[At]("meta", this[dt]), t.type) {
|
|
2168
|
+
case "ExtendedHeader":
|
|
2169
|
+
case "OldExtendedHeader":
|
|
2170
|
+
this[V] = ft.parse(this[dt], this[V], !1);
|
|
2171
|
+
break;
|
|
2172
|
+
case "GlobalExtendedHeader":
|
|
2173
|
+
this[he] = ft.parse(this[dt], this[he], !0);
|
|
2174
|
+
break;
|
|
2175
|
+
case "NextFileHasLongPath":
|
|
2176
|
+
case "OldGnuLongPath": {
|
|
2177
|
+
let e = this[V] ?? Object.create(null);
|
|
2178
|
+
this[V] = e, e.path = this[dt].replace(/\0.*/, "");
|
|
2179
|
+
break;
|
|
2180
|
+
}
|
|
2181
|
+
case "NextFileHasLongLinkpath": {
|
|
2182
|
+
let e = this[V] || Object.create(null);
|
|
2183
|
+
this[V] = e, e.linkpath = this[dt].replace(/\0.*/, "");
|
|
2184
|
+
break;
|
|
2185
|
+
}
|
|
2186
|
+
default: throw new Error("unknown meta: " + t.type);
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
abort(t) {
|
|
2190
|
+
if (!this[$]) {
|
|
2191
|
+
if (this[w]) {
|
|
2192
|
+
let e = this[w];
|
|
2193
|
+
e.write = () => !0, e.end = () => e, e.emit = () => !1, e.destroy?.();
|
|
2194
|
+
}
|
|
2195
|
+
this[$] = !0, this.emit("abort", t), this.warn("TAR_ABORT", t, { recoverable: !1 });
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
[Xs](t) {
|
|
2199
|
+
this[$i] += t.length;
|
|
2200
|
+
let e = this[$i] / this[le];
|
|
2201
|
+
return e > this.maxDecompressionRatio ? (this.abort(/* @__PURE__ */ new Error(`max decompression ratio exceeded: ${e.toFixed(2)} > ${this.maxDecompressionRatio}`)), !1) : !0;
|
|
2202
|
+
}
|
|
2203
|
+
write(t, e, i) {
|
|
2204
|
+
if (typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, typeof e == "string" ? e : "utf8")), this[$]) return i?.(), !1;
|
|
2205
|
+
if ((this[w] === void 0 || this.brotli === void 0 && this[w] === !1) && t) {
|
|
2206
|
+
if (this[p] && (t = Buffer.concat([this[p], t]), this[p] = void 0), t.length < An) return this[p] = t, i?.(), !0;
|
|
2207
|
+
for (let a = 0; this[w] === void 0 && a < Xi.length; a++) t[a] !== Xi[a] && (this[w] = !1);
|
|
2208
|
+
let o = !1;
|
|
2209
|
+
if (this[w] === !1 && this.zstd !== !1) {
|
|
2210
|
+
o = !0;
|
|
2211
|
+
for (let a = 0; a < qi.length; a++) if (t[a] !== qi[a]) {
|
|
2212
|
+
o = !1;
|
|
2213
|
+
break;
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
let h = this.brotli === void 0 && !o;
|
|
2217
|
+
if (this[w] === !1 && h) if (t.length < 512) if (this[ut]) this.brotli = !0;
|
|
2218
|
+
else return this[p] = t, i?.(), !0;
|
|
2219
|
+
else try {
|
|
2220
|
+
new F(t.subarray(0, 512)), this.brotli = !1;
|
|
2221
|
+
} catch {
|
|
2222
|
+
this.brotli = !0;
|
|
2223
|
+
}
|
|
2224
|
+
if (this[w] === void 0 || this[w] === !1 && (this.brotli || o)) {
|
|
2225
|
+
let a = this[ut];
|
|
2226
|
+
this[ut] = !1, this[w] = this[w] === void 0 ? new Ue({}) : o ? new Ke({}) : new Ge({}), this[w].on("data", (c) => {
|
|
2227
|
+
this[Xs](c) && this[Xe](c);
|
|
2228
|
+
}), this[w].on("error", (c) => {
|
|
2229
|
+
this[$] || this.abort(c);
|
|
2230
|
+
}), this[w].on("end", () => {
|
|
2231
|
+
this[ut] = !0, this[Xe]();
|
|
2232
|
+
}), this[Yt] = !0, this[le] += t.length;
|
|
2233
|
+
let l = !!this[w][a ? "end" : "write"](t);
|
|
2234
|
+
return this[Yt] = !1, i?.(), l;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
this[Yt] = !0, this[w] ? (this[le] += t.length, this[w].write(t)) : this[Xe](t), this[Yt] = !1;
|
|
2238
|
+
let n = this[st].length > 0 ? !1 : this[it] ? this[it].flowing : !0;
|
|
2239
|
+
return !n && this[st].length === 0 && this[it]?.once("drain", () => this.emit("drain")), i?.(), n;
|
|
2240
|
+
}
|
|
2241
|
+
[Vi](t) {
|
|
2242
|
+
t && !this[$] && (this[p] = this[p] ? Buffer.concat([this[p], t]) : t);
|
|
2243
|
+
}
|
|
2244
|
+
[Qe]() {
|
|
2245
|
+
if (this[ut] && !this[Yi] && !this[$] && !this[ae]) {
|
|
2246
|
+
this[Yi] = !0;
|
|
2247
|
+
let t = this[Nt];
|
|
2248
|
+
if (t?.blockRemain) {
|
|
2249
|
+
let e = this[p] ? this[p].length : 0;
|
|
2250
|
+
this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`, { entry: t }), this[p] && t.write(this[p]), t.end();
|
|
2251
|
+
}
|
|
2252
|
+
this[At](Je);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
[Xe](t) {
|
|
2256
|
+
if (this[ae] && t) this[Vi](t);
|
|
2257
|
+
else if (!t && !this[p]) this[Qe]();
|
|
2258
|
+
else if (t) {
|
|
2259
|
+
if (this[ae] = !0, this[p]) {
|
|
2260
|
+
this[Vi](t);
|
|
2261
|
+
let e = this[p];
|
|
2262
|
+
this[p] = void 0, this[qe](e);
|
|
2263
|
+
} else this[qe](t);
|
|
2264
|
+
for (; this[p] && this[p]?.length >= 512 && !this[$] && !this[ti];) {
|
|
2265
|
+
let e = this[p];
|
|
2266
|
+
this[p] = void 0, this[qe](e);
|
|
2267
|
+
}
|
|
2268
|
+
this[ae] = !1;
|
|
2269
|
+
}
|
|
2270
|
+
(!this[p] || this[ut]) && this[Qe]();
|
|
2271
|
+
}
|
|
2272
|
+
[qe](t) {
|
|
2273
|
+
let e = 0, i = t.length;
|
|
2274
|
+
for (; e + 512 <= i && !this[$] && !this[ti];) switch (this[B]) {
|
|
2275
|
+
case "begin":
|
|
2276
|
+
case "header":
|
|
2277
|
+
this[Vs](t, e), e += 512;
|
|
2278
|
+
break;
|
|
2279
|
+
case "ignore":
|
|
2280
|
+
case "body":
|
|
2281
|
+
e += this[Ki](t, e);
|
|
2282
|
+
break;
|
|
2283
|
+
case "meta":
|
|
2284
|
+
e += this[Ks](t, e);
|
|
2285
|
+
break;
|
|
2286
|
+
default: throw new Error("invalid state: " + this[B]);
|
|
2287
|
+
}
|
|
2288
|
+
e < i && (this[p] = this[p] ? Buffer.concat([t.subarray(e), this[p]]) : t.subarray(e));
|
|
2289
|
+
}
|
|
2290
|
+
end(t, e, i) {
|
|
2291
|
+
return typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, e)), i && this.once("finish", i), this[$] || (this[w] ? (t && (this[le] += t.length, this[w].write(t)), this[w].end()) : (this[ut] = !0, (this.brotli === void 0 || this.zstd === void 0) && (t = t || Buffer.alloc(0)), t && this.write(t), this[Qe]())), this;
|
|
2292
|
+
}
|
|
2293
|
+
};
|
|
2294
|
+
var mt = (s) => {
|
|
2295
|
+
let t = s.length - 1, e = -1;
|
|
2296
|
+
for (; t > -1 && s.charAt(t) === "/";) e = t, t--;
|
|
2297
|
+
return e === -1 ? s : s.slice(0, e);
|
|
2298
|
+
};
|
|
2299
|
+
var vn = (s) => {
|
|
2300
|
+
let t = s.onReadEntry;
|
|
2301
|
+
s.onReadEntry = t ? (e) => {
|
|
2302
|
+
t(e), e.resume();
|
|
2303
|
+
} : (e) => e.resume();
|
|
2304
|
+
};
|
|
2305
|
+
var Qi = (s, t) => {
|
|
2306
|
+
let e = new Map(t.map((o) => [mt(o), !0])), i = s.filter, r = 100, n = (o, h = "", a = 0) => {
|
|
2307
|
+
if (a >= r) return e.set(o, !1), !1;
|
|
2308
|
+
let l = h || parse(o).root || ".", c;
|
|
2309
|
+
if (o === l) c = !1;
|
|
2310
|
+
else {
|
|
2311
|
+
let d = e.get(o);
|
|
2312
|
+
c = d !== void 0 ? d : n(dirname(o), l, a + 1);
|
|
2313
|
+
}
|
|
2314
|
+
return e.set(o, c), c;
|
|
2315
|
+
};
|
|
2316
|
+
s.filter = i ? (o, h) => i(o, h) && n(mt(o)) : (o) => n(mt(o));
|
|
2317
|
+
};
|
|
2318
|
+
var Mn = (s) => {
|
|
2319
|
+
let t = new rt(s), e = s.file, i;
|
|
2320
|
+
try {
|
|
2321
|
+
i = fs.openSync(e, "r");
|
|
2322
|
+
let r = fs.fstatSync(i), n = s.maxReadSize || 16777216;
|
|
2323
|
+
if (r.size < n) {
|
|
2324
|
+
let o = Buffer.allocUnsafe(r.size), h = fs.readSync(i, o, 0, r.size, 0);
|
|
2325
|
+
t.end(h === o.byteLength ? o : o.subarray(0, h));
|
|
2326
|
+
} else {
|
|
2327
|
+
let o = 0, h = Buffer.allocUnsafe(n);
|
|
2328
|
+
for (; o < r.size;) {
|
|
2329
|
+
let a = fs.readSync(i, h, 0, n, o);
|
|
2330
|
+
if (a === 0) break;
|
|
2331
|
+
o += a, t.write(h.subarray(0, a));
|
|
2332
|
+
}
|
|
2333
|
+
t.end();
|
|
2334
|
+
}
|
|
2335
|
+
} finally {
|
|
2336
|
+
if (typeof i == "number") try {
|
|
2337
|
+
fs.closeSync(i);
|
|
2338
|
+
} catch {}
|
|
2339
|
+
}
|
|
2340
|
+
};
|
|
2341
|
+
var Bn = (s, t) => {
|
|
2342
|
+
let e = new rt(s), i = s.maxReadSize || 16777216, r = s.file;
|
|
2343
|
+
return new Promise((o, h) => {
|
|
2344
|
+
e.on("error", h), e.on("end", o), fs.stat(r, (a, l) => {
|
|
2345
|
+
if (a) h(a);
|
|
2346
|
+
else {
|
|
2347
|
+
let c = new _t(r, {
|
|
2348
|
+
readSize: i,
|
|
2349
|
+
size: l.size
|
|
2350
|
+
});
|
|
2351
|
+
c.on("error", h), c.pipe(e);
|
|
2352
|
+
}
|
|
2353
|
+
});
|
|
2354
|
+
});
|
|
2355
|
+
};
|
|
2356
|
+
var Ct = K(Mn, Bn, (s) => new rt(s), (s) => new rt(s), (s, t) => {
|
|
2357
|
+
t?.length && Qi(s, t), s.noResume || vn(s);
|
|
2358
|
+
});
|
|
2359
|
+
var Ji = (s, t, e) => (s &= 4095, e && (s = (s | 384) & -19), t && (s & 256 && (s |= 64), s & 32 && (s |= 8), s & 4 && (s |= 1)), s);
|
|
2360
|
+
var { isAbsolute: zn, parse: qs } = win32, ce = (s) => {
|
|
2361
|
+
let t = "", e = qs(s);
|
|
2362
|
+
for (; zn(s) || e.root;) {
|
|
2363
|
+
let i = s.charAt(0) === "/" && s.slice(0, 4) !== "//?/" ? "/" : e.root;
|
|
2364
|
+
s = s.slice(i.length), t += i, e = qs(s);
|
|
2365
|
+
}
|
|
2366
|
+
return [t, s];
|
|
2367
|
+
};
|
|
2368
|
+
var ei = [
|
|
2369
|
+
"|",
|
|
2370
|
+
"<",
|
|
2371
|
+
">",
|
|
2372
|
+
"?",
|
|
2373
|
+
":"
|
|
2374
|
+
];
|
|
2375
|
+
var ji = ei.map((s) => String.fromCodePoint(61440 + Number(s.codePointAt(0))));
|
|
2376
|
+
var Un = new Map(ei.map((s, t) => [s, ji[t]]));
|
|
2377
|
+
var Hn = new Map(ji.map((s, t) => [s, ei[t]]));
|
|
2378
|
+
var ts = (s) => ei.reduce((t, e) => t.split(e).join(Un.get(e)), s);
|
|
2379
|
+
var Qs = (s) => ji.reduce((t, e) => t.split(e).join(Hn.get(e)), s);
|
|
2380
|
+
var rr = (s, t) => t ? (s = f(s).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s) : f(s);
|
|
2381
|
+
var Wn = 16777216;
|
|
2382
|
+
var tr = Symbol("process");
|
|
2383
|
+
var er = Symbol("file");
|
|
2384
|
+
var ir = Symbol("directory");
|
|
2385
|
+
var is = Symbol("symlink");
|
|
2386
|
+
var sr = Symbol("hardlink");
|
|
2387
|
+
var fe = Symbol("header");
|
|
2388
|
+
var ii = Symbol("read");
|
|
2389
|
+
var ss = Symbol("lstat");
|
|
2390
|
+
var si = Symbol("onlstat");
|
|
2391
|
+
var rs = Symbol("onread");
|
|
2392
|
+
var ns = Symbol("onreadlink");
|
|
2393
|
+
var os$1 = Symbol("openfile");
|
|
2394
|
+
var hs = Symbol("onopenfile");
|
|
2395
|
+
var pt = Symbol("close");
|
|
2396
|
+
var ri = Symbol("mode");
|
|
2397
|
+
var as = Symbol("awaitDrain");
|
|
2398
|
+
var es = Symbol("ondrain");
|
|
2399
|
+
var q = Symbol("prefix");
|
|
2400
|
+
var de = class extends A {
|
|
2401
|
+
path;
|
|
2402
|
+
portable;
|
|
2403
|
+
myuid = process.getuid && process.getuid() || 0;
|
|
2404
|
+
myuser = process.env.USER || "";
|
|
2405
|
+
maxReadSize;
|
|
2406
|
+
linkCache;
|
|
2407
|
+
statCache;
|
|
2408
|
+
preservePaths;
|
|
2409
|
+
cwd;
|
|
2410
|
+
strict;
|
|
2411
|
+
mtime;
|
|
2412
|
+
noPax;
|
|
2413
|
+
noMtime;
|
|
2414
|
+
prefix;
|
|
2415
|
+
fd;
|
|
2416
|
+
blockLen = 0;
|
|
2417
|
+
blockRemain = 0;
|
|
2418
|
+
buf;
|
|
2419
|
+
pos = 0;
|
|
2420
|
+
remain = 0;
|
|
2421
|
+
length = 0;
|
|
2422
|
+
offset = 0;
|
|
2423
|
+
win32;
|
|
2424
|
+
absolute;
|
|
2425
|
+
header;
|
|
2426
|
+
type;
|
|
2427
|
+
linkpath;
|
|
2428
|
+
stat;
|
|
2429
|
+
onWriteEntry;
|
|
2430
|
+
#t = !1;
|
|
2431
|
+
constructor(t, e = {}) {
|
|
2432
|
+
let i = se(e);
|
|
2433
|
+
super(), this.path = f(t), this.portable = !!i.portable, this.maxReadSize = i.maxReadSize || Wn, this.linkCache = i.linkCache || /* @__PURE__ */ new Map(), this.statCache = i.statCache || /* @__PURE__ */ new Map(), this.preservePaths = !!i.preservePaths, this.cwd = f(i.cwd || process.cwd()), this.strict = !!i.strict, this.noPax = !!i.noPax, this.noMtime = !!i.noMtime, this.mtime = i.mtime, this.prefix = i.prefix ? f(i.prefix) : void 0, this.onWriteEntry = i.onWriteEntry, typeof i.onwarn == "function" && this.on("warn", i.onwarn);
|
|
2434
|
+
let r = !1;
|
|
2435
|
+
if (!this.preservePaths) {
|
|
2436
|
+
let [o, h] = ce(this.path);
|
|
2437
|
+
o && typeof h == "string" && (this.path = h, r = o);
|
|
2438
|
+
}
|
|
2439
|
+
this.win32 = !!i.win32 || process.platform === "win32", this.win32 && (this.path = Qs(this.path.replaceAll(/\\/g, "/")), t = t.replaceAll(/\\/g, "/")), this.absolute = f(i.absolute || ar.resolve(this.cwd, t)), this.path === "" && (this.path = "./"), r && this.warn("TAR_ENTRY_INFO", `stripping ${r} from absolute path`, {
|
|
2440
|
+
entry: this,
|
|
2441
|
+
path: r + this.path
|
|
2442
|
+
});
|
|
2443
|
+
let n = this.statCache.get(this.absolute);
|
|
2444
|
+
n ? this[si](n) : this[ss]();
|
|
2445
|
+
}
|
|
2446
|
+
warn(t, e, i = {}) {
|
|
2447
|
+
return Dt(this, t, e, i);
|
|
2448
|
+
}
|
|
2449
|
+
emit(t, ...e) {
|
|
2450
|
+
return t === "error" && (this.#t = !0), super.emit(t, ...e);
|
|
2451
|
+
}
|
|
2452
|
+
[ss]() {
|
|
2453
|
+
I.lstat(this.absolute, (t, e) => {
|
|
2454
|
+
if (t) return this.emit("error", t);
|
|
2455
|
+
this[si](e);
|
|
2456
|
+
});
|
|
2457
|
+
}
|
|
2458
|
+
[si](t) {
|
|
2459
|
+
this.statCache.set(this.absolute, t), this.stat = t, t.isFile() || (t.size = 0), this.type = Gn(t), this.emit("stat", t), this[tr]();
|
|
2460
|
+
}
|
|
2461
|
+
[tr]() {
|
|
2462
|
+
switch (this.type) {
|
|
2463
|
+
case "File": return this[er]();
|
|
2464
|
+
case "Directory": return this[ir]();
|
|
2465
|
+
case "SymbolicLink": return this[is]();
|
|
2466
|
+
default: return this.end();
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
[ri](t) {
|
|
2470
|
+
return Ji(t, this.type === "Directory", this.portable);
|
|
2471
|
+
}
|
|
2472
|
+
[q](t) {
|
|
2473
|
+
return rr(t, this.prefix);
|
|
2474
|
+
}
|
|
2475
|
+
[fe]() {
|
|
2476
|
+
if (!this.stat) throw new Error("cannot write header before stat");
|
|
2477
|
+
this.type === "Directory" && this.portable && (this.noMtime = !0), this.onWriteEntry?.(this), this.header = new F({
|
|
2478
|
+
path: this[q](this.path),
|
|
2479
|
+
linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[q](this.linkpath) : this.linkpath,
|
|
2480
|
+
mode: this[ri](this.stat.mode),
|
|
2481
|
+
uid: this.portable ? void 0 : this.stat.uid,
|
|
2482
|
+
gid: this.portable ? void 0 : this.stat.gid,
|
|
2483
|
+
size: this.stat.size,
|
|
2484
|
+
mtime: this.noMtime ? void 0 : this.mtime || this.stat.mtime,
|
|
2485
|
+
type: this.type === "Unsupported" ? void 0 : this.type,
|
|
2486
|
+
uname: this.portable ? void 0 : this.stat.uid === this.myuid ? this.myuser : "",
|
|
2487
|
+
atime: this.portable ? void 0 : this.stat.atime,
|
|
2488
|
+
ctime: this.portable ? void 0 : this.stat.ctime
|
|
2489
|
+
}), this.header.encode() && !this.noPax && super.write(new ft({
|
|
2490
|
+
atime: this.portable ? void 0 : this.header.atime,
|
|
2491
|
+
ctime: this.portable ? void 0 : this.header.ctime,
|
|
2492
|
+
gid: this.portable ? void 0 : this.header.gid,
|
|
2493
|
+
mtime: this.noMtime ? void 0 : this.mtime || this.header.mtime,
|
|
2494
|
+
path: this[q](this.path),
|
|
2495
|
+
linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[q](this.linkpath) : this.linkpath,
|
|
2496
|
+
size: this.header.size,
|
|
2497
|
+
uid: this.portable ? void 0 : this.header.uid,
|
|
2498
|
+
uname: this.portable ? void 0 : this.header.uname,
|
|
2499
|
+
dev: this.portable ? void 0 : this.stat.dev,
|
|
2500
|
+
ino: this.portable ? void 0 : this.stat.ino,
|
|
2501
|
+
nlink: this.portable ? void 0 : this.stat.nlink
|
|
2502
|
+
}).encode());
|
|
2503
|
+
let t = this.header?.block;
|
|
2504
|
+
if (!t) throw new Error("failed to encode header");
|
|
2505
|
+
super.write(t);
|
|
2506
|
+
}
|
|
2507
|
+
[ir]() {
|
|
2508
|
+
if (!this.stat) throw new Error("cannot create directory entry without stat");
|
|
2509
|
+
this.path.slice(-1) !== "/" && (this.path += "/"), this.stat.size = 0, this[fe](), this.end();
|
|
2510
|
+
}
|
|
2511
|
+
[is]() {
|
|
2512
|
+
I.readlink(this.absolute, (t, e) => {
|
|
2513
|
+
if (t) return this.emit("error", t);
|
|
2514
|
+
this[ns](e);
|
|
2515
|
+
});
|
|
2516
|
+
}
|
|
2517
|
+
[ns](t) {
|
|
2518
|
+
this.linkpath = f(t), this[fe](), this.end();
|
|
2519
|
+
}
|
|
2520
|
+
[sr](t) {
|
|
2521
|
+
if (!this.stat) throw new Error("cannot create link entry without stat");
|
|
2522
|
+
this.type = "Link", this.linkpath = f(ar.relative(this.cwd, t)), this.stat.size = 0, this[fe](), this.end();
|
|
2523
|
+
}
|
|
2524
|
+
[er]() {
|
|
2525
|
+
if (!this.stat) throw new Error("cannot create file entry without stat");
|
|
2526
|
+
if (this.stat.nlink > 1) {
|
|
2527
|
+
let t = `${this.stat.dev}:${this.stat.ino}`, e = this.linkCache.get(t);
|
|
2528
|
+
if (e?.indexOf(this.cwd) === 0) return this[sr](e);
|
|
2529
|
+
this.linkCache.set(t, this.absolute);
|
|
2530
|
+
}
|
|
2531
|
+
if (this[fe](), this.stat.size === 0) return this.end();
|
|
2532
|
+
this[os$1]();
|
|
2533
|
+
}
|
|
2534
|
+
[os$1]() {
|
|
2535
|
+
I.open(this.absolute, "r", (t, e) => {
|
|
2536
|
+
if (t) return this.emit("error", t);
|
|
2537
|
+
this[hs](e);
|
|
2538
|
+
});
|
|
2539
|
+
}
|
|
2540
|
+
[hs](t) {
|
|
2541
|
+
if (this.fd = t, this.#t) return this[pt]();
|
|
2542
|
+
if (!this.stat) throw new Error("should stat before calling onopenfile");
|
|
2543
|
+
this.blockLen = 512 * Math.ceil(this.stat.size / 512), this.blockRemain = this.blockLen;
|
|
2544
|
+
let e = Math.min(this.blockLen, this.maxReadSize);
|
|
2545
|
+
this.buf = Buffer.allocUnsafe(e), this.offset = 0, this.pos = 0, this.remain = this.stat.size, this.length = this.buf.length, this[ii]();
|
|
2546
|
+
}
|
|
2547
|
+
[ii]() {
|
|
2548
|
+
let { fd: t, buf: e, offset: i, length: r, pos: n } = this;
|
|
2549
|
+
if (t === void 0 || e === void 0) throw new Error("cannot read file without first opening");
|
|
2550
|
+
I.read(t, e, i, r, n, (o, h) => {
|
|
2551
|
+
if (o) return this[pt](() => this.emit("error", o));
|
|
2552
|
+
this[rs](h);
|
|
2553
|
+
});
|
|
2554
|
+
}
|
|
2555
|
+
[pt](t = () => {}) {
|
|
2556
|
+
this.fd !== void 0 && I.close(this.fd, t);
|
|
2557
|
+
}
|
|
2558
|
+
[rs](t) {
|
|
2559
|
+
if (t <= 0 && this.remain > 0) {
|
|
2560
|
+
let r = Object.assign(/* @__PURE__ */ new Error("encountered unexpected EOF"), {
|
|
2561
|
+
path: this.absolute,
|
|
2562
|
+
syscall: "read",
|
|
2563
|
+
code: "EOF"
|
|
2564
|
+
});
|
|
2565
|
+
return this[pt](() => this.emit("error", r));
|
|
2566
|
+
}
|
|
2567
|
+
if (t > this.remain) {
|
|
2568
|
+
let r = Object.assign(/* @__PURE__ */ new Error("did not encounter expected EOF"), {
|
|
2569
|
+
path: this.absolute,
|
|
2570
|
+
syscall: "read",
|
|
2571
|
+
code: "EOF"
|
|
2572
|
+
});
|
|
2573
|
+
return this[pt](() => this.emit("error", r));
|
|
2574
|
+
}
|
|
2575
|
+
if (!this.buf) throw new Error("should have created buffer prior to reading");
|
|
2576
|
+
if (t === this.remain) for (let r = t; r < this.length && t < this.blockRemain; r++) this.buf[r + this.offset] = 0, t++, this.remain++;
|
|
2577
|
+
let e = this.offset === 0 && t === this.buf.length ? this.buf : this.buf.subarray(this.offset, this.offset + t);
|
|
2578
|
+
this.write(e) ? this[es]() : this[as](() => this[es]());
|
|
2579
|
+
}
|
|
2580
|
+
[as](t) {
|
|
2581
|
+
this.once("drain", t);
|
|
2582
|
+
}
|
|
2583
|
+
write(t, e, i) {
|
|
2584
|
+
if (typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, typeof e == "string" ? e : "utf8")), this.blockRemain < t.length) {
|
|
2585
|
+
let r = Object.assign(/* @__PURE__ */ new Error("writing more data than expected"), { path: this.absolute });
|
|
2586
|
+
return this.emit("error", r);
|
|
2587
|
+
}
|
|
2588
|
+
return this.remain -= t.length, this.blockRemain -= t.length, this.pos += t.length, this.offset += t.length, super.write(t, null, i);
|
|
2589
|
+
}
|
|
2590
|
+
[es]() {
|
|
2591
|
+
if (!this.remain) return this.blockRemain && super.write(Buffer.alloc(this.blockRemain)), this[pt]((t) => t ? this.emit("error", t) : this.end());
|
|
2592
|
+
if (!this.buf) throw new Error("buffer lost somehow in ONDRAIN");
|
|
2593
|
+
this.offset >= this.length && (this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)), this.offset = 0), this.length = this.buf.length - this.offset, this[ii]();
|
|
2594
|
+
}
|
|
2595
|
+
};
|
|
2596
|
+
var ni = class extends de {
|
|
2597
|
+
sync = !0;
|
|
2598
|
+
[ss]() {
|
|
2599
|
+
this[si](I.lstatSync(this.absolute));
|
|
2600
|
+
}
|
|
2601
|
+
[is]() {
|
|
2602
|
+
this[ns](I.readlinkSync(this.absolute));
|
|
2603
|
+
}
|
|
2604
|
+
[os$1]() {
|
|
2605
|
+
this[hs](I.openSync(this.absolute, "r"));
|
|
2606
|
+
}
|
|
2607
|
+
[ii]() {
|
|
2608
|
+
let t = !0;
|
|
2609
|
+
try {
|
|
2610
|
+
let { fd: e, buf: i, offset: r, length: n, pos: o } = this;
|
|
2611
|
+
if (e === void 0 || i === void 0) throw new Error("fd and buf must be set in READ method");
|
|
2612
|
+
let h = I.readSync(e, i, r, n, o);
|
|
2613
|
+
this[rs](h), t = !1;
|
|
2614
|
+
} finally {
|
|
2615
|
+
if (t) try {
|
|
2616
|
+
this[pt](() => {});
|
|
2617
|
+
} catch {}
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
[as](t) {
|
|
2621
|
+
t();
|
|
2622
|
+
}
|
|
2623
|
+
[pt](t = () => {}) {
|
|
2624
|
+
this.fd !== void 0 && I.closeSync(this.fd), t();
|
|
2625
|
+
}
|
|
2626
|
+
};
|
|
2627
|
+
var oi = class extends A {
|
|
2628
|
+
blockLen = 0;
|
|
2629
|
+
blockRemain = 0;
|
|
2630
|
+
buf = 0;
|
|
2631
|
+
pos = 0;
|
|
2632
|
+
remain = 0;
|
|
2633
|
+
length = 0;
|
|
2634
|
+
preservePaths;
|
|
2635
|
+
portable;
|
|
2636
|
+
strict;
|
|
2637
|
+
noPax;
|
|
2638
|
+
noMtime;
|
|
2639
|
+
readEntry;
|
|
2640
|
+
type;
|
|
2641
|
+
prefix;
|
|
2642
|
+
path;
|
|
2643
|
+
mode;
|
|
2644
|
+
uid;
|
|
2645
|
+
gid;
|
|
2646
|
+
uname;
|
|
2647
|
+
gname;
|
|
2648
|
+
header;
|
|
2649
|
+
mtime;
|
|
2650
|
+
atime;
|
|
2651
|
+
ctime;
|
|
2652
|
+
linkpath;
|
|
2653
|
+
size;
|
|
2654
|
+
onWriteEntry;
|
|
2655
|
+
warn(t, e, i = {}) {
|
|
2656
|
+
return Dt(this, t, e, i);
|
|
2657
|
+
}
|
|
2658
|
+
constructor(t, e = {}) {
|
|
2659
|
+
let i = se(e);
|
|
2660
|
+
super(), this.preservePaths = !!i.preservePaths, this.portable = !!i.portable, this.strict = !!i.strict, this.noPax = !!i.noPax, this.noMtime = !!i.noMtime, this.onWriteEntry = i.onWriteEntry, this.readEntry = t;
|
|
2661
|
+
let { type: r } = t;
|
|
2662
|
+
if (r === "Unsupported") throw new Error("writing entry that should be ignored");
|
|
2663
|
+
this.type = r, this.type === "Directory" && this.portable && (this.noMtime = !0), this.prefix = i.prefix, this.path = f(t.path), this.mode = t.mode !== void 0 ? this[ri](t.mode) : void 0, this.uid = this.portable ? void 0 : t.uid, this.gid = this.portable ? void 0 : t.gid, this.uname = this.portable ? void 0 : t.uname, this.gname = this.portable ? void 0 : t.gname, this.size = t.size, this.mtime = this.noMtime ? void 0 : i.mtime || t.mtime, this.atime = this.portable ? void 0 : t.atime, this.ctime = this.portable ? void 0 : t.ctime, this.linkpath = t.linkpath !== void 0 ? f(t.linkpath) : void 0, typeof i.onwarn == "function" && this.on("warn", i.onwarn);
|
|
2664
|
+
let n = !1;
|
|
2665
|
+
if (!this.preservePaths) {
|
|
2666
|
+
let [h, a] = ce(this.path);
|
|
2667
|
+
h && typeof a == "string" && (this.path = a, n = h);
|
|
2668
|
+
}
|
|
2669
|
+
this.remain = t.size, this.blockRemain = t.startBlockSize, this.onWriteEntry?.(this), this.header = new F({
|
|
2670
|
+
path: this[q](this.path),
|
|
2671
|
+
linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[q](this.linkpath) : this.linkpath,
|
|
2672
|
+
mode: this.mode,
|
|
2673
|
+
uid: this.portable ? void 0 : this.uid,
|
|
2674
|
+
gid: this.portable ? void 0 : this.gid,
|
|
2675
|
+
size: this.size,
|
|
2676
|
+
mtime: this.noMtime ? void 0 : this.mtime,
|
|
2677
|
+
type: this.type,
|
|
2678
|
+
uname: this.portable ? void 0 : this.uname,
|
|
2679
|
+
atime: this.portable ? void 0 : this.atime,
|
|
2680
|
+
ctime: this.portable ? void 0 : this.ctime
|
|
2681
|
+
}), n && this.warn("TAR_ENTRY_INFO", `stripping ${n} from absolute path`, {
|
|
2682
|
+
entry: this,
|
|
2683
|
+
path: n + this.path
|
|
2684
|
+
}), this.header.encode() && !this.noPax && super.write(new ft({
|
|
2685
|
+
atime: this.portable ? void 0 : this.atime,
|
|
2686
|
+
ctime: this.portable ? void 0 : this.ctime,
|
|
2687
|
+
gid: this.portable ? void 0 : this.gid,
|
|
2688
|
+
mtime: this.noMtime ? void 0 : this.mtime,
|
|
2689
|
+
path: this[q](this.path),
|
|
2690
|
+
linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[q](this.linkpath) : this.linkpath,
|
|
2691
|
+
size: this.size,
|
|
2692
|
+
uid: this.portable ? void 0 : this.uid,
|
|
2693
|
+
uname: this.portable ? void 0 : this.uname,
|
|
2694
|
+
dev: this.portable ? void 0 : this.readEntry.dev,
|
|
2695
|
+
ino: this.portable ? void 0 : this.readEntry.ino,
|
|
2696
|
+
nlink: this.portable ? void 0 : this.readEntry.nlink
|
|
2697
|
+
}).encode());
|
|
2698
|
+
let o = this.header?.block;
|
|
2699
|
+
if (!o) throw new Error("failed to encode header");
|
|
2700
|
+
super.write(o), t.pipe(this);
|
|
2701
|
+
}
|
|
2702
|
+
[q](t) {
|
|
2703
|
+
return rr(t, this.prefix);
|
|
2704
|
+
}
|
|
2705
|
+
[ri](t) {
|
|
2706
|
+
return Ji(t, this.type === "Directory", this.portable);
|
|
2707
|
+
}
|
|
2708
|
+
write(t, e, i) {
|
|
2709
|
+
typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, typeof e == "string" ? e : "utf8"));
|
|
2710
|
+
let r = t.length;
|
|
2711
|
+
if (r > this.blockRemain) throw new Error("writing more to entry than is appropriate");
|
|
2712
|
+
return this.blockRemain -= r, super.write(t, i);
|
|
2713
|
+
}
|
|
2714
|
+
end(t, e, i) {
|
|
2715
|
+
return this.blockRemain && super.write(Buffer.alloc(this.blockRemain)), typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, e ?? "utf8")), i && this.once("finish", i), t ? super.end(t, i) : super.end(i), this;
|
|
2716
|
+
}
|
|
2717
|
+
};
|
|
2718
|
+
var Gn = (s) => s.isFile() ? "File" : s.isDirectory() ? "Directory" : s.isSymbolicLink() ? "SymbolicLink" : "Unsupported";
|
|
2719
|
+
var hi = class s {
|
|
2720
|
+
tail;
|
|
2721
|
+
head;
|
|
2722
|
+
length = 0;
|
|
2723
|
+
static create(t = []) {
|
|
2724
|
+
return new s(t);
|
|
2725
|
+
}
|
|
2726
|
+
constructor(t = []) {
|
|
2727
|
+
for (let e of t) this.push(e);
|
|
2728
|
+
}
|
|
2729
|
+
*[Symbol.iterator]() {
|
|
2730
|
+
for (let t = this.head; t; t = t.next) yield t.value;
|
|
2731
|
+
}
|
|
2732
|
+
removeNode(t) {
|
|
2733
|
+
if (t.list !== this) throw new Error("removing node which does not belong to this list");
|
|
2734
|
+
let e = t.next, i = t.prev;
|
|
2735
|
+
return e && (e.prev = i), i && (i.next = e), t === this.head && (this.head = e), t === this.tail && (this.tail = i), this.length--, t.next = void 0, t.prev = void 0, t.list = void 0, e;
|
|
2736
|
+
}
|
|
2737
|
+
unshiftNode(t) {
|
|
2738
|
+
if (t === this.head) return;
|
|
2739
|
+
t.list && t.list.removeNode(t);
|
|
2740
|
+
let e = this.head;
|
|
2741
|
+
t.list = this, t.next = e, e && (e.prev = t), this.head = t, this.tail || (this.tail = t), this.length++;
|
|
2742
|
+
}
|
|
2743
|
+
pushNode(t) {
|
|
2744
|
+
if (t === this.tail) return;
|
|
2745
|
+
t.list && t.list.removeNode(t);
|
|
2746
|
+
let e = this.tail;
|
|
2747
|
+
t.list = this, t.prev = e, e && (e.next = t), this.tail = t, this.head || (this.head = t), this.length++;
|
|
2748
|
+
}
|
|
2749
|
+
push(...t) {
|
|
2750
|
+
for (let e = 0, i = t.length; e < i; e++) Yn(this, t[e]);
|
|
2751
|
+
return this.length;
|
|
2752
|
+
}
|
|
2753
|
+
unshift(...t) {
|
|
2754
|
+
for (var e = 0, i = t.length; e < i; e++) Kn(this, t[e]);
|
|
2755
|
+
return this.length;
|
|
2756
|
+
}
|
|
2757
|
+
pop() {
|
|
2758
|
+
if (!this.tail) return;
|
|
2759
|
+
let t = this.tail.value, e = this.tail;
|
|
2760
|
+
return this.tail = this.tail.prev, this.tail ? this.tail.next = void 0 : this.head = void 0, e.list = void 0, this.length--, t;
|
|
2761
|
+
}
|
|
2762
|
+
shift() {
|
|
2763
|
+
if (!this.head) return;
|
|
2764
|
+
let t = this.head.value, e = this.head;
|
|
2765
|
+
return this.head = this.head.next, this.head ? this.head.prev = void 0 : this.tail = void 0, e.list = void 0, this.length--, t;
|
|
2766
|
+
}
|
|
2767
|
+
forEach(t, e) {
|
|
2768
|
+
e = e || this;
|
|
2769
|
+
for (let i = this.head, r = 0; i; r++) t.call(e, i.value, r, this), i = i.next;
|
|
2770
|
+
}
|
|
2771
|
+
forEachReverse(t, e) {
|
|
2772
|
+
e = e || this;
|
|
2773
|
+
for (let i = this.tail, r = this.length - 1; i; r--) t.call(e, i.value, r, this), i = i.prev;
|
|
2774
|
+
}
|
|
2775
|
+
get(t) {
|
|
2776
|
+
let e = 0, i = this.head;
|
|
2777
|
+
for (; i && e < t; e++) i = i.next;
|
|
2778
|
+
if (e === t && i) return i.value;
|
|
2779
|
+
}
|
|
2780
|
+
getReverse(t) {
|
|
2781
|
+
let e = 0, i = this.tail;
|
|
2782
|
+
for (; i && e < t; e++) i = i.prev;
|
|
2783
|
+
if (e === t && i) return i.value;
|
|
2784
|
+
}
|
|
2785
|
+
map(t, e) {
|
|
2786
|
+
e = e || this;
|
|
2787
|
+
let i = new s();
|
|
2788
|
+
for (let r = this.head; r;) i.push(t.call(e, r.value, this)), r = r.next;
|
|
2789
|
+
return i;
|
|
2790
|
+
}
|
|
2791
|
+
mapReverse(t, e) {
|
|
2792
|
+
e = e || this;
|
|
2793
|
+
var i = new s();
|
|
2794
|
+
for (let r = this.tail; r;) i.push(t.call(e, r.value, this)), r = r.prev;
|
|
2795
|
+
return i;
|
|
2796
|
+
}
|
|
2797
|
+
reduce(t, e) {
|
|
2798
|
+
let i, r = this.head;
|
|
2799
|
+
if (arguments.length > 1) i = e;
|
|
2800
|
+
else if (this.head) r = this.head.next, i = this.head.value;
|
|
2801
|
+
else throw new TypeError("Reduce of empty list with no initial value");
|
|
2802
|
+
for (var n = 0; r; n++) i = t(i, r.value, n), r = r.next;
|
|
2803
|
+
return i;
|
|
2804
|
+
}
|
|
2805
|
+
reduceReverse(t, e) {
|
|
2806
|
+
let i, r = this.tail;
|
|
2807
|
+
if (arguments.length > 1) i = e;
|
|
2808
|
+
else if (this.tail) r = this.tail.prev, i = this.tail.value;
|
|
2809
|
+
else throw new TypeError("Reduce of empty list with no initial value");
|
|
2810
|
+
for (let n = this.length - 1; r; n--) i = t(i, r.value, n), r = r.prev;
|
|
2811
|
+
return i;
|
|
2812
|
+
}
|
|
2813
|
+
toArray() {
|
|
2814
|
+
let t = new Array(this.length);
|
|
2815
|
+
for (let e = 0, i = this.head; i; e++) t[e] = i.value, i = i.next;
|
|
2816
|
+
return t;
|
|
2817
|
+
}
|
|
2818
|
+
toArrayReverse() {
|
|
2819
|
+
let t = new Array(this.length);
|
|
2820
|
+
for (let e = 0, i = this.tail; i; e++) t[e] = i.value, i = i.prev;
|
|
2821
|
+
return t;
|
|
2822
|
+
}
|
|
2823
|
+
slice(t = 0, e = this.length) {
|
|
2824
|
+
e < 0 && (e += this.length), t < 0 && (t += this.length);
|
|
2825
|
+
let i = new s();
|
|
2826
|
+
if (e < t || e < 0) return i;
|
|
2827
|
+
t < 0 && (t = 0), e > this.length && (e = this.length);
|
|
2828
|
+
let r = this.head, n = 0;
|
|
2829
|
+
for (n = 0; r && n < t; n++) r = r.next;
|
|
2830
|
+
for (; r && n < e; n++, r = r.next) i.push(r.value);
|
|
2831
|
+
return i;
|
|
2832
|
+
}
|
|
2833
|
+
sliceReverse(t = 0, e = this.length) {
|
|
2834
|
+
e < 0 && (e += this.length), t < 0 && (t += this.length);
|
|
2835
|
+
let i = new s();
|
|
2836
|
+
if (e < t || e < 0) return i;
|
|
2837
|
+
t < 0 && (t = 0), e > this.length && (e = this.length);
|
|
2838
|
+
let r = this.length, n = this.tail;
|
|
2839
|
+
for (; n && r > e; r--) n = n.prev;
|
|
2840
|
+
for (; n && r > t; r--, n = n.prev) i.push(n.value);
|
|
2841
|
+
return i;
|
|
2842
|
+
}
|
|
2843
|
+
splice(t, e = 0, ...i) {
|
|
2844
|
+
t > this.length && (t = this.length - 1), t < 0 && (t = this.length + t);
|
|
2845
|
+
let r = this.head;
|
|
2846
|
+
for (let o = 0; r && o < t; o++) r = r.next;
|
|
2847
|
+
let n = [];
|
|
2848
|
+
for (let o = 0; r && o < e; o++) n.push(r.value), r = this.removeNode(r);
|
|
2849
|
+
r ? r !== this.tail && (r = r.prev) : r = this.tail;
|
|
2850
|
+
for (let o of i) r = Zn(this, r, o);
|
|
2851
|
+
return n;
|
|
2852
|
+
}
|
|
2853
|
+
reverse() {
|
|
2854
|
+
let t = this.head, e = this.tail;
|
|
2855
|
+
for (let i = t; i; i = i.prev) {
|
|
2856
|
+
let r = i.prev;
|
|
2857
|
+
i.prev = i.next, i.next = r;
|
|
2858
|
+
}
|
|
2859
|
+
return this.head = e, this.tail = t, this;
|
|
2860
|
+
}
|
|
2861
|
+
};
|
|
2862
|
+
function Zn(s, t, e) {
|
|
2863
|
+
let n = new ue(e, t, t ? t.next : s.head, s);
|
|
2864
|
+
return n.next === void 0 && (s.tail = n), n.prev === void 0 && (s.head = n), s.length++, n;
|
|
2865
|
+
}
|
|
2866
|
+
function Yn(s, t) {
|
|
2867
|
+
s.tail = new ue(t, s.tail, void 0, s), s.head || (s.head = s.tail), s.length++;
|
|
2868
|
+
}
|
|
2869
|
+
function Kn(s, t) {
|
|
2870
|
+
s.head = new ue(t, void 0, s.head, s), s.tail || (s.tail = s.head), s.length++;
|
|
2871
|
+
}
|
|
2872
|
+
var ue = class {
|
|
2873
|
+
list;
|
|
2874
|
+
next;
|
|
2875
|
+
prev;
|
|
2876
|
+
value;
|
|
2877
|
+
constructor(t, e, i, r) {
|
|
2878
|
+
this.list = r, this.value = t, e ? (e.next = this, this.prev = e) : this.prev = void 0, i ? (i.prev = this, this.next = i) : this.next = void 0;
|
|
2879
|
+
}
|
|
2880
|
+
};
|
|
2881
|
+
var pi = class {
|
|
2882
|
+
path;
|
|
2883
|
+
absolute;
|
|
2884
|
+
entry;
|
|
2885
|
+
stat;
|
|
2886
|
+
readdir;
|
|
2887
|
+
pending = !1;
|
|
2888
|
+
pendingLink = !1;
|
|
2889
|
+
ignore = !1;
|
|
2890
|
+
piped = !1;
|
|
2891
|
+
constructor(t, e) {
|
|
2892
|
+
this.path = t || "./", this.absolute = e;
|
|
2893
|
+
}
|
|
2894
|
+
};
|
|
2895
|
+
var nr = Buffer.alloc(1024);
|
|
2896
|
+
var li = Symbol("onStat");
|
|
2897
|
+
var me = Symbol("ended");
|
|
2898
|
+
var W = Symbol("queue");
|
|
2899
|
+
var pe = Symbol("pendingLinks");
|
|
2900
|
+
var Et = Symbol("current");
|
|
2901
|
+
var Ft = Symbol("process");
|
|
2902
|
+
var Ee = Symbol("processing");
|
|
2903
|
+
var ai = Symbol("processJob");
|
|
2904
|
+
var G = Symbol("jobs");
|
|
2905
|
+
var ls = Symbol("jobDone");
|
|
2906
|
+
var ci = Symbol("addFSEntry");
|
|
2907
|
+
var or = Symbol("addTarEntry");
|
|
2908
|
+
var ds = Symbol("stat");
|
|
2909
|
+
var us = Symbol("readdir");
|
|
2910
|
+
var fi = Symbol("onreaddir");
|
|
2911
|
+
var di = Symbol("pipe");
|
|
2912
|
+
var hr = Symbol("entry");
|
|
2913
|
+
var cs = Symbol("entryOpt");
|
|
2914
|
+
var ui = Symbol("writeEntryClass");
|
|
2915
|
+
var lr = Symbol("write");
|
|
2916
|
+
var fs$1 = Symbol("ondrain");
|
|
2917
|
+
var wt = class extends A {
|
|
2918
|
+
sync = !1;
|
|
2919
|
+
opt;
|
|
2920
|
+
cwd;
|
|
2921
|
+
maxReadSize;
|
|
2922
|
+
preservePaths;
|
|
2923
|
+
strict;
|
|
2924
|
+
noPax;
|
|
2925
|
+
prefix;
|
|
2926
|
+
linkCache;
|
|
2927
|
+
statCache;
|
|
2928
|
+
file;
|
|
2929
|
+
portable;
|
|
2930
|
+
zip;
|
|
2931
|
+
readdirCache;
|
|
2932
|
+
noDirRecurse;
|
|
2933
|
+
follow;
|
|
2934
|
+
noMtime;
|
|
2935
|
+
mtime;
|
|
2936
|
+
filter;
|
|
2937
|
+
jobs;
|
|
2938
|
+
[ui];
|
|
2939
|
+
onWriteEntry;
|
|
2940
|
+
[W];
|
|
2941
|
+
[pe] = /* @__PURE__ */ new Map();
|
|
2942
|
+
[G] = 0;
|
|
2943
|
+
[Ee] = !1;
|
|
2944
|
+
[me] = !1;
|
|
2945
|
+
constructor(t = {}) {
|
|
2946
|
+
if (super(), this.opt = t, this.file = t.file || "", this.cwd = t.cwd || process.cwd(), this.maxReadSize = t.maxReadSize, this.preservePaths = !!t.preservePaths, this.strict = !!t.strict, this.noPax = !!t.noPax, this.prefix = f(t.prefix || ""), this.linkCache = t.linkCache || /* @__PURE__ */ new Map(), this.statCache = t.statCache || /* @__PURE__ */ new Map(), this.readdirCache = t.readdirCache || /* @__PURE__ */ new Map(), this.onWriteEntry = t.onWriteEntry, this[ui] = de, typeof t.onwarn == "function" && this.on("warn", t.onwarn), this.portable = !!t.portable, t.gzip || t.brotli || t.zstd) {
|
|
2947
|
+
if ((t.gzip ? 1 : 0) + (t.brotli ? 1 : 0) + (t.zstd ? 1 : 0) > 1) throw new TypeError("gzip, brotli, zstd are mutually exclusive");
|
|
2948
|
+
if (t.gzip && (typeof t.gzip != "object" && (t.gzip = {}), this.portable && (t.gzip.portable = !0), this.zip = new ze(t.gzip)), t.brotli && (typeof t.brotli != "object" && (t.brotli = {}), this.zip = new We(t.brotli)), t.zstd && (typeof t.zstd != "object" && (t.zstd = {}), this.zip = new Ye(t.zstd)), !this.zip) throw new Error("impossible");
|
|
2949
|
+
let e = this.zip;
|
|
2950
|
+
e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$1]()), this.on("resume", () => e.resume());
|
|
2951
|
+
} else this.on("drain", this[fs$1]);
|
|
2952
|
+
this.noDirRecurse = !!t.noDirRecurse, this.follow = !!t.follow, this.noMtime = !!t.noMtime, t.mtime && (this.mtime = t.mtime), this.filter = typeof t.filter == "function" ? t.filter : () => !0, this[W] = new hi(), this[G] = 0, this.jobs = Number(t.jobs) || 4, this[Ee] = !1, this[me] = !1;
|
|
2953
|
+
}
|
|
2954
|
+
[lr](t) {
|
|
2955
|
+
return super.write(t);
|
|
2956
|
+
}
|
|
2957
|
+
add(t) {
|
|
2958
|
+
return this.write(t), this;
|
|
2959
|
+
}
|
|
2960
|
+
end(t, e, i) {
|
|
2961
|
+
return typeof t == "function" && (i = t, t = void 0), typeof e == "function" && (i = e, e = void 0), t && this.add(t), this[me] = !0, this[Ft](), i && i(), this;
|
|
2962
|
+
}
|
|
2963
|
+
write(t) {
|
|
2964
|
+
if (this[me]) throw new Error("write after end");
|
|
2965
|
+
return typeof t == "string" ? this[ci](t) : this[or](t), this.flowing;
|
|
2966
|
+
}
|
|
2967
|
+
[or](t) {
|
|
2968
|
+
let e = f(ar.resolve(this.cwd, t.path));
|
|
2969
|
+
if (!this.filter(t.path, t)) t.resume();
|
|
2970
|
+
else {
|
|
2971
|
+
let i = new pi(t.path, e);
|
|
2972
|
+
i.entry = new oi(t, this[cs](i)), i.entry.on("end", () => this[ls](i)), this[G] += 1, this[W].push(i);
|
|
2973
|
+
}
|
|
2974
|
+
this[Ft]();
|
|
2975
|
+
}
|
|
2976
|
+
[ci](t) {
|
|
2977
|
+
let e = f(ar.resolve(this.cwd, t));
|
|
2978
|
+
this[W].push(new pi(t, e)), this[Ft]();
|
|
2979
|
+
}
|
|
2980
|
+
[ds](t) {
|
|
2981
|
+
t.pending = !0, this[G] += 1;
|
|
2982
|
+
let e = this.follow ? "stat" : "lstat";
|
|
2983
|
+
I[e](t.absolute, (i, r) => {
|
|
2984
|
+
t.pending = !1, this[G] -= 1, i ? this.emit("error", i) : this[li](t, r);
|
|
2985
|
+
});
|
|
2986
|
+
}
|
|
2987
|
+
[li](t, e) {
|
|
2988
|
+
if (this.statCache.set(t.absolute, e), t.stat = e, !this.filter(t.path, e)) t.ignore = !0;
|
|
2989
|
+
else if (e.isFile() && e.nlink > 1 && !this.linkCache.get(`${e.dev}:${e.ino}`) && !this.sync) if (t === this[Et]) this[ai](t);
|
|
2990
|
+
else {
|
|
2991
|
+
let i = `${e.dev}:${e.ino}`, r = this[pe].get(i);
|
|
2992
|
+
r ? r.push(t) : this[pe].set(i, [t]), t.pendingLink = !0, t.pending = !0;
|
|
2993
|
+
}
|
|
2994
|
+
this[Ft]();
|
|
2995
|
+
}
|
|
2996
|
+
[us](t) {
|
|
2997
|
+
t.pending = !0, this[G] += 1, I.readdir(t.absolute, (e, i) => {
|
|
2998
|
+
if (t.pending = !1, this[G] -= 1, e) return this.emit("error", e);
|
|
2999
|
+
this[fi](t, i);
|
|
3000
|
+
});
|
|
3001
|
+
}
|
|
3002
|
+
[fi](t, e) {
|
|
3003
|
+
this.readdirCache.set(t.absolute, e), t.readdir = e, this[Ft]();
|
|
3004
|
+
}
|
|
3005
|
+
[Ft]() {
|
|
3006
|
+
if (!this[Ee]) {
|
|
3007
|
+
this[Ee] = !0;
|
|
3008
|
+
for (let t = this[W].head; t && this[G] < this.jobs; t = t.next) if (this[ai](t.value), t.value.ignore) {
|
|
3009
|
+
let e = t.next;
|
|
3010
|
+
this[W].removeNode(t), t.next = e;
|
|
3011
|
+
}
|
|
3012
|
+
this[Ee] = !1, this[me] && this[W].length === 0 && this[G] === 0 && (this.zip ? this.zip.end(nr) : (super.write(nr), super.end()));
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
get [Et]() {
|
|
3016
|
+
return this[W] && this[W].head && this[W].head.value;
|
|
3017
|
+
}
|
|
3018
|
+
[ls](t) {
|
|
3019
|
+
this[W].shift(), this[G] -= 1;
|
|
3020
|
+
let { stat: e } = t;
|
|
3021
|
+
if (e && e.isFile() && e.nlink > 1) {
|
|
3022
|
+
let i = `${e.dev}:${e.ino}`, r = this[pe].get(i);
|
|
3023
|
+
if (r) {
|
|
3024
|
+
this[pe].delete(i);
|
|
3025
|
+
for (let n of r) n.pending = !1, this[ai](n);
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
this[Ft]();
|
|
3029
|
+
}
|
|
3030
|
+
[ai](t) {
|
|
3031
|
+
if (t.pending && t.pendingLink && t === this[Et] && (t.pending = !1, t.pendingLink = !1), !t.pending) {
|
|
3032
|
+
if (t.entry) {
|
|
3033
|
+
t === this[Et] && !t.piped && this[di](t);
|
|
3034
|
+
return;
|
|
3035
|
+
}
|
|
3036
|
+
if (!t.stat) {
|
|
3037
|
+
let e = this.statCache.get(t.absolute);
|
|
3038
|
+
e ? this[li](t, e) : this[ds](t);
|
|
3039
|
+
}
|
|
3040
|
+
if (t.stat && !t.ignore) {
|
|
3041
|
+
if (!this.noDirRecurse && t.stat.isDirectory() && !t.readdir) {
|
|
3042
|
+
let e = this.readdirCache.get(t.absolute);
|
|
3043
|
+
if (e ? this[fi](t, e) : this[us](t), !t.readdir) return;
|
|
3044
|
+
}
|
|
3045
|
+
if (t.entry = this[hr](t), !t.entry) {
|
|
3046
|
+
t.ignore = !0;
|
|
3047
|
+
return;
|
|
3048
|
+
}
|
|
3049
|
+
t === this[Et] && !t.piped && this[di](t);
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
[cs](t) {
|
|
3054
|
+
return {
|
|
3055
|
+
onwarn: (e, i, r) => this.warn(e, i, r),
|
|
3056
|
+
noPax: this.noPax,
|
|
3057
|
+
cwd: this.cwd,
|
|
3058
|
+
absolute: t.absolute,
|
|
3059
|
+
preservePaths: this.preservePaths,
|
|
3060
|
+
maxReadSize: this.maxReadSize,
|
|
3061
|
+
strict: this.strict,
|
|
3062
|
+
portable: this.portable,
|
|
3063
|
+
linkCache: this.linkCache,
|
|
3064
|
+
statCache: this.statCache,
|
|
3065
|
+
noMtime: this.noMtime,
|
|
3066
|
+
mtime: this.mtime,
|
|
3067
|
+
prefix: this.prefix,
|
|
3068
|
+
onWriteEntry: this.onWriteEntry
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3071
|
+
[hr](t) {
|
|
3072
|
+
this[G] += 1;
|
|
3073
|
+
try {
|
|
3074
|
+
return new this[ui](t.path, this[cs](t)).on("end", () => this[ls](t)).on("error", (i) => this.emit("error", i));
|
|
3075
|
+
} catch (e) {
|
|
3076
|
+
this.emit("error", e);
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
[fs$1]() {
|
|
3080
|
+
this[Et] && this[Et].entry && this[Et].entry.resume();
|
|
3081
|
+
}
|
|
3082
|
+
[di](t) {
|
|
3083
|
+
t.piped = !0, t.readdir && t.readdir.forEach((r) => {
|
|
3084
|
+
let n = t.path, o = n === "./" ? "" : n.replace(/\/*$/, "/");
|
|
3085
|
+
this[ci](o + r);
|
|
3086
|
+
});
|
|
3087
|
+
let e = t.entry, i = this.zip;
|
|
3088
|
+
if (!e) throw new Error("cannot pipe without source");
|
|
3089
|
+
i ? e.on("data", (r) => {
|
|
3090
|
+
i.write(r) || e.pause();
|
|
3091
|
+
}) : e.on("data", (r) => {
|
|
3092
|
+
super.write(r) || e.pause();
|
|
3093
|
+
});
|
|
3094
|
+
}
|
|
3095
|
+
pause() {
|
|
3096
|
+
return this.zip && this.zip.pause(), super.pause();
|
|
3097
|
+
}
|
|
3098
|
+
warn(t, e, i = {}) {
|
|
3099
|
+
Dt(this, t, e, i);
|
|
3100
|
+
}
|
|
3101
|
+
};
|
|
3102
|
+
var kt = class extends wt {
|
|
3103
|
+
sync = !0;
|
|
3104
|
+
constructor(t) {
|
|
3105
|
+
super(t), this[ui] = ni;
|
|
3106
|
+
}
|
|
3107
|
+
pause() {}
|
|
3108
|
+
resume() {}
|
|
3109
|
+
[ds](t) {
|
|
3110
|
+
let e = this.follow ? "statSync" : "lstatSync";
|
|
3111
|
+
this[li](t, I[e](t.absolute));
|
|
3112
|
+
}
|
|
3113
|
+
[us](t) {
|
|
3114
|
+
this[fi](t, I.readdirSync(t.absolute));
|
|
3115
|
+
}
|
|
3116
|
+
[di](t) {
|
|
3117
|
+
let e = t.entry, i = this.zip;
|
|
3118
|
+
if (t.readdir && t.readdir.forEach((r) => {
|
|
3119
|
+
let n = t.path, o = n === "./" ? "" : n.replace(/\/*$/, "/");
|
|
3120
|
+
this[ci](o + r);
|
|
3121
|
+
}), !e) throw new Error("Cannot pipe without source");
|
|
3122
|
+
i ? e.on("data", (r) => {
|
|
3123
|
+
i.write(r);
|
|
3124
|
+
}) : e.on("data", (r) => {
|
|
3125
|
+
super[lr](r);
|
|
3126
|
+
});
|
|
3127
|
+
}
|
|
3128
|
+
};
|
|
3129
|
+
var Vn = (s, t) => {
|
|
3130
|
+
let e = new kt(s), i = new Wt(s.file, { mode: s.mode || 438 });
|
|
3131
|
+
e.pipe(i), fr(e, t);
|
|
3132
|
+
};
|
|
3133
|
+
var $n = (s, t) => {
|
|
3134
|
+
let e = new wt(s), i = new et(s.file, { mode: s.mode || 438 });
|
|
3135
|
+
e.pipe(i);
|
|
3136
|
+
let r = new Promise((n, o) => {
|
|
3137
|
+
i.on("error", o), i.on("close", n), e.on("error", o);
|
|
3138
|
+
});
|
|
3139
|
+
return dr(e, t).catch((n) => e.emit("error", n)), r;
|
|
3140
|
+
};
|
|
3141
|
+
var fr = (s, t) => {
|
|
3142
|
+
t.forEach((e) => {
|
|
3143
|
+
e.charAt(0) === "@" ? Ct({
|
|
3144
|
+
file: path.resolve(s.cwd, e.slice(1)),
|
|
3145
|
+
sync: !0,
|
|
3146
|
+
noResume: !0,
|
|
3147
|
+
onReadEntry: (i) => s.add(i)
|
|
3148
|
+
}) : s.add(e);
|
|
3149
|
+
}), s.end();
|
|
3150
|
+
};
|
|
3151
|
+
var dr = async (s, t) => {
|
|
3152
|
+
for (let e of t) e.charAt(0) === "@" ? await Ct({
|
|
3153
|
+
file: path.resolve(String(s.cwd), e.slice(1)),
|
|
3154
|
+
noResume: !0,
|
|
3155
|
+
onReadEntry: (i) => {
|
|
3156
|
+
s.add(i);
|
|
3157
|
+
}
|
|
3158
|
+
}) : s.add(e);
|
|
3159
|
+
s.end();
|
|
3160
|
+
};
|
|
3161
|
+
var Xn = (s, t) => {
|
|
3162
|
+
let e = new kt(s);
|
|
3163
|
+
return fr(e, t), e;
|
|
3164
|
+
};
|
|
3165
|
+
var qn = (s, t) => {
|
|
3166
|
+
let e = new wt(s);
|
|
3167
|
+
return dr(e, t).catch((i) => e.emit("error", i)), e;
|
|
3168
|
+
};
|
|
3169
|
+
var Qn = K(Vn, $n, Xn, qn, (s, t) => {
|
|
3170
|
+
if (!t?.length) throw new TypeError("no paths specified to add to archive");
|
|
3171
|
+
});
|
|
3172
|
+
var Er = (process.env.__FAKE_PLATFORM__ || process.platform) === "win32", { O_CREAT: wr, O_NOFOLLOW: ur, O_TRUNC: Sr, O_WRONLY: yr } = I.constants, Rr = Number(process.env.__FAKE_FS_O_FILENAME__) || I.constants.UV_FS_O_FILEMAP || 0, jn = Er && !!Rr, to = 524288, eo = Rr | Sr | wr | yr, mr = !Er && typeof ur == "number" ? ur | Sr | wr | yr : null, ms = mr !== null ? () => mr : jn ? (s) => s < to ? eo : "w" : () => "w";
|
|
3173
|
+
var ps = (s, t, e) => {
|
|
3174
|
+
try {
|
|
3175
|
+
return fs.lchownSync(s, t, e);
|
|
3176
|
+
} catch (i) {
|
|
3177
|
+
if (i?.code !== "ENOENT") throw i;
|
|
3178
|
+
}
|
|
3179
|
+
};
|
|
3180
|
+
var Ei = (s, t, e, i) => {
|
|
3181
|
+
fs.lchown(s, t, e, (r) => {
|
|
3182
|
+
i(r && r?.code !== "ENOENT" ? r : null);
|
|
3183
|
+
});
|
|
3184
|
+
};
|
|
3185
|
+
var io = (s, t, e, i, r) => {
|
|
3186
|
+
if (t.isDirectory()) Es(path.resolve(s, t.name), e, i, (n) => {
|
|
3187
|
+
if (n) return r(n);
|
|
3188
|
+
Ei(path.resolve(s, t.name), e, i, r);
|
|
3189
|
+
});
|
|
3190
|
+
else Ei(path.resolve(s, t.name), e, i, r);
|
|
3191
|
+
};
|
|
3192
|
+
var Es = (s, t, e, i) => {
|
|
3193
|
+
fs.readdir(s, { withFileTypes: !0 }, (r, n) => {
|
|
3194
|
+
if (r) {
|
|
3195
|
+
if (r.code === "ENOENT") return i();
|
|
3196
|
+
if (r.code !== "ENOTDIR" && r.code !== "ENOTSUP") return i(r);
|
|
3197
|
+
}
|
|
3198
|
+
if (r || !n.length) return Ei(s, t, e, i);
|
|
3199
|
+
let o = n.length, h = null, a = (l) => {
|
|
3200
|
+
if (!h) {
|
|
3201
|
+
if (l) return i(h = l);
|
|
3202
|
+
if (--o === 0) return Ei(s, t, e, i);
|
|
3203
|
+
}
|
|
3204
|
+
};
|
|
3205
|
+
for (let l of n) io(s, l, t, e, a);
|
|
3206
|
+
});
|
|
3207
|
+
};
|
|
3208
|
+
var so = (s, t, e, i) => {
|
|
3209
|
+
t.isDirectory() && ws(path.resolve(s, t.name), e, i), ps(path.resolve(s, t.name), e, i);
|
|
3210
|
+
};
|
|
3211
|
+
var ws = (s, t, e) => {
|
|
3212
|
+
let i;
|
|
3213
|
+
try {
|
|
3214
|
+
i = fs.readdirSync(s, { withFileTypes: !0 });
|
|
3215
|
+
} catch (r) {
|
|
3216
|
+
let n = r;
|
|
3217
|
+
if (n?.code === "ENOENT") return;
|
|
3218
|
+
if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP") return ps(s, t, e);
|
|
3219
|
+
throw n;
|
|
3220
|
+
}
|
|
3221
|
+
for (let r of i) so(s, r, t, e);
|
|
3222
|
+
return ps(s, t, e);
|
|
3223
|
+
};
|
|
3224
|
+
var Se = class extends Error {
|
|
3225
|
+
path;
|
|
3226
|
+
code;
|
|
3227
|
+
syscall = "chdir";
|
|
3228
|
+
constructor(t, e) {
|
|
3229
|
+
super(`${e}: Cannot cd into '${t}'`), this.path = t, this.code = e;
|
|
3230
|
+
}
|
|
3231
|
+
get name() {
|
|
3232
|
+
return "CwdError";
|
|
3233
|
+
}
|
|
3234
|
+
};
|
|
3235
|
+
var St = class extends Error {
|
|
3236
|
+
path;
|
|
3237
|
+
symlink;
|
|
3238
|
+
syscall = "symlink";
|
|
3239
|
+
code = "TAR_SYMLINK_ERROR";
|
|
3240
|
+
constructor(t, e) {
|
|
3241
|
+
super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"), this.symlink = t, this.path = e;
|
|
3242
|
+
}
|
|
3243
|
+
get name() {
|
|
3244
|
+
return "SymlinkError";
|
|
3245
|
+
}
|
|
3246
|
+
};
|
|
3247
|
+
var no = (s, t) => {
|
|
3248
|
+
fs.stat(s, (e, i) => {
|
|
3249
|
+
(e || !i.isDirectory()) && (e = new Se(s, e?.code || "ENOTDIR")), t(e);
|
|
3250
|
+
});
|
|
3251
|
+
};
|
|
3252
|
+
var gr = (s, t, e) => {
|
|
3253
|
+
s = f(s);
|
|
3254
|
+
let i = t.umask ?? 18, r = t.mode | 448, n = (r & i) !== 0, o = t.uid, h = t.gid, a = typeof o == "number" && typeof h == "number" && (o !== t.processUid || h !== t.processGid), l = t.preserve, c = t.unlink, d = f(t.cwd), y = (E, x) => {
|
|
3255
|
+
E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ? fs.chmod(s, r, e) : e();
|
|
3256
|
+
};
|
|
3257
|
+
if (s === d) return no(s, y);
|
|
3258
|
+
if (l) return ro.mkdir(s, {
|
|
3259
|
+
mode: r,
|
|
3260
|
+
recursive: !0
|
|
3261
|
+
}).then((E) => y(null, E ?? void 0), y);
|
|
3262
|
+
Ss(d, f(path.relative(d, s)).split("/"), r, c, d, void 0, y);
|
|
3263
|
+
};
|
|
3264
|
+
var Ss = (s, t, e, i, r, n, o) => {
|
|
3265
|
+
if (t.length === 0) return o(null, n);
|
|
3266
|
+
let h = t.shift(), a = f(path.resolve(s + "/" + h));
|
|
3267
|
+
fs.mkdir(a, e, br(a, t, e, i, r, n, o));
|
|
3268
|
+
};
|
|
3269
|
+
var br = (s, t, e, i, r, n, o) => (h) => {
|
|
3270
|
+
h ? fs.lstat(s, (a, l) => {
|
|
3271
|
+
if (a) a.path = a.path && f(a.path), o(a);
|
|
3272
|
+
else if (l.isDirectory()) Ss(s, t, e, i, r, n, o);
|
|
3273
|
+
else if (i) fs.unlink(s, (c) => {
|
|
3274
|
+
if (c) return o(c);
|
|
3275
|
+
fs.mkdir(s, e, br(s, t, e, i, r, n, o));
|
|
3276
|
+
});
|
|
3277
|
+
else {
|
|
3278
|
+
if (l.isSymbolicLink()) return o(new St(s, s + "/" + t.join("/")));
|
|
3279
|
+
o(h);
|
|
3280
|
+
}
|
|
3281
|
+
}) : (n = n || s, Ss(s, t, e, i, r, n, o));
|
|
3282
|
+
};
|
|
3283
|
+
var oo = (s) => {
|
|
3284
|
+
let t = !1, e;
|
|
3285
|
+
try {
|
|
3286
|
+
t = fs.statSync(s).isDirectory();
|
|
3287
|
+
} catch (i) {
|
|
3288
|
+
e = i?.code;
|
|
3289
|
+
} finally {
|
|
3290
|
+
if (!t) throw new Se(s, e ?? "ENOTDIR");
|
|
3291
|
+
}
|
|
3292
|
+
};
|
|
3293
|
+
var _r = (s, t) => {
|
|
3294
|
+
s = f(s);
|
|
3295
|
+
let e = t.umask ?? 18, i = t.mode | 448, r = (i & e) !== 0, n = t.uid, o = t.gid, h = typeof n == "number" && typeof o == "number" && (n !== t.processUid || o !== t.processGid), a = t.preserve, l = t.unlink, c = f(t.cwd), d = (E) => {
|
|
3296
|
+
E && h && ws(E, n, o), r && fs.chmodSync(s, i);
|
|
3297
|
+
};
|
|
3298
|
+
if (s === c) return oo(c), d();
|
|
3299
|
+
if (a) return d(fs.mkdirSync(s, {
|
|
3300
|
+
mode: i,
|
|
3301
|
+
recursive: !0
|
|
3302
|
+
}) ?? void 0);
|
|
3303
|
+
let T = f(path.relative(c, s)).split("/"), D;
|
|
3304
|
+
for (let E = T.shift(), x = c; E && (x += "/" + E); E = T.shift()) {
|
|
3305
|
+
x = f(path.resolve(x));
|
|
3306
|
+
try {
|
|
3307
|
+
fs.mkdirSync(x, i), D = D || x;
|
|
3308
|
+
} catch {
|
|
3309
|
+
let Le = fs.lstatSync(x);
|
|
3310
|
+
if (Le.isDirectory()) continue;
|
|
3311
|
+
if (l) {
|
|
3312
|
+
fs.unlinkSync(x), fs.mkdirSync(x, i), D = D || x;
|
|
3313
|
+
continue;
|
|
3314
|
+
} else if (Le.isSymbolicLink()) return new St(x, x + "/" + T.join("/"));
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
return d(D);
|
|
3318
|
+
};
|
|
3319
|
+
var ys = Object.create(null);
|
|
3320
|
+
var Or = 1e4;
|
|
3321
|
+
var Vt = /* @__PURE__ */ new Set();
|
|
3322
|
+
var Tr = (s) => {
|
|
3323
|
+
Vt.has(s) ? Vt.delete(s) : ys[s] = s.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"), Vt.add(s);
|
|
3324
|
+
let t = ys[s], e = Vt.size - Or;
|
|
3325
|
+
if (e > Or / 10) {
|
|
3326
|
+
for (let i of Vt) if (Vt.delete(i), delete ys[i], --e <= 0) break;
|
|
3327
|
+
}
|
|
3328
|
+
return t;
|
|
3329
|
+
};
|
|
3330
|
+
var ao = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
|
|
3331
|
+
var lo = (s) => s.split("/").slice(0, -1).reduce((e, i) => {
|
|
3332
|
+
let r = e.at(-1);
|
|
3333
|
+
return r !== void 0 && (i = join(r, i)), e.push(i || "/"), e;
|
|
3334
|
+
}, []);
|
|
3335
|
+
var yi = class {
|
|
3336
|
+
#t = /* @__PURE__ */ new Map();
|
|
3337
|
+
#i = /* @__PURE__ */ new Map();
|
|
3338
|
+
#s = /* @__PURE__ */ new Set();
|
|
3339
|
+
reserve(t, e) {
|
|
3340
|
+
t = ao ? ["win32 parallelization disabled"] : t.map((r) => mt(join(Tr(r))));
|
|
3341
|
+
let i = new Set(t.map((r) => lo(r)).reduce((r, n) => r.concat(n)));
|
|
3342
|
+
this.#i.set(e, {
|
|
3343
|
+
dirs: i,
|
|
3344
|
+
paths: t
|
|
3345
|
+
});
|
|
3346
|
+
for (let r of t) {
|
|
3347
|
+
let n = this.#t.get(r);
|
|
3348
|
+
n ? n.push(e) : this.#t.set(r, [e]);
|
|
3349
|
+
}
|
|
3350
|
+
for (let r of i) {
|
|
3351
|
+
let n = this.#t.get(r);
|
|
3352
|
+
if (!n) this.#t.set(r, [/* @__PURE__ */ new Set([e])]);
|
|
3353
|
+
else {
|
|
3354
|
+
let o = n.at(-1);
|
|
3355
|
+
o instanceof Set ? o.add(e) : n.push(/* @__PURE__ */ new Set([e]));
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
return this.#r(e);
|
|
3359
|
+
}
|
|
3360
|
+
#n(t) {
|
|
3361
|
+
let e = this.#i.get(t);
|
|
3362
|
+
if (!e) throw new Error("function does not have any path reservations");
|
|
3363
|
+
return {
|
|
3364
|
+
paths: e.paths.map((i) => this.#t.get(i)),
|
|
3365
|
+
dirs: [...e.dirs].map((i) => this.#t.get(i))
|
|
3366
|
+
};
|
|
3367
|
+
}
|
|
3368
|
+
check(t) {
|
|
3369
|
+
let { paths: e, dirs: i } = this.#n(t);
|
|
3370
|
+
return e.every((r) => r && r[0] === t) && i.every((r) => r && r[0] instanceof Set && r[0].has(t));
|
|
3371
|
+
}
|
|
3372
|
+
#r(t) {
|
|
3373
|
+
return this.#s.has(t) || !this.check(t) ? !1 : (this.#s.add(t), t(() => this.#e(t)), !0);
|
|
3374
|
+
}
|
|
3375
|
+
#e(t) {
|
|
3376
|
+
if (!this.#s.has(t)) return !1;
|
|
3377
|
+
let e = this.#i.get(t);
|
|
3378
|
+
if (!e) throw new Error("invalid reservation");
|
|
3379
|
+
let { paths: i, dirs: r } = e, n = /* @__PURE__ */ new Set();
|
|
3380
|
+
for (let o of i) {
|
|
3381
|
+
let h = this.#t.get(o);
|
|
3382
|
+
if (!h || h?.[0] !== t) continue;
|
|
3383
|
+
let a = h[1];
|
|
3384
|
+
if (!a) {
|
|
3385
|
+
this.#t.delete(o);
|
|
3386
|
+
continue;
|
|
3387
|
+
}
|
|
3388
|
+
if (h.shift(), typeof a == "function") n.add(a);
|
|
3389
|
+
else for (let l of a) n.add(l);
|
|
3390
|
+
}
|
|
3391
|
+
for (let o of r) {
|
|
3392
|
+
let h = this.#t.get(o), a = h?.[0];
|
|
3393
|
+
if (!(!h || !(a instanceof Set))) if (a.size === 1 && h.length === 1) {
|
|
3394
|
+
this.#t.delete(o);
|
|
3395
|
+
continue;
|
|
3396
|
+
} else if (a.size === 1) {
|
|
3397
|
+
h.shift();
|
|
3398
|
+
let l = h[0];
|
|
3399
|
+
typeof l == "function" && n.add(l);
|
|
3400
|
+
} else a.delete(t);
|
|
3401
|
+
}
|
|
3402
|
+
return this.#s.delete(t), n.forEach((o) => this.#r(o)), !0;
|
|
3403
|
+
}
|
|
3404
|
+
};
|
|
3405
|
+
var Lr = () => process.umask();
|
|
3406
|
+
var Dr = Symbol("onEntry");
|
|
3407
|
+
var _s = Symbol("checkFs");
|
|
3408
|
+
var Nr = Symbol("checkFs2");
|
|
3409
|
+
var Os = Symbol("isReusable");
|
|
3410
|
+
var P = Symbol("makeFs");
|
|
3411
|
+
var Ts = Symbol("file");
|
|
3412
|
+
var xs = Symbol("directory");
|
|
3413
|
+
var gi = Symbol("link");
|
|
3414
|
+
var Ar = Symbol("symlink");
|
|
3415
|
+
var Ir = Symbol("hardlink");
|
|
3416
|
+
var Re = Symbol("ensureNoSymlink");
|
|
3417
|
+
var Cr = Symbol("unsupported");
|
|
3418
|
+
var Fr = Symbol("checkPath");
|
|
3419
|
+
var Rs = Symbol("stripAbsolutePath");
|
|
3420
|
+
var yt = Symbol("mkdir");
|
|
3421
|
+
var O = Symbol("onError");
|
|
3422
|
+
var Ri = Symbol("pending");
|
|
3423
|
+
var kr = Symbol("pend");
|
|
3424
|
+
var $t = Symbol("unpend");
|
|
3425
|
+
var gs = Symbol("ended");
|
|
3426
|
+
var bs = Symbol("maybeClose");
|
|
3427
|
+
var Ls = Symbol("skip");
|
|
3428
|
+
var ge = Symbol("doChown");
|
|
3429
|
+
var be = Symbol("uid");
|
|
3430
|
+
var _e = Symbol("gid");
|
|
3431
|
+
var Oe = Symbol("checkedCwd");
|
|
3432
|
+
var Te = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
|
|
3433
|
+
var uo = 1024;
|
|
3434
|
+
var mo = (s, t) => {
|
|
3435
|
+
if (!Te) return fs.unlink(s, t);
|
|
3436
|
+
let e = s + ".DELETE." + randomBytes(16).toString("hex");
|
|
3437
|
+
fs.rename(s, e, (i) => {
|
|
3438
|
+
if (i) return t(i);
|
|
3439
|
+
fs.unlink(e, t);
|
|
3440
|
+
});
|
|
3441
|
+
};
|
|
3442
|
+
var po = (s) => {
|
|
3443
|
+
if (!Te) return fs.unlinkSync(s);
|
|
3444
|
+
let t = s + ".DELETE." + randomBytes(16).toString("hex");
|
|
3445
|
+
fs.renameSync(s, t), fs.unlinkSync(t);
|
|
3446
|
+
};
|
|
3447
|
+
var vr = (s, t, e) => s !== void 0 && s === s >>> 0 ? s : t !== void 0 && t === t >>> 0 ? t : e;
|
|
3448
|
+
var Xt = class extends rt {
|
|
3449
|
+
[gs] = !1;
|
|
3450
|
+
[Oe] = !1;
|
|
3451
|
+
[Ri] = 0;
|
|
3452
|
+
reservations = new yi();
|
|
3453
|
+
transform;
|
|
3454
|
+
writable = !0;
|
|
3455
|
+
readable = !1;
|
|
3456
|
+
uid;
|
|
3457
|
+
gid;
|
|
3458
|
+
setOwner;
|
|
3459
|
+
preserveOwner;
|
|
3460
|
+
processGid;
|
|
3461
|
+
processUid;
|
|
3462
|
+
maxDepth;
|
|
3463
|
+
forceChown;
|
|
3464
|
+
win32;
|
|
3465
|
+
newer;
|
|
3466
|
+
keep;
|
|
3467
|
+
noMtime;
|
|
3468
|
+
preservePaths;
|
|
3469
|
+
unlink;
|
|
3470
|
+
cwd;
|
|
3471
|
+
strip;
|
|
3472
|
+
processUmask;
|
|
3473
|
+
umask;
|
|
3474
|
+
dmode;
|
|
3475
|
+
fmode;
|
|
3476
|
+
chmod;
|
|
3477
|
+
constructor(t = {}) {
|
|
3478
|
+
if (t.ondone = () => {
|
|
3479
|
+
this[gs] = !0, this[bs]();
|
|
3480
|
+
}, super(t), this.transform = t.transform, this.chmod = !!t.chmod, typeof t.uid == "number" || typeof t.gid == "number") {
|
|
3481
|
+
if (typeof t.uid != "number" || typeof t.gid != "number") throw new TypeError("cannot set owner without number uid and gid");
|
|
3482
|
+
if (t.preserveOwner) throw new TypeError("cannot preserve owner in archive and also set owner explicitly");
|
|
3483
|
+
this.uid = t.uid, this.gid = t.gid, this.setOwner = !0;
|
|
3484
|
+
} else this.uid = void 0, this.gid = void 0, this.setOwner = !1;
|
|
3485
|
+
this.preserveOwner = t.preserveOwner === void 0 && typeof t.uid != "number" ? process.getuid?.() === 0 : !!t.preserveOwner, this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : void 0, this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : void 0, this.maxDepth = typeof t.maxDepth == "number" ? t.maxDepth : uo, this.forceChown = t.forceChown === !0, this.win32 = !!t.win32 || Te, this.newer = !!t.newer, this.keep = !!t.keep, this.noMtime = !!t.noMtime, this.preservePaths = !!t.preservePaths, this.unlink = !!t.unlink, this.cwd = f(path.resolve(t.cwd || process.cwd())), this.strip = Number(t.strip) || 0, this.processUmask = this.chmod ? typeof t.processUmask == "number" ? t.processUmask : Lr() : 0, this.umask = typeof t.umask == "number" ? t.umask : this.processUmask, this.dmode = t.dmode || 511 & ~this.umask, this.fmode = t.fmode || 438 & ~this.umask, this.on("entry", (e) => this[Dr](e));
|
|
3486
|
+
}
|
|
3487
|
+
warn(t, e, i = {}) {
|
|
3488
|
+
return (t === "TAR_BAD_ARCHIVE" || t === "TAR_ABORT") && (i.recoverable = !1), super.warn(t, e, i);
|
|
3489
|
+
}
|
|
3490
|
+
[bs]() {
|
|
3491
|
+
this[gs] && this[Ri] === 0 && (this.emit("prefinish"), this.emit("finish"), this.emit("end"));
|
|
3492
|
+
}
|
|
3493
|
+
[Rs](t, e) {
|
|
3494
|
+
let i = t[e], { type: r } = t;
|
|
3495
|
+
if (!i || this.preservePaths) return !0;
|
|
3496
|
+
let [n, o] = ce(i), h = o.replaceAll(/\\/g, "/").split("/");
|
|
3497
|
+
if (h.includes("..") || Te && /^[a-z]:\.\.$/i.test(h[0] ?? "")) {
|
|
3498
|
+
if (e === "path" || r === "Link") return this.warn("TAR_ENTRY_ERROR", `${e} contains '..'`, {
|
|
3499
|
+
entry: t,
|
|
3500
|
+
[e]: i
|
|
3501
|
+
}), !1;
|
|
3502
|
+
let a = path.posix.dirname(t.path), l = path.posix.normalize(path.posix.join(a, h.join("/")));
|
|
3503
|
+
if (l.startsWith("../") || l === "..") return this.warn("TAR_ENTRY_ERROR", `${e} escapes extraction directory`, {
|
|
3504
|
+
entry: t,
|
|
3505
|
+
[e]: i
|
|
3506
|
+
}), !1;
|
|
3507
|
+
}
|
|
3508
|
+
return n && (t[e] = String(o), this.warn("TAR_ENTRY_INFO", `stripping ${n} from absolute ${e}`, {
|
|
3509
|
+
entry: t,
|
|
3510
|
+
[e]: i
|
|
3511
|
+
})), !0;
|
|
3512
|
+
}
|
|
3513
|
+
[Fr](t) {
|
|
3514
|
+
let e = f(t.path), i = e.split("/");
|
|
3515
|
+
if (this.strip) {
|
|
3516
|
+
if (i.length < this.strip) return !1;
|
|
3517
|
+
if (t.type === "Link") {
|
|
3518
|
+
let r = f(String(t.linkpath)).split("/");
|
|
3519
|
+
if (r.length >= this.strip) t.linkpath = r.slice(this.strip).join("/");
|
|
3520
|
+
else return !1;
|
|
3521
|
+
}
|
|
3522
|
+
i.splice(0, this.strip), t.path = i.join("/");
|
|
3523
|
+
}
|
|
3524
|
+
if (isFinite(this.maxDepth) && i.length > this.maxDepth) return this.warn("TAR_ENTRY_ERROR", "path excessively deep", {
|
|
3525
|
+
entry: t,
|
|
3526
|
+
path: e,
|
|
3527
|
+
depth: i.length,
|
|
3528
|
+
maxDepth: this.maxDepth
|
|
3529
|
+
}), !1;
|
|
3530
|
+
if (!this[Rs](t, "path") || !this[Rs](t, "linkpath")) return !1;
|
|
3531
|
+
if (t.absolute = path.isAbsolute(t.path) ? f(path.resolve(t.path)) : f(path.resolve(this.cwd, t.path)), !this.preservePaths && typeof t.absolute == "string" && t.absolute.indexOf(this.cwd + "/") !== 0 && t.absolute !== this.cwd) return this.warn("TAR_ENTRY_ERROR", "path escaped extraction target", {
|
|
3532
|
+
entry: t,
|
|
3533
|
+
path: f(t.path),
|
|
3534
|
+
resolvedPath: t.absolute,
|
|
3535
|
+
cwd: this.cwd
|
|
3536
|
+
}), !1;
|
|
3537
|
+
if (t.absolute === this.cwd && t.type !== "Directory" && t.type !== "GNUDumpDir") return !1;
|
|
3538
|
+
if (this.win32) {
|
|
3539
|
+
let { root: r } = path.win32.parse(String(t.absolute));
|
|
3540
|
+
t.absolute = r + ts(String(t.absolute).slice(r.length));
|
|
3541
|
+
let { root: n } = path.win32.parse(t.path);
|
|
3542
|
+
t.path = n + ts(t.path.slice(n.length));
|
|
3543
|
+
}
|
|
3544
|
+
return !0;
|
|
3545
|
+
}
|
|
3546
|
+
[Dr](t) {
|
|
3547
|
+
if (!this[Fr](t)) return t.resume();
|
|
3548
|
+
switch (co.equal(typeof t.absolute, "string"), t.type) {
|
|
3549
|
+
case "Directory":
|
|
3550
|
+
case "GNUDumpDir": t.mode && (t.mode = t.mode | 448);
|
|
3551
|
+
case "File":
|
|
3552
|
+
case "OldFile":
|
|
3553
|
+
case "ContiguousFile":
|
|
3554
|
+
case "Link":
|
|
3555
|
+
case "SymbolicLink": return this[_s](t);
|
|
3556
|
+
default: return this[Cr](t);
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
[O](t, e) {
|
|
3560
|
+
t.name === "CwdError" ? this.emit("error", t) : (this.warn("TAR_ENTRY_ERROR", t, { entry: e }), this[$t](), e.resume());
|
|
3561
|
+
}
|
|
3562
|
+
[yt](t, e, i) {
|
|
3563
|
+
gr(f(t), {
|
|
3564
|
+
uid: this.uid,
|
|
3565
|
+
gid: this.gid,
|
|
3566
|
+
processUid: this.processUid,
|
|
3567
|
+
processGid: this.processGid,
|
|
3568
|
+
umask: this.processUmask,
|
|
3569
|
+
preserve: this.preservePaths,
|
|
3570
|
+
unlink: this.unlink,
|
|
3571
|
+
cwd: this.cwd,
|
|
3572
|
+
mode: e
|
|
3573
|
+
}, i);
|
|
3574
|
+
}
|
|
3575
|
+
[ge](t) {
|
|
3576
|
+
return this.forceChown || this.preserveOwner && (typeof t.uid == "number" && t.uid !== this.processUid || typeof t.gid == "number" && t.gid !== this.processGid) || typeof this.uid == "number" && this.uid !== this.processUid || typeof this.gid == "number" && this.gid !== this.processGid;
|
|
3577
|
+
}
|
|
3578
|
+
[be](t) {
|
|
3579
|
+
return vr(this.uid, t.uid, this.processUid);
|
|
3580
|
+
}
|
|
3581
|
+
[_e](t) {
|
|
3582
|
+
return vr(this.gid, t.gid, this.processGid);
|
|
3583
|
+
}
|
|
3584
|
+
[Ts](t, e) {
|
|
3585
|
+
let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = new et(String(t.absolute), {
|
|
3586
|
+
flags: ms(t.size),
|
|
3587
|
+
mode: i,
|
|
3588
|
+
autoClose: !1
|
|
3589
|
+
});
|
|
3590
|
+
r.on("error", (a) => {
|
|
3591
|
+
r.fd && fs.close(r.fd, () => {}), r.write = () => !0, this[O](a, t), e();
|
|
3592
|
+
});
|
|
3593
|
+
let n = 1, o = (a) => {
|
|
3594
|
+
if (a) {
|
|
3595
|
+
r.fd && fs.close(r.fd, () => {}), this[O](a, t), e();
|
|
3596
|
+
return;
|
|
3597
|
+
}
|
|
3598
|
+
--n === 0 && r.fd !== void 0 && fs.close(r.fd, (l) => {
|
|
3599
|
+
l ? this[O](l, t) : this[$t](), e();
|
|
3600
|
+
});
|
|
3601
|
+
};
|
|
3602
|
+
r.on("finish", () => {
|
|
3603
|
+
let a = String(t.absolute), l = r.fd;
|
|
3604
|
+
if (typeof l == "number" && t.mtime && !this.noMtime) {
|
|
3605
|
+
n++;
|
|
3606
|
+
let c = t.atime || /* @__PURE__ */ new Date(), d = t.mtime;
|
|
3607
|
+
fs.futimes(l, c, d, (y) => y ? fs.utimes(a, c, d, (T) => o(T && y)) : o());
|
|
3608
|
+
}
|
|
3609
|
+
if (typeof l == "number" && this[ge](t)) {
|
|
3610
|
+
n++;
|
|
3611
|
+
let c = this[be](t), d = this[_e](t);
|
|
3612
|
+
typeof c == "number" && typeof d == "number" && fs.fchown(l, c, d, (y) => y ? fs.chown(a, c, d, (T) => o(T && y)) : o());
|
|
3613
|
+
}
|
|
3614
|
+
o();
|
|
3615
|
+
});
|
|
3616
|
+
let h = this.transform && this.transform(t) || t;
|
|
3617
|
+
h !== t && (h.on("error", (a) => {
|
|
3618
|
+
this[O](a, t), e();
|
|
3619
|
+
}), t.pipe(h)), h.pipe(r);
|
|
3620
|
+
}
|
|
3621
|
+
[xs](t, e) {
|
|
3622
|
+
let i = typeof t.mode == "number" ? t.mode & 4095 : this.dmode;
|
|
3623
|
+
this[yt](String(t.absolute), i, (r) => {
|
|
3624
|
+
if (r) {
|
|
3625
|
+
this[O](r, t), e();
|
|
3626
|
+
return;
|
|
3627
|
+
}
|
|
3628
|
+
let n = 1, o = () => {
|
|
3629
|
+
--n === 0 && (e(), this[$t](), t.resume());
|
|
3630
|
+
};
|
|
3631
|
+
t.mtime && !this.noMtime && (n++, fs.utimes(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime, o)), this[ge](t) && (n++, fs.chown(String(t.absolute), Number(this[be](t)), Number(this[_e](t)), o)), o();
|
|
3632
|
+
});
|
|
3633
|
+
}
|
|
3634
|
+
[Cr](t) {
|
|
3635
|
+
t.unsupported = !0, this.warn("TAR_ENTRY_UNSUPPORTED", `unsupported entry type: ${t.type}`, { entry: t }), t.resume();
|
|
3636
|
+
}
|
|
3637
|
+
[Ar](t, e) {
|
|
3638
|
+
let i = f(path.relative(this.cwd, path.resolve(path.dirname(String(t.absolute)), String(t.linkpath)))).split("/");
|
|
3639
|
+
this[Re](t, this.cwd, i, () => this[gi](t, String(t.linkpath), "symlink", e), (r) => {
|
|
3640
|
+
this[O](r, t), e();
|
|
3641
|
+
});
|
|
3642
|
+
}
|
|
3643
|
+
[Ir](t, e) {
|
|
3644
|
+
let i = f(path.resolve(this.cwd, String(t.linkpath))), r = f(String(t.linkpath)).split("/");
|
|
3645
|
+
this[Re](t, this.cwd, r, () => this[gi](t, i, "link", e), (n) => {
|
|
3646
|
+
this[O](n, t), e();
|
|
3647
|
+
});
|
|
3648
|
+
}
|
|
3649
|
+
[Re](t, e, i, r, n) {
|
|
3650
|
+
let o = i.shift();
|
|
3651
|
+
if (this.preservePaths || o === void 0) return r();
|
|
3652
|
+
let h = path.resolve(e, o);
|
|
3653
|
+
fs.lstat(h, (a, l) => {
|
|
3654
|
+
if (a) return r();
|
|
3655
|
+
if (l?.isSymbolicLink()) return n(new St(h, path.resolve(h, i.join("/"))));
|
|
3656
|
+
this[Re](t, h, i, r, n);
|
|
3657
|
+
});
|
|
3658
|
+
}
|
|
3659
|
+
[kr]() {
|
|
3660
|
+
this[Ri]++;
|
|
3661
|
+
}
|
|
3662
|
+
[$t]() {
|
|
3663
|
+
this[Ri]--, this[bs]();
|
|
3664
|
+
}
|
|
3665
|
+
[Ls](t) {
|
|
3666
|
+
this[$t](), t.resume();
|
|
3667
|
+
}
|
|
3668
|
+
[Os](t, e) {
|
|
3669
|
+
return t.type === "File" && !this.unlink && e.isFile() && e.nlink <= 1 && !Te;
|
|
3670
|
+
}
|
|
3671
|
+
[_s](t) {
|
|
3672
|
+
this[kr]();
|
|
3673
|
+
let e = [t.path];
|
|
3674
|
+
t.linkpath && e.push(t.linkpath), this.reservations.reserve(e, (i) => this[Nr](t, i));
|
|
3675
|
+
}
|
|
3676
|
+
[Nr](t, e) {
|
|
3677
|
+
let i = (h) => {
|
|
3678
|
+
e(h);
|
|
3679
|
+
}, r = () => {
|
|
3680
|
+
this[yt](this.cwd, this.dmode, (h) => {
|
|
3681
|
+
if (h) {
|
|
3682
|
+
this[O](h, t), i();
|
|
3683
|
+
return;
|
|
3684
|
+
}
|
|
3685
|
+
this[Oe] = !0, n();
|
|
3686
|
+
});
|
|
3687
|
+
}, n = () => {
|
|
3688
|
+
if (t.absolute !== this.cwd) {
|
|
3689
|
+
let h = f(path.dirname(String(t.absolute)));
|
|
3690
|
+
if (h !== this.cwd) return this[yt](h, this.dmode, (a) => {
|
|
3691
|
+
if (a) {
|
|
3692
|
+
this[O](a, t), i();
|
|
3693
|
+
return;
|
|
3694
|
+
}
|
|
3695
|
+
o();
|
|
3696
|
+
});
|
|
3697
|
+
}
|
|
3698
|
+
o();
|
|
3699
|
+
}, o = () => {
|
|
3700
|
+
fs.lstat(String(t.absolute), (h, a) => {
|
|
3701
|
+
if (a && (this.keep || this.newer && a.mtime > (t.mtime ?? a.mtime))) {
|
|
3702
|
+
this[Ls](t), i();
|
|
3703
|
+
return;
|
|
3704
|
+
}
|
|
3705
|
+
if (h || this[Os](t, a)) return this[P](null, t, i);
|
|
3706
|
+
if (a.isDirectory()) {
|
|
3707
|
+
if (t.type === "Directory") {
|
|
3708
|
+
let l = this.chmod && t.mode && (a.mode & 4095) !== t.mode, c = (d) => this[P](d ?? null, t, i);
|
|
3709
|
+
return l ? fs.chmod(String(t.absolute), Number(t.mode), c) : c();
|
|
3710
|
+
}
|
|
3711
|
+
if (t.absolute !== this.cwd) return fs.rmdir(String(t.absolute), (l) => this[P](l ?? null, t, i));
|
|
3712
|
+
}
|
|
3713
|
+
if (t.absolute === this.cwd) return this[P](null, t, i);
|
|
3714
|
+
mo(String(t.absolute), (l) => this[P](l ?? null, t, i));
|
|
3715
|
+
});
|
|
3716
|
+
};
|
|
3717
|
+
this[Oe] ? n() : r();
|
|
3718
|
+
}
|
|
3719
|
+
[P](t, e, i) {
|
|
3720
|
+
if (t) {
|
|
3721
|
+
this[O](t, e), i();
|
|
3722
|
+
return;
|
|
3723
|
+
}
|
|
3724
|
+
switch (e.type) {
|
|
3725
|
+
case "File":
|
|
3726
|
+
case "OldFile":
|
|
3727
|
+
case "ContiguousFile": return this[Ts](e, i);
|
|
3728
|
+
case "Link": return this[Ir](e, i);
|
|
3729
|
+
case "SymbolicLink": return this[Ar](e, i);
|
|
3730
|
+
case "Directory":
|
|
3731
|
+
case "GNUDumpDir": return this[xs](e, i);
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
[gi](t, e, i, r) {
|
|
3735
|
+
fs[i](e, String(t.absolute), (n) => {
|
|
3736
|
+
n ? this[O](n, t) : (this[$t](), t.resume()), r();
|
|
3737
|
+
});
|
|
3738
|
+
}
|
|
3739
|
+
};
|
|
3740
|
+
var ye = (s) => {
|
|
3741
|
+
try {
|
|
3742
|
+
return [null, s()];
|
|
3743
|
+
} catch (t) {
|
|
3744
|
+
return [t, null];
|
|
3745
|
+
}
|
|
3746
|
+
};
|
|
3747
|
+
var xe = class extends Xt {
|
|
3748
|
+
sync = !0;
|
|
3749
|
+
[P](t, e) {
|
|
3750
|
+
return super[P](t, e, () => {});
|
|
3751
|
+
}
|
|
3752
|
+
[_s](t) {
|
|
3753
|
+
if (!this[Oe]) {
|
|
3754
|
+
let n = this[yt](this.cwd, this.dmode);
|
|
3755
|
+
if (n) return this[O](n, t);
|
|
3756
|
+
this[Oe] = !0;
|
|
3757
|
+
}
|
|
3758
|
+
if (t.absolute !== this.cwd) {
|
|
3759
|
+
let n = f(path.dirname(String(t.absolute)));
|
|
3760
|
+
if (n !== this.cwd) {
|
|
3761
|
+
let o = this[yt](n, this.dmode);
|
|
3762
|
+
if (o) return this[O](o, t);
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
let [e, i] = ye(() => fs.lstatSync(String(t.absolute)));
|
|
3766
|
+
if (i && (this.keep || this.newer && i.mtime > (t.mtime ?? i.mtime))) return this[Ls](t);
|
|
3767
|
+
if (e || this[Os](t, i)) return this[P](null, t);
|
|
3768
|
+
if (i.isDirectory()) {
|
|
3769
|
+
if (t.type === "Directory") {
|
|
3770
|
+
let [h] = this.chmod && t.mode && (i.mode & 4095) !== t.mode ? ye(() => {
|
|
3771
|
+
fs.chmodSync(String(t.absolute), Number(t.mode));
|
|
3772
|
+
}) : [];
|
|
3773
|
+
return this[P](h, t);
|
|
3774
|
+
}
|
|
3775
|
+
let [n] = ye(() => fs.rmdirSync(String(t.absolute)));
|
|
3776
|
+
this[P](n, t);
|
|
3777
|
+
}
|
|
3778
|
+
let [r] = t.absolute === this.cwd ? [] : ye(() => po(String(t.absolute)));
|
|
3779
|
+
this[P](r, t);
|
|
3780
|
+
}
|
|
3781
|
+
[Ts](t, e) {
|
|
3782
|
+
let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = (h) => {
|
|
3783
|
+
let a;
|
|
3784
|
+
try {
|
|
3785
|
+
fs.closeSync(n);
|
|
3786
|
+
} catch (l) {
|
|
3787
|
+
a = l;
|
|
3788
|
+
}
|
|
3789
|
+
(h || a) && this[O](h || a, t), e();
|
|
3790
|
+
}, n;
|
|
3791
|
+
try {
|
|
3792
|
+
n = fs.openSync(String(t.absolute), ms(t.size), i);
|
|
3793
|
+
} catch (h) {
|
|
3794
|
+
return r(h);
|
|
3795
|
+
}
|
|
3796
|
+
let o = this.transform && this.transform(t) || t;
|
|
3797
|
+
o !== t && (o.on("error", (h) => this[O](h, t)), t.pipe(o)), o.on("data", (h) => {
|
|
3798
|
+
try {
|
|
3799
|
+
fs.writeSync(n, h, 0, h.length);
|
|
3800
|
+
} catch (a) {
|
|
3801
|
+
r(a);
|
|
3802
|
+
}
|
|
3803
|
+
}), o.on("end", () => {
|
|
3804
|
+
let h = null;
|
|
3805
|
+
if (t.mtime && !this.noMtime) {
|
|
3806
|
+
let a = t.atime || /* @__PURE__ */ new Date(), l = t.mtime;
|
|
3807
|
+
try {
|
|
3808
|
+
fs.futimesSync(n, a, l);
|
|
3809
|
+
} catch (c) {
|
|
3810
|
+
try {
|
|
3811
|
+
fs.utimesSync(String(t.absolute), a, l);
|
|
3812
|
+
} catch {
|
|
3813
|
+
h = c;
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
if (this[ge](t)) {
|
|
3818
|
+
let a = this[be](t), l = this[_e](t);
|
|
3819
|
+
try {
|
|
3820
|
+
fs.fchownSync(n, Number(a), Number(l));
|
|
3821
|
+
} catch (c) {
|
|
3822
|
+
try {
|
|
3823
|
+
fs.chownSync(String(t.absolute), Number(a), Number(l));
|
|
3824
|
+
} catch {
|
|
3825
|
+
h = h || c;
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
r(h);
|
|
3830
|
+
});
|
|
3831
|
+
}
|
|
3832
|
+
[xs](t, e) {
|
|
3833
|
+
let i = typeof t.mode == "number" ? t.mode & 4095 : this.dmode, r = this[yt](String(t.absolute), i);
|
|
3834
|
+
if (r) {
|
|
3835
|
+
this[O](r, t), e();
|
|
3836
|
+
return;
|
|
3837
|
+
}
|
|
3838
|
+
if (t.mtime && !this.noMtime) try {
|
|
3839
|
+
fs.utimesSync(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime);
|
|
3840
|
+
} catch {}
|
|
3841
|
+
if (this[ge](t)) try {
|
|
3842
|
+
fs.chownSync(String(t.absolute), Number(this[be](t)), Number(this[_e](t)));
|
|
3843
|
+
} catch {}
|
|
3844
|
+
e(), t.resume();
|
|
3845
|
+
}
|
|
3846
|
+
[yt](t, e) {
|
|
3847
|
+
try {
|
|
3848
|
+
return _r(f(t), {
|
|
3849
|
+
uid: this.uid,
|
|
3850
|
+
gid: this.gid,
|
|
3851
|
+
processUid: this.processUid,
|
|
3852
|
+
processGid: this.processGid,
|
|
3853
|
+
umask: this.processUmask,
|
|
3854
|
+
preserve: this.preservePaths,
|
|
3855
|
+
unlink: this.unlink,
|
|
3856
|
+
cwd: this.cwd,
|
|
3857
|
+
mode: e
|
|
3858
|
+
});
|
|
3859
|
+
} catch (i) {
|
|
3860
|
+
return i;
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
[Re](t, e, i, r, n) {
|
|
3864
|
+
if (this.preservePaths || i.length === 0) return r();
|
|
3865
|
+
let o = e;
|
|
3866
|
+
for (let h of i) {
|
|
3867
|
+
o = path.resolve(o, h);
|
|
3868
|
+
let [a, l] = ye(() => fs.lstatSync(o));
|
|
3869
|
+
if (a) return r();
|
|
3870
|
+
if (l.isSymbolicLink()) return n(new St(o, path.resolve(e, i.join("/"))));
|
|
3871
|
+
}
|
|
3872
|
+
r();
|
|
3873
|
+
}
|
|
3874
|
+
[gi](t, e, i, r) {
|
|
3875
|
+
let n = `${i}Sync`;
|
|
3876
|
+
try {
|
|
3877
|
+
fs[n](e, String(t.absolute)), r(), t.resume();
|
|
3878
|
+
} catch (o) {
|
|
3879
|
+
return this[O](o, t);
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
};
|
|
3883
|
+
var Eo = (s) => {
|
|
3884
|
+
let t = new xe(s), e = s.file, i = fs.statSync(e);
|
|
3885
|
+
new Be(e, {
|
|
3886
|
+
readSize: s.maxReadSize || 16777216,
|
|
3887
|
+
size: i.size
|
|
3888
|
+
}).pipe(t);
|
|
3889
|
+
};
|
|
3890
|
+
var wo = (s, t) => {
|
|
3891
|
+
let e = new Xt(s), i = s.maxReadSize || 16777216, r = s.file;
|
|
3892
|
+
return new Promise((o, h) => {
|
|
3893
|
+
e.on("error", h), e.on("close", o), fs.stat(r, (a, l) => {
|
|
3894
|
+
if (a) h(a);
|
|
3895
|
+
else {
|
|
3896
|
+
let c = new _t(r, {
|
|
3897
|
+
readSize: i,
|
|
3898
|
+
size: l.size
|
|
3899
|
+
});
|
|
3900
|
+
c.on("error", h), c.pipe(e);
|
|
3901
|
+
}
|
|
3902
|
+
});
|
|
3903
|
+
});
|
|
3904
|
+
};
|
|
3905
|
+
K(Eo, wo, (s) => new xe(s), (s) => new Xt(s), (s, t) => {
|
|
3906
|
+
t?.length && Qi(s, t);
|
|
3907
|
+
});
|
|
3908
|
+
var yo = (s, t) => {
|
|
3909
|
+
let e = new kt(s), i = !0, r, n;
|
|
3910
|
+
try {
|
|
3911
|
+
try {
|
|
3912
|
+
r = fs.openSync(s.file, "r+");
|
|
3913
|
+
} catch (a) {
|
|
3914
|
+
if (a?.code === "ENOENT") r = fs.openSync(s.file, "w+");
|
|
3915
|
+
else throw a;
|
|
3916
|
+
}
|
|
3917
|
+
let o = fs.fstatSync(r), h = Buffer.alloc(512);
|
|
3918
|
+
t: for (n = 0; n < o.size; n += 512) {
|
|
3919
|
+
for (let c = 0, d = 0; c < 512; c += d) {
|
|
3920
|
+
if (d = fs.readSync(r, h, c, h.length - c, n + c), n === 0 && h[0] === 31 && h[1] === 139) throw new Error("cannot append to compressed archives");
|
|
3921
|
+
if (!d) break t;
|
|
3922
|
+
}
|
|
3923
|
+
let a = new F(h);
|
|
3924
|
+
if (!a.cksumValid) break;
|
|
3925
|
+
let l = 512 * Math.ceil((a.size || 0) / 512);
|
|
3926
|
+
if (n + l + 512 > o.size) break;
|
|
3927
|
+
n += l, s.mtimeCache && a.mtime && s.mtimeCache.set(String(a.path), a.mtime);
|
|
3928
|
+
}
|
|
3929
|
+
i = !1, Ro(s, e, n, r, t);
|
|
3930
|
+
} finally {
|
|
3931
|
+
if (i) try {
|
|
3932
|
+
fs.closeSync(r);
|
|
3933
|
+
} catch {}
|
|
3934
|
+
}
|
|
3935
|
+
};
|
|
3936
|
+
var Ro = (s, t, e, i, r) => {
|
|
3937
|
+
let n = new Wt(s.file, {
|
|
3938
|
+
fd: i,
|
|
3939
|
+
start: e
|
|
3940
|
+
});
|
|
3941
|
+
t.pipe(n), bo(t, r);
|
|
3942
|
+
};
|
|
3943
|
+
var go = (s, t) => {
|
|
3944
|
+
t = Array.from(t);
|
|
3945
|
+
let e = new wt(s), i = (n, o, h) => {
|
|
3946
|
+
let a = (T, D) => {
|
|
3947
|
+
T ? fs.close(n, (E) => h(T)) : h(null, D);
|
|
3948
|
+
}, l = 0;
|
|
3949
|
+
if (o === 0) return a(null, 0);
|
|
3950
|
+
let c = 0, d = Buffer.alloc(512), y = (T, D) => {
|
|
3951
|
+
if (T || D === void 0) return a(T);
|
|
3952
|
+
if (c += D, c < 512 && D) return fs.read(n, d, c, d.length - c, l + c, y);
|
|
3953
|
+
if (l === 0 && d[0] === 31 && d[1] === 139) return a(/* @__PURE__ */ new Error("cannot append to compressed archives"));
|
|
3954
|
+
if (c < 512) return a(null, l);
|
|
3955
|
+
let E = new F(d);
|
|
3956
|
+
if (!E.cksumValid) return a(null, l);
|
|
3957
|
+
let x = 512 * Math.ceil((E.size ?? 0) / 512);
|
|
3958
|
+
if (l + x + 512 > o || (l += x + 512, l >= o)) return a(null, l);
|
|
3959
|
+
s.mtimeCache && E.mtime && s.mtimeCache.set(String(E.path), E.mtime), c = 0, fs.read(n, d, 0, 512, l, y);
|
|
3960
|
+
};
|
|
3961
|
+
fs.read(n, d, 0, 512, l, y);
|
|
3962
|
+
};
|
|
3963
|
+
return new Promise((n, o) => {
|
|
3964
|
+
e.on("error", o);
|
|
3965
|
+
let h = "r+", a = (l, c) => {
|
|
3966
|
+
if (l && l.code === "ENOENT" && h === "r+") return h = "w+", fs.open(s.file, h, a);
|
|
3967
|
+
if (l || !c) return o(l);
|
|
3968
|
+
fs.fstat(c, (d, y) => {
|
|
3969
|
+
if (d) return fs.close(c, () => o(d));
|
|
3970
|
+
i(c, y.size, (T, D) => {
|
|
3971
|
+
if (T) return o(T);
|
|
3972
|
+
let E = new et(s.file, {
|
|
3973
|
+
fd: c,
|
|
3974
|
+
start: D
|
|
3975
|
+
});
|
|
3976
|
+
e.pipe(E), E.on("error", o), E.on("close", n), _o(e, t);
|
|
3977
|
+
});
|
|
3978
|
+
});
|
|
3979
|
+
};
|
|
3980
|
+
fs.open(s.file, h, a);
|
|
3981
|
+
});
|
|
3982
|
+
};
|
|
3983
|
+
var bo = (s, t) => {
|
|
3984
|
+
t.forEach((e) => {
|
|
3985
|
+
e.charAt(0) === "@" ? Ct({
|
|
3986
|
+
file: path.resolve(s.cwd, e.slice(1)),
|
|
3987
|
+
sync: !0,
|
|
3988
|
+
noResume: !0,
|
|
3989
|
+
onReadEntry: (i) => s.add(i)
|
|
3990
|
+
}) : s.add(e);
|
|
3991
|
+
}), s.end();
|
|
3992
|
+
};
|
|
3993
|
+
var _o = async (s, t) => {
|
|
3994
|
+
for (let e of t) e.charAt(0) === "@" ? await Ct({
|
|
3995
|
+
file: path.resolve(String(s.cwd), e.slice(1)),
|
|
3996
|
+
noResume: !0,
|
|
3997
|
+
onReadEntry: (i) => s.add(i)
|
|
3998
|
+
}) : s.add(e);
|
|
3999
|
+
s.end();
|
|
4000
|
+
};
|
|
4001
|
+
var vt = K(yo, go, () => {
|
|
4002
|
+
throw new TypeError("file is required");
|
|
4003
|
+
}, () => {
|
|
4004
|
+
throw new TypeError("file is required");
|
|
4005
|
+
}, (s, t) => {
|
|
4006
|
+
if (!Bs(s)) throw new TypeError("file is required");
|
|
4007
|
+
if (s.gzip || s.brotli || s.zstd || s.file.endsWith(".br") || s.file.endsWith(".tbr")) throw new TypeError("cannot append to compressed archives");
|
|
4008
|
+
if (!t?.length) throw new TypeError("no paths specified to add/replace");
|
|
4009
|
+
});
|
|
4010
|
+
K(vt.syncFile, vt.asyncFile, vt.syncNoFile, vt.asyncNoFile, (s, t = []) => {
|
|
4011
|
+
vt.validate?.(s, t), To(s);
|
|
4012
|
+
});
|
|
4013
|
+
var To = (s) => {
|
|
4014
|
+
let t = s.filter;
|
|
4015
|
+
s.mtimeCache || (s.mtimeCache = /* @__PURE__ */ new Map()), s.filter = t ? (e, i) => t(e, i) && !((s.mtimeCache?.get(e) ?? i.mtime ?? 0) > (i.mtime ?? 0)) : (e, i) => !((s.mtimeCache?.get(e) ?? i.mtime ?? 0) > (i.mtime ?? 0));
|
|
4016
|
+
};
|
|
4017
|
+
// src/cli/commands/sync.ts
|
|
4018
|
+
const MANIFEST_FILE = "docker-sync.json";
|
|
4019
|
+
const MAX_ARCHIVE_BYTES = 104857600;
|
|
4020
|
+
const DOCKERIGNORE = ".dockerignore";
|
|
4021
|
+
const ESCAPED_QUOTE = String.raw`'\''`;
|
|
4022
|
+
const DOLLAR = "$";
|
|
4023
|
+
const CANT_COPY = "Can't copy the local files docker reads into the sandbox.";
|
|
4024
|
+
const REMOVE_GONE = [
|
|
4025
|
+
"r=$(pwd -P)",
|
|
4026
|
+
`for p; do d=$(dirname -- "$p"); [ "$(cd -- "$d" 2>/dev/null && pwd -P)" = "${DOLLAR}{r%/}/$d" ] && rm -df -- "$p" 2>/dev/null; done`,
|
|
4027
|
+
"true"
|
|
4028
|
+
].join("; ");
|
|
4029
|
+
const Manifest = Record(String$1, ArraySchema(String$1));
|
|
4030
|
+
const decodeManifest = decodeUnknownOption(fromJsonString(Manifest));
|
|
4031
|
+
const decodeDenied = decodeUnknownOption(Struct({
|
|
4032
|
+
code: Literal("EACCES"),
|
|
4033
|
+
path: String$1
|
|
4034
|
+
}));
|
|
4035
|
+
const quoted = (word) => `'${word.replaceAll("'", () => ESCAPED_QUOTE)}'`;
|
|
4036
|
+
const lstatOf = liftThrowable((file) => fs.lstatSync(file));
|
|
4037
|
+
const readText = liftThrowable((file) => fs.readFileSync(file, "utf-8"));
|
|
4038
|
+
const isPackable = (entry) => entry.isFile() || entry.isDirectory() || entry.isSymbolicLink();
|
|
4039
|
+
const wholeEntries = (target) => match(lstatOf(target), {
|
|
4040
|
+
onNone: () => [],
|
|
4041
|
+
onSome: (stat) => {
|
|
4042
|
+
if (!stat.isDirectory()) return stat.isFile() || stat.isSymbolicLink() ? [target] : [];
|
|
4043
|
+
return [target, ...fs.readdirSync(target, {
|
|
4044
|
+
recursive: true,
|
|
4045
|
+
withFileTypes: true
|
|
4046
|
+
}).flatMap((entry) => isPackable(entry) ? [path.join(entry.parentPath, entry.name)] : [])];
|
|
4047
|
+
}
|
|
4048
|
+
});
|
|
4049
|
+
const contextEntries = ({ directory, dockerfiles }) => {
|
|
4050
|
+
if (!exists(lstatOf(directory), (stat) => stat.isDirectory())) return [];
|
|
4051
|
+
const ignoreFile = fromNullishOr([...dockerfiles.map((file) => `${file}${DOCKERIGNORE}`), path.join(directory, DOCKERIGNORE)].find((file) => exists(lstatOf(file), (stat) => stat.isFile())));
|
|
4052
|
+
const patterns = ignoreFile.pipe(flatMap(readText), getOrElse(() => ""));
|
|
4053
|
+
const matcher = (0, import_ignore.default)({ ignorecase: false }).add(patterns);
|
|
4054
|
+
const exceptions = patterns.split("\n").some((line) => line.trim().startsWith("!"));
|
|
4055
|
+
const walked = (current) => {
|
|
4056
|
+
return fs.readdirSync(current, { withFileTypes: true }).flatMap((entry) => {
|
|
4057
|
+
if (!isPackable(entry)) return [];
|
|
4058
|
+
const absolute = path.join(current, entry.name);
|
|
4059
|
+
const relative = path.relative(directory, absolute);
|
|
4060
|
+
const ignored = matcher.ignores(relative.split(path.sep).join("/"));
|
|
4061
|
+
const kept = ignored ? [] : [absolute];
|
|
4062
|
+
if (!entry.isDirectory()) return kept;
|
|
4063
|
+
return [...kept, ...ignored && !exceptions ? [] : walked(absolute)];
|
|
4064
|
+
});
|
|
4065
|
+
};
|
|
4066
|
+
return [
|
|
4067
|
+
directory,
|
|
4068
|
+
...walked(directory),
|
|
4069
|
+
...toArray(ignoreFile),
|
|
4070
|
+
...dockerfiles.flatMap(wholeEntries)
|
|
4071
|
+
];
|
|
4072
|
+
};
|
|
4073
|
+
const packed = async ({ entries, tool }) => {
|
|
4074
|
+
const archive = Qn({
|
|
4075
|
+
cwd: path.sep,
|
|
4076
|
+
gzip: true,
|
|
4077
|
+
noDirRecurse: true
|
|
4078
|
+
}, [...entries]);
|
|
4079
|
+
const size = make(0);
|
|
4080
|
+
try {
|
|
4081
|
+
return Buffer.concat(await Array.fromAsync(archive, (chunk) => {
|
|
4082
|
+
tool.signal.throwIfAborted();
|
|
4083
|
+
if (updateAndGet(size, (sum) => sum + chunk.byteLength) > MAX_ARCHIVE_BYTES) throw new Error(`${CANT_COPY} They pack to more than 100 MiB, the most one upload takes.`);
|
|
4084
|
+
return chunk;
|
|
4085
|
+
}));
|
|
4086
|
+
} catch (error) {
|
|
4087
|
+
throw match(decodeDenied(error), {
|
|
4088
|
+
onNone: () => error,
|
|
4089
|
+
onSome: (denied) => /* @__PURE__ */ new Error(`${CANT_COPY} ${denied.path} isn't readable.`)
|
|
4090
|
+
});
|
|
4091
|
+
}
|
|
4092
|
+
};
|
|
4093
|
+
const uploaded = async ({ content, file, id, tool }) => {
|
|
4094
|
+
await tool.client.sandboxes.writeFile(id, file, content, { signal: tool.signal });
|
|
4095
|
+
return {
|
|
4096
|
+
file,
|
|
4097
|
+
sha: createHash("sha256").update(content).digest("hex")
|
|
4098
|
+
};
|
|
4099
|
+
};
|
|
4100
|
+
const syncCommand = async ({ cwd, id, live, paths, tool }) => {
|
|
4101
|
+
const scopes = [os.homedir(), cwd].filter((root) => path.dirname(root) !== root).toSorted((left, right) => left.length - right.length);
|
|
4102
|
+
const listing = try_(() => paths.flatMap((synced) => synced.kind === "whole" ? wholeEntries(synced.path) : contextEntries({
|
|
4103
|
+
directory: synced.path,
|
|
4104
|
+
dockerfiles: [synced.dockerfile].filter(isNotNullish)
|
|
4105
|
+
})));
|
|
4106
|
+
if (isFailure(listing)) throw match(decodeDenied(listing.failure), {
|
|
4107
|
+
onNone: () => listing.failure,
|
|
4108
|
+
onSome: (denied) => /* @__PURE__ */ new Error(`${CANT_COPY} ${denied.path} isn't readable.`)
|
|
4109
|
+
});
|
|
4110
|
+
const scoped = listing.success.flatMap((entry) => {
|
|
4111
|
+
return fromNullishOr(scopes.find((scope) => {
|
|
4112
|
+
const relative = path.relative(scope, entry);
|
|
4113
|
+
return relative === "" || relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
|
|
4114
|
+
})).pipe(map((scope) => ({
|
|
4115
|
+
entry,
|
|
4116
|
+
scope
|
|
4117
|
+
})), toArray);
|
|
4118
|
+
});
|
|
4119
|
+
const folders = new Set(scoped.flatMap(({ entry, scope }) => {
|
|
4120
|
+
const parts = path.relative(scope, entry).split(path.sep).slice(0, -1);
|
|
4121
|
+
return parts.map((part, index) => path.join(scope, ...parts.slice(0, index), part));
|
|
4122
|
+
}));
|
|
4123
|
+
const linked = fromNullishOr([...folders].find((folder) => !exists(lstatOf(folder), (stat) => stat.isDirectory())));
|
|
4124
|
+
if (isSome(linked)) throw new Error(`${CANT_COPY} ${linked.value} is a symbolic link, and Sandcovery copies files only through real folders.`);
|
|
4125
|
+
const entries = uniq([...folders, ...scoped.map(({ entry }) => entry)]).map((entry) => path.relative(path.parse(entry).root, entry)).toSorted();
|
|
4126
|
+
const manifestPath = path.join(tool.folder, MANIFEST_FILE);
|
|
4127
|
+
const manifest = getOrElse(flatMap(readText(manifestPath), decodeManifest), () => ({}));
|
|
4128
|
+
const previous = manifest[id] ?? [];
|
|
4129
|
+
const gone = previous.filter((entry) => isNone(lstatOf(path.join(path.sep, entry))));
|
|
4130
|
+
const stamp = `/tmp/sandcovery-docker-${v7()}`;
|
|
4131
|
+
const archive = entries.length === 0 ? none() : some(await uploaded({
|
|
4132
|
+
content: await packed({
|
|
4133
|
+
entries,
|
|
4134
|
+
tool
|
|
4135
|
+
}),
|
|
4136
|
+
file: `${stamp}.tar.gz`,
|
|
4137
|
+
id,
|
|
4138
|
+
tool
|
|
4139
|
+
}));
|
|
4140
|
+
const removed = gone.length === 0 ? none() : some(await uploaded({
|
|
4141
|
+
content: Buffer.from(`${gone.toSorted().toReversed().join("\0")}\0`),
|
|
4142
|
+
file: `${stamp}-gone`,
|
|
4143
|
+
id,
|
|
4144
|
+
tool
|
|
4145
|
+
}));
|
|
4146
|
+
if (isSome(archive) || isSome(removed)) {
|
|
4147
|
+
const others = Object.entries(manifest).filter(([saved]) => saved !== id && live.has(saved));
|
|
4148
|
+
const synced = union(difference(previous, gone), entries);
|
|
4149
|
+
const saved = Object.fromEntries([...others, [id, synced]]);
|
|
4150
|
+
writePrivateFile({
|
|
4151
|
+
file: manifestPath,
|
|
4152
|
+
text: `${JSON.stringify(saved)}\n`
|
|
4153
|
+
});
|
|
4154
|
+
}
|
|
4155
|
+
const cwdFromRoot = path.relative(path.parse(cwd).root, cwd);
|
|
4156
|
+
const workdir = quoted(cwdFromRoot === "" ? "." : cwdFromRoot);
|
|
4157
|
+
const uploads = [...toArray(archive), ...toArray(removed)];
|
|
4158
|
+
const sums = uploads.map(({ file, sha }) => `${sha} ${quoted(file)}`);
|
|
4159
|
+
const verify = uploads.length === 0 ? [] : [String.raw`printf '%s %s\n' ${sums.join(" ")} | sha256sum -c --quiet -`];
|
|
4160
|
+
const remove = toArray(removed).flatMap(({ file }) => [`xargs -0 -r sh -c ${quoted(REMOVE_GONE)} sh <${quoted(file)}`, `rm -f ${quoted(file)}`]);
|
|
4161
|
+
const extract = toArray(archive).flatMap(({ file }) => [`tar -xzf ${quoted(file)} --numeric-owner`, `rm -f ${quoted(file)}`]);
|
|
4162
|
+
return [
|
|
4163
|
+
"cd /",
|
|
4164
|
+
...verify,
|
|
4165
|
+
...remove,
|
|
4166
|
+
...extract,
|
|
4167
|
+
`mkdir -p ${workdir}`,
|
|
4168
|
+
`cd ${workdir}`
|
|
4169
|
+
].join(" && ");
|
|
4170
|
+
};
|
|
4171
|
+
export { terminalOf as a, exhaustive as c, value as d, when as f, runAttached as i, orElse as l, __require as m, syncCommand as n, uniq as o, __commonJSMin as p, follow as r, difference as s, quoted as t, tag as u };
|