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