@powerlines/plugin-env 0.16.67 → 0.16.69

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