@powerlines/plugin-env 0.16.67 → 0.16.68

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.
Files changed (104) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +0 -2
  2. package/dist/_virtual/_rolldown/runtime.mjs +2 -31
  3. package/dist/helpers/load.cjs +4 -4
  4. package/dist/helpers/load.mjs +2 -2
  5. package/dist/helpers/load.mjs.map +1 -1
  6. package/package.json +11 -26
  7. package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.cjs +0 -346
  8. package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.mjs +0 -347
  9. package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.mjs.map +0 -1
  10. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.cjs +0 -23
  11. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs +0 -23
  12. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs.map +0 -1
  13. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.cjs +0 -10
  14. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs +0 -11
  15. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs.map +0 -1
  16. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/js-yaml.cjs +0 -1060
  17. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/js-yaml.mjs +0 -1060
  18. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/js-yaml.mjs.map +0 -1
  19. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/json5.cjs +0 -761
  20. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/json5.mjs +0 -761
  21. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/json5.mjs.map +0 -1
  22. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.cjs +0 -388
  23. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs +0 -388
  24. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs.map +0 -1
  25. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/smol-toml.cjs +0 -639
  26. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/smol-toml.mjs +0 -639
  27. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/smol-toml.mjs.map +0 -1
  28. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.cjs +0 -17
  29. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs +0 -17
  30. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs.map +0 -1
  31. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/json5.cjs +0 -13
  32. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/json5.mjs +0 -14
  33. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/json5.mjs.map +0 -1
  34. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.cjs +0 -11
  35. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs +0 -12
  36. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs.map +0 -1
  37. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/toml.cjs +0 -11
  38. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/toml.mjs +0 -12
  39. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/toml.mjs.map +0 -1
  40. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/yaml.cjs +0 -11
  41. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/yaml.mjs +0 -12
  42. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/yaml.mjs.map +0 -1
  43. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.cjs +0 -46
  44. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs +0 -46
  45. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs.map +0 -1
  46. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.cjs +0 -285
  47. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.mjs +0 -283
  48. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.mjs.map +0 -1
  49. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.cjs +0 -71
  50. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.mjs +0 -69
  51. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.mjs.map +0 -1
  52. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.cjs +0 -1013
  53. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs +0 -1008
  54. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs.map +0 -1
  55. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.cjs +0 -23
  56. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs +0 -14
  57. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs.map +0 -1
  58. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.cjs +0 -2695
  59. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +0 -2683
  60. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs.map +0 -1
  61. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs +0 -4457
  62. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.mjs +0 -4455
  63. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.mjs.map +0 -1
  64. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.cjs +0 -29
  65. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.mjs +0 -30
  66. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.mjs.map +0 -1
  67. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +0 -181
  68. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +0 -177
  69. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs.map +0 -1
  70. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.cjs +0 -22
  71. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs +0 -18
  72. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs.map +0 -1
  73. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.cjs +0 -3967
  74. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs +0 -3963
  75. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs.map +0 -1
  76. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.cjs +0 -11766
  77. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs +0 -11762
  78. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs.map +0 -1
  79. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs +0 -25
  80. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.mjs +0 -21
  81. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.mjs.map +0 -1
  82. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/lib/index.cjs +0 -20
  83. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/lib/index.mjs +0 -18
  84. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/lib/index.mjs.map +0 -1
  85. package/dist/node_modules/.pnpm/nypm@0.6.5/node_modules/nypm/dist/index.cjs +0 -178
  86. package/dist/node_modules/.pnpm/nypm@0.6.5/node_modules/nypm/dist/index.mjs +0 -176
  87. package/dist/node_modules/.pnpm/nypm@0.6.5/node_modules/nypm/dist/index.mjs.map +0 -1
  88. package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.cjs +0 -13
  89. package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs +0 -13
  90. package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs.map +0 -1
  91. package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/index.cjs +0 -3
  92. package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/index.mjs +0 -3
  93. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs +0 -145
  94. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -139
  95. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs.map +0 -1
  96. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.cjs +0 -128
  97. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs +0 -127
  98. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs.map +0 -1
  99. package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.cjs +0 -138
  100. package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs +0 -137
  101. package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs.map +0 -1
  102. package/dist/node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.cjs +0 -629
  103. package/dist/node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.mjs +0 -628
  104. package/dist/node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.mjs.map +0 -1
@@ -1,2683 +0,0 @@
1
- import { basename, dirname as dirname$1, resolve as resolve$1 } from "../../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs";
2
- import { installDependencies } from "../../../../../nypm@0.6.5/node_modules/nypm/dist/index.mjs";
3
- import { require_proxy } from "../../../../../node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs";
4
- import fs, { createWriteStream, existsSync, readdirSync, renameSync } from "node:fs";
5
- import path from "node:path";
6
- import { homedir, tmpdir } from "node:os";
7
- import Ds from "node:crypto";
8
- import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
9
- import assert from "node:assert";
10
- import process$1 from "node:process";
11
- import a$a, { promisify } from "node:util";
12
- import { defu as defu$1 } from "defu";
13
- import nt from "node:events";
14
- import ot, { pipeline } from "node:stream";
15
- import ht from "node:string_decoder";
16
- import P from "node:buffer";
17
- import O$2 from "node:zlib";
18
- import "node:child_process";
19
-
20
- //#region ../../node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs
21
- var import_proxy = require_proxy();
22
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
23
- function getDefaultExportFromCjs(x) {
24
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
25
- }
26
- var i$6, t$5;
27
- function s$6() {
28
- if (t$5) return i$6;
29
- t$5 = 1;
30
- const n = new Map([
31
- ["C", "cwd"],
32
- ["f", "file"],
33
- ["z", "gzip"],
34
- ["P", "preservePaths"],
35
- ["U", "unlink"],
36
- ["strip-components", "strip"],
37
- ["stripComponents", "strip"],
38
- ["keep-newer", "newer"],
39
- ["keepNewer", "newer"],
40
- ["keep-newer-files", "newer"],
41
- ["keepNewerFiles", "newer"],
42
- ["k", "keep"],
43
- ["keep-existing", "keep"],
44
- ["keepExisting", "keep"],
45
- ["m", "noMtime"],
46
- ["no-mtime", "noMtime"],
47
- ["p", "preserveOwner"],
48
- ["L", "follow"],
49
- ["h", "follow"]
50
- ]);
51
- return i$6 = (r) => r ? Object.keys(r).map((e) => [n.has(e) ? n.get(e) : e, r[e]]).reduce((e, p) => (e[p[0]] = p[1], e), Object.create(null)) : {}, i$6;
52
- }
53
- var e$5, t$4;
54
- function c$4() {
55
- return t$4 || (t$4 = 1, e$5 = (o) => class extends o {
56
- warn(n, i, r = {}) {
57
- this.file && (r.file = this.file), this.cwd && (r.cwd = this.cwd), r.code = i instanceof Error && i.code || n, r.tarCode = n, !this.strict && r.recoverable !== false ? (i instanceof Error && (r = Object.assign(i, r), i = i.message), this.emit("warn", r.tarCode, i, r)) : i instanceof Error ? this.emit("error", Object.assign(i, r)) : this.emit("error", Object.assign(/* @__PURE__ */ new Error(`${n}: ${i}`), r));
58
- }
59
- }), e$5;
60
- }
61
- var e$4 = {};
62
- var a$9;
63
- function n$3() {
64
- return a$9 ? e$4 : (a$9 = 1, function(e) {
65
- e.name = new Map([
66
- ["0", "File"],
67
- ["", "OldFile"],
68
- ["1", "Link"],
69
- ["2", "SymbolicLink"],
70
- ["3", "CharacterDevice"],
71
- ["4", "BlockDevice"],
72
- ["5", "Directory"],
73
- ["6", "FIFO"],
74
- ["7", "ContiguousFile"],
75
- ["g", "GlobalExtendedHeader"],
76
- ["x", "ExtendedHeader"],
77
- ["A", "SolarisACL"],
78
- ["D", "GNUDumpDir"],
79
- ["I", "Inode"],
80
- ["K", "NextFileHasLongLinkpath"],
81
- ["L", "NextFileHasLongPath"],
82
- ["M", "ContinuationFile"],
83
- ["N", "OldGnuLongPath"],
84
- ["S", "SparseFile"],
85
- ["V", "TapeVolumeHeader"],
86
- ["X", "OldExtendedHeader"]
87
- ]), e.code = new Map(Array.from(e.name).map((i) => [i[1], i[0]]));
88
- }(e$4), e$4);
89
- }
90
- var f$3, i$5;
91
- function w$1() {
92
- if (i$5) return f$3;
93
- i$5 = 1;
94
- const v = (e, r) => {
95
- if (Number.isSafeInteger(e)) e < 0 ? g(e, r) : p(e, r);
96
- else throw Error("cannot encode number outside of javascript safe integer range");
97
- return r;
98
- }, p = (e, r) => {
99
- r[0] = 128;
100
- for (var o = r.length; o > 1; o--) r[o - 1] = e & 255, e = Math.floor(e / 256);
101
- }, g = (e, r) => {
102
- r[0] = 255;
103
- var o = false;
104
- e = e * -1;
105
- for (var s = r.length; s > 1; s--) {
106
- var a = e & 255;
107
- e = Math.floor(e / 256), o ? r[s - 1] = l(a) : a === 0 ? r[s - 1] = 0 : (o = true, r[s - 1] = c(a));
108
- }
109
- }, h = (e) => {
110
- const r = e[0], o = r === 128 ? d(e.slice(1, e.length)) : r === 255 ? x(e) : null;
111
- if (o === null) throw Error("invalid base256 encoding");
112
- if (!Number.isSafeInteger(o)) throw Error("parsed number outside of javascript safe integer range");
113
- return o;
114
- }, x = (e) => {
115
- for (var r = e.length, o = 0, s = false, a = r - 1; a > -1; a--) {
116
- var n = e[a], t;
117
- s ? t = l(n) : n === 0 ? t = n : (s = true, t = c(n)), t !== 0 && (o -= t * Math.pow(256, r - a - 1));
118
- }
119
- return o;
120
- }, d = (e) => {
121
- for (var r = e.length, o = 0, s = r - 1; s > -1; s--) {
122
- var a = e[s];
123
- a !== 0 && (o += a * Math.pow(256, r - s - 1));
124
- }
125
- return o;
126
- }, l = (e) => (255 ^ e) & 255, c = (e) => (255 ^ e) + 1 & 255;
127
- return f$3 = {
128
- encode: v,
129
- parse: h
130
- }, f$3;
131
- }
132
- var k, w;
133
- function E() {
134
- if (w) return k;
135
- w = 1;
136
- const u = n$3(), x = path.posix, y = w$1(), P = Symbol("slurp"), a = Symbol("type");
137
- class B {
138
- constructor(e, t, i, h) {
139
- this.cksumValid = false, this.needPax = false, this.nullBlock = false, this.block = null, this.path = null, this.mode = null, this.uid = null, this.gid = null, this.size = null, this.mtime = null, this.cksum = null, this[a] = "0", this.linkpath = null, this.uname = null, this.gname = null, this.devmaj = 0, this.devmin = 0, this.atime = null, this.ctime = null, Buffer.isBuffer(e) ? this.decode(e, t || 0, i, h) : e && this.set(e);
140
- }
141
- decode(e, t, i, h) {
142
- if (t || (t = 0), !e || !(e.length >= t + 512)) throw new Error("need 512 bytes for header");
143
- if (this.path = d(e, t, 100), this.mode = r(e, t + 100, 8), this.uid = r(e, t + 108, 8), this.gid = r(e, t + 116, 8), this.size = r(e, t + 124, 12), this.mtime = o(e, t + 136, 12), this.cksum = r(e, t + 148, 12), this[P](i), this[P](h, true), this[a] = d(e, t + 156, 1), this[a] === "" && (this[a] = "0"), this[a] === "0" && this.path.slice(-1) === "/" && (this[a] = "5"), this[a] === "5" && (this.size = 0), this.linkpath = d(e, t + 157, 100), e.slice(t + 257, t + 265).toString() === "ustar\x0000") if (this.uname = d(e, t + 265, 32), this.gname = d(e, t + 297, 32), this.devmaj = r(e, t + 329, 8), this.devmin = r(e, t + 337, 8), e[t + 475] !== 0) this.path = d(e, t + 345, 155) + "/" + this.path;
144
- else {
145
- const n = d(e, t + 345, 130);
146
- n && (this.path = n + "/" + this.path), this.atime = o(e, t + 476, 12), this.ctime = o(e, t + 488, 12);
147
- }
148
- let l = 256;
149
- for (let n = t; n < t + 148; n++) l += e[n];
150
- for (let n = t + 156; n < t + 512; n++) l += e[n];
151
- this.cksumValid = l === this.cksum, this.cksum === null && l === 256 && (this.nullBlock = true);
152
- }
153
- [P](e, t) {
154
- for (const i in e) e[i] !== null && e[i] !== void 0 && !(t && i === "path") && (this[i] = e[i]);
155
- }
156
- encode(e, t) {
157
- if (e || (e = this.block = Buffer.alloc(512), t = 0), t || (t = 0), !(e.length >= t + 512)) throw new Error("need 512 bytes for header");
158
- const i = this.ctime || this.atime ? 130 : 155, h = L(this.path || "", i), l = h[0], n = h[1];
159
- this.needPax = h[2], this.needPax = m(e, t, 100, l) || this.needPax, this.needPax = c(e, t + 100, 8, this.mode) || this.needPax, this.needPax = c(e, t + 108, 8, this.uid) || this.needPax, this.needPax = c(e, t + 116, 8, this.gid) || this.needPax, this.needPax = c(e, t + 124, 12, this.size) || this.needPax, this.needPax = g(e, t + 136, 12, this.mtime) || this.needPax, e[t + 156] = this[a].charCodeAt(0), this.needPax = m(e, t + 157, 100, this.linkpath) || this.needPax, e.write("ustar\x0000", t + 257, 8), this.needPax = m(e, t + 265, 32, this.uname) || this.needPax, this.needPax = m(e, t + 297, 32, this.gname) || this.needPax, this.needPax = c(e, t + 329, 8, this.devmaj) || this.needPax, this.needPax = c(e, t + 337, 8, this.devmin) || this.needPax, this.needPax = m(e, t + 345, i, n) || this.needPax, e[t + 475] !== 0 ? this.needPax = m(e, t + 345, 155, n) || this.needPax : (this.needPax = m(e, t + 345, 130, n) || this.needPax, this.needPax = g(e, t + 476, 12, this.atime) || this.needPax, this.needPax = g(e, t + 488, 12, this.ctime) || this.needPax);
160
- let S = 256;
161
- for (let p = t; p < t + 148; p++) S += e[p];
162
- for (let p = t + 156; p < t + 512; p++) S += e[p];
163
- return this.cksum = S, c(e, t + 148, 8, this.cksum), this.cksumValid = true, this.needPax;
164
- }
165
- set(e) {
166
- for (const t in e) e[t] !== null && e[t] !== void 0 && (this[t] = e[t]);
167
- }
168
- get type() {
169
- return u.name.get(this[a]) || this[a];
170
- }
171
- get typeKey() {
172
- return this[a];
173
- }
174
- set type(e) {
175
- u.code.has(e) ? this[a] = u.code.get(e) : this[a] = e;
176
- }
177
- }
178
- const L = (s, e) => {
179
- let i = s, h = "", l;
180
- const n = x.parse(s).root || ".";
181
- if (Buffer.byteLength(i) < 100) l = [
182
- i,
183
- h,
184
- false
185
- ];
186
- else {
187
- h = x.dirname(i), i = x.basename(i);
188
- do
189
- Buffer.byteLength(i) <= 100 && Buffer.byteLength(h) <= e ? l = [
190
- i,
191
- h,
192
- false
193
- ] : Buffer.byteLength(i) > 100 && Buffer.byteLength(h) <= e ? l = [
194
- i.slice(0, 99),
195
- h,
196
- true
197
- ] : (i = x.join(x.basename(h), i), h = x.dirname(h));
198
- while (h !== n && !l);
199
- l || (l = [
200
- s.slice(0, 99),
201
- "",
202
- true
203
- ]);
204
- }
205
- return l;
206
- }, d = (s, e, t) => s.slice(e, e + t).toString("utf8").replace(/\0.*/, ""), o = (s, e, t) => N(r(s, e, t)), N = (s) => s === null ? null : /* @__PURE__ */ new Date(s * 1e3), r = (s, e, t) => s[e] & 128 ? y.parse(s.slice(e, e + t)) : j(s, e, t), q = (s) => isNaN(s) ? null : s, j = (s, e, t) => q(parseInt(s.slice(e, e + t).toString("utf8").replace(/\0.*$/, "").trim(), 8)), v = {
207
- 12: 8589934591,
208
- 8: 2097151
209
- }, c = (s, e, t, i) => i === null ? false : i > v[t] || i < 0 ? (y.encode(i, s.slice(e, e + t)), true) : ($(s, e, t, i), false), $ = (s, e, t, i) => s.write(_(i, t), e, t, "ascii"), _ = (s, e) => z(Math.floor(s).toString(8), e), z = (s, e) => (s.length === e - 1 ? s : new Array(e - s.length - 1).join("0") + s + " ") + "\0", g = (s, e, t, i) => i === null ? false : c(s, e, t, i.getTime() / 1e3), A = new Array(156).join("\0"), m = (s, e, t, i) => i === null ? false : (s.write(i + A, e, t, "utf8"), i.length !== Buffer.byteLength(i) || i.length > t);
210
- return k = B, k;
211
- }
212
- var e$3, t$3;
213
- function i$4() {
214
- return t$3 || (t$3 = 1, e$3 = function(o) {
215
- o.prototype[Symbol.iterator] = function* () {
216
- for (let r = this.head; r; r = r.next) yield r.value;
217
- };
218
- }), e$3;
219
- }
220
- var u$4, a$8;
221
- function c$3() {
222
- if (a$8) return u$4;
223
- a$8 = 1, u$4 = r, r.Node = s, r.create = r;
224
- function r(t) {
225
- var i = this;
226
- if (i instanceof r || (i = new r()), i.tail = null, i.head = null, i.length = 0, t && typeof t.forEach == "function") t.forEach(function(n) {
227
- i.push(n);
228
- });
229
- else if (arguments.length > 0) for (var e = 0, h = arguments.length; e < h; e++) i.push(arguments[e]);
230
- return i;
231
- }
232
- r.prototype.removeNode = function(t) {
233
- if (t.list !== this) throw new Error("removing node which does not belong to this list");
234
- var i = t.next, e = t.prev;
235
- return i && (i.prev = e), e && (e.next = i), t === this.head && (this.head = i), t === this.tail && (this.tail = e), t.list.length--, t.next = null, t.prev = null, t.list = null, i;
236
- }, r.prototype.unshiftNode = function(t) {
237
- if (t !== this.head) {
238
- t.list && t.list.removeNode(t);
239
- var i = this.head;
240
- t.list = this, t.next = i, i && (i.prev = t), this.head = t, this.tail || (this.tail = t), this.length++;
241
- }
242
- }, r.prototype.pushNode = function(t) {
243
- if (t !== this.tail) {
244
- t.list && t.list.removeNode(t);
245
- var i = this.tail;
246
- t.list = this, t.prev = i, i && (i.next = t), this.tail = t, this.head || (this.head = t), this.length++;
247
- }
248
- }, r.prototype.push = function() {
249
- for (var t = 0, i = arguments.length; t < i; t++) f(this, arguments[t]);
250
- return this.length;
251
- }, r.prototype.unshift = function() {
252
- for (var t = 0, i = arguments.length; t < i; t++) o(this, arguments[t]);
253
- return this.length;
254
- }, r.prototype.pop = function() {
255
- if (this.tail) {
256
- var t = this.tail.value;
257
- return this.tail = this.tail.prev, this.tail ? this.tail.next = null : this.head = null, this.length--, t;
258
- }
259
- }, r.prototype.shift = function() {
260
- if (this.head) {
261
- var t = this.head.value;
262
- return this.head = this.head.next, this.head ? this.head.prev = null : this.tail = null, this.length--, t;
263
- }
264
- }, r.prototype.forEach = function(t, i) {
265
- i = i || this;
266
- for (var e = this.head, h = 0; e !== null; h++) t.call(i, e.value, h, this), e = e.next;
267
- }, r.prototype.forEachReverse = function(t, i) {
268
- i = i || this;
269
- for (var e = this.tail, h = this.length - 1; e !== null; h--) t.call(i, e.value, h, this), e = e.prev;
270
- }, r.prototype.get = function(t) {
271
- for (var i = 0, e = this.head; e !== null && i < t; i++) e = e.next;
272
- if (i === t && e !== null) return e.value;
273
- }, r.prototype.getReverse = function(t) {
274
- for (var i = 0, e = this.tail; e !== null && i < t; i++) e = e.prev;
275
- if (i === t && e !== null) return e.value;
276
- }, r.prototype.map = function(t, i) {
277
- i = i || this;
278
- for (var e = new r(), h = this.head; h !== null;) e.push(t.call(i, h.value, this)), h = h.next;
279
- return e;
280
- }, r.prototype.mapReverse = function(t, i) {
281
- i = i || this;
282
- for (var e = new r(), h = this.tail; h !== null;) e.push(t.call(i, h.value, this)), h = h.prev;
283
- return e;
284
- }, r.prototype.reduce = function(t, i) {
285
- var e, h = this.head;
286
- if (arguments.length > 1) e = i;
287
- else if (this.head) h = this.head.next, e = this.head.value;
288
- else throw new TypeError("Reduce of empty list with no initial value");
289
- for (var n = 0; h !== null; n++) e = t(e, h.value, n), h = h.next;
290
- return e;
291
- }, r.prototype.reduceReverse = function(t, i) {
292
- var e, h = this.tail;
293
- if (arguments.length > 1) e = i;
294
- else if (this.tail) h = this.tail.prev, e = this.tail.value;
295
- else throw new TypeError("Reduce of empty list with no initial value");
296
- for (var n = this.length - 1; h !== null; n--) e = t(e, h.value, n), h = h.prev;
297
- return e;
298
- }, r.prototype.toArray = function() {
299
- for (var t = new Array(this.length), i = 0, e = this.head; e !== null; i++) t[i] = e.value, e = e.next;
300
- return t;
301
- }, r.prototype.toArrayReverse = function() {
302
- for (var t = new Array(this.length), i = 0, e = this.tail; e !== null; i++) t[i] = e.value, e = e.prev;
303
- return t;
304
- }, r.prototype.slice = function(t, i) {
305
- i = i || this.length, i < 0 && (i += this.length), t = t || 0, t < 0 && (t += this.length);
306
- var e = new r();
307
- if (i < t || i < 0) return e;
308
- t < 0 && (t = 0), i > this.length && (i = this.length);
309
- for (var h = 0, n = this.head; n !== null && h < t; h++) n = n.next;
310
- for (; n !== null && h < i; h++, n = n.next) e.push(n.value);
311
- return e;
312
- }, r.prototype.sliceReverse = function(t, i) {
313
- i = i || this.length, i < 0 && (i += this.length), t = t || 0, t < 0 && (t += this.length);
314
- var e = new r();
315
- if (i < t || i < 0) return e;
316
- t < 0 && (t = 0), i > this.length && (i = this.length);
317
- for (var h = this.length, n = this.tail; n !== null && h > i; h--) n = n.prev;
318
- for (; n !== null && h > t; h--, n = n.prev) e.push(n.value);
319
- return e;
320
- }, r.prototype.splice = function(t, i, ...e) {
321
- t > this.length && (t = this.length - 1), t < 0 && (t = this.length + t);
322
- for (var h = 0, n = this.head; n !== null && h < t; h++) n = n.next;
323
- for (var l = [], h = 0; n && h < i; h++) l.push(n.value), n = this.removeNode(n);
324
- n === null && (n = this.tail), n !== this.head && n !== this.tail && (n = n.prev);
325
- for (var h = 0; h < e.length; h++) n = v(this, n, e[h]);
326
- return l;
327
- }, r.prototype.reverse = function() {
328
- for (var t = this.head, i = this.tail, e = t; e !== null; e = e.prev) {
329
- var h = e.prev;
330
- e.prev = e.next, e.next = h;
331
- }
332
- return this.head = i, this.tail = t, this;
333
- };
334
- function v(t, i, e) {
335
- var h = i === t.head ? new s(e, null, i, t) : new s(e, i, i.next, t);
336
- return h.next === null && (t.tail = h), h.prev === null && (t.head = h), t.length++, h;
337
- }
338
- function f(t, i) {
339
- t.tail = new s(i, t.tail, null, t), t.head || (t.head = t.tail), t.length++;
340
- }
341
- function o(t, i) {
342
- t.head = new s(i, null, t.head, t), t.tail || (t.tail = t.head), t.length++;
343
- }
344
- function s(t, i, e, h) {
345
- if (!(this instanceof s)) return new s(t, i, e, h);
346
- this.list = h, this.value = t, i ? (i.next = this, this.prev = i) : this.prev = null, e ? (e.prev = this, this.next = e) : this.next = null;
347
- }
348
- try {
349
- i$4()(r);
350
- } catch {}
351
- return u$4;
352
- }
353
- var s$5 = {};
354
- var X$1;
355
- function ft() {
356
- if (X$1) return s$5;
357
- X$1 = 1;
358
- const H = typeof process == "object" && process ? process : {
359
- stdout: null,
360
- stderr: null
361
- }, Z = nt, q = ot, G = ht.StringDecoder, m = Symbol("EOF"), d = Symbol("maybeEmitEnd"), y = Symbol("emittedEnd"), R = Symbol("emittingEnd"), g = Symbol("emittedError"), B = Symbol("closed"), Y = Symbol("read"), T = Symbol("flush"), $ = Symbol("flushChunk"), f = Symbol("encoding"), c = Symbol("decoder"), M = Symbol("flowing"), S = Symbol("paused"), b = Symbol("resume"), i = Symbol("buffer"), a = Symbol("pipes"), n = Symbol("bufferLength"), j = Symbol("bufferPush"), I = Symbol("bufferShift"), o = Symbol("objectMode"), r = Symbol("destroyed"), P = Symbol("error"), x = Symbol("emitData"), V = Symbol("emitEnd"), N = Symbol("emitEnd2"), p = Symbol("async"), _ = Symbol("abort"), O = Symbol("aborted"), E = Symbol("signal"), w = (h) => Promise.resolve().then(h), J = commonjsGlobal._MP_NO_ITERATOR_SYMBOLS_ !== "1", K = J && Symbol.asyncIterator || Symbol("asyncIterator not implemented"), W = J && Symbol.iterator || Symbol("iterator not implemented"), k = (h) => h === "end" || h === "finish" || h === "prefinish", tt = (h) => h instanceof ArrayBuffer || typeof h == "object" && h.constructor && h.constructor.name === "ArrayBuffer" && h.byteLength >= 0, et = (h) => !Buffer.isBuffer(h) && ArrayBuffer.isView(h);
362
- class z {
363
- constructor(t, e, s) {
364
- this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[b](), e.on("drain", this.ondrain);
365
- }
366
- unpipe() {
367
- this.dest.removeListener("drain", this.ondrain);
368
- }
369
- proxyErrors() {}
370
- end() {
371
- this.unpipe(), this.opts.end && this.dest.end();
372
- }
373
- }
374
- class st extends z {
375
- unpipe() {
376
- this.src.removeListener("error", this.proxyErrors), super.unpipe();
377
- }
378
- constructor(t, e, s) {
379
- super(t, e, s), this.proxyErrors = (l) => e.emit("error", l), t.on("error", this.proxyErrors);
380
- }
381
- }
382
- class F extends q {
383
- constructor(t) {
384
- super(), this[M] = false, this[S] = false, this[a] = [], this[i] = [], this[o] = t && t.objectMode || false, this[o] ? this[f] = null : this[f] = t && t.encoding || null, this[f] === "buffer" && (this[f] = null), this[p] = t && !!t.async || false, this[c] = this[f] ? new G(this[f]) : null, this[m] = false, this[y] = false, this[R] = false, this[B] = false, this[g] = null, this.writable = true, this.readable = true, this[n] = 0, this[r] = false, t && t.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[i] }), t && t.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[a] }), this[E] = t && t.signal, this[O] = false, this[E] && (this[E].addEventListener("abort", () => this[_]()), this[E].aborted && this[_]());
385
- }
386
- get bufferLength() {
387
- return this[n];
388
- }
389
- get encoding() {
390
- return this[f];
391
- }
392
- set encoding(t) {
393
- if (this[o]) throw new Error("cannot set encoding in objectMode");
394
- if (this[f] && t !== this[f] && (this[c] && this[c].lastNeed || this[n])) throw new Error("cannot change encoding");
395
- this[f] !== t && (this[c] = t ? new G(t) : null, this[i].length && (this[i] = this[i].map((e) => this[c].write(e)))), this[f] = t;
396
- }
397
- setEncoding(t) {
398
- this.encoding = t;
399
- }
400
- get objectMode() {
401
- return this[o];
402
- }
403
- set objectMode(t) {
404
- this[o] = this[o] || !!t;
405
- }
406
- get async() {
407
- return this[p];
408
- }
409
- set async(t) {
410
- this[p] = this[p] || !!t;
411
- }
412
- [_]() {
413
- this[O] = true, this.emit("abort", this[E].reason), this.destroy(this[E].reason);
414
- }
415
- get aborted() {
416
- return this[O];
417
- }
418
- set aborted(t) {}
419
- write(t, e, s) {
420
- if (this[O]) return false;
421
- if (this[m]) throw new Error("write after end");
422
- if (this[r]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
423
- typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
424
- const l = this[p] ? w : (u) => u();
425
- return !this[o] && !Buffer.isBuffer(t) && (et(t) ? t = Buffer.from(t.buffer, t.byteOffset, t.byteLength) : tt(t) ? t = Buffer.from(t) : typeof t != "string" && (this.objectMode = true)), this[o] ? (this.flowing && this[n] !== 0 && this[T](true), this.flowing ? this.emit("data", t) : this[j](t), this[n] !== 0 && this.emit("readable"), s && l(s), this.flowing) : t.length ? (typeof t == "string" && !(e === this[f] && !this[c].lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[f] && (t = this[c].write(t)), this.flowing && this[n] !== 0 && this[T](true), this.flowing ? this.emit("data", t) : this[j](t), this[n] !== 0 && this.emit("readable"), s && l(s), this.flowing) : (this[n] !== 0 && this.emit("readable"), s && l(s), this.flowing);
426
- }
427
- read(t) {
428
- if (this[r]) return null;
429
- if (this[n] === 0 || t === 0 || t > this[n]) return this[d](), null;
430
- this[o] && (t = null), this[i].length > 1 && !this[o] && (this.encoding ? this[i] = [this[i].join("")] : this[i] = [Buffer.concat(this[i], this[n])]);
431
- const e = this[Y](t || null, this[i][0]);
432
- return this[d](), e;
433
- }
434
- [Y](t, e) {
435
- return t === e.length || t === null ? this[I]() : (this[i][0] = e.slice(t), e = e.slice(0, t), this[n] -= t), this.emit("data", e), !this[i].length && !this[m] && this.emit("drain"), e;
436
- }
437
- end(t, e, s) {
438
- return typeof t == "function" && (s = t, t = null), typeof e == "function" && (s = e, e = "utf8"), t && this.write(t, e), s && this.once("end", s), this[m] = true, this.writable = false, (this.flowing || !this[S]) && this[d](), this;
439
- }
440
- [b]() {
441
- this[r] || (this[S] = false, this[M] = true, this.emit("resume"), this[i].length ? this[T]() : this[m] ? this[d]() : this.emit("drain"));
442
- }
443
- resume() {
444
- return this[b]();
445
- }
446
- pause() {
447
- this[M] = false, this[S] = true;
448
- }
449
- get destroyed() {
450
- return this[r];
451
- }
452
- get flowing() {
453
- return this[M];
454
- }
455
- get paused() {
456
- return this[S];
457
- }
458
- [j](t) {
459
- this[o] ? this[n] += 1 : this[n] += t.length, this[i].push(t);
460
- }
461
- [I]() {
462
- return this[o] ? this[n] -= 1 : this[n] -= this[i][0].length, this[i].shift();
463
- }
464
- [T](t) {
465
- do ;
466
- while (this[$](this[I]()) && this[i].length);
467
- !t && !this[i].length && !this[m] && this.emit("drain");
468
- }
469
- [$](t) {
470
- return this.emit("data", t), this.flowing;
471
- }
472
- pipe(t, e) {
473
- if (this[r]) return;
474
- const s = this[y];
475
- return e = e || {}, t === H.stdout || t === H.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[a].push(e.proxyErrors ? new st(this, t, e) : new z(this, t, e)), this[p] ? w(() => this[b]()) : this[b]()), t;
476
- }
477
- unpipe(t) {
478
- const e = this[a].find((s) => s.dest === t);
479
- e && (this[a].splice(this[a].indexOf(e), 1), e.unpipe());
480
- }
481
- addListener(t, e) {
482
- return this.on(t, e);
483
- }
484
- on(t, e) {
485
- const s = super.on(t, e);
486
- return t === "data" && !this[a].length && !this.flowing ? this[b]() : t === "readable" && this[n] !== 0 ? super.emit("readable") : k(t) && this[y] ? (super.emit(t), this.removeAllListeners(t)) : t === "error" && this[g] && (this[p] ? w(() => e.call(this, this[g])) : e.call(this, this[g])), s;
487
- }
488
- get emittedEnd() {
489
- return this[y];
490
- }
491
- [d]() {
492
- !this[R] && !this[y] && !this[r] && this[i].length === 0 && this[m] && (this[R] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[B] && this.emit("close"), this[R] = false);
493
- }
494
- emit(t, e, ...s) {
495
- if (t !== "error" && t !== "close" && t !== r && this[r]) return;
496
- if (t === "data") return !this[o] && !e ? false : this[p] ? w(() => this[x](e)) : this[x](e);
497
- if (t === "end") return this[V]();
498
- if (t === "close") {
499
- if (this[B] = true, !this[y] && !this[r]) return;
500
- const u = super.emit("close");
501
- return this.removeAllListeners("close"), u;
502
- } else if (t === "error") {
503
- this[g] = e, super.emit(P, e);
504
- const u = !this[E] || this.listeners("error").length ? super.emit("error", e) : false;
505
- return this[d](), u;
506
- } else if (t === "resume") {
507
- const u = super.emit("resume");
508
- return this[d](), u;
509
- } else if (t === "finish" || t === "prefinish") {
510
- const u = super.emit(t);
511
- return this.removeAllListeners(t), u;
512
- }
513
- const l = super.emit(t, e, ...s);
514
- return this[d](), l;
515
- }
516
- [x](t) {
517
- for (const s of this[a]) s.dest.write(t) === false && this.pause();
518
- const e = super.emit("data", t);
519
- return this[d](), e;
520
- }
521
- [V]() {
522
- this[y] || (this[y] = true, this.readable = false, this[p] ? w(() => this[N]()) : this[N]());
523
- }
524
- [N]() {
525
- if (this[c]) {
526
- const e = this[c].end();
527
- if (e) {
528
- for (const s of this[a]) s.dest.write(e);
529
- super.emit("data", e);
530
- }
531
- }
532
- for (const e of this[a]) e.end();
533
- const t = super.emit("end");
534
- return this.removeAllListeners("end"), t;
535
- }
536
- collect() {
537
- const t = [];
538
- this[o] || (t.dataLength = 0);
539
- const e = this.promise();
540
- return this.on("data", (s) => {
541
- t.push(s), this[o] || (t.dataLength += s.length);
542
- }), e.then(() => t);
543
- }
544
- concat() {
545
- return this[o] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this.collect().then((t) => this[o] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this[f] ? t.join("") : Buffer.concat(t, t.dataLength));
546
- }
547
- promise() {
548
- return new Promise((t, e) => {
549
- this.on(r, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
550
- });
551
- }
552
- [K]() {
553
- let t = false;
554
- const e = () => (this.pause(), t = true, Promise.resolve({ done: true }));
555
- return {
556
- next: () => {
557
- if (t) return e();
558
- const l = this.read();
559
- if (l !== null) return Promise.resolve({
560
- done: false,
561
- value: l
562
- });
563
- if (this[m]) return e();
564
- let u = null, Q = null;
565
- const A = (L) => {
566
- this.removeListener("data", U), this.removeListener("end", C), this.removeListener(r, D), e(), Q(L);
567
- }, U = (L) => {
568
- this.removeListener("error", A), this.removeListener("end", C), this.removeListener(r, D), this.pause(), u({
569
- value: L,
570
- done: !!this[m]
571
- });
572
- }, C = () => {
573
- this.removeListener("error", A), this.removeListener("data", U), this.removeListener(r, D), e(), u({ done: true });
574
- }, D = () => A(/* @__PURE__ */ new Error("stream destroyed"));
575
- return new Promise((L, it) => {
576
- Q = it, u = L, this.once(r, D), this.once("error", A), this.once("end", C), this.once("data", U);
577
- });
578
- },
579
- throw: e,
580
- return: e,
581
- [K]() {
582
- return this;
583
- }
584
- };
585
- }
586
- [W]() {
587
- let t = false;
588
- const e = () => (this.pause(), this.removeListener(P, e), this.removeListener(r, e), this.removeListener("end", e), t = true, { done: true }), s = () => {
589
- if (t) return e();
590
- const l = this.read();
591
- return l === null ? e() : { value: l };
592
- };
593
- return this.once("end", e), this.once(P, e), this.once(r, e), {
594
- next: s,
595
- throw: e,
596
- return: e,
597
- [W]() {
598
- return this;
599
- }
600
- };
601
- }
602
- destroy(t) {
603
- return this[r] ? (t ? this.emit("error", t) : this.emit(r), this) : (this[r] = true, this[i].length = 0, this[n] = 0, typeof this.close == "function" && !this[B] && this.close(), t ? this.emit("error", t) : this.emit(r), this);
604
- }
605
- static isStream(t) {
606
- return !!t && (t instanceof F || t instanceof q || t instanceof Z && (typeof t.pipe == "function" || typeof t.write == "function" && typeof t.end == "function"));
607
- }
608
- }
609
- return s$5.Minipass = F, s$5;
610
- }
611
- var e$2, o$4;
612
- function a$7() {
613
- return o$4 || (o$4 = 1, e$2 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) !== "win32" ? (r) => r : (r) => r && r.replace(/\\/g, "/")), e$2;
614
- }
615
- var n$2, a$6;
616
- function u$3() {
617
- if (a$6) return n$2;
618
- a$6 = 1;
619
- const { Minipass: o } = ft(), s = a$7(), r = Symbol("slurp");
620
- return n$2 = class extends o {
621
- constructor(t, e, i) {
622
- switch (super(), this.pause(), this.extended = e, this.globalExtended = i, this.header = t, this.startBlockSize = 512 * Math.ceil(t.size / 512), this.blockRemain = this.startBlockSize, this.remain = t.size, this.type = t.type, this.meta = false, this.ignore = false, this.type) {
623
- case "File":
624
- case "OldFile":
625
- case "Link":
626
- case "SymbolicLink":
627
- case "CharacterDevice":
628
- case "BlockDevice":
629
- case "Directory":
630
- case "FIFO":
631
- case "ContiguousFile":
632
- case "GNUDumpDir": break;
633
- case "NextFileHasLongLinkpath":
634
- case "NextFileHasLongPath":
635
- case "OldGnuLongPath":
636
- case "GlobalExtendedHeader":
637
- case "ExtendedHeader":
638
- case "OldExtendedHeader":
639
- this.meta = true;
640
- break;
641
- default: this.ignore = true;
642
- }
643
- this.path = s(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 = t.size, this.mtime = t.mtime, this.atime = t.atime, this.ctime = t.ctime, this.linkpath = s(t.linkpath), this.uname = t.uname, this.gname = t.gname, e && this[r](e), i && this[r](i, true);
644
- }
645
- write(t) {
646
- const e = t.length;
647
- if (e > this.blockRemain) throw new Error("writing more to entry than is appropriate");
648
- const i = this.remain, c = this.blockRemain;
649
- return this.remain = Math.max(0, i - e), this.blockRemain = Math.max(0, c - e), this.ignore ? true : i >= e ? super.write(t) : super.write(t.slice(0, i));
650
- }
651
- [r](t, e) {
652
- for (const i in t) t[i] !== null && t[i] !== void 0 && !(e && i === "path") && (this[i] = i === "path" || i === "linkpath" ? s(t[i]) : t[i]);
653
- }
654
- }, n$2;
655
- }
656
- var r$2, a$5;
657
- function f$2() {
658
- if (a$5) return r$2;
659
- a$5 = 1;
660
- const c = E(), d = path;
661
- class h {
662
- constructor(e, n) {
663
- this.atime = e.atime || null, this.charset = e.charset || null, this.comment = e.comment || null, this.ctime = e.ctime || null, this.gid = e.gid || null, this.gname = e.gname || null, this.linkpath = e.linkpath || null, this.mtime = e.mtime || null, this.path = e.path || null, this.size = e.size || null, this.uid = e.uid || null, this.uname = e.uname || null, this.dev = e.dev || null, this.ino = e.ino || null, this.nlink = e.nlink || null, this.global = n || false;
664
- }
665
- encode() {
666
- const e = this.encodeBody();
667
- if (e === "") return null;
668
- const n = Buffer.byteLength(e), l = 512 * Math.ceil(1 + n / 512), i = Buffer.allocUnsafe(l);
669
- for (let t = 0; t < 512; t++) i[t] = 0;
670
- new c({
671
- path: ("PaxHeader/" + d.basename(this.path)).slice(0, 99),
672
- mode: this.mode || 420,
673
- uid: this.uid || null,
674
- gid: this.gid || null,
675
- size: n,
676
- mtime: this.mtime || null,
677
- type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader",
678
- linkpath: "",
679
- uname: this.uname || "",
680
- gname: this.gname || "",
681
- devmaj: 0,
682
- devmin: 0,
683
- atime: this.atime || null,
684
- ctime: this.ctime || null
685
- }).encode(i), i.write(e, 512, n, "utf8");
686
- for (let t = n + 512; t < i.length; t++) i[t] = 0;
687
- return i;
688
- }
689
- encodeBody() {
690
- 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");
691
- }
692
- encodeField(e) {
693
- if (this[e] === null || this[e] === void 0) return "";
694
- const n = this[e] instanceof Date ? this[e].getTime() / 1e3 : this[e], l = " " + (e === "dev" || e === "ino" || e === "nlink" ? "SCHILY." : "") + e + "=" + n + `
695
- `, i = Buffer.byteLength(l);
696
- let t = Math.floor(Math.log(i) / Math.log(10)) + 1;
697
- return i + t >= Math.pow(10, t) && (t += 1), t + i + l;
698
- }
699
- }
700
- h.parse = (s, e, n) => new h(o(u(s), e), n);
701
- const o = (s, e) => e ? Object.keys(s).reduce((n, l) => (n[l] = s[l], n), e) : s, u = (s) => s.replace(/\n$/, "").split(`
702
- `).reduce(m, Object.create(null)), m = (s, e) => {
703
- const n = parseInt(e, 10);
704
- if (n !== Buffer.byteLength(e) + 1) return s;
705
- e = e.slice((n + " ").length);
706
- const l = e.split("="), i = l.shift().replace(/^SCHILY\.(dev|ino|nlink)/, "$1");
707
- if (!i) return s;
708
- const t = l.join("=");
709
- return s[i] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(i) ? /* @__PURE__ */ new Date(t * 1e3) : /^[0-9]+$/.test(t) ? +t : t, s;
710
- };
711
- return r$2 = h, r$2;
712
- }
713
- var i$3 = {};
714
- var _, R$1;
715
- function T() {
716
- if (R$1) return _;
717
- R$1 = 1;
718
- const E = O$2.constants || { ZLIB_VERNUM: 4736 };
719
- return _ = Object.freeze(Object.assign(Object.create(null), {
720
- Z_NO_FLUSH: 0,
721
- Z_PARTIAL_FLUSH: 1,
722
- Z_SYNC_FLUSH: 2,
723
- Z_FULL_FLUSH: 3,
724
- Z_FINISH: 4,
725
- Z_BLOCK: 5,
726
- Z_OK: 0,
727
- Z_STREAM_END: 1,
728
- Z_NEED_DICT: 2,
729
- Z_ERRNO: -1,
730
- Z_STREAM_ERROR: -2,
731
- Z_DATA_ERROR: -3,
732
- Z_MEM_ERROR: -4,
733
- Z_BUF_ERROR: -5,
734
- Z_VERSION_ERROR: -6,
735
- Z_NO_COMPRESSION: 0,
736
- Z_BEST_SPEED: 1,
737
- Z_BEST_COMPRESSION: 9,
738
- Z_DEFAULT_COMPRESSION: -1,
739
- Z_FILTERED: 1,
740
- Z_HUFFMAN_ONLY: 2,
741
- Z_RLE: 3,
742
- Z_FIXED: 4,
743
- Z_DEFAULT_STRATEGY: 0,
744
- DEFLATE: 1,
745
- INFLATE: 2,
746
- GZIP: 3,
747
- GUNZIP: 4,
748
- DEFLATERAW: 5,
749
- INFLATERAW: 6,
750
- UNZIP: 7,
751
- BROTLI_DECODE: 8,
752
- BROTLI_ENCODE: 9,
753
- Z_MIN_WINDOWBITS: 8,
754
- Z_MAX_WINDOWBITS: 15,
755
- Z_DEFAULT_WINDOWBITS: 15,
756
- Z_MIN_CHUNK: 64,
757
- Z_MAX_CHUNK: Infinity,
758
- Z_DEFAULT_CHUNK: 16384,
759
- Z_MIN_MEMLEVEL: 1,
760
- Z_MAX_MEMLEVEL: 9,
761
- Z_DEFAULT_MEMLEVEL: 8,
762
- Z_MIN_LEVEL: -1,
763
- Z_MAX_LEVEL: 9,
764
- Z_DEFAULT_LEVEL: -1,
765
- BROTLI_OPERATION_PROCESS: 0,
766
- BROTLI_OPERATION_FLUSH: 1,
767
- BROTLI_OPERATION_FINISH: 2,
768
- BROTLI_OPERATION_EMIT_METADATA: 3,
769
- BROTLI_MODE_GENERIC: 0,
770
- BROTLI_MODE_TEXT: 1,
771
- BROTLI_MODE_FONT: 2,
772
- BROTLI_DEFAULT_MODE: 0,
773
- BROTLI_MIN_QUALITY: 0,
774
- BROTLI_MAX_QUALITY: 11,
775
- BROTLI_DEFAULT_QUALITY: 11,
776
- BROTLI_MIN_WINDOW_BITS: 10,
777
- BROTLI_MAX_WINDOW_BITS: 24,
778
- BROTLI_LARGE_MAX_WINDOW_BITS: 30,
779
- BROTLI_DEFAULT_WINDOW: 22,
780
- BROTLI_MIN_INPUT_BLOCK_BITS: 16,
781
- BROTLI_MAX_INPUT_BLOCK_BITS: 24,
782
- BROTLI_PARAM_MODE: 0,
783
- BROTLI_PARAM_QUALITY: 1,
784
- BROTLI_PARAM_LGWIN: 2,
785
- BROTLI_PARAM_LGBLOCK: 3,
786
- BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
787
- BROTLI_PARAM_SIZE_HINT: 5,
788
- BROTLI_PARAM_LARGE_WINDOW: 6,
789
- BROTLI_PARAM_NPOSTFIX: 7,
790
- BROTLI_PARAM_NDIRECT: 8,
791
- BROTLI_DECODER_RESULT_ERROR: 0,
792
- BROTLI_DECODER_RESULT_SUCCESS: 1,
793
- BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
794
- BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
795
- BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
796
- BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
797
- BROTLI_DECODER_NO_ERROR: 0,
798
- BROTLI_DECODER_SUCCESS: 1,
799
- BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
800
- BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
801
- BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
802
- BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
803
- BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
804
- BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
805
- BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
806
- BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
807
- BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
808
- BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
809
- BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
810
- BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
811
- BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
812
- BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
813
- BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
814
- BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
815
- BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
816
- BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
817
- BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
818
- BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
819
- BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
820
- BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
821
- BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
822
- BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
823
- BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
824
- BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
825
- BROTLI_DECODER_ERROR_UNREACHABLE: -31
826
- }, E)), _;
827
- }
828
- var j, H$1;
829
- function tt() {
830
- if (H$1) return j;
831
- H$1 = 1;
832
- const I = typeof process == "object" && process ? process : {
833
- stdout: null,
834
- stderr: null
835
- }, Y = nt, x = ot, N = ht.StringDecoder, u = Symbol("EOF"), a = Symbol("maybeEmitEnd"), c = Symbol("emittedEnd"), S = Symbol("emittingEnd"), E = Symbol("emittedError"), w = Symbol("closed"), P = Symbol("read"), L = Symbol("flush"), _ = Symbol("flushChunk"), h = Symbol("encoding"), m = Symbol("decoder"), M = Symbol("flowing"), y = Symbol("paused"), p = Symbol("resume"), s = Symbol("bufferLength"), T = Symbol("bufferPush"), B = Symbol("bufferShift"), r = Symbol("objectMode"), n = Symbol("destroyed"), D = Symbol("emitData"), F = Symbol("emitEnd"), R = Symbol("emitEnd2"), d = Symbol("async"), b = (o) => Promise.resolve().then(o), C = commonjsGlobal._MP_NO_ITERATOR_SYMBOLS_ !== "1", $ = C && Symbol.asyncIterator || Symbol("asyncIterator not implemented"), G = C && Symbol.iterator || Symbol("iterator not implemented"), V = (o) => o === "end" || o === "finish" || o === "prefinish", v = (o) => o instanceof ArrayBuffer || typeof o == "object" && o.constructor && o.constructor.name === "ArrayBuffer" && o.byteLength >= 0, J = (o) => !Buffer.isBuffer(o) && ArrayBuffer.isView(o);
836
- class U {
837
- constructor(t, e, i) {
838
- this.src = t, this.dest = e, this.opts = i, this.ondrain = () => t[p](), e.on("drain", this.ondrain);
839
- }
840
- unpipe() {
841
- this.dest.removeListener("drain", this.ondrain);
842
- }
843
- proxyErrors() {}
844
- end() {
845
- this.unpipe(), this.opts.end && this.dest.end();
846
- }
847
- }
848
- class K extends U {
849
- unpipe() {
850
- this.src.removeListener("error", this.proxyErrors), super.unpipe();
851
- }
852
- constructor(t, e, i) {
853
- super(t, e, i), this.proxyErrors = (l) => e.emit("error", l), t.on("error", this.proxyErrors);
854
- }
855
- }
856
- return j = class q extends x {
857
- constructor(t) {
858
- super(), this[M] = false, this[y] = false, this.pipes = [], this.buffer = [], this[r] = t && t.objectMode || false, this[r] ? this[h] = null : this[h] = t && t.encoding || null, this[h] === "buffer" && (this[h] = null), this[d] = t && !!t.async || false, this[m] = this[h] ? new N(this[h]) : null, this[u] = false, this[c] = false, this[S] = false, this[w] = false, this[E] = null, this.writable = true, this.readable = true, this[s] = 0, this[n] = false;
859
- }
860
- get bufferLength() {
861
- return this[s];
862
- }
863
- get encoding() {
864
- return this[h];
865
- }
866
- set encoding(t) {
867
- if (this[r]) throw new Error("cannot set encoding in objectMode");
868
- if (this[h] && t !== this[h] && (this[m] && this[m].lastNeed || this[s])) throw new Error("cannot change encoding");
869
- this[h] !== t && (this[m] = t ? new N(t) : null, this.buffer.length && (this.buffer = this.buffer.map((e) => this[m].write(e)))), this[h] = t;
870
- }
871
- setEncoding(t) {
872
- this.encoding = t;
873
- }
874
- get objectMode() {
875
- return this[r];
876
- }
877
- set objectMode(t) {
878
- this[r] = this[r] || !!t;
879
- }
880
- get async() {
881
- return this[d];
882
- }
883
- set async(t) {
884
- this[d] = this[d] || !!t;
885
- }
886
- write(t, e, i) {
887
- if (this[u]) throw new Error("write after end");
888
- if (this[n]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
889
- typeof e == "function" && (i = e, e = "utf8"), e || (e = "utf8");
890
- const l = this[d] ? b : (f) => f();
891
- return !this[r] && !Buffer.isBuffer(t) && (J(t) ? t = Buffer.from(t.buffer, t.byteOffset, t.byteLength) : v(t) ? t = Buffer.from(t) : typeof t != "string" && (this.objectMode = true)), this[r] ? (this.flowing && this[s] !== 0 && this[L](true), this.flowing ? this.emit("data", t) : this[T](t), this[s] !== 0 && this.emit("readable"), i && l(i), this.flowing) : t.length ? (typeof t == "string" && !(e === this[h] && !this[m].lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[h] && (t = this[m].write(t)), this.flowing && this[s] !== 0 && this[L](true), this.flowing ? this.emit("data", t) : this[T](t), this[s] !== 0 && this.emit("readable"), i && l(i), this.flowing) : (this[s] !== 0 && this.emit("readable"), i && l(i), this.flowing);
892
- }
893
- read(t) {
894
- if (this[n]) return null;
895
- if (this[s] === 0 || t === 0 || t > this[s]) return this[a](), null;
896
- this[r] && (t = null), this.buffer.length > 1 && !this[r] && (this.encoding ? this.buffer = [this.buffer.join("")] : this.buffer = [Buffer.concat(this.buffer, this[s])]);
897
- const e = this[P](t || null, this.buffer[0]);
898
- return this[a](), e;
899
- }
900
- [P](t, e) {
901
- return t === e.length || t === null ? this[B]() : (this.buffer[0] = e.slice(t), e = e.slice(0, t), this[s] -= t), this.emit("data", e), !this.buffer.length && !this[u] && this.emit("drain"), e;
902
- }
903
- end(t, e, i) {
904
- return typeof t == "function" && (i = t, t = null), typeof e == "function" && (i = e, e = "utf8"), t && this.write(t, e), i && this.once("end", i), this[u] = true, this.writable = false, (this.flowing || !this[y]) && this[a](), this;
905
- }
906
- [p]() {
907
- this[n] || (this[y] = false, this[M] = true, this.emit("resume"), this.buffer.length ? this[L]() : this[u] ? this[a]() : this.emit("drain"));
908
- }
909
- resume() {
910
- return this[p]();
911
- }
912
- pause() {
913
- this[M] = false, this[y] = true;
914
- }
915
- get destroyed() {
916
- return this[n];
917
- }
918
- get flowing() {
919
- return this[M];
920
- }
921
- get paused() {
922
- return this[y];
923
- }
924
- [T](t) {
925
- this[r] ? this[s] += 1 : this[s] += t.length, this.buffer.push(t);
926
- }
927
- [B]() {
928
- return this.buffer.length && (this[r] ? this[s] -= 1 : this[s] -= this.buffer[0].length), this.buffer.shift();
929
- }
930
- [L](t) {
931
- do ;
932
- while (this[_](this[B]()));
933
- !t && !this.buffer.length && !this[u] && this.emit("drain");
934
- }
935
- [_](t) {
936
- return t ? (this.emit("data", t), this.flowing) : false;
937
- }
938
- pipe(t, e) {
939
- if (this[n]) return;
940
- const i = this[c];
941
- return e = e || {}, t === I.stdout || t === I.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, i ? e.end && t.end() : (this.pipes.push(e.proxyErrors ? new K(this, t, e) : new U(this, t, e)), this[d] ? b(() => this[p]()) : this[p]()), t;
942
- }
943
- unpipe(t) {
944
- const e = this.pipes.find((i) => i.dest === t);
945
- e && (this.pipes.splice(this.pipes.indexOf(e), 1), e.unpipe());
946
- }
947
- addListener(t, e) {
948
- return this.on(t, e);
949
- }
950
- on(t, e) {
951
- const i = super.on(t, e);
952
- return t === "data" && !this.pipes.length && !this.flowing ? this[p]() : t === "readable" && this[s] !== 0 ? super.emit("readable") : V(t) && this[c] ? (super.emit(t), this.removeAllListeners(t)) : t === "error" && this[E] && (this[d] ? b(() => e.call(this, this[E])) : e.call(this, this[E])), i;
953
- }
954
- get emittedEnd() {
955
- return this[c];
956
- }
957
- [a]() {
958
- !this[S] && !this[c] && !this[n] && this.buffer.length === 0 && this[u] && (this[S] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[w] && this.emit("close"), this[S] = false);
959
- }
960
- emit(t, e, ...i) {
961
- if (t !== "error" && t !== "close" && t !== n && this[n]) return;
962
- if (t === "data") return e ? this[d] ? b(() => this[D](e)) : this[D](e) : false;
963
- if (t === "end") return this[F]();
964
- if (t === "close") {
965
- if (this[w] = true, !this[c] && !this[n]) return;
966
- const f = super.emit("close");
967
- return this.removeAllListeners("close"), f;
968
- } else if (t === "error") {
969
- this[E] = e;
970
- const f = super.emit("error", e);
971
- return this[a](), f;
972
- } else if (t === "resume") {
973
- const f = super.emit("resume");
974
- return this[a](), f;
975
- } else if (t === "finish" || t === "prefinish") {
976
- const f = super.emit(t);
977
- return this.removeAllListeners(t), f;
978
- }
979
- const l = super.emit(t, e, ...i);
980
- return this[a](), l;
981
- }
982
- [D](t) {
983
- for (const i of this.pipes) i.dest.write(t) === false && this.pause();
984
- const e = super.emit("data", t);
985
- return this[a](), e;
986
- }
987
- [F]() {
988
- this[c] || (this[c] = true, this.readable = false, this[d] ? b(() => this[R]()) : this[R]());
989
- }
990
- [R]() {
991
- if (this[m]) {
992
- const e = this[m].end();
993
- if (e) {
994
- for (const i of this.pipes) i.dest.write(e);
995
- super.emit("data", e);
996
- }
997
- }
998
- for (const e of this.pipes) e.end();
999
- const t = super.emit("end");
1000
- return this.removeAllListeners("end"), t;
1001
- }
1002
- collect() {
1003
- const t = [];
1004
- this[r] || (t.dataLength = 0);
1005
- const e = this.promise();
1006
- return this.on("data", (i) => {
1007
- t.push(i), this[r] || (t.dataLength += i.length);
1008
- }), e.then(() => t);
1009
- }
1010
- concat() {
1011
- return this[r] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this.collect().then((t) => this[r] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this[h] ? t.join("") : Buffer.concat(t, t.dataLength));
1012
- }
1013
- promise() {
1014
- return new Promise((t, e) => {
1015
- this.on(n, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (i) => e(i)), this.on("end", () => t());
1016
- });
1017
- }
1018
- [$]() {
1019
- return { next: () => {
1020
- const e = this.read();
1021
- if (e !== null) return Promise.resolve({
1022
- done: false,
1023
- value: e
1024
- });
1025
- if (this[u]) return Promise.resolve({ done: true });
1026
- let i = null, l = null;
1027
- const f = (g) => {
1028
- this.removeListener("data", A), this.removeListener("end", O), l(g);
1029
- }, A = (g) => {
1030
- this.removeListener("error", f), this.removeListener("end", O), this.pause(), i({
1031
- value: g,
1032
- done: !!this[u]
1033
- });
1034
- }, O = () => {
1035
- this.removeListener("error", f), this.removeListener("data", A), i({ done: true });
1036
- }, W = () => f(/* @__PURE__ */ new Error("stream destroyed"));
1037
- return new Promise((g, z) => {
1038
- l = z, i = g, this.once(n, W), this.once("error", f), this.once("end", O), this.once("data", A);
1039
- });
1040
- } };
1041
- }
1042
- [G]() {
1043
- return { next: () => {
1044
- const e = this.read();
1045
- return {
1046
- value: e,
1047
- done: e === null
1048
- };
1049
- } };
1050
- }
1051
- destroy(t) {
1052
- return this[n] ? (t ? this.emit("error", t) : this.emit(n), this) : (this[n] = true, this.buffer.length = 0, this[s] = 0, typeof this.close == "function" && !this[w] && this.close(), t ? this.emit("error", t) : this.emit(n), this);
1053
- }
1054
- static isStream(t) {
1055
- return !!t && (t instanceof q || t instanceof x || t instanceof Y && (typeof t.pipe == "function" || typeof t.write == "function" && typeof t.end == "function"));
1056
- }
1057
- }, j;
1058
- }
1059
- var C;
1060
- function J() {
1061
- if (C) return i$3;
1062
- C = 1;
1063
- const w = assert, n = P.Buffer, z = O$2, u = i$3.constants = T(), L = tt(), E = n.concat, c = Symbol("_superWrite");
1064
- class d extends Error {
1065
- constructor(s) {
1066
- super("zlib: " + s.message), this.code = s.code, this.errno = s.errno, this.code || (this.code = "ZLIB_ERROR"), this.message = "zlib: " + s.message, Error.captureStackTrace(this, this.constructor);
1067
- }
1068
- get name() {
1069
- return "ZlibError";
1070
- }
1071
- }
1072
- const Z = Symbol("opts"), p = Symbol("flushFlag"), I = Symbol("finishFlushFlag"), y = Symbol("fullFlushFlag"), t = Symbol("handle"), _ = Symbol("onError"), f = Symbol("sawError"), F = Symbol("level"), S = Symbol("strategy"), g = Symbol("ended");
1073
- class x extends L {
1074
- constructor(s, e) {
1075
- if (!s || typeof s != "object") throw new TypeError("invalid options for ZlibBase constructor");
1076
- super(s), this[f] = false, this[g] = false, this[Z] = s, this[p] = s.flush, this[I] = s.finishFlush;
1077
- try {
1078
- this[t] = new z[e](s);
1079
- } catch (i) {
1080
- throw new d(i);
1081
- }
1082
- this[_] = (i) => {
1083
- this[f] || (this[f] = true, this.close(), this.emit("error", i));
1084
- }, this[t].on("error", (i) => this[_](new d(i))), this.once("end", () => this.close);
1085
- }
1086
- close() {
1087
- this[t] && (this[t].close(), this[t] = null, this.emit("close"));
1088
- }
1089
- reset() {
1090
- if (!this[f]) return w(this[t], "zlib binding closed"), this[t].reset();
1091
- }
1092
- flush(s) {
1093
- this.ended || (typeof s != "number" && (s = this[y]), this.write(Object.assign(n.alloc(0), { [p]: s })));
1094
- }
1095
- end(s, e, i) {
1096
- return s && this.write(s, e), this.flush(this[I]), this[g] = true, super.end(null, null, i);
1097
- }
1098
- get ended() {
1099
- return this[g];
1100
- }
1101
- write(s, e, i) {
1102
- if (typeof e == "function" && (i = e, e = "utf8"), typeof s == "string" && (s = n.from(s, e)), this[f]) return;
1103
- w(this[t], "zlib binding closed");
1104
- const m = this[t]._handle, R = m.close;
1105
- m.close = () => {};
1106
- const G = this[t].close;
1107
- this[t].close = () => {}, n.concat = (l) => l;
1108
- let h;
1109
- try {
1110
- const l = typeof s[p] == "number" ? s[p] : this[p];
1111
- h = this[t]._processChunk(s, l), n.concat = E;
1112
- } catch (l) {
1113
- n.concat = E, this[_](new d(l));
1114
- } finally {
1115
- this[t] && (this[t]._handle = m, m.close = R, this[t].close = G, this[t].removeAllListeners("error"));
1116
- }
1117
- this[t] && this[t].on("error", (l) => this[_](new d(l)));
1118
- let b;
1119
- if (h) if (Array.isArray(h) && h.length > 0) {
1120
- b = this[c](n.from(h[0]));
1121
- for (let l = 1; l < h.length; l++) b = this[c](h[l]);
1122
- } else b = this[c](n.from(h));
1123
- return i && i(), b;
1124
- }
1125
- [c](s) {
1126
- return super.write(s);
1127
- }
1128
- }
1129
- class a extends x {
1130
- constructor(s, e) {
1131
- s = s || {}, s.flush = s.flush || u.Z_NO_FLUSH, s.finishFlush = s.finishFlush || u.Z_FINISH, super(s, e), this[y] = u.Z_FULL_FLUSH, this[F] = s.level, this[S] = s.strategy;
1132
- }
1133
- params(s, e) {
1134
- if (!this[f]) {
1135
- if (!this[t]) throw new Error("cannot switch params when binding is closed");
1136
- if (!this[t].params) throw new Error("not supported in this implementation");
1137
- if (this[F] !== s || this[S] !== e) {
1138
- this.flush(u.Z_SYNC_FLUSH), w(this[t], "zlib binding closed");
1139
- const i = this[t].flush;
1140
- this[t].flush = (m, R) => {
1141
- this.flush(m), R();
1142
- };
1143
- try {
1144
- this[t].params(s, e);
1145
- } finally {
1146
- this[t].flush = i;
1147
- }
1148
- this[t] && (this[F] = s, this[S] = e);
1149
- }
1150
- }
1151
- }
1152
- }
1153
- class q extends a {
1154
- constructor(s) {
1155
- super(s, "Deflate");
1156
- }
1157
- }
1158
- class D extends a {
1159
- constructor(s) {
1160
- super(s, "Inflate");
1161
- }
1162
- }
1163
- const B = Symbol("_portable");
1164
- class $ extends a {
1165
- constructor(s) {
1166
- super(s, "Gzip"), this[B] = s && !!s.portable;
1167
- }
1168
- [c](s) {
1169
- return this[B] ? (this[B] = false, s[9] = 255, super[c](s)) : super[c](s);
1170
- }
1171
- }
1172
- class N extends a {
1173
- constructor(s) {
1174
- super(s, "Gunzip");
1175
- }
1176
- }
1177
- class H extends a {
1178
- constructor(s) {
1179
- super(s, "DeflateRaw");
1180
- }
1181
- }
1182
- let T$1 = class T extends a {
1183
- constructor(s) {
1184
- super(s, "InflateRaw");
1185
- }
1186
- };
1187
- class U extends a {
1188
- constructor(s) {
1189
- super(s, "Unzip");
1190
- }
1191
- }
1192
- class O extends x {
1193
- constructor(s, e) {
1194
- s = s || {}, s.flush = s.flush || u.BROTLI_OPERATION_PROCESS, s.finishFlush = s.finishFlush || u.BROTLI_OPERATION_FINISH, super(s, e), this[y] = u.BROTLI_OPERATION_FLUSH;
1195
- }
1196
- }
1197
- class v extends O {
1198
- constructor(s) {
1199
- super(s, "BrotliCompress");
1200
- }
1201
- }
1202
- class A extends O {
1203
- constructor(s) {
1204
- super(s, "BrotliDecompress");
1205
- }
1206
- }
1207
- return i$3.Deflate = q, i$3.Inflate = D, i$3.Gzip = $, i$3.Gunzip = N, i$3.DeflateRaw = H, i$3.InflateRaw = T$1, i$3.Unzip = U, typeof z.BrotliCompress == "function" ? (i$3.BrotliCompress = v, i$3.BrotliDecompress = A) : i$3.BrotliCompress = i$3.BrotliDecompress = class {
1208
- constructor() {
1209
- throw new Error("Brotli is not supported in this version of Node.js");
1210
- }
1211
- }, i$3;
1212
- }
1213
- var O$1, F$2;
1214
- function rt() {
1215
- if (F$2) return O$1;
1216
- F$2 = 1;
1217
- const P = c$4(), $ = E(), v = nt, W = c$3(), G = 1024 * 1024, k = u$3(), C = f$2(), x = J(), { nextTick: j } = process$1, B = Buffer.from([31, 139]), h = Symbol("state"), d = Symbol("writeEntry"), a = Symbol("readEntry"), I = Symbol("nextEntry"), U = Symbol("processEntry"), l = Symbol("extendedHeader"), y = Symbol("globalExtendedHeader"), c = Symbol("meta"), H = Symbol("emitMeta"), n = Symbol("buffer"), f = Symbol("queue"), u = Symbol("ended"), L = Symbol("emittedEnd"), b = Symbol("emit"), r = Symbol("unzip"), _ = Symbol("consumeChunk"), g = Symbol("consumeChunkSub"), q = Symbol("consumeBody"), z = Symbol("consumeMeta"), Y = Symbol("consumeHeader"), N = Symbol("consuming"), D = Symbol("bufferConcat"), M = Symbol("maybeEnd"), S = Symbol("writing"), m = Symbol("aborted"), T = Symbol("onDone"), E$1 = Symbol("sawValidEntry"), R = Symbol("sawNullBlock"), A = Symbol("sawEOF"), V = Symbol("closeStream"), K = (X) => true;
1218
- return O$1 = P(class extends v {
1219
- constructor(t) {
1220
- t = t || {}, super(t), this.file = t.file || "", this[E$1] = null, this.on(T, (s) => {
1221
- (this[h] === "begin" || this[E$1] === false) && this.warn("TAR_BAD_ARCHIVE", "Unrecognized archive format");
1222
- }), t.ondone ? this.on(T, t.ondone) : this.on(T, (s) => {
1223
- this.emit("prefinish"), this.emit("finish"), this.emit("end");
1224
- }), this.strict = !!t.strict, this.maxMetaEntrySize = t.maxMetaEntrySize || G, this.filter = typeof t.filter == "function" ? t.filter : K;
1225
- const i = t.file && (t.file.endsWith(".tar.br") || t.file.endsWith(".tbr"));
1226
- this.brotli = !t.gzip && t.brotli !== void 0 ? t.brotli : i ? void 0 : false, this.writable = true, this.readable = false, this[f] = new W(), this[n] = null, this[a] = null, this[d] = null, this[h] = "begin", this[c] = "", this[l] = null, this[y] = null, this[u] = false, this[r] = null, this[m] = false, this[R] = false, this[A] = false, this.on("end", () => this[V]()), typeof t.onwarn == "function" && this.on("warn", t.onwarn), typeof t.onentry == "function" && this.on("entry", t.onentry);
1227
- }
1228
- [Y](t, i) {
1229
- this[E$1] === null && (this[E$1] = false);
1230
- let s;
1231
- try {
1232
- s = new $(t, i, this[l], this[y]);
1233
- } catch (o) {
1234
- return this.warn("TAR_ENTRY_INVALID", o);
1235
- }
1236
- if (s.nullBlock) this[R] ? (this[A] = true, this[h] === "begin" && (this[h] = "header"), this[b]("eof")) : (this[R] = true, this[b]("nullBlock"));
1237
- else if (this[R] = false, !s.cksumValid) this.warn("TAR_ENTRY_INVALID", "checksum failure", { header: s });
1238
- else if (!s.path) this.warn("TAR_ENTRY_INVALID", "path is required", { header: s });
1239
- else {
1240
- const o = s.type;
1241
- if (/^(Symbolic)?Link$/.test(o) && !s.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath required", { header: s });
1242
- else if (!/^(Symbolic)?Link$/.test(o) && s.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath forbidden", { header: s });
1243
- else {
1244
- const e = this[d] = new k(s, this[l], this[y]);
1245
- if (!this[E$1]) if (e.remain) {
1246
- const w = () => {
1247
- e.invalid || (this[E$1] = true);
1248
- };
1249
- e.on("end", w);
1250
- } else this[E$1] = true;
1251
- e.meta ? e.size > this.maxMetaEntrySize ? (e.ignore = true, this[b]("ignoredEntry", e), this[h] = "ignore", e.resume()) : e.size > 0 && (this[c] = "", e.on("data", (w) => this[c] += w), this[h] = "meta") : (this[l] = null, e.ignore = e.ignore || !this.filter(e.path, e), e.ignore ? (this[b]("ignoredEntry", e), this[h] = e.remain ? "ignore" : "header", e.resume()) : (e.remain ? this[h] = "body" : (this[h] = "header", e.end()), this[a] ? this[f].push(e) : (this[f].push(e), this[I]())));
1252
- }
1253
- }
1254
- }
1255
- [V]() {
1256
- j(() => this.emit("close"));
1257
- }
1258
- [U](t) {
1259
- let i = true;
1260
- return t ? Array.isArray(t) ? this.emit.apply(this, t) : (this[a] = t, this.emit("entry", t), t.emittedEnd || (t.on("end", (s) => this[I]()), i = false)) : (this[a] = null, i = false), i;
1261
- }
1262
- [I]() {
1263
- do ;
1264
- while (this[U](this[f].shift()));
1265
- if (!this[f].length) {
1266
- const t = this[a];
1267
- !t || t.flowing || t.size === t.remain ? this[S] || this.emit("drain") : t.once("drain", (s) => this.emit("drain"));
1268
- }
1269
- }
1270
- [q](t, i) {
1271
- const s = this[d], o = s.blockRemain, e = o >= t.length && i === 0 ? t : t.slice(i, i + o);
1272
- return s.write(e), s.blockRemain || (this[h] = "header", this[d] = null, s.end()), e.length;
1273
- }
1274
- [z](t, i) {
1275
- const s = this[d], o = this[q](t, i);
1276
- return this[d] || this[H](s), o;
1277
- }
1278
- [b](t, i, s) {
1279
- !this[f].length && !this[a] ? this.emit(t, i, s) : this[f].push([
1280
- t,
1281
- i,
1282
- s
1283
- ]);
1284
- }
1285
- [H](t) {
1286
- switch (this[b]("meta", this[c]), t.type) {
1287
- case "ExtendedHeader":
1288
- case "OldExtendedHeader":
1289
- this[l] = C.parse(this[c], this[l], false);
1290
- break;
1291
- case "GlobalExtendedHeader":
1292
- this[y] = C.parse(this[c], this[y], true);
1293
- break;
1294
- case "NextFileHasLongPath":
1295
- case "OldGnuLongPath":
1296
- this[l] = this[l] || Object.create(null), this[l].path = this[c].replace(/\0.*/, "");
1297
- break;
1298
- case "NextFileHasLongLinkpath":
1299
- this[l] = this[l] || Object.create(null), this[l].linkpath = this[c].replace(/\0.*/, "");
1300
- break;
1301
- default: throw new Error("unknown meta: " + t.type);
1302
- }
1303
- }
1304
- abort(t) {
1305
- this[m] = true, this.emit("abort", t), this.warn("TAR_ABORT", t, { recoverable: false });
1306
- }
1307
- write(t) {
1308
- if (this[m]) return;
1309
- if ((this[r] === null || this.brotli === void 0 && this[r] === false) && t) {
1310
- if (this[n] && (t = Buffer.concat([this[n], t]), this[n] = null), t.length < B.length) return this[n] = t, true;
1311
- for (let e = 0; this[r] === null && e < B.length; e++) t[e] !== B[e] && (this[r] = false);
1312
- const o = this.brotli === void 0;
1313
- if (this[r] === false && o) if (t.length < 512) if (this[u]) this.brotli = true;
1314
- else return this[n] = t, true;
1315
- else try {
1316
- new $(t.slice(0, 512)), this.brotli = !1;
1317
- } catch {
1318
- this.brotli = true;
1319
- }
1320
- if (this[r] === null || this[r] === false && this.brotli) {
1321
- const e = this[u];
1322
- this[u] = false, this[r] = this[r] === null ? new x.Unzip() : new x.BrotliDecompress(), this[r].on("data", (p) => this[_](p)), this[r].on("error", (p) => this.abort(p)), this[r].on("end", (p) => {
1323
- this[u] = true, this[_]();
1324
- }), this[S] = true;
1325
- const w = this[r][e ? "end" : "write"](t);
1326
- return this[S] = false, w;
1327
- }
1328
- }
1329
- this[S] = true, this[r] ? this[r].write(t) : this[_](t), this[S] = false;
1330
- const s = this[f].length ? false : this[a] ? this[a].flowing : true;
1331
- return !s && !this[f].length && this[a].once("drain", (o) => this.emit("drain")), s;
1332
- }
1333
- [D](t) {
1334
- t && !this[m] && (this[n] = this[n] ? Buffer.concat([this[n], t]) : t);
1335
- }
1336
- [M]() {
1337
- if (this[u] && !this[L] && !this[m] && !this[N]) {
1338
- this[L] = true;
1339
- const t = this[d];
1340
- if (t && t.blockRemain) {
1341
- const i = this[n] ? this[n].length : 0;
1342
- this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${t.blockRemain} more bytes, only ${i} available)`, { entry: t }), this[n] && t.write(this[n]), t.end();
1343
- }
1344
- this[b](T);
1345
- }
1346
- }
1347
- [_](t) {
1348
- if (this[N]) this[D](t);
1349
- else if (!t && !this[n]) this[M]();
1350
- else {
1351
- if (this[N] = true, this[n]) {
1352
- this[D](t);
1353
- const i = this[n];
1354
- this[n] = null, this[g](i);
1355
- } else this[g](t);
1356
- for (; this[n] && this[n].length >= 512 && !this[m] && !this[A];) {
1357
- const i = this[n];
1358
- this[n] = null, this[g](i);
1359
- }
1360
- this[N] = false;
1361
- }
1362
- (!this[n] || this[u]) && this[M]();
1363
- }
1364
- [g](t) {
1365
- let i = 0;
1366
- const s = t.length;
1367
- for (; i + 512 <= s && !this[m] && !this[A];) switch (this[h]) {
1368
- case "begin":
1369
- case "header":
1370
- this[Y](t, i), i += 512;
1371
- break;
1372
- case "ignore":
1373
- case "body":
1374
- i += this[q](t, i);
1375
- break;
1376
- case "meta":
1377
- i += this[z](t, i);
1378
- break;
1379
- default: throw new Error("invalid state: " + this[h]);
1380
- }
1381
- i < s && (this[n] ? this[n] = Buffer.concat([t.slice(i), this[n]]) : this[n] = t.slice(i));
1382
- }
1383
- end(t) {
1384
- this[m] || (this[r] ? this[r].end(t) : (this[u] = true, this.brotli === void 0 && (t = t || Buffer.alloc(0)), this.write(t)));
1385
- }
1386
- }), O$1;
1387
- }
1388
- var s$4 = {};
1389
- var v$1;
1390
- function X() {
1391
- if (v$1) return s$4;
1392
- v$1 = 1;
1393
- const H = tt(), I = nt.EventEmitter, r = fs;
1394
- let R = r.writev;
1395
- if (!R) {
1396
- const c = process.binding("fs"), t = c.FSReqWrap || c.FSReqCallback;
1397
- R = (e, i, $, A) => {
1398
- const G = (J, K) => A(J, K, i), j = new t();
1399
- j.oncomplete = G, c.writeBuffers(e, i, $, j);
1400
- };
1401
- }
1402
- const m = Symbol("_autoClose"), h = Symbol("_close"), g = Symbol("_ended"), s = Symbol("_fd"), B = Symbol("_finished"), o = Symbol("_flags"), x = Symbol("_flush"), z = Symbol("_handleChunk"), T = Symbol("_makeBuf"), q = Symbol("_mode"), E = Symbol("_needDrain"), d = Symbol("_onerror"), y = Symbol("_onopen"), W = Symbol("_onread"), _ = Symbol("_onwrite"), a = Symbol("_open"), l = Symbol("_path"), u = Symbol("_pos"), n = Symbol("_queue"), S = Symbol("_read"), M = Symbol("_readSize"), f = Symbol("_reading"), k = Symbol("_remain"), N = Symbol("_size"), C = Symbol("_write"), b = Symbol("_writing"), F = Symbol("_defaultFlag"), p = Symbol("_errored");
1403
- class D extends H {
1404
- constructor(t, e) {
1405
- if (e = e || {}, super(e), this.readable = true, this.writable = false, typeof t != "string") throw new TypeError("path must be a string");
1406
- this[p] = false, this[s] = typeof e.fd == "number" ? e.fd : null, this[l] = t, this[M] = e.readSize || 16 * 1024 * 1024, this[f] = false, this[N] = typeof e.size == "number" ? e.size : Infinity, this[k] = this[N], this[m] = typeof e.autoClose == "boolean" ? e.autoClose : true, typeof this[s] == "number" ? this[S]() : this[a]();
1407
- }
1408
- get fd() {
1409
- return this[s];
1410
- }
1411
- get path() {
1412
- return this[l];
1413
- }
1414
- write() {
1415
- throw new TypeError("this is a readable stream");
1416
- }
1417
- end() {
1418
- throw new TypeError("this is a readable stream");
1419
- }
1420
- [a]() {
1421
- r.open(this[l], "r", (t, e) => this[y](t, e));
1422
- }
1423
- [y](t, e) {
1424
- t ? this[d](t) : (this[s] = e, this.emit("open", e), this[S]());
1425
- }
1426
- [T]() {
1427
- return Buffer.allocUnsafe(Math.min(this[M], this[k]));
1428
- }
1429
- [S]() {
1430
- if (!this[f]) {
1431
- this[f] = true;
1432
- const t = this[T]();
1433
- if (t.length === 0) return process.nextTick(() => this[W](null, 0, t));
1434
- r.read(this[s], t, 0, t.length, null, (e, i, $) => this[W](e, i, $));
1435
- }
1436
- }
1437
- [W](t, e, i) {
1438
- this[f] = false, t ? this[d](t) : this[z](e, i) && this[S]();
1439
- }
1440
- [h]() {
1441
- if (this[m] && typeof this[s] == "number") {
1442
- const t = this[s];
1443
- this[s] = null, r.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
1444
- }
1445
- }
1446
- [d](t) {
1447
- this[f] = true, this[h](), this.emit("error", t);
1448
- }
1449
- [z](t, e) {
1450
- let i = false;
1451
- return this[k] -= t, t > 0 && (i = super.write(t < e.length ? e.slice(0, t) : e)), (t === 0 || this[k] <= 0) && (i = false, this[h](), super.end()), i;
1452
- }
1453
- emit(t, e) {
1454
- switch (t) {
1455
- case "prefinish":
1456
- case "finish": break;
1457
- case "drain":
1458
- typeof this[s] == "number" && this[S]();
1459
- break;
1460
- case "error": return this[p] ? void 0 : (this[p] = true, super.emit(t, e));
1461
- default: return super.emit(t, e);
1462
- }
1463
- }
1464
- }
1465
- class P extends D {
1466
- [a]() {
1467
- let t = true;
1468
- try {
1469
- this[y](null, r.openSync(this[l], "r")), t = !1;
1470
- } finally {
1471
- t && this[h]();
1472
- }
1473
- }
1474
- [S]() {
1475
- let t = true;
1476
- try {
1477
- if (!this[f]) {
1478
- this[f] = !0;
1479
- do {
1480
- const e = this[T](), i = e.length === 0 ? 0 : r.readSync(this[s], e, 0, e.length, null);
1481
- if (!this[z](i, e)) break;
1482
- } while (!0);
1483
- this[f] = !1;
1484
- }
1485
- t = !1;
1486
- } finally {
1487
- t && this[h]();
1488
- }
1489
- }
1490
- [h]() {
1491
- if (this[m] && typeof this[s] == "number") {
1492
- const t = this[s];
1493
- this[s] = null, r.closeSync(t), this.emit("close");
1494
- }
1495
- }
1496
- }
1497
- class O extends I {
1498
- constructor(t, e) {
1499
- e = e || {}, super(e), this.readable = false, this.writable = true, this[p] = false, this[b] = false, this[g] = false, this[E] = false, this[n] = [], this[l] = t, this[s] = typeof e.fd == "number" ? e.fd : null, this[q] = e.mode === void 0 ? 438 : e.mode, this[u] = typeof e.start == "number" ? e.start : null, this[m] = typeof e.autoClose == "boolean" ? e.autoClose : true;
1500
- const i = this[u] !== null ? "r+" : "w";
1501
- this[F] = e.flags === void 0, this[o] = this[F] ? i : e.flags, this[s] === null && this[a]();
1502
- }
1503
- emit(t, e) {
1504
- if (t === "error") {
1505
- if (this[p]) return;
1506
- this[p] = true;
1507
- }
1508
- return super.emit(t, e);
1509
- }
1510
- get fd() {
1511
- return this[s];
1512
- }
1513
- get path() {
1514
- return this[l];
1515
- }
1516
- [d](t) {
1517
- this[h](), this[b] = true, this.emit("error", t);
1518
- }
1519
- [a]() {
1520
- r.open(this[l], this[o], this[q], (t, e) => this[y](t, e));
1521
- }
1522
- [y](t, e) {
1523
- this[F] && this[o] === "r+" && t && t.code === "ENOENT" ? (this[o] = "w", this[a]()) : t ? this[d](t) : (this[s] = e, this.emit("open", e), this[x]());
1524
- }
1525
- end(t, e) {
1526
- return t && this.write(t, e), this[g] = true, !this[b] && !this[n].length && typeof this[s] == "number" && this[_](null, 0), this;
1527
- }
1528
- write(t, e) {
1529
- return typeof t == "string" && (t = Buffer.from(t, e)), this[g] ? (this.emit("error", /* @__PURE__ */ new Error("write() after end()")), false) : this[s] === null || this[b] || this[n].length ? (this[n].push(t), this[E] = true, false) : (this[b] = true, this[C](t), true);
1530
- }
1531
- [C](t) {
1532
- r.write(this[s], t, 0, t.length, this[u], (e, i) => this[_](e, i));
1533
- }
1534
- [_](t, e) {
1535
- t ? this[d](t) : (this[u] !== null && (this[u] += e), this[n].length ? this[x]() : (this[b] = false, this[g] && !this[B] ? (this[B] = true, this[h](), this.emit("finish")) : this[E] && (this[E] = false, this.emit("drain"))));
1536
- }
1537
- [x]() {
1538
- if (this[n].length === 0) this[g] && this[_](null, 0);
1539
- else if (this[n].length === 1) this[C](this[n].pop());
1540
- else {
1541
- const t = this[n];
1542
- this[n] = [], R(this[s], t, this[u], (e, i) => this[_](e, i));
1543
- }
1544
- }
1545
- [h]() {
1546
- if (this[m] && typeof this[s] == "number") {
1547
- const t = this[s];
1548
- this[s] = null, r.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
1549
- }
1550
- }
1551
- }
1552
- class U extends O {
1553
- [a]() {
1554
- let t;
1555
- if (this[F] && this[o] === "r+") try {
1556
- t = r.openSync(this[l], this[o], this[q]);
1557
- } catch (e) {
1558
- if (e.code === "ENOENT") return this[o] = "w", this[a]();
1559
- throw e;
1560
- }
1561
- else t = r.openSync(this[l], this[o], this[q]);
1562
- this[y](null, t);
1563
- }
1564
- [h]() {
1565
- if (this[m] && typeof this[s] == "number") {
1566
- const t = this[s];
1567
- this[s] = null, r.closeSync(t), this.emit("close");
1568
- }
1569
- }
1570
- [C](t) {
1571
- let e = true;
1572
- try {
1573
- this[_](null, r.writeSync(this[s], t, 0, t.length, this[u])), e = !1;
1574
- } finally {
1575
- if (e) try {
1576
- this[h]();
1577
- } catch {}
1578
- }
1579
- }
1580
- }
1581
- return s$4.ReadStream = D, s$4.ReadStreamSync = P, s$4.WriteStream = O, s$4.WriteStreamSync = U, s$4;
1582
- }
1583
- var r$1 = { exports: {} };
1584
- var i$2, m$2;
1585
- function t$2() {
1586
- if (m$2) return i$2;
1587
- m$2 = 1;
1588
- const { promisify: n } = a$a, e = fs;
1589
- return i$2 = (r) => {
1590
- if (!r) r = {
1591
- mode: 511,
1592
- fs: e
1593
- };
1594
- else if (typeof r == "object") r = {
1595
- mode: 511,
1596
- fs: e,
1597
- ...r
1598
- };
1599
- else if (typeof r == "number") r = {
1600
- mode: r,
1601
- fs: e
1602
- };
1603
- else if (typeof r == "string") r = {
1604
- mode: parseInt(r, 8),
1605
- fs: e
1606
- };
1607
- else throw new TypeError("invalid options argument");
1608
- return r.mkdir = r.mkdir || r.fs.mkdir || e.mkdir, r.mkdirAsync = n(r.mkdir), r.stat = r.stat || r.fs.stat || e.stat, r.statAsync = n(r.stat), r.statSync = r.statSync || r.fs.statSync || e.statSync, r.mkdirSync = r.mkdirSync || r.fs.mkdirSync || e.mkdirSync, r;
1609
- }, i$2;
1610
- }
1611
- var e$1, t$1;
1612
- function u$2() {
1613
- if (t$1) return e$1;
1614
- t$1 = 1;
1615
- const s = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform, { resolve: o, parse: n } = path;
1616
- return e$1 = (r) => {
1617
- if (/\0/.test(r)) throw Object.assign(/* @__PURE__ */ new TypeError("path must be a string without null bytes"), {
1618
- path: r,
1619
- code: "ERR_INVALID_ARG_VALUE"
1620
- });
1621
- if (r = o(r), s === "win32") {
1622
- const i = /[*|"<>?:]/, { root: a } = n(r);
1623
- if (i.test(r.substr(a.length))) throw Object.assign(/* @__PURE__ */ new Error("Illegal characters in path."), {
1624
- path: r,
1625
- code: "EINVAL"
1626
- });
1627
- }
1628
- return r;
1629
- }, e$1;
1630
- }
1631
- var i$1, c$2;
1632
- function t() {
1633
- if (c$2) return i$1;
1634
- c$2 = 1;
1635
- const { dirname: u } = path, f = (r, e, n = void 0) => n === e ? Promise.resolve() : r.statAsync(e).then((d) => d.isDirectory() ? n : void 0, (d) => d.code === "ENOENT" ? f(r, u(e), e) : void 0), o = (r, e, n = void 0) => {
1636
- if (n !== e) try {
1637
- return r.statSync(e).isDirectory() ? n : void 0;
1638
- } catch (d) {
1639
- return d.code === "ENOENT" ? o(r, u(e), e) : void 0;
1640
- }
1641
- };
1642
- return i$1 = {
1643
- findMade: f,
1644
- findMadeSync: o
1645
- }, i$1;
1646
- }
1647
- var o$3, a$4;
1648
- function y$2() {
1649
- if (a$4) return o$3;
1650
- a$4 = 1;
1651
- const { dirname: f } = path, t = (n, e, c) => {
1652
- e.recursive = false;
1653
- const i = f(n);
1654
- return i === n ? e.mkdirAsync(n, e).catch((r) => {
1655
- if (r.code !== "EISDIR") throw r;
1656
- }) : e.mkdirAsync(n, e).then(() => c || n, (r) => {
1657
- if (r.code === "ENOENT") return t(i, e).then((u) => t(n, e, u));
1658
- if (r.code !== "EEXIST" && r.code !== "EROFS") throw r;
1659
- return e.statAsync(n).then((u) => {
1660
- if (u.isDirectory()) return c;
1661
- throw r;
1662
- }, () => {
1663
- throw r;
1664
- });
1665
- });
1666
- }, d = (n, e, c) => {
1667
- const i = f(n);
1668
- if (e.recursive = false, i === n) try {
1669
- return e.mkdirSync(n, e);
1670
- } catch (r) {
1671
- if (r.code !== "EISDIR") throw r;
1672
- return;
1673
- }
1674
- try {
1675
- return e.mkdirSync(n, e), c || n;
1676
- } catch (r) {
1677
- if (r.code === "ENOENT") return d(n, e, d(i, e, c));
1678
- if (r.code !== "EEXIST" && r.code !== "EROFS") throw r;
1679
- try {
1680
- if (!e.statSync(n).isDirectory()) throw r;
1681
- } catch {
1682
- throw r;
1683
- }
1684
- }
1685
- };
1686
- return o$3 = {
1687
- mkdirpManual: t,
1688
- mkdirpManualSync: d
1689
- }, o$3;
1690
- }
1691
- var c$1, m$1;
1692
- function s$3() {
1693
- if (m$1) return c$1;
1694
- m$1 = 1;
1695
- const { dirname: u } = path, { findMade: d, findMadeSync: t$1 } = t(), { mkdirpManual: a, mkdirpManualSync: k } = y$2();
1696
- return c$1 = {
1697
- mkdirpNative: (e, r) => (r.recursive = true, u(e) === e ? r.mkdirAsync(e, r) : d(r, e).then((n) => r.mkdirAsync(e, r).then(() => n).catch((i) => {
1698
- if (i.code === "ENOENT") return a(e, r);
1699
- throw i;
1700
- }))),
1701
- mkdirpNativeSync: (e, r) => {
1702
- if (r.recursive = true, u(e) === e) return r.mkdirSync(e, r);
1703
- const n = t$1(r, e);
1704
- try {
1705
- return r.mkdirSync(e, r), n;
1706
- } catch (i) {
1707
- if (i.code === "ENOENT") return k(e, r);
1708
- throw i;
1709
- }
1710
- }
1711
- }, c$1;
1712
- }
1713
- var s$2, n$1;
1714
- function a$3() {
1715
- if (n$1) return s$2;
1716
- n$1 = 1;
1717
- const i = fs, e = (process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version).replace(/^v/, "").split("."), t = +e[0] > 10 || +e[0] == 10 && +e[1] >= 12;
1718
- return s$2 = {
1719
- useNative: t ? (r) => r.mkdir === i.mkdir : () => false,
1720
- useNativeSync: t ? (r) => r.mkdirSync === i.mkdirSync : () => false
1721
- }, s$2;
1722
- }
1723
- var m, s$1;
1724
- function S() {
1725
- if (s$1) return m;
1726
- s$1 = 1;
1727
- const i = t$2(), u = u$2(), { mkdirpNative: a, mkdirpNativeSync: c } = s$3(), { mkdirpManual: o, mkdirpManualSync: q } = y$2(), { useNative: t, useNativeSync: _ } = a$3(), n = (e, r) => (e = u(e), r = i(r), t(r) ? a(e, r) : o(e, r)), d = (e, r) => (e = u(e), r = i(r), _(r) ? c(e, r) : q(e, r));
1728
- return n.sync = d, n.native = (e, r) => a(u(e), i(r)), n.manual = (e, r) => o(u(e), i(r)), n.nativeSync = (e, r) => c(u(e), i(r)), n.manualSync = (e, r) => q(u(e), i(r)), m = n, m;
1729
- }
1730
- var y$1, O;
1731
- function F$1() {
1732
- if (O) return y$1;
1733
- O = 1;
1734
- const c = fs, a = path, T = c.lchown ? "lchown" : "chown", I = c.lchownSync ? "lchownSync" : "chownSync", i = c.lchown && !process.version.match(/v1[1-9]+\./) && !process.version.match(/v10\.[6-9]/), u = (r, e, n) => {
1735
- try {
1736
- return c[I](r, e, n);
1737
- } catch (t) {
1738
- if (t.code !== "ENOENT") throw t;
1739
- }
1740
- }, D = (r, e, n) => {
1741
- try {
1742
- return c.chownSync(r, e, n);
1743
- } catch (t) {
1744
- if (t.code !== "ENOENT") throw t;
1745
- }
1746
- }, _ = i ? (r, e, n, t) => (o) => {
1747
- !o || o.code !== "EISDIR" ? t(o) : c.chown(r, e, n, t);
1748
- } : (r, e, n, t) => t, w = i ? (r, e, n) => {
1749
- try {
1750
- return u(r, e, n);
1751
- } catch (t) {
1752
- if (t.code !== "EISDIR") throw t;
1753
- D(r, e, n);
1754
- }
1755
- } : (r, e, n) => u(r, e, n), R = process.version;
1756
- let N = (r, e, n) => c.readdir(r, e, n), q = (r, e) => c.readdirSync(r, e);
1757
- /^v4\./.test(R) && (N = (r, e, n) => c.readdir(r, n));
1758
- const h = (r, e, n, t) => {
1759
- c[T](r, e, n, _(r, e, n, (o) => {
1760
- t(o && o.code !== "ENOENT" ? o : null);
1761
- }));
1762
- }, S = (r, e, n, t, o) => {
1763
- if (typeof e == "string") return c.lstat(a.resolve(r, e), (s, f) => {
1764
- if (s) return o(s.code !== "ENOENT" ? s : null);
1765
- f.name = e, S(r, f, n, t, o);
1766
- });
1767
- if (e.isDirectory()) E(a.resolve(r, e.name), n, t, (s) => {
1768
- if (s) return o(s);
1769
- h(a.resolve(r, e.name), n, t, o);
1770
- });
1771
- else h(a.resolve(r, e.name), n, t, o);
1772
- }, E = (r, e, n, t) => {
1773
- N(r, { withFileTypes: true }, (o, s) => {
1774
- if (o) {
1775
- if (o.code === "ENOENT") return t();
1776
- if (o.code !== "ENOTDIR" && o.code !== "ENOTSUP") return t(o);
1777
- }
1778
- if (o || !s.length) return h(r, e, n, t);
1779
- let f = s.length, v = null;
1780
- const H = (l) => {
1781
- if (!v) {
1782
- if (l) return t(v = l);
1783
- if (--f === 0) return h(r, e, n, t);
1784
- }
1785
- };
1786
- s.forEach((l) => S(r, l, e, n, H));
1787
- });
1788
- }, C = (r, e, n, t) => {
1789
- if (typeof e == "string") try {
1790
- const o = c.lstatSync(a.resolve(r, e));
1791
- o.name = e, e = o;
1792
- } catch (o) {
1793
- if (o.code === "ENOENT") return;
1794
- throw o;
1795
- }
1796
- e.isDirectory() && m(a.resolve(r, e.name), n, t), w(a.resolve(r, e.name), n, t);
1797
- }, m = (r, e, n) => {
1798
- let t;
1799
- try {
1800
- t = q(r, { withFileTypes: !0 });
1801
- } catch (o) {
1802
- if (o.code === "ENOENT") return;
1803
- if (o.code === "ENOTDIR" || o.code === "ENOTSUP") return w(r, e, n);
1804
- throw o;
1805
- }
1806
- return t && t.length && t.forEach((o) => C(r, o, e, n)), w(r, e, n);
1807
- };
1808
- return y$1 = E, E.sync = m, y$1;
1809
- }
1810
- var R;
1811
- function H() {
1812
- if (R) return r$1.exports;
1813
- R = 1;
1814
- const g = S(), l = fs, p = path, x = F$1(), y = a$7();
1815
- class D extends Error {
1816
- constructor(e, s) {
1817
- super("Cannot extract through symbolic link"), this.path = s, this.symlink = e;
1818
- }
1819
- get name() {
1820
- return "SylinkError";
1821
- }
1822
- }
1823
- class E extends Error {
1824
- constructor(e, s) {
1825
- super(s + ": Cannot cd into '" + e + "'"), this.path = e, this.code = s;
1826
- }
1827
- get name() {
1828
- return "CwdError";
1829
- }
1830
- }
1831
- const v = (n, e) => n.get(y(e)), q = (n, e, s) => n.set(y(e), s), I = (n, e) => {
1832
- l.stat(n, (s, r) => {
1833
- (s || !r.isDirectory()) && (s = new E(n, s && s.code || "ENOTDIR")), e(s);
1834
- });
1835
- };
1836
- r$1.exports = (n, e, s) => {
1837
- n = y(n);
1838
- const r = e.umask, c = e.mode | 448, f = (c & r) !== 0, t = e.uid, i = e.gid, a = typeof t == "number" && typeof i == "number" && (t !== e.processUid || i !== e.processGid), u = e.preserve, m = e.unlink, h = e.cache, d = y(e.cwd), w = (k, o) => {
1839
- k ? s(k) : (q(h, n, true), o && a ? x(o, t, i, (G) => w(G)) : f ? l.chmod(n, c, s) : s());
1840
- };
1841
- if (h && v(h, n) === true) return w();
1842
- if (n === d) return I(n, w);
1843
- if (u) return g(n, { mode: c }).then((k) => w(null, k), w);
1844
- C(d, y(p.relative(d, n)).split("/"), c, h, m, d, null, w);
1845
- };
1846
- const C = (n, e, s, r, c, f, t, i) => {
1847
- if (!e.length) return i(null, t);
1848
- const a = e.shift(), u = y(p.resolve(n + "/" + a));
1849
- if (v(r, u)) return C(u, e, s, r, c, f, t, i);
1850
- l.mkdir(u, s, j(u, e, s, r, c, f, t, i));
1851
- }, j = (n, e, s, r, c, f, t, i) => (a) => {
1852
- a ? l.lstat(n, (u, m) => {
1853
- if (u) u.path = u.path && y(u.path), i(u);
1854
- else if (m.isDirectory()) C(n, e, s, r, c, f, t, i);
1855
- else if (c) l.unlink(n, (h) => {
1856
- if (h) return i(h);
1857
- l.mkdir(n, s, j(n, e, s, r, c, f, t, i));
1858
- });
1859
- else {
1860
- if (m.isSymbolicLink()) return i(new D(n, n + "/" + e.join("/")));
1861
- i(a);
1862
- }
1863
- }) : (t = t || n, C(n, e, s, r, c, f, t, i));
1864
- }, L = (n) => {
1865
- let e = false, s = "ENOTDIR";
1866
- try {
1867
- e = l.statSync(n).isDirectory();
1868
- } catch (r) {
1869
- s = r.code;
1870
- } finally {
1871
- if (!e) throw new E(n, s);
1872
- }
1873
- };
1874
- return r$1.exports.sync = (n, e) => {
1875
- n = y(n);
1876
- const s = e.umask, r = e.mode | 448, c = (r & s) !== 0, f = e.uid, t = e.gid, i = typeof f == "number" && typeof t == "number" && (f !== e.processUid || t !== e.processGid), a = e.preserve, u = e.unlink, m = e.cache, h = y(e.cwd), d = (k) => {
1877
- q(m, n, true), k && i && x.sync(k, f, t), c && l.chmodSync(n, r);
1878
- };
1879
- if (m && v(m, n) === true) return d();
1880
- if (n === h) return L(h), d();
1881
- if (a) return d(g.sync(n, r));
1882
- const $ = y(p.relative(h, n)).split("/");
1883
- let S = null;
1884
- for (let k = $.shift(), o = h; k && (o += "/" + k); k = $.shift()) if (o = y(p.resolve(o)), !v(m, o)) try {
1885
- l.mkdirSync(o, r), S = S || o, q(m, o, !0);
1886
- } catch {
1887
- const M = l.lstatSync(o);
1888
- if (M.isDirectory()) {
1889
- q(m, o, true);
1890
- continue;
1891
- } else if (u) {
1892
- l.unlinkSync(o), l.mkdirSync(o, r), S = S || o, q(m, o, true);
1893
- continue;
1894
- } else if (M.isSymbolicLink()) return new D(o, o + "/" + $.join("/"));
1895
- }
1896
- return d(S);
1897
- }, r$1.exports;
1898
- }
1899
- var a$2, i;
1900
- function p() {
1901
- if (i) return a$2;
1902
- i = 1;
1903
- const o = [
1904
- "|",
1905
- "<",
1906
- ">",
1907
- "?",
1908
- ":"
1909
- ], t = o.map((e) => String.fromCharCode(61440 + e.charCodeAt(0))), s = new Map(o.map((e, r) => [e, t[r]])), c = new Map(t.map((e, r) => [e, o[r]]));
1910
- return a$2 = {
1911
- encode: (e) => o.reduce((r, n) => r.split(n).join(s.get(n)), e),
1912
- decode: (e) => t.reduce((r, n) => r.split(n).join(c.get(n)), e)
1913
- }, a$2;
1914
- }
1915
- var o$2, n;
1916
- function a$1() {
1917
- if (n) return o$2;
1918
- n = 1;
1919
- const r = Object.create(null), { hasOwnProperty: i } = Object.prototype;
1920
- return o$2 = (e) => (i.call(r, e) || (r[e] = e.normalize("NFD")), r[e]), o$2;
1921
- }
1922
- var a, l;
1923
- function s() {
1924
- return l || (l = 1, a = (r) => {
1925
- let e = r.length - 1, i = -1;
1926
- for (; e > -1 && r.charAt(e) === "/";) i = e, e--;
1927
- return i === -1 ? r : r.slice(0, i);
1928
- }), a;
1929
- }
1930
- var u$1, f$1;
1931
- function z() {
1932
- if (f$1) return u$1;
1933
- f$1 = 1;
1934
- const l = assert, m = a$1(), g = s(), { join: d } = path, q = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
1935
- return u$1 = () => {
1936
- const i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), v = (e) => e.split("/").slice(0, -1).reduce((o, r) => (o.length && (r = d(o[o.length - 1], r)), o.push(r || "/"), o), []), a = /* @__PURE__ */ new Set(), w = (e) => {
1937
- const s = c.get(e);
1938
- if (!s) throw new Error("function does not have any path reservations");
1939
- return {
1940
- paths: s.paths.map((o) => i.get(o)),
1941
- dirs: [...s.dirs].map((o) => i.get(o))
1942
- };
1943
- }, h = (e) => {
1944
- const { paths: s, dirs: o } = w(e);
1945
- return s.every((r) => r[0] === e) && o.every((r) => r[0] instanceof Set && r[0].has(e));
1946
- }, p = (e) => a.has(e) || !h(e) ? false : (a.add(e), e(() => S(e)), true), S = (e) => {
1947
- if (!a.has(e)) return false;
1948
- const { paths: s, dirs: o } = c.get(e), r = /* @__PURE__ */ new Set();
1949
- return s.forEach((t) => {
1950
- const n = i.get(t);
1951
- l.equal(n[0], e), n.length === 1 ? i.delete(t) : (n.shift(), typeof n[0] == "function" ? r.add(n[0]) : n[0].forEach((E) => r.add(E)));
1952
- }), o.forEach((t) => {
1953
- const n = i.get(t);
1954
- l(n[0] instanceof Set), n[0].size === 1 && n.length === 1 ? i.delete(t) : n[0].size === 1 ? (n.shift(), r.add(n[0])) : n[0].delete(e);
1955
- }), a.delete(e), r.forEach((t) => p(t)), true;
1956
- };
1957
- return {
1958
- check: h,
1959
- reserve: (e, s) => {
1960
- e = q ? ["win32 parallelization disabled"] : e.map((r) => g(d(m(r))).toLowerCase());
1961
- const o = new Set(e.map((r) => v(r)).reduce((r, t) => r.concat(t)));
1962
- return c.set(s, {
1963
- dirs: o,
1964
- paths: e
1965
- }), e.forEach((r) => {
1966
- const t = i.get(r);
1967
- t ? t.push(s) : i.set(r, [s]);
1968
- }), o.forEach((r) => {
1969
- const t = i.get(r);
1970
- t ? t[t.length - 1] instanceof Set ? t[t.length - 1].add(s) : t.push(new Set([s])) : i.set(r, [new Set([s])]);
1971
- }), p(s);
1972
- }
1973
- };
1974
- }, u$1;
1975
- }
1976
- var o$1, u;
1977
- function c() {
1978
- if (u) return o$1;
1979
- u = 1;
1980
- const { isAbsolute: l, parse: t } = path.win32;
1981
- return o$1 = (r) => {
1982
- let s = "", e = t(r);
1983
- for (; l(r) || e.root;) {
1984
- const i = r.charAt(0) === "/" && r.slice(0, 4) !== "//?/" ? "/" : e.root;
1985
- r = r.slice(i.length), s += i, e = t(r);
1986
- }
1987
- return [s, r];
1988
- }, o$1;
1989
- }
1990
- var e, o;
1991
- function F() {
1992
- if (o) return e;
1993
- o = 1;
1994
- const t = process.env.__FAKE_PLATFORM__ || process.platform, s = typeof Bun < "u" ? false : t === "win32", { O_CREAT: _, O_TRUNC: a, O_WRONLY: i, UV_FS_O_FILEMAP: r = 0 } = (commonjsGlobal.__FAKE_TESTING_FS__ || fs).constants, c = s && !!r, f = 512 * 1024, p = r | a | _ | i;
1995
- return e = c ? (l) => l < f ? p : "w" : () => "w", e;
1996
- }
1997
- var G, y;
1998
- function Os() {
1999
- if (y) return G;
2000
- y = 1;
2001
- const ss = assert, is = rt(), r = fs, es = X(), w = path, M = H(), K = p(), ts = z(), os = c(), l = a$7(), rs = s(), hs = a$1(), H$1 = Symbol("onEntry"), q = Symbol("checkFs"), Y = Symbol("checkFs2"), v = Symbol("pruneCache"), N = Symbol("isReusable"), d = Symbol("makeFs"), U = Symbol("file"), F$1 = Symbol("directory"), O = Symbol("link"), B = Symbol("symlink"), z$1 = Symbol("hardlink"), W = Symbol("unsupported"), j = Symbol("checkPath"), b = Symbol("mkdir"), m = Symbol("onError"), $ = Symbol("pending"), V$1 = Symbol("pend"), S = Symbol("unpend"), P = Symbol("ended"), A = Symbol("maybeClose"), x = Symbol("skip"), E = Symbol("doChown"), R = Symbol("uid"), _ = Symbol("gid"), g = Symbol("checkedCwd"), X$1 = Ds, J = F(), C = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32", cs = 1024, as = (a, s) => {
2002
- if (!C) return r.unlink(a, s);
2003
- const i = a + ".DELETE." + X$1.randomBytes(16).toString("hex");
2004
- r.rename(a, i, (e) => {
2005
- if (e) return s(e);
2006
- r.unlink(i, s);
2007
- });
2008
- }, us = (a) => {
2009
- if (!C) return r.unlinkSync(a);
2010
- const s = a + ".DELETE." + X$1.randomBytes(16).toString("hex");
2011
- r.renameSync(a, s), r.unlinkSync(s);
2012
- }, Q = (a, s, i) => a === a >>> 0 ? a : s === s >>> 0 ? s : i, Z = (a) => rs(l(hs(a))).toLowerCase(), ns = (a, s) => {
2013
- s = Z(s);
2014
- for (const i of a.keys()) {
2015
- const e = Z(i);
2016
- (e === s || e.indexOf(s + "/") === 0) && a.delete(i);
2017
- }
2018
- }, ms = (a) => {
2019
- for (const s of a.keys()) a.delete(s);
2020
- };
2021
- class L extends is {
2022
- constructor(s) {
2023
- if (s || (s = {}), s.ondone = (i) => {
2024
- this[P] = true, this[A]();
2025
- }, super(s), this[g] = false, this.reservations = ts(), this.transform = typeof s.transform == "function" ? s.transform : null, this.writable = true, this.readable = false, this[$] = 0, this[P] = false, this.dirCache = s.dirCache || /* @__PURE__ */ new Map(), typeof s.uid == "number" || typeof s.gid == "number") {
2026
- if (typeof s.uid != "number" || typeof s.gid != "number") throw new TypeError("cannot set owner without number uid and gid");
2027
- if (s.preserveOwner) throw new TypeError("cannot preserve owner in archive and also set owner explicitly");
2028
- this.uid = s.uid, this.gid = s.gid, this.setOwner = true;
2029
- } else this.uid = null, this.gid = null, this.setOwner = false;
2030
- s.preserveOwner === void 0 && typeof s.uid != "number" ? this.preserveOwner = process.getuid && process.getuid() === 0 : this.preserveOwner = !!s.preserveOwner, this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : null, this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : null, this.maxDepth = typeof s.maxDepth == "number" ? s.maxDepth : cs, this.forceChown = s.forceChown === true, this.win32 = !!s.win32 || C, this.newer = !!s.newer, this.keep = !!s.keep, this.noMtime = !!s.noMtime, this.preservePaths = !!s.preservePaths, this.unlink = !!s.unlink, this.cwd = l(w.resolve(s.cwd || process.cwd())), this.strip = +s.strip || 0, this.processUmask = s.noChmod ? 0 : process.umask(), this.umask = typeof s.umask == "number" ? s.umask : this.processUmask, this.dmode = s.dmode || 511 & ~this.umask, this.fmode = s.fmode || 438 & ~this.umask, this.on("entry", (i) => this[H$1](i));
2031
- }
2032
- warn(s, i, e = {}) {
2033
- return (s === "TAR_BAD_ARCHIVE" || s === "TAR_ABORT") && (e.recoverable = false), super.warn(s, i, e);
2034
- }
2035
- [A]() {
2036
- this[P] && this[$] === 0 && (this.emit("prefinish"), this.emit("finish"), this.emit("end"));
2037
- }
2038
- [j](s) {
2039
- const i = l(s.path), e = i.split("/");
2040
- if (this.strip) {
2041
- if (e.length < this.strip) return false;
2042
- if (s.type === "Link") {
2043
- const t = l(s.linkpath).split("/");
2044
- if (t.length >= this.strip) s.linkpath = t.slice(this.strip).join("/");
2045
- else return false;
2046
- }
2047
- e.splice(0, this.strip), s.path = e.join("/");
2048
- }
2049
- if (isFinite(this.maxDepth) && e.length > this.maxDepth) return this.warn("TAR_ENTRY_ERROR", "path excessively deep", {
2050
- entry: s,
2051
- path: i,
2052
- depth: e.length,
2053
- maxDepth: this.maxDepth
2054
- }), false;
2055
- if (!this.preservePaths) {
2056
- if (e.includes("..") || C && /^[a-z]:\.\.$/i.test(e[0])) return this.warn("TAR_ENTRY_ERROR", "path contains '..'", {
2057
- entry: s,
2058
- path: i
2059
- }), false;
2060
- const [t, o] = os(i);
2061
- t && (s.path = o, this.warn("TAR_ENTRY_INFO", `stripping ${t} from absolute path`, {
2062
- entry: s,
2063
- path: i
2064
- }));
2065
- }
2066
- if (w.isAbsolute(s.path) ? s.absolute = l(w.resolve(s.path)) : s.absolute = l(w.resolve(this.cwd, s.path)), !this.preservePaths && s.absolute.indexOf(this.cwd + "/") !== 0 && s.absolute !== this.cwd) return this.warn("TAR_ENTRY_ERROR", "path escaped extraction target", {
2067
- entry: s,
2068
- path: l(s.path),
2069
- resolvedPath: s.absolute,
2070
- cwd: this.cwd
2071
- }), false;
2072
- if (s.absolute === this.cwd && s.type !== "Directory" && s.type !== "GNUDumpDir") return false;
2073
- if (this.win32) {
2074
- const { root: t } = w.win32.parse(s.absolute);
2075
- s.absolute = t + K.encode(s.absolute.slice(t.length));
2076
- const { root: o } = w.win32.parse(s.path);
2077
- s.path = o + K.encode(s.path.slice(o.length));
2078
- }
2079
- return true;
2080
- }
2081
- [H$1](s) {
2082
- if (!this[j](s)) return s.resume();
2083
- switch (ss.equal(typeof s.absolute, "string"), s.type) {
2084
- case "Directory":
2085
- case "GNUDumpDir": s.mode && (s.mode = s.mode | 448);
2086
- case "File":
2087
- case "OldFile":
2088
- case "ContiguousFile":
2089
- case "Link":
2090
- case "SymbolicLink": return this[q](s);
2091
- default: return this[W](s);
2092
- }
2093
- }
2094
- [m](s, i) {
2095
- s.name === "CwdError" ? this.emit("error", s) : (this.warn("TAR_ENTRY_ERROR", s, { entry: i }), this[S](), i.resume());
2096
- }
2097
- [b](s, i, e) {
2098
- M(l(s), {
2099
- uid: this.uid,
2100
- gid: this.gid,
2101
- processUid: this.processUid,
2102
- processGid: this.processGid,
2103
- umask: this.processUmask,
2104
- preserve: this.preservePaths,
2105
- unlink: this.unlink,
2106
- cache: this.dirCache,
2107
- cwd: this.cwd,
2108
- mode: i,
2109
- noChmod: this.noChmod
2110
- }, e);
2111
- }
2112
- [E](s) {
2113
- return this.forceChown || this.preserveOwner && (typeof s.uid == "number" && s.uid !== this.processUid || typeof s.gid == "number" && s.gid !== this.processGid) || typeof this.uid == "number" && this.uid !== this.processUid || typeof this.gid == "number" && this.gid !== this.processGid;
2114
- }
2115
- [R](s) {
2116
- return Q(this.uid, s.uid, this.processUid);
2117
- }
2118
- [_](s) {
2119
- return Q(this.gid, s.gid, this.processGid);
2120
- }
2121
- [U](s, i) {
2122
- const e = s.mode & 4095 || this.fmode, t = new es.WriteStream(s.absolute, {
2123
- flags: J(s.size),
2124
- mode: e,
2125
- autoClose: false
2126
- });
2127
- t.on("error", (c) => {
2128
- t.fd && r.close(t.fd, () => {}), t.write = () => true, this[m](c, s), i();
2129
- });
2130
- let o = 1;
2131
- const u = (c) => {
2132
- if (c) {
2133
- t.fd && r.close(t.fd, () => {}), this[m](c, s), i();
2134
- return;
2135
- }
2136
- --o === 0 && r.close(t.fd, (n) => {
2137
- n ? this[m](n, s) : this[S](), i();
2138
- });
2139
- };
2140
- t.on("finish", (c) => {
2141
- const n = s.absolute, p = t.fd;
2142
- if (s.mtime && !this.noMtime) {
2143
- o++;
2144
- const f = s.atime || /* @__PURE__ */ new Date(), k = s.mtime;
2145
- r.futimes(p, f, k, (D) => D ? r.utimes(n, f, k, (I) => u(I && D)) : u());
2146
- }
2147
- if (this[E](s)) {
2148
- o++;
2149
- const f = this[R](s), k = this[_](s);
2150
- r.fchown(p, f, k, (D) => D ? r.chown(n, f, k, (I) => u(I && D)) : u());
2151
- }
2152
- u();
2153
- });
2154
- const h = this.transform && this.transform(s) || s;
2155
- h !== s && (h.on("error", (c) => {
2156
- this[m](c, s), i();
2157
- }), s.pipe(h)), h.pipe(t);
2158
- }
2159
- [F$1](s, i) {
2160
- const e = s.mode & 4095 || this.dmode;
2161
- this[b](s.absolute, e, (t) => {
2162
- if (t) {
2163
- this[m](t, s), i();
2164
- return;
2165
- }
2166
- let o = 1;
2167
- const u = (h) => {
2168
- --o === 0 && (i(), this[S](), s.resume());
2169
- };
2170
- s.mtime && !this.noMtime && (o++, r.utimes(s.absolute, s.atime || /* @__PURE__ */ new Date(), s.mtime, u)), this[E](s) && (o++, r.chown(s.absolute, this[R](s), this[_](s), u)), u();
2171
- });
2172
- }
2173
- [W](s) {
2174
- s.unsupported = true, this.warn("TAR_ENTRY_UNSUPPORTED", `unsupported entry type: ${s.type}`, { entry: s }), s.resume();
2175
- }
2176
- [B](s, i) {
2177
- this[O](s, s.linkpath, "symlink", i);
2178
- }
2179
- [z$1](s, i) {
2180
- const e = l(w.resolve(this.cwd, s.linkpath));
2181
- this[O](s, e, "link", i);
2182
- }
2183
- [V$1]() {
2184
- this[$]++;
2185
- }
2186
- [S]() {
2187
- this[$]--, this[A]();
2188
- }
2189
- [x](s) {
2190
- this[S](), s.resume();
2191
- }
2192
- [N](s, i) {
2193
- return s.type === "File" && !this.unlink && i.isFile() && i.nlink <= 1 && !C;
2194
- }
2195
- [q](s) {
2196
- this[V$1]();
2197
- const i = [s.path];
2198
- s.linkpath && i.push(s.linkpath), this.reservations.reserve(i, (e) => this[Y](s, e));
2199
- }
2200
- [v](s) {
2201
- s.type === "SymbolicLink" ? ms(this.dirCache) : s.type !== "Directory" && ns(this.dirCache, s.absolute);
2202
- }
2203
- [Y](s, i) {
2204
- this[v](s);
2205
- const e = (h) => {
2206
- this[v](s), i(h);
2207
- }, t = () => {
2208
- this[b](this.cwd, this.dmode, (h) => {
2209
- if (h) {
2210
- this[m](h, s), e();
2211
- return;
2212
- }
2213
- this[g] = true, o();
2214
- });
2215
- }, o = () => {
2216
- if (s.absolute !== this.cwd) {
2217
- const h = l(w.dirname(s.absolute));
2218
- if (h !== this.cwd) return this[b](h, this.dmode, (c) => {
2219
- if (c) {
2220
- this[m](c, s), e();
2221
- return;
2222
- }
2223
- u();
2224
- });
2225
- }
2226
- u();
2227
- }, u = () => {
2228
- r.lstat(s.absolute, (h, c) => {
2229
- if (c && (this.keep || this.newer && c.mtime > s.mtime)) {
2230
- this[x](s), e();
2231
- return;
2232
- }
2233
- if (h || this[N](s, c)) return this[d](null, s, e);
2234
- if (c.isDirectory()) {
2235
- if (s.type === "Directory") {
2236
- const n = !this.noChmod && s.mode && (c.mode & 4095) !== s.mode, p = (f) => this[d](f, s, e);
2237
- return n ? r.chmod(s.absolute, s.mode, p) : p();
2238
- }
2239
- if (s.absolute !== this.cwd) return r.rmdir(s.absolute, (n) => this[d](n, s, e));
2240
- }
2241
- if (s.absolute === this.cwd) return this[d](null, s, e);
2242
- as(s.absolute, (n) => this[d](n, s, e));
2243
- });
2244
- };
2245
- this[g] ? o() : t();
2246
- }
2247
- [d](s, i, e) {
2248
- if (s) {
2249
- this[m](s, i), e();
2250
- return;
2251
- }
2252
- switch (i.type) {
2253
- case "File":
2254
- case "OldFile":
2255
- case "ContiguousFile": return this[U](i, e);
2256
- case "Link": return this[z$1](i, e);
2257
- case "SymbolicLink": return this[B](i, e);
2258
- case "Directory":
2259
- case "GNUDumpDir": return this[F$1](i, e);
2260
- }
2261
- }
2262
- [O](s, i, e, t) {
2263
- r[e](i, s.absolute, (o) => {
2264
- o ? this[m](o, s) : (this[S](), s.resume()), t();
2265
- });
2266
- }
2267
- }
2268
- const T = (a) => {
2269
- try {
2270
- return [null, a()];
2271
- } catch (s) {
2272
- return [s, null];
2273
- }
2274
- };
2275
- class ls extends L {
2276
- [d](s, i) {
2277
- return super[d](s, i, () => {});
2278
- }
2279
- [q](s) {
2280
- if (this[v](s), !this[g]) {
2281
- const o = this[b](this.cwd, this.dmode);
2282
- if (o) return this[m](o, s);
2283
- this[g] = true;
2284
- }
2285
- if (s.absolute !== this.cwd) {
2286
- const o = l(w.dirname(s.absolute));
2287
- if (o !== this.cwd) {
2288
- const u = this[b](o, this.dmode);
2289
- if (u) return this[m](u, s);
2290
- }
2291
- }
2292
- const [i, e] = T(() => r.lstatSync(s.absolute));
2293
- if (e && (this.keep || this.newer && e.mtime > s.mtime)) return this[x](s);
2294
- if (i || this[N](s, e)) return this[d](null, s);
2295
- if (e.isDirectory()) {
2296
- if (s.type === "Directory") {
2297
- const [h] = !this.noChmod && s.mode && (e.mode & 4095) !== s.mode ? T(() => {
2298
- r.chmodSync(s.absolute, s.mode);
2299
- }) : [];
2300
- return this[d](h, s);
2301
- }
2302
- const [o] = T(() => r.rmdirSync(s.absolute));
2303
- this[d](o, s);
2304
- }
2305
- const [t] = s.absolute === this.cwd ? [] : T(() => us(s.absolute));
2306
- this[d](t, s);
2307
- }
2308
- [U](s, i) {
2309
- const e = s.mode & 4095 || this.fmode, t = (h) => {
2310
- let c;
2311
- try {
2312
- r.closeSync(o);
2313
- } catch (n) {
2314
- c = n;
2315
- }
2316
- (h || c) && this[m](h || c, s), i();
2317
- };
2318
- let o;
2319
- try {
2320
- o = r.openSync(s.absolute, J(s.size), e);
2321
- } catch (h) {
2322
- return t(h);
2323
- }
2324
- const u = this.transform && this.transform(s) || s;
2325
- u !== s && (u.on("error", (h) => this[m](h, s)), s.pipe(u)), u.on("data", (h) => {
2326
- try {
2327
- r.writeSync(o, h, 0, h.length);
2328
- } catch (c) {
2329
- t(c);
2330
- }
2331
- }), u.on("end", (h) => {
2332
- let c = null;
2333
- if (s.mtime && !this.noMtime) {
2334
- const n = s.atime || /* @__PURE__ */ new Date(), p = s.mtime;
2335
- try {
2336
- r.futimesSync(o, n, p);
2337
- } catch (f) {
2338
- try {
2339
- r.utimesSync(s.absolute, n, p);
2340
- } catch {
2341
- c = f;
2342
- }
2343
- }
2344
- }
2345
- if (this[E](s)) {
2346
- const n = this[R](s), p = this[_](s);
2347
- try {
2348
- r.fchownSync(o, n, p);
2349
- } catch (f) {
2350
- try {
2351
- r.chownSync(s.absolute, n, p);
2352
- } catch {
2353
- c = c || f;
2354
- }
2355
- }
2356
- }
2357
- t(c);
2358
- });
2359
- }
2360
- [F$1](s, i) {
2361
- const e = s.mode & 4095 || this.dmode, t = this[b](s.absolute, e);
2362
- if (t) {
2363
- this[m](t, s), i();
2364
- return;
2365
- }
2366
- if (s.mtime && !this.noMtime) try {
2367
- r.utimesSync(s.absolute, s.atime || /* @__PURE__ */ new Date(), s.mtime);
2368
- } catch {}
2369
- if (this[E](s)) try {
2370
- r.chownSync(s.absolute, this[R](s), this[_](s));
2371
- } catch {}
2372
- i(), s.resume();
2373
- }
2374
- [b](s, i) {
2375
- try {
2376
- return M.sync(l(s), {
2377
- uid: this.uid,
2378
- gid: this.gid,
2379
- processUid: this.processUid,
2380
- processGid: this.processGid,
2381
- umask: this.processUmask,
2382
- preserve: this.preservePaths,
2383
- unlink: this.unlink,
2384
- cache: this.dirCache,
2385
- cwd: this.cwd,
2386
- mode: i
2387
- });
2388
- } catch (e) {
2389
- return e;
2390
- }
2391
- }
2392
- [O](s, i, e, t) {
2393
- try {
2394
- r[e + "Sync"](i, s.absolute), t(), s.resume();
2395
- } catch (o) {
2396
- return this[m](o, s);
2397
- }
2398
- }
2399
- }
2400
- return L.Sync = ls, G = L, G;
2401
- }
2402
- var f, q;
2403
- function v() {
2404
- if (q) return f;
2405
- q = 1;
2406
- const w = s$6(), u = Os(), p = fs, y = X(), l = path, m = s();
2407
- f = (r, e, o) => {
2408
- typeof r == "function" ? (o = r, e = null, r = {}) : Array.isArray(r) && (e = r, r = {}), typeof e == "function" && (o = e, e = null), e ? e = Array.from(e) : e = [];
2409
- const t = w(r);
2410
- if (t.sync && typeof o == "function") throw new TypeError("callback not supported for sync tar functions");
2411
- if (!t.file && typeof o == "function") throw new TypeError("callback only supported with file option");
2412
- return e.length && d(t, e), t.file && t.sync ? $(t) : t.file ? h(t, o) : t.sync ? x(t) : z(t);
2413
- };
2414
- const d = (r, e) => {
2415
- const o = new Map(e.map((n) => [m(n), true])), t = r.filter, s = (n, i) => {
2416
- const a = i || l.parse(n).root || ".", c = n === a ? false : o.has(n) ? o.get(n) : s(l.dirname(n), a);
2417
- return o.set(n, c), c;
2418
- };
2419
- r.filter = t ? (n, i) => t(n, i) && s(m(n)) : (n) => s(m(n));
2420
- }, $ = (r) => {
2421
- const e = new u.Sync(r), o = r.file, t = p.statSync(o), s = r.maxReadSize || 16 * 1024 * 1024;
2422
- new y.ReadStreamSync(o, {
2423
- readSize: s,
2424
- size: t.size
2425
- }).pipe(e);
2426
- }, h = (r, e) => {
2427
- const o = new u(r), t = r.maxReadSize || 16 * 1024 * 1024, s = r.file, n = new Promise((i, a) => {
2428
- o.on("error", a), o.on("close", i), p.stat(s, (c, R) => {
2429
- if (c) a(c);
2430
- else {
2431
- const S = new y.ReadStream(s, {
2432
- readSize: t,
2433
- size: R.size
2434
- });
2435
- S.on("error", a), S.pipe(o);
2436
- }
2437
- });
2438
- });
2439
- return e ? n.then(e, e) : n;
2440
- }, x = (r) => new u.Sync(r), z = (r) => new u(r);
2441
- return f;
2442
- }
2443
- const tarExtract = getDefaultExportFromCjs(v());
2444
- async function download(url, filePath, options = {}) {
2445
- const infoPath = filePath + ".json";
2446
- const info = JSON.parse(await readFile(infoPath, "utf8").catch(() => "{}"));
2447
- const etag = (await sendFetch(url, {
2448
- method: "HEAD",
2449
- headers: options.headers
2450
- }).catch(() => void 0))?.headers.get("etag");
2451
- if (info.etag === etag && existsSync(filePath)) return;
2452
- if (typeof etag === "string") info.etag = etag;
2453
- const response = await sendFetch(url, { headers: options.headers });
2454
- if (response.status >= 400) throw new Error(`Failed to download ${url}: ${response.status} ${response.statusText}`);
2455
- const stream = createWriteStream(filePath);
2456
- await promisify(pipeline)(response.body, stream);
2457
- await writeFile(infoPath, JSON.stringify(info), "utf8");
2458
- }
2459
- const inputRegex = /^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;
2460
- function parseGitURI(input) {
2461
- const m = input.match(inputRegex)?.groups || {};
2462
- return {
2463
- repo: m.repo,
2464
- subdir: m.subdir || "/",
2465
- ref: m.ref ? m.ref.slice(1) : "main"
2466
- };
2467
- }
2468
- function debug(...args) {
2469
- if (process.env.DEBUG) console.debug("[giget]", ...args);
2470
- }
2471
- async function sendFetch(url, options = {}) {
2472
- if (options.headers?.["sec-fetch-mode"]) options.mode = options.headers["sec-fetch-mode"];
2473
- const res = await (0, import_proxy.fetch)(url, {
2474
- ...options,
2475
- headers: normalizeHeaders(options.headers)
2476
- }).catch((error) => {
2477
- throw new Error(`Failed to download ${url}: ${error}`, { cause: error });
2478
- });
2479
- if (options.validateStatus && res.status >= 400) throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);
2480
- return res;
2481
- }
2482
- function cacheDirectory() {
2483
- const cacheDir = process.env.XDG_CACHE_HOME ? resolve$1(process.env.XDG_CACHE_HOME, "giget") : resolve$1(homedir(), ".cache/giget");
2484
- if (process.platform === "win32") {
2485
- const windowsCacheDir = resolve$1(tmpdir(), "giget");
2486
- if (!existsSync(windowsCacheDir) && existsSync(cacheDir)) try {
2487
- renameSync(cacheDir, windowsCacheDir);
2488
- } catch {}
2489
- return windowsCacheDir;
2490
- }
2491
- return cacheDir;
2492
- }
2493
- function normalizeHeaders(headers = {}) {
2494
- const normalized = {};
2495
- for (const [key, value] of Object.entries(headers)) {
2496
- if (!value) continue;
2497
- normalized[key.toLowerCase()] = value;
2498
- }
2499
- return normalized;
2500
- }
2501
- const http = async (input, options) => {
2502
- if (input.endsWith(".json")) return await _httpJSON(input, options);
2503
- const url = new URL(input);
2504
- let name = basename(url.pathname);
2505
- try {
2506
- const head = await sendFetch(url.href, {
2507
- method: "HEAD",
2508
- validateStatus: true,
2509
- headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
2510
- });
2511
- if ((head.headers.get("content-type") || "").includes("application/json")) return await _httpJSON(input, options);
2512
- const filename = head.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];
2513
- if (filename) name = filename.split(".")[0];
2514
- } catch (error) {
2515
- debug(`Failed to fetch HEAD for ${url.href}:`, error);
2516
- }
2517
- return {
2518
- name: `${name}-${url.href.slice(0, 8)}`,
2519
- version: "",
2520
- subdir: "",
2521
- tar: url.href,
2522
- defaultDir: name,
2523
- headers: { Authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
2524
- };
2525
- };
2526
- const _httpJSON = async (input, options) => {
2527
- const info = await (await sendFetch(input, {
2528
- validateStatus: true,
2529
- headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
2530
- })).json();
2531
- if (!info.tar || !info.name) throw new Error(`Invalid template info from ${input}. name or tar fields are missing!`);
2532
- return info;
2533
- };
2534
- const github = (input, options) => {
2535
- const parsed = parseGitURI(input);
2536
- const githubAPIURL = process.env.GIGET_GITHUB_URL || "https://api.github.com";
2537
- return {
2538
- name: parsed.repo.replace("/", "-"),
2539
- version: parsed.ref,
2540
- subdir: parsed.subdir,
2541
- headers: {
2542
- Authorization: options.auth ? `Bearer ${options.auth}` : void 0,
2543
- Accept: "application/vnd.github+json",
2544
- "X-GitHub-Api-Version": "2022-11-28"
2545
- },
2546
- url: `${githubAPIURL.replace("api.github.com", "github.com")}/${parsed.repo}/tree/${parsed.ref}${parsed.subdir}`,
2547
- tar: `${githubAPIURL}/repos/${parsed.repo}/tarball/${parsed.ref}`
2548
- };
2549
- };
2550
- const gitlab = (input, options) => {
2551
- const parsed = parseGitURI(input);
2552
- const gitlab2 = process.env.GIGET_GITLAB_URL || "https://gitlab.com";
2553
- return {
2554
- name: parsed.repo.replace("/", "-"),
2555
- version: parsed.ref,
2556
- subdir: parsed.subdir,
2557
- headers: {
2558
- authorization: options.auth ? `Bearer ${options.auth}` : void 0,
2559
- "sec-fetch-mode": "same-origin"
2560
- },
2561
- url: `${gitlab2}/${parsed.repo}/tree/${parsed.ref}${parsed.subdir}`,
2562
- tar: `${gitlab2}/${parsed.repo}/-/archive/${parsed.ref}.tar.gz`
2563
- };
2564
- };
2565
- const bitbucket = (input, options) => {
2566
- const parsed = parseGitURI(input);
2567
- return {
2568
- name: parsed.repo.replace("/", "-"),
2569
- version: parsed.ref,
2570
- subdir: parsed.subdir,
2571
- headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 },
2572
- url: `https://bitbucket.com/${parsed.repo}/src/${parsed.ref}${parsed.subdir}`,
2573
- tar: `https://bitbucket.org/${parsed.repo}/get/${parsed.ref}.tar.gz`
2574
- };
2575
- };
2576
- const sourcehut = (input, options) => {
2577
- const parsed = parseGitURI(input);
2578
- return {
2579
- name: parsed.repo.replace("/", "-"),
2580
- version: parsed.ref,
2581
- subdir: parsed.subdir,
2582
- headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 },
2583
- url: `https://git.sr.ht/~${parsed.repo}/tree/${parsed.ref}/item${parsed.subdir}`,
2584
- tar: `https://git.sr.ht/~${parsed.repo}/archive/${parsed.ref}.tar.gz`
2585
- };
2586
- };
2587
- const providers = {
2588
- http,
2589
- https: http,
2590
- github,
2591
- gh: github,
2592
- gitlab,
2593
- bitbucket,
2594
- sourcehut
2595
- };
2596
- const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/unjs/giget/main/templates";
2597
- const registryProvider = (registryEndpoint = DEFAULT_REGISTRY, options = {}) => {
2598
- return async (input) => {
2599
- const start = Date.now();
2600
- const registryURL = `${registryEndpoint}/${input}.json`;
2601
- const result = await sendFetch(registryURL, { headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 } });
2602
- if (result.status >= 400) throw new Error(`Failed to download ${input} template info from ${registryURL}: ${result.status} ${result.statusText}`);
2603
- const info = await result.json();
2604
- if (!info.tar || !info.name) throw new Error(`Invalid template info from ${registryURL}. name or tar fields are missing!`);
2605
- debug(`Fetched ${input} template info from ${registryURL} in ${Date.now() - start}ms`);
2606
- return info;
2607
- };
2608
- };
2609
- const sourceProtoRe = /^([\w-.]+):/;
2610
- async function downloadTemplate(input, options = {}) {
2611
- options = defu$1({
2612
- registry: process.env.GIGET_REGISTRY,
2613
- auth: process.env.GIGET_AUTH
2614
- }, options);
2615
- const registry = options.registry === false ? void 0 : registryProvider(options.registry, { auth: options.auth });
2616
- let providerName = options.provider || (registry ? "registry" : "github");
2617
- let source = input;
2618
- const sourceProviderMatch = input.match(sourceProtoRe);
2619
- if (sourceProviderMatch) {
2620
- providerName = sourceProviderMatch[1];
2621
- source = input.slice(sourceProviderMatch[0].length);
2622
- if (providerName === "http" || providerName === "https") source = input;
2623
- }
2624
- const provider = options.providers?.[providerName] || providers[providerName] || registry;
2625
- if (!provider) throw new Error(`Unsupported provider: ${providerName}`);
2626
- const template = await Promise.resolve().then(() => provider(source, { auth: options.auth })).catch((error) => {
2627
- throw new Error(`Failed to download template from ${providerName}: ${error.message}`);
2628
- });
2629
- if (!template) throw new Error(`Failed to resolve template from ${providerName}`);
2630
- template.name = (template.name || "template").replace(/[^\da-z-]/gi, "-");
2631
- template.defaultDir = (template.defaultDir || template.name).replace(/[^\da-z-]/gi, "-");
2632
- const tarPath = resolve$1(resolve$1(cacheDirectory(), providerName, template.name), (template.version || template.name) + ".tar.gz");
2633
- if (options.preferOffline && existsSync(tarPath)) options.offline = true;
2634
- if (!options.offline) {
2635
- await mkdir(dirname$1(tarPath), { recursive: true });
2636
- const s2 = Date.now();
2637
- await download(template.tar, tarPath, { headers: {
2638
- Authorization: options.auth ? `Bearer ${options.auth}` : void 0,
2639
- ...normalizeHeaders(template.headers)
2640
- } }).catch((error) => {
2641
- if (!existsSync(tarPath)) throw error;
2642
- debug("Download error. Using cached version:", error);
2643
- options.offline = true;
2644
- });
2645
- debug(`Downloaded ${template.tar} to ${tarPath} in ${Date.now() - s2}ms`);
2646
- }
2647
- if (!existsSync(tarPath)) throw new Error(`Tarball not found: ${tarPath} (offline: ${options.offline})`);
2648
- const extractPath = resolve$1(resolve$1(options.cwd || "."), options.dir || template.defaultDir);
2649
- if (options.forceClean) await rm(extractPath, {
2650
- recursive: true,
2651
- force: true
2652
- });
2653
- if (!options.force && existsSync(extractPath) && readdirSync(extractPath).length > 0) throw new Error(`Destination ${extractPath} already exists.`);
2654
- await mkdir(extractPath, { recursive: true });
2655
- const s = Date.now();
2656
- const subdir = template.subdir?.replace(/^\//, "") || "";
2657
- await tarExtract({
2658
- file: tarPath,
2659
- cwd: extractPath,
2660
- onentry(entry) {
2661
- entry.path = entry.path.split("/").splice(1).join("/");
2662
- if (subdir) if (entry.path.startsWith(subdir + "/")) entry.path = entry.path.slice(subdir.length);
2663
- else entry.path = "";
2664
- }
2665
- });
2666
- debug(`Extracted to ${extractPath} in ${Date.now() - s}ms`);
2667
- if (options.install) {
2668
- debug("Installing dependencies...");
2669
- await installDependencies({
2670
- cwd: extractPath,
2671
- silent: options.silent
2672
- });
2673
- }
2674
- return {
2675
- ...template,
2676
- source,
2677
- dir: extractPath
2678
- };
2679
- }
2680
-
2681
- //#endregion
2682
- export { downloadTemplate, registryProvider };
2683
- //# sourceMappingURL=giget.OCaTp9b-.mjs.map