@kubb/core 2.0.0-beta.12 → 2.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-35FDNG5F.cjs +71 -0
- package/dist/chunk-35FDNG5F.cjs.map +1 -0
- package/dist/chunk-7CNPSL5M.js +85 -0
- package/dist/chunk-7CNPSL5M.js.map +1 -0
- package/dist/chunk-DKYWBKNH.js +18 -0
- package/dist/chunk-DKYWBKNH.js.map +1 -0
- package/dist/chunk-EZSRGYAY.js +128 -0
- package/dist/chunk-EZSRGYAY.js.map +1 -0
- package/dist/chunk-GBX7KRCX.cjs +162 -0
- package/dist/chunk-GBX7KRCX.cjs.map +1 -0
- package/dist/chunk-ICRPOCV4.cjs +2290 -0
- package/dist/chunk-ICRPOCV4.cjs.map +1 -0
- package/dist/chunk-LAS7UYTK.cjs +129 -0
- package/dist/chunk-LAS7UYTK.cjs.map +1 -0
- package/dist/chunk-LJHT3DNH.js +67 -0
- package/dist/chunk-LJHT3DNH.js.map +1 -0
- package/dist/chunk-MM42A6GN.cjs +91 -0
- package/dist/chunk-MM42A6GN.cjs.map +1 -0
- package/dist/chunk-SRGTC4FJ.js +129 -0
- package/dist/chunk-SRGTC4FJ.js.map +1 -0
- package/dist/chunk-ST7GHHSU.cjs +104 -0
- package/dist/chunk-ST7GHHSU.cjs.map +1 -0
- package/dist/chunk-U4C2WTCI.cjs +131 -0
- package/dist/chunk-U4C2WTCI.cjs.map +1 -0
- package/dist/chunk-UIQUKFF4.js +155 -0
- package/dist/chunk-UIQUKFF4.js.map +1 -0
- package/dist/chunk-WTSDXEWD.js +71 -0
- package/dist/chunk-WTSDXEWD.js.map +1 -0
- package/dist/fs.cjs +20 -2372
- package/dist/fs.cjs.map +1 -1
- package/dist/fs.d.cts +1 -1
- package/dist/fs.d.ts +1 -1
- package/dist/fs.js +4 -2373
- package/dist/fs.js.map +1 -1
- package/dist/index.cjs +930 -3261
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -15
- package/dist/index.d.ts +17 -15
- package/dist/index.js +208 -3490
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +19 -141
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.d.cts +1 -0
- package/dist/logger.d.ts +1 -0
- package/dist/logger.js +3 -135
- package/dist/logger.js.map +1 -1
- package/dist/transformers.cjs +40 -208
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.js +15 -201
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +22 -524
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +0 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +11 -517
- package/dist/utils.js.map +1 -1
- package/dist/{write-46ytbnu9.d.cts → write-A6VgHkYA.d.cts} +4 -1
- package/dist/{write-46ytbnu9.d.ts → write-A6VgHkYA.d.ts} +4 -1
- package/package.json +9 -8
- package/src/BarrelManager.ts +3 -3
- package/src/FileManager.ts +66 -62
- package/src/PluginManager.ts +11 -18
- package/src/build.ts +57 -32
- package/src/fs/clean.ts +2 -2
- package/src/fs/read.ts +1 -0
- package/src/fs/write.ts +40 -24
- package/src/logger.ts +10 -0
- package/src/utils/FunctionParams.ts +2 -2
- package/src/utils/URLPath.ts +5 -5
- package/src/utils/index.ts +0 -2
- package/dist/Queue-2-6pMcCx.d.cts +0 -32
- package/dist/Queue-2-6pMcCx.d.ts +0 -32
- package/src/utils/Queue.ts +0 -110
package/dist/index.js
CHANGED
|
@@ -1,2303 +1,25 @@
|
|
|
1
1
|
import mod, { createRequire } from 'module';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { transformReservedWord, trimExtName, searchAndReplace } from './chunk-SRGTC4FJ.js';
|
|
3
|
+
import { setUniqueName, URLPath } from './chunk-EZSRGYAY.js';
|
|
4
|
+
import './chunk-DKYWBKNH.js';
|
|
5
|
+
import { LogLevel, createLogger, p, randomCliColour } from './chunk-UIQUKFF4.js';
|
|
6
|
+
import { read, getRelativePath, clean } from './chunk-LJHT3DNH.js';
|
|
7
|
+
import { write } from './chunk-7CNPSL5M.js';
|
|
8
|
+
import { __commonJS, init_esm_shims, __toESM, __privateAdd, __privateSet, __privateGet, __privateMethod, __require } from './chunk-WTSDXEWD.js';
|
|
9
|
+
import crypto from 'crypto';
|
|
10
|
+
import path, { resolve, extname } from 'path';
|
|
6
11
|
import { print } from '@kubb/parser';
|
|
7
12
|
import * as factory from '@kubb/parser/factory';
|
|
8
13
|
import { orderBy } from 'natural-orderby';
|
|
14
|
+
import PQueue from 'p-queue';
|
|
9
15
|
import dirTree from 'directory-tree';
|
|
10
|
-
import seedrandom from 'seedrandom';
|
|
11
16
|
import { EventEmitter as EventEmitter$1 } from 'events';
|
|
12
|
-
import { performance } from 'perf_hooks';
|
|
13
17
|
import os from 'os';
|
|
14
|
-
import { pathToFileURL
|
|
15
|
-
import
|
|
16
|
-
import fs3, { promises } from 'fs';
|
|
18
|
+
import { pathToFileURL } from 'url';
|
|
19
|
+
import { findUp, findUpSync } from 'find-up';
|
|
17
20
|
import { coerce, satisfies } from 'semver';
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var __create = Object.create;
|
|
22
|
-
var __defProp = Object.defineProperty;
|
|
23
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
24
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
25
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
26
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
27
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
28
|
-
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
|
|
29
|
-
get: (a, b2) => (typeof require !== "undefined" ? require : a)[b2]
|
|
30
|
-
}) : x2)(function(x2) {
|
|
31
|
-
if (typeof require !== "undefined")
|
|
32
|
-
return require.apply(this, arguments);
|
|
33
|
-
throw Error('Dynamic require of "' + x2 + '" is not supported');
|
|
34
|
-
});
|
|
35
|
-
var __esm = (fn, res) => function __init() {
|
|
36
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
37
|
-
};
|
|
38
|
-
var __commonJS = (cb, mod2) => function __require2() {
|
|
39
|
-
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
|
|
40
|
-
};
|
|
41
|
-
var __copyProps = (to, from, except, desc) => {
|
|
42
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
-
for (let key of __getOwnPropNames(from))
|
|
44
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
-
}
|
|
47
|
-
return to;
|
|
48
|
-
};
|
|
49
|
-
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
50
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
-
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
55
|
-
mod2
|
|
56
|
-
));
|
|
57
|
-
var __publicField = (obj, key, value) => {
|
|
58
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
59
|
-
return value;
|
|
60
|
-
};
|
|
61
|
-
var __accessCheck = (obj, member, msg) => {
|
|
62
|
-
if (!member.has(obj))
|
|
63
|
-
throw TypeError("Cannot " + msg);
|
|
64
|
-
};
|
|
65
|
-
var __privateGet = (obj, member, getter) => {
|
|
66
|
-
__accessCheck(obj, member, "read from private field");
|
|
67
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
68
|
-
};
|
|
69
|
-
var __privateAdd = (obj, member, value) => {
|
|
70
|
-
if (member.has(obj))
|
|
71
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
72
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
73
|
-
};
|
|
74
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
75
|
-
__accessCheck(obj, member, "write to private field");
|
|
76
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
77
|
-
return value;
|
|
78
|
-
};
|
|
79
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
80
|
-
set _(value) {
|
|
81
|
-
__privateSet(obj, member, value, setter);
|
|
82
|
-
},
|
|
83
|
-
get _() {
|
|
84
|
-
return __privateGet(obj, member, getter);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
var __privateMethod = (obj, member, method) => {
|
|
88
|
-
__accessCheck(obj, member, "access private method");
|
|
89
|
-
return method;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// ../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.3_ts-node@10.9.1_typescript@5.3.2/node_modules/tsup/assets/esm_shims.js
|
|
93
|
-
var init_esm_shims = __esm({
|
|
94
|
-
"../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.3_ts-node@10.9.1_typescript@5.3.2/node_modules/tsup/assets/esm_shims.js"() {
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
|
|
99
|
-
var require_universalify = __commonJS({
|
|
100
|
-
"../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports) {
|
|
101
|
-
init_esm_shims();
|
|
102
|
-
exports.fromCallback = function(fn) {
|
|
103
|
-
return Object.defineProperty(function(...args) {
|
|
104
|
-
if (typeof args[args.length - 1] === "function")
|
|
105
|
-
fn.apply(this, args);
|
|
106
|
-
else {
|
|
107
|
-
return new Promise((resolve3, reject) => {
|
|
108
|
-
args.push((err, res) => err != null ? reject(err) : resolve3(res));
|
|
109
|
-
fn.apply(this, args);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}, "name", { value: fn.name });
|
|
113
|
-
};
|
|
114
|
-
exports.fromPromise = function(fn) {
|
|
115
|
-
return Object.defineProperty(function(...args) {
|
|
116
|
-
const cb = args[args.length - 1];
|
|
117
|
-
if (typeof cb !== "function")
|
|
118
|
-
return fn.apply(this, args);
|
|
119
|
-
else {
|
|
120
|
-
args.pop();
|
|
121
|
-
fn.apply(this, args).then((r2) => cb(null, r2), cb);
|
|
122
|
-
}
|
|
123
|
-
}, "name", { value: fn.name });
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
|
|
129
|
-
var require_polyfills = __commonJS({
|
|
130
|
-
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module) {
|
|
131
|
-
init_esm_shims();
|
|
132
|
-
var constants = __require("constants");
|
|
133
|
-
var origCwd = process.cwd;
|
|
134
|
-
var cwd = null;
|
|
135
|
-
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
136
|
-
process.cwd = function() {
|
|
137
|
-
if (!cwd)
|
|
138
|
-
cwd = origCwd.call(process);
|
|
139
|
-
return cwd;
|
|
140
|
-
};
|
|
141
|
-
try {
|
|
142
|
-
process.cwd();
|
|
143
|
-
} catch (er) {
|
|
144
|
-
}
|
|
145
|
-
if (typeof process.chdir === "function") {
|
|
146
|
-
chdir = process.chdir;
|
|
147
|
-
process.chdir = function(d2) {
|
|
148
|
-
cwd = null;
|
|
149
|
-
chdir.call(process, d2);
|
|
150
|
-
};
|
|
151
|
-
if (Object.setPrototypeOf)
|
|
152
|
-
Object.setPrototypeOf(process.chdir, chdir);
|
|
153
|
-
}
|
|
154
|
-
var chdir;
|
|
155
|
-
module.exports = patch;
|
|
156
|
-
function patch(fs4) {
|
|
157
|
-
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
158
|
-
patchLchmod(fs4);
|
|
159
|
-
}
|
|
160
|
-
if (!fs4.lutimes) {
|
|
161
|
-
patchLutimes(fs4);
|
|
162
|
-
}
|
|
163
|
-
fs4.chown = chownFix(fs4.chown);
|
|
164
|
-
fs4.fchown = chownFix(fs4.fchown);
|
|
165
|
-
fs4.lchown = chownFix(fs4.lchown);
|
|
166
|
-
fs4.chmod = chmodFix(fs4.chmod);
|
|
167
|
-
fs4.fchmod = chmodFix(fs4.fchmod);
|
|
168
|
-
fs4.lchmod = chmodFix(fs4.lchmod);
|
|
169
|
-
fs4.chownSync = chownFixSync(fs4.chownSync);
|
|
170
|
-
fs4.fchownSync = chownFixSync(fs4.fchownSync);
|
|
171
|
-
fs4.lchownSync = chownFixSync(fs4.lchownSync);
|
|
172
|
-
fs4.chmodSync = chmodFixSync(fs4.chmodSync);
|
|
173
|
-
fs4.fchmodSync = chmodFixSync(fs4.fchmodSync);
|
|
174
|
-
fs4.lchmodSync = chmodFixSync(fs4.lchmodSync);
|
|
175
|
-
fs4.stat = statFix(fs4.stat);
|
|
176
|
-
fs4.fstat = statFix(fs4.fstat);
|
|
177
|
-
fs4.lstat = statFix(fs4.lstat);
|
|
178
|
-
fs4.statSync = statFixSync(fs4.statSync);
|
|
179
|
-
fs4.fstatSync = statFixSync(fs4.fstatSync);
|
|
180
|
-
fs4.lstatSync = statFixSync(fs4.lstatSync);
|
|
181
|
-
if (fs4.chmod && !fs4.lchmod) {
|
|
182
|
-
fs4.lchmod = function(path5, mode, cb) {
|
|
183
|
-
if (cb)
|
|
184
|
-
process.nextTick(cb);
|
|
185
|
-
};
|
|
186
|
-
fs4.lchmodSync = function() {
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
if (fs4.chown && !fs4.lchown) {
|
|
190
|
-
fs4.lchown = function(path5, uid, gid, cb) {
|
|
191
|
-
if (cb)
|
|
192
|
-
process.nextTick(cb);
|
|
193
|
-
};
|
|
194
|
-
fs4.lchownSync = function() {
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
if (platform === "win32") {
|
|
198
|
-
fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : function(fs$rename) {
|
|
199
|
-
function rename(from, to, cb) {
|
|
200
|
-
var start = Date.now();
|
|
201
|
-
var backoff = 0;
|
|
202
|
-
fs$rename(from, to, function CB(er) {
|
|
203
|
-
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
204
|
-
setTimeout(function() {
|
|
205
|
-
fs4.stat(to, function(stater, st) {
|
|
206
|
-
if (stater && stater.code === "ENOENT")
|
|
207
|
-
fs$rename(from, to, CB);
|
|
208
|
-
else
|
|
209
|
-
cb(er);
|
|
210
|
-
});
|
|
211
|
-
}, backoff);
|
|
212
|
-
if (backoff < 100)
|
|
213
|
-
backoff += 10;
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
if (cb)
|
|
217
|
-
cb(er);
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
if (Object.setPrototypeOf)
|
|
221
|
-
Object.setPrototypeOf(rename, fs$rename);
|
|
222
|
-
return rename;
|
|
223
|
-
}(fs4.rename);
|
|
224
|
-
}
|
|
225
|
-
fs4.read = typeof fs4.read !== "function" ? fs4.read : function(fs$read) {
|
|
226
|
-
function read2(fd, buffer, offset, length, position, callback_) {
|
|
227
|
-
var callback;
|
|
228
|
-
if (callback_ && typeof callback_ === "function") {
|
|
229
|
-
var eagCounter = 0;
|
|
230
|
-
callback = function(er, _, __) {
|
|
231
|
-
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
232
|
-
eagCounter++;
|
|
233
|
-
return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
|
|
234
|
-
}
|
|
235
|
-
callback_.apply(this, arguments);
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
|
|
239
|
-
}
|
|
240
|
-
if (Object.setPrototypeOf)
|
|
241
|
-
Object.setPrototypeOf(read2, fs$read);
|
|
242
|
-
return read2;
|
|
243
|
-
}(fs4.read);
|
|
244
|
-
fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : /* @__PURE__ */ function(fs$readSync) {
|
|
245
|
-
return function(fd, buffer, offset, length, position) {
|
|
246
|
-
var eagCounter = 0;
|
|
247
|
-
while (true) {
|
|
248
|
-
try {
|
|
249
|
-
return fs$readSync.call(fs4, fd, buffer, offset, length, position);
|
|
250
|
-
} catch (er) {
|
|
251
|
-
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
252
|
-
eagCounter++;
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
throw er;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
}(fs4.readSync);
|
|
260
|
-
function patchLchmod(fs5) {
|
|
261
|
-
fs5.lchmod = function(path5, mode, callback) {
|
|
262
|
-
fs5.open(
|
|
263
|
-
path5,
|
|
264
|
-
constants.O_WRONLY | constants.O_SYMLINK,
|
|
265
|
-
mode,
|
|
266
|
-
function(err, fd) {
|
|
267
|
-
if (err) {
|
|
268
|
-
if (callback)
|
|
269
|
-
callback(err);
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
fs5.fchmod(fd, mode, function(err2) {
|
|
273
|
-
fs5.close(fd, function(err22) {
|
|
274
|
-
if (callback)
|
|
275
|
-
callback(err2 || err22);
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
);
|
|
280
|
-
};
|
|
281
|
-
fs5.lchmodSync = function(path5, mode) {
|
|
282
|
-
var fd = fs5.openSync(path5, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
283
|
-
var threw = true;
|
|
284
|
-
var ret;
|
|
285
|
-
try {
|
|
286
|
-
ret = fs5.fchmodSync(fd, mode);
|
|
287
|
-
threw = false;
|
|
288
|
-
} finally {
|
|
289
|
-
if (threw) {
|
|
290
|
-
try {
|
|
291
|
-
fs5.closeSync(fd);
|
|
292
|
-
} catch (er) {
|
|
293
|
-
}
|
|
294
|
-
} else {
|
|
295
|
-
fs5.closeSync(fd);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
return ret;
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
function patchLutimes(fs5) {
|
|
302
|
-
if (constants.hasOwnProperty("O_SYMLINK") && fs5.futimes) {
|
|
303
|
-
fs5.lutimes = function(path5, at, mt, cb) {
|
|
304
|
-
fs5.open(path5, constants.O_SYMLINK, function(er, fd) {
|
|
305
|
-
if (er) {
|
|
306
|
-
if (cb)
|
|
307
|
-
cb(er);
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
fs5.futimes(fd, at, mt, function(er2) {
|
|
311
|
-
fs5.close(fd, function(er22) {
|
|
312
|
-
if (cb)
|
|
313
|
-
cb(er2 || er22);
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
|
-
fs5.lutimesSync = function(path5, at, mt) {
|
|
319
|
-
var fd = fs5.openSync(path5, constants.O_SYMLINK);
|
|
320
|
-
var ret;
|
|
321
|
-
var threw = true;
|
|
322
|
-
try {
|
|
323
|
-
ret = fs5.futimesSync(fd, at, mt);
|
|
324
|
-
threw = false;
|
|
325
|
-
} finally {
|
|
326
|
-
if (threw) {
|
|
327
|
-
try {
|
|
328
|
-
fs5.closeSync(fd);
|
|
329
|
-
} catch (er) {
|
|
330
|
-
}
|
|
331
|
-
} else {
|
|
332
|
-
fs5.closeSync(fd);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return ret;
|
|
336
|
-
};
|
|
337
|
-
} else if (fs5.futimes) {
|
|
338
|
-
fs5.lutimes = function(_a, _b, _c, cb) {
|
|
339
|
-
if (cb)
|
|
340
|
-
process.nextTick(cb);
|
|
341
|
-
};
|
|
342
|
-
fs5.lutimesSync = function() {
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
function chmodFix(orig) {
|
|
347
|
-
if (!orig)
|
|
348
|
-
return orig;
|
|
349
|
-
return function(target, mode, cb) {
|
|
350
|
-
return orig.call(fs4, target, mode, function(er) {
|
|
351
|
-
if (chownErOk(er))
|
|
352
|
-
er = null;
|
|
353
|
-
if (cb)
|
|
354
|
-
cb.apply(this, arguments);
|
|
355
|
-
});
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
function chmodFixSync(orig) {
|
|
359
|
-
if (!orig)
|
|
360
|
-
return orig;
|
|
361
|
-
return function(target, mode) {
|
|
362
|
-
try {
|
|
363
|
-
return orig.call(fs4, target, mode);
|
|
364
|
-
} catch (er) {
|
|
365
|
-
if (!chownErOk(er))
|
|
366
|
-
throw er;
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
function chownFix(orig) {
|
|
371
|
-
if (!orig)
|
|
372
|
-
return orig;
|
|
373
|
-
return function(target, uid, gid, cb) {
|
|
374
|
-
return orig.call(fs4, target, uid, gid, function(er) {
|
|
375
|
-
if (chownErOk(er))
|
|
376
|
-
er = null;
|
|
377
|
-
if (cb)
|
|
378
|
-
cb.apply(this, arguments);
|
|
379
|
-
});
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
function chownFixSync(orig) {
|
|
383
|
-
if (!orig)
|
|
384
|
-
return orig;
|
|
385
|
-
return function(target, uid, gid) {
|
|
386
|
-
try {
|
|
387
|
-
return orig.call(fs4, target, uid, gid);
|
|
388
|
-
} catch (er) {
|
|
389
|
-
if (!chownErOk(er))
|
|
390
|
-
throw er;
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
function statFix(orig) {
|
|
395
|
-
if (!orig)
|
|
396
|
-
return orig;
|
|
397
|
-
return function(target, options, cb) {
|
|
398
|
-
if (typeof options === "function") {
|
|
399
|
-
cb = options;
|
|
400
|
-
options = null;
|
|
401
|
-
}
|
|
402
|
-
function callback(er, stats) {
|
|
403
|
-
if (stats) {
|
|
404
|
-
if (stats.uid < 0)
|
|
405
|
-
stats.uid += 4294967296;
|
|
406
|
-
if (stats.gid < 0)
|
|
407
|
-
stats.gid += 4294967296;
|
|
408
|
-
}
|
|
409
|
-
if (cb)
|
|
410
|
-
cb.apply(this, arguments);
|
|
411
|
-
}
|
|
412
|
-
return options ? orig.call(fs4, target, options, callback) : orig.call(fs4, target, callback);
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
function statFixSync(orig) {
|
|
416
|
-
if (!orig)
|
|
417
|
-
return orig;
|
|
418
|
-
return function(target, options) {
|
|
419
|
-
var stats = options ? orig.call(fs4, target, options) : orig.call(fs4, target);
|
|
420
|
-
if (stats) {
|
|
421
|
-
if (stats.uid < 0)
|
|
422
|
-
stats.uid += 4294967296;
|
|
423
|
-
if (stats.gid < 0)
|
|
424
|
-
stats.gid += 4294967296;
|
|
425
|
-
}
|
|
426
|
-
return stats;
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
function chownErOk(er) {
|
|
430
|
-
if (!er)
|
|
431
|
-
return true;
|
|
432
|
-
if (er.code === "ENOSYS")
|
|
433
|
-
return true;
|
|
434
|
-
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
435
|
-
if (nonroot) {
|
|
436
|
-
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
437
|
-
return true;
|
|
438
|
-
}
|
|
439
|
-
return false;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
|
|
446
|
-
var require_legacy_streams = __commonJS({
|
|
447
|
-
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module) {
|
|
448
|
-
init_esm_shims();
|
|
449
|
-
var Stream = __require("stream").Stream;
|
|
450
|
-
module.exports = legacy;
|
|
451
|
-
function legacy(fs4) {
|
|
452
|
-
return {
|
|
453
|
-
ReadStream,
|
|
454
|
-
WriteStream
|
|
455
|
-
};
|
|
456
|
-
function ReadStream(path5, options) {
|
|
457
|
-
if (!(this instanceof ReadStream))
|
|
458
|
-
return new ReadStream(path5, options);
|
|
459
|
-
Stream.call(this);
|
|
460
|
-
var self2 = this;
|
|
461
|
-
this.path = path5;
|
|
462
|
-
this.fd = null;
|
|
463
|
-
this.readable = true;
|
|
464
|
-
this.paused = false;
|
|
465
|
-
this.flags = "r";
|
|
466
|
-
this.mode = 438;
|
|
467
|
-
this.bufferSize = 64 * 1024;
|
|
468
|
-
options = options || {};
|
|
469
|
-
var keys = Object.keys(options);
|
|
470
|
-
for (var index = 0, length = keys.length; index < length; index++) {
|
|
471
|
-
var key = keys[index];
|
|
472
|
-
this[key] = options[key];
|
|
473
|
-
}
|
|
474
|
-
if (this.encoding)
|
|
475
|
-
this.setEncoding(this.encoding);
|
|
476
|
-
if (this.start !== void 0) {
|
|
477
|
-
if ("number" !== typeof this.start) {
|
|
478
|
-
throw TypeError("start must be a Number");
|
|
479
|
-
}
|
|
480
|
-
if (this.end === void 0) {
|
|
481
|
-
this.end = Infinity;
|
|
482
|
-
} else if ("number" !== typeof this.end) {
|
|
483
|
-
throw TypeError("end must be a Number");
|
|
484
|
-
}
|
|
485
|
-
if (this.start > this.end) {
|
|
486
|
-
throw new Error("start must be <= end");
|
|
487
|
-
}
|
|
488
|
-
this.pos = this.start;
|
|
489
|
-
}
|
|
490
|
-
if (this.fd !== null) {
|
|
491
|
-
process.nextTick(function() {
|
|
492
|
-
self2._read();
|
|
493
|
-
});
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
fs4.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
497
|
-
if (err) {
|
|
498
|
-
self2.emit("error", err);
|
|
499
|
-
self2.readable = false;
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
self2.fd = fd;
|
|
503
|
-
self2.emit("open", fd);
|
|
504
|
-
self2._read();
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
function WriteStream(path5, options) {
|
|
508
|
-
if (!(this instanceof WriteStream))
|
|
509
|
-
return new WriteStream(path5, options);
|
|
510
|
-
Stream.call(this);
|
|
511
|
-
this.path = path5;
|
|
512
|
-
this.fd = null;
|
|
513
|
-
this.writable = true;
|
|
514
|
-
this.flags = "w";
|
|
515
|
-
this.encoding = "binary";
|
|
516
|
-
this.mode = 438;
|
|
517
|
-
this.bytesWritten = 0;
|
|
518
|
-
options = options || {};
|
|
519
|
-
var keys = Object.keys(options);
|
|
520
|
-
for (var index = 0, length = keys.length; index < length; index++) {
|
|
521
|
-
var key = keys[index];
|
|
522
|
-
this[key] = options[key];
|
|
523
|
-
}
|
|
524
|
-
if (this.start !== void 0) {
|
|
525
|
-
if ("number" !== typeof this.start) {
|
|
526
|
-
throw TypeError("start must be a Number");
|
|
527
|
-
}
|
|
528
|
-
if (this.start < 0) {
|
|
529
|
-
throw new Error("start must be >= zero");
|
|
530
|
-
}
|
|
531
|
-
this.pos = this.start;
|
|
532
|
-
}
|
|
533
|
-
this.busy = false;
|
|
534
|
-
this._queue = [];
|
|
535
|
-
if (this.fd === null) {
|
|
536
|
-
this._open = fs4.open;
|
|
537
|
-
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
538
|
-
this.flush();
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
});
|
|
544
|
-
|
|
545
|
-
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
|
|
546
|
-
var require_clone = __commonJS({
|
|
547
|
-
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports, module) {
|
|
548
|
-
init_esm_shims();
|
|
549
|
-
module.exports = clone;
|
|
550
|
-
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
551
|
-
return obj.__proto__;
|
|
552
|
-
};
|
|
553
|
-
function clone(obj) {
|
|
554
|
-
if (obj === null || typeof obj !== "object")
|
|
555
|
-
return obj;
|
|
556
|
-
if (obj instanceof Object)
|
|
557
|
-
var copy = { __proto__: getPrototypeOf(obj) };
|
|
558
|
-
else
|
|
559
|
-
var copy = /* @__PURE__ */ Object.create(null);
|
|
560
|
-
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
561
|
-
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
562
|
-
});
|
|
563
|
-
return copy;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
569
|
-
var require_graceful_fs = __commonJS({
|
|
570
|
-
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
571
|
-
init_esm_shims();
|
|
572
|
-
var fs4 = __require("fs");
|
|
573
|
-
var polyfills = require_polyfills();
|
|
574
|
-
var legacy = require_legacy_streams();
|
|
575
|
-
var clone = require_clone();
|
|
576
|
-
var util = __require("util");
|
|
577
|
-
var gracefulQueue;
|
|
578
|
-
var previousSymbol;
|
|
579
|
-
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
580
|
-
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
581
|
-
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
582
|
-
} else {
|
|
583
|
-
gracefulQueue = "___graceful-fs.queue";
|
|
584
|
-
previousSymbol = "___graceful-fs.previous";
|
|
585
|
-
}
|
|
586
|
-
function noop() {
|
|
587
|
-
}
|
|
588
|
-
function publishQueue(context, queue2) {
|
|
589
|
-
Object.defineProperty(context, gracefulQueue, {
|
|
590
|
-
get: function() {
|
|
591
|
-
return queue2;
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
var debug = noop;
|
|
596
|
-
if (util.debuglog)
|
|
597
|
-
debug = util.debuglog("gfs4");
|
|
598
|
-
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
599
|
-
debug = function() {
|
|
600
|
-
var m = util.format.apply(util, arguments);
|
|
601
|
-
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
602
|
-
console.error(m);
|
|
603
|
-
};
|
|
604
|
-
if (!fs4[gracefulQueue]) {
|
|
605
|
-
queue = global[gracefulQueue] || [];
|
|
606
|
-
publishQueue(fs4, queue);
|
|
607
|
-
fs4.close = function(fs$close) {
|
|
608
|
-
function close(fd, cb) {
|
|
609
|
-
return fs$close.call(fs4, fd, function(err) {
|
|
610
|
-
if (!err) {
|
|
611
|
-
resetQueue();
|
|
612
|
-
}
|
|
613
|
-
if (typeof cb === "function")
|
|
614
|
-
cb.apply(this, arguments);
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
Object.defineProperty(close, previousSymbol, {
|
|
618
|
-
value: fs$close
|
|
619
|
-
});
|
|
620
|
-
return close;
|
|
621
|
-
}(fs4.close);
|
|
622
|
-
fs4.closeSync = function(fs$closeSync) {
|
|
623
|
-
function closeSync(fd) {
|
|
624
|
-
fs$closeSync.apply(fs4, arguments);
|
|
625
|
-
resetQueue();
|
|
626
|
-
}
|
|
627
|
-
Object.defineProperty(closeSync, previousSymbol, {
|
|
628
|
-
value: fs$closeSync
|
|
629
|
-
});
|
|
630
|
-
return closeSync;
|
|
631
|
-
}(fs4.closeSync);
|
|
632
|
-
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
633
|
-
process.on("exit", function() {
|
|
634
|
-
debug(fs4[gracefulQueue]);
|
|
635
|
-
__require("assert").equal(fs4[gracefulQueue].length, 0);
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
var queue;
|
|
640
|
-
if (!global[gracefulQueue]) {
|
|
641
|
-
publishQueue(global, fs4[gracefulQueue]);
|
|
642
|
-
}
|
|
643
|
-
module.exports = patch(clone(fs4));
|
|
644
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) {
|
|
645
|
-
module.exports = patch(fs4);
|
|
646
|
-
fs4.__patched = true;
|
|
647
|
-
}
|
|
648
|
-
function patch(fs5) {
|
|
649
|
-
polyfills(fs5);
|
|
650
|
-
fs5.gracefulify = patch;
|
|
651
|
-
fs5.createReadStream = createReadStream;
|
|
652
|
-
fs5.createWriteStream = createWriteStream;
|
|
653
|
-
var fs$readFile = fs5.readFile;
|
|
654
|
-
fs5.readFile = readFile;
|
|
655
|
-
function readFile(path5, options, cb) {
|
|
656
|
-
if (typeof options === "function")
|
|
657
|
-
cb = options, options = null;
|
|
658
|
-
return go$readFile(path5, options, cb);
|
|
659
|
-
function go$readFile(path6, options2, cb2, startTime) {
|
|
660
|
-
return fs$readFile(path6, options2, function(err) {
|
|
661
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
662
|
-
enqueue([go$readFile, [path6, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
663
|
-
else {
|
|
664
|
-
if (typeof cb2 === "function")
|
|
665
|
-
cb2.apply(this, arguments);
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
var fs$writeFile = fs5.writeFile;
|
|
671
|
-
fs5.writeFile = writeFile;
|
|
672
|
-
function writeFile(path5, data, options, cb) {
|
|
673
|
-
if (typeof options === "function")
|
|
674
|
-
cb = options, options = null;
|
|
675
|
-
return go$writeFile(path5, data, options, cb);
|
|
676
|
-
function go$writeFile(path6, data2, options2, cb2, startTime) {
|
|
677
|
-
return fs$writeFile(path6, data2, options2, function(err) {
|
|
678
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
679
|
-
enqueue([go$writeFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
680
|
-
else {
|
|
681
|
-
if (typeof cb2 === "function")
|
|
682
|
-
cb2.apply(this, arguments);
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
var fs$appendFile = fs5.appendFile;
|
|
688
|
-
if (fs$appendFile)
|
|
689
|
-
fs5.appendFile = appendFile;
|
|
690
|
-
function appendFile(path5, data, options, cb) {
|
|
691
|
-
if (typeof options === "function")
|
|
692
|
-
cb = options, options = null;
|
|
693
|
-
return go$appendFile(path5, data, options, cb);
|
|
694
|
-
function go$appendFile(path6, data2, options2, cb2, startTime) {
|
|
695
|
-
return fs$appendFile(path6, data2, options2, function(err) {
|
|
696
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
697
|
-
enqueue([go$appendFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
698
|
-
else {
|
|
699
|
-
if (typeof cb2 === "function")
|
|
700
|
-
cb2.apply(this, arguments);
|
|
701
|
-
}
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
var fs$copyFile = fs5.copyFile;
|
|
706
|
-
if (fs$copyFile)
|
|
707
|
-
fs5.copyFile = copyFile;
|
|
708
|
-
function copyFile(src, dest, flags, cb) {
|
|
709
|
-
if (typeof flags === "function") {
|
|
710
|
-
cb = flags;
|
|
711
|
-
flags = 0;
|
|
712
|
-
}
|
|
713
|
-
return go$copyFile(src, dest, flags, cb);
|
|
714
|
-
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
|
|
715
|
-
return fs$copyFile(src2, dest2, flags2, function(err) {
|
|
716
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
717
|
-
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
718
|
-
else {
|
|
719
|
-
if (typeof cb2 === "function")
|
|
720
|
-
cb2.apply(this, arguments);
|
|
721
|
-
}
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
var fs$readdir = fs5.readdir;
|
|
726
|
-
fs5.readdir = readdir;
|
|
727
|
-
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
728
|
-
function readdir(path5, options, cb) {
|
|
729
|
-
if (typeof options === "function")
|
|
730
|
-
cb = options, options = null;
|
|
731
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path6, options2, cb2, startTime) {
|
|
732
|
-
return fs$readdir(path6, fs$readdirCallback(
|
|
733
|
-
path6,
|
|
734
|
-
options2,
|
|
735
|
-
cb2,
|
|
736
|
-
startTime
|
|
737
|
-
));
|
|
738
|
-
} : function go$readdir2(path6, options2, cb2, startTime) {
|
|
739
|
-
return fs$readdir(path6, options2, fs$readdirCallback(
|
|
740
|
-
path6,
|
|
741
|
-
options2,
|
|
742
|
-
cb2,
|
|
743
|
-
startTime
|
|
744
|
-
));
|
|
745
|
-
};
|
|
746
|
-
return go$readdir(path5, options, cb);
|
|
747
|
-
function fs$readdirCallback(path6, options2, cb2, startTime) {
|
|
748
|
-
return function(err, files) {
|
|
749
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
750
|
-
enqueue([
|
|
751
|
-
go$readdir,
|
|
752
|
-
[path6, options2, cb2],
|
|
753
|
-
err,
|
|
754
|
-
startTime || Date.now(),
|
|
755
|
-
Date.now()
|
|
756
|
-
]);
|
|
757
|
-
else {
|
|
758
|
-
if (files && files.sort)
|
|
759
|
-
files.sort();
|
|
760
|
-
if (typeof cb2 === "function")
|
|
761
|
-
cb2.call(this, err, files);
|
|
762
|
-
}
|
|
763
|
-
};
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
if (process.version.substr(0, 4) === "v0.8") {
|
|
767
|
-
var legStreams = legacy(fs5);
|
|
768
|
-
ReadStream = legStreams.ReadStream;
|
|
769
|
-
WriteStream = legStreams.WriteStream;
|
|
770
|
-
}
|
|
771
|
-
var fs$ReadStream = fs5.ReadStream;
|
|
772
|
-
if (fs$ReadStream) {
|
|
773
|
-
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
774
|
-
ReadStream.prototype.open = ReadStream$open;
|
|
775
|
-
}
|
|
776
|
-
var fs$WriteStream = fs5.WriteStream;
|
|
777
|
-
if (fs$WriteStream) {
|
|
778
|
-
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
779
|
-
WriteStream.prototype.open = WriteStream$open;
|
|
780
|
-
}
|
|
781
|
-
Object.defineProperty(fs5, "ReadStream", {
|
|
782
|
-
get: function() {
|
|
783
|
-
return ReadStream;
|
|
784
|
-
},
|
|
785
|
-
set: function(val) {
|
|
786
|
-
ReadStream = val;
|
|
787
|
-
},
|
|
788
|
-
enumerable: true,
|
|
789
|
-
configurable: true
|
|
790
|
-
});
|
|
791
|
-
Object.defineProperty(fs5, "WriteStream", {
|
|
792
|
-
get: function() {
|
|
793
|
-
return WriteStream;
|
|
794
|
-
},
|
|
795
|
-
set: function(val) {
|
|
796
|
-
WriteStream = val;
|
|
797
|
-
},
|
|
798
|
-
enumerable: true,
|
|
799
|
-
configurable: true
|
|
800
|
-
});
|
|
801
|
-
var FileReadStream = ReadStream;
|
|
802
|
-
Object.defineProperty(fs5, "FileReadStream", {
|
|
803
|
-
get: function() {
|
|
804
|
-
return FileReadStream;
|
|
805
|
-
},
|
|
806
|
-
set: function(val) {
|
|
807
|
-
FileReadStream = val;
|
|
808
|
-
},
|
|
809
|
-
enumerable: true,
|
|
810
|
-
configurable: true
|
|
811
|
-
});
|
|
812
|
-
var FileWriteStream = WriteStream;
|
|
813
|
-
Object.defineProperty(fs5, "FileWriteStream", {
|
|
814
|
-
get: function() {
|
|
815
|
-
return FileWriteStream;
|
|
816
|
-
},
|
|
817
|
-
set: function(val) {
|
|
818
|
-
FileWriteStream = val;
|
|
819
|
-
},
|
|
820
|
-
enumerable: true,
|
|
821
|
-
configurable: true
|
|
822
|
-
});
|
|
823
|
-
function ReadStream(path5, options) {
|
|
824
|
-
if (this instanceof ReadStream)
|
|
825
|
-
return fs$ReadStream.apply(this, arguments), this;
|
|
826
|
-
else
|
|
827
|
-
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
828
|
-
}
|
|
829
|
-
function ReadStream$open() {
|
|
830
|
-
var that = this;
|
|
831
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
832
|
-
if (err) {
|
|
833
|
-
if (that.autoClose)
|
|
834
|
-
that.destroy();
|
|
835
|
-
that.emit("error", err);
|
|
836
|
-
} else {
|
|
837
|
-
that.fd = fd;
|
|
838
|
-
that.emit("open", fd);
|
|
839
|
-
that.read();
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
function WriteStream(path5, options) {
|
|
844
|
-
if (this instanceof WriteStream)
|
|
845
|
-
return fs$WriteStream.apply(this, arguments), this;
|
|
846
|
-
else
|
|
847
|
-
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
848
|
-
}
|
|
849
|
-
function WriteStream$open() {
|
|
850
|
-
var that = this;
|
|
851
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
852
|
-
if (err) {
|
|
853
|
-
that.destroy();
|
|
854
|
-
that.emit("error", err);
|
|
855
|
-
} else {
|
|
856
|
-
that.fd = fd;
|
|
857
|
-
that.emit("open", fd);
|
|
858
|
-
}
|
|
859
|
-
});
|
|
860
|
-
}
|
|
861
|
-
function createReadStream(path5, options) {
|
|
862
|
-
return new fs5.ReadStream(path5, options);
|
|
863
|
-
}
|
|
864
|
-
function createWriteStream(path5, options) {
|
|
865
|
-
return new fs5.WriteStream(path5, options);
|
|
866
|
-
}
|
|
867
|
-
var fs$open = fs5.open;
|
|
868
|
-
fs5.open = open;
|
|
869
|
-
function open(path5, flags, mode, cb) {
|
|
870
|
-
if (typeof mode === "function")
|
|
871
|
-
cb = mode, mode = null;
|
|
872
|
-
return go$open(path5, flags, mode, cb);
|
|
873
|
-
function go$open(path6, flags2, mode2, cb2, startTime) {
|
|
874
|
-
return fs$open(path6, flags2, mode2, function(err, fd) {
|
|
875
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
876
|
-
enqueue([go$open, [path6, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
877
|
-
else {
|
|
878
|
-
if (typeof cb2 === "function")
|
|
879
|
-
cb2.apply(this, arguments);
|
|
880
|
-
}
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
return fs5;
|
|
885
|
-
}
|
|
886
|
-
function enqueue(elem) {
|
|
887
|
-
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
888
|
-
fs4[gracefulQueue].push(elem);
|
|
889
|
-
retry();
|
|
890
|
-
}
|
|
891
|
-
var retryTimer;
|
|
892
|
-
function resetQueue() {
|
|
893
|
-
var now = Date.now();
|
|
894
|
-
for (var i = 0; i < fs4[gracefulQueue].length; ++i) {
|
|
895
|
-
if (fs4[gracefulQueue][i].length > 2) {
|
|
896
|
-
fs4[gracefulQueue][i][3] = now;
|
|
897
|
-
fs4[gracefulQueue][i][4] = now;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
retry();
|
|
901
|
-
}
|
|
902
|
-
function retry() {
|
|
903
|
-
clearTimeout(retryTimer);
|
|
904
|
-
retryTimer = void 0;
|
|
905
|
-
if (fs4[gracefulQueue].length === 0)
|
|
906
|
-
return;
|
|
907
|
-
var elem = fs4[gracefulQueue].shift();
|
|
908
|
-
var fn = elem[0];
|
|
909
|
-
var args = elem[1];
|
|
910
|
-
var err = elem[2];
|
|
911
|
-
var startTime = elem[3];
|
|
912
|
-
var lastTime = elem[4];
|
|
913
|
-
if (startTime === void 0) {
|
|
914
|
-
debug("RETRY", fn.name, args);
|
|
915
|
-
fn.apply(null, args);
|
|
916
|
-
} else if (Date.now() - startTime >= 6e4) {
|
|
917
|
-
debug("TIMEOUT", fn.name, args);
|
|
918
|
-
var cb = args.pop();
|
|
919
|
-
if (typeof cb === "function")
|
|
920
|
-
cb.call(null, err);
|
|
921
|
-
} else {
|
|
922
|
-
var sinceAttempt = Date.now() - lastTime;
|
|
923
|
-
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
924
|
-
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
925
|
-
if (sinceAttempt >= desiredDelay) {
|
|
926
|
-
debug("RETRY", fn.name, args);
|
|
927
|
-
fn.apply(null, args.concat([startTime]));
|
|
928
|
-
} else {
|
|
929
|
-
fs4[gracefulQueue].push(elem);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
if (retryTimer === void 0) {
|
|
933
|
-
retryTimer = setTimeout(retry, 0);
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
});
|
|
938
|
-
|
|
939
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js
|
|
940
|
-
var require_fs = __commonJS({
|
|
941
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js"(exports) {
|
|
942
|
-
init_esm_shims();
|
|
943
|
-
var u = require_universalify().fromCallback;
|
|
944
|
-
var fs4 = require_graceful_fs();
|
|
945
|
-
var api = [
|
|
946
|
-
"access",
|
|
947
|
-
"appendFile",
|
|
948
|
-
"chmod",
|
|
949
|
-
"chown",
|
|
950
|
-
"close",
|
|
951
|
-
"copyFile",
|
|
952
|
-
"fchmod",
|
|
953
|
-
"fchown",
|
|
954
|
-
"fdatasync",
|
|
955
|
-
"fstat",
|
|
956
|
-
"fsync",
|
|
957
|
-
"ftruncate",
|
|
958
|
-
"futimes",
|
|
959
|
-
"lchmod",
|
|
960
|
-
"lchown",
|
|
961
|
-
"link",
|
|
962
|
-
"lstat",
|
|
963
|
-
"mkdir",
|
|
964
|
-
"mkdtemp",
|
|
965
|
-
"open",
|
|
966
|
-
"opendir",
|
|
967
|
-
"readdir",
|
|
968
|
-
"readFile",
|
|
969
|
-
"readlink",
|
|
970
|
-
"realpath",
|
|
971
|
-
"rename",
|
|
972
|
-
"rm",
|
|
973
|
-
"rmdir",
|
|
974
|
-
"stat",
|
|
975
|
-
"symlink",
|
|
976
|
-
"truncate",
|
|
977
|
-
"unlink",
|
|
978
|
-
"utimes",
|
|
979
|
-
"writeFile"
|
|
980
|
-
].filter((key) => {
|
|
981
|
-
return typeof fs4[key] === "function";
|
|
982
|
-
});
|
|
983
|
-
Object.assign(exports, fs4);
|
|
984
|
-
api.forEach((method) => {
|
|
985
|
-
exports[method] = u(fs4[method]);
|
|
986
|
-
});
|
|
987
|
-
exports.exists = function(filename, callback) {
|
|
988
|
-
if (typeof callback === "function") {
|
|
989
|
-
return fs4.exists(filename, callback);
|
|
990
|
-
}
|
|
991
|
-
return new Promise((resolve3) => {
|
|
992
|
-
return fs4.exists(filename, resolve3);
|
|
993
|
-
});
|
|
994
|
-
};
|
|
995
|
-
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
996
|
-
if (typeof callback === "function") {
|
|
997
|
-
return fs4.read(fd, buffer, offset, length, position, callback);
|
|
998
|
-
}
|
|
999
|
-
return new Promise((resolve3, reject) => {
|
|
1000
|
-
fs4.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
1001
|
-
if (err)
|
|
1002
|
-
return reject(err);
|
|
1003
|
-
resolve3({ bytesRead, buffer: buffer2 });
|
|
1004
|
-
});
|
|
1005
|
-
});
|
|
1006
|
-
};
|
|
1007
|
-
exports.write = function(fd, buffer, ...args) {
|
|
1008
|
-
if (typeof args[args.length - 1] === "function") {
|
|
1009
|
-
return fs4.write(fd, buffer, ...args);
|
|
1010
|
-
}
|
|
1011
|
-
return new Promise((resolve3, reject) => {
|
|
1012
|
-
fs4.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
1013
|
-
if (err)
|
|
1014
|
-
return reject(err);
|
|
1015
|
-
resolve3({ bytesWritten, buffer: buffer2 });
|
|
1016
|
-
});
|
|
1017
|
-
});
|
|
1018
|
-
};
|
|
1019
|
-
exports.readv = function(fd, buffers, ...args) {
|
|
1020
|
-
if (typeof args[args.length - 1] === "function") {
|
|
1021
|
-
return fs4.readv(fd, buffers, ...args);
|
|
1022
|
-
}
|
|
1023
|
-
return new Promise((resolve3, reject) => {
|
|
1024
|
-
fs4.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
|
|
1025
|
-
if (err)
|
|
1026
|
-
return reject(err);
|
|
1027
|
-
resolve3({ bytesRead, buffers: buffers2 });
|
|
1028
|
-
});
|
|
1029
|
-
});
|
|
1030
|
-
};
|
|
1031
|
-
exports.writev = function(fd, buffers, ...args) {
|
|
1032
|
-
if (typeof args[args.length - 1] === "function") {
|
|
1033
|
-
return fs4.writev(fd, buffers, ...args);
|
|
1034
|
-
}
|
|
1035
|
-
return new Promise((resolve3, reject) => {
|
|
1036
|
-
fs4.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
|
|
1037
|
-
if (err)
|
|
1038
|
-
return reject(err);
|
|
1039
|
-
resolve3({ bytesWritten, buffers: buffers2 });
|
|
1040
|
-
});
|
|
1041
|
-
});
|
|
1042
|
-
};
|
|
1043
|
-
if (typeof fs4.realpath.native === "function") {
|
|
1044
|
-
exports.realpath.native = u(fs4.realpath.native);
|
|
1045
|
-
} else {
|
|
1046
|
-
process.emitWarning(
|
|
1047
|
-
"fs.realpath.native is not a function. Is fs being monkey-patched?",
|
|
1048
|
-
"Warning",
|
|
1049
|
-
"fs-extra-WARN0003"
|
|
1050
|
-
);
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
});
|
|
1054
|
-
|
|
1055
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js
|
|
1056
|
-
var require_utils = __commonJS({
|
|
1057
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module) {
|
|
1058
|
-
init_esm_shims();
|
|
1059
|
-
var path5 = __require("path");
|
|
1060
|
-
module.exports.checkPath = function checkPath(pth) {
|
|
1061
|
-
if (process.platform === "win32") {
|
|
1062
|
-
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path5.parse(pth).root, ""));
|
|
1063
|
-
if (pathHasInvalidWinCharacters) {
|
|
1064
|
-
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
1065
|
-
error.code = "EINVAL";
|
|
1066
|
-
throw error;
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
};
|
|
1070
|
-
}
|
|
1071
|
-
});
|
|
1072
|
-
|
|
1073
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js
|
|
1074
|
-
var require_make_dir = __commonJS({
|
|
1075
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module) {
|
|
1076
|
-
init_esm_shims();
|
|
1077
|
-
var fs4 = require_fs();
|
|
1078
|
-
var { checkPath } = require_utils();
|
|
1079
|
-
var getMode = (options) => {
|
|
1080
|
-
const defaults = { mode: 511 };
|
|
1081
|
-
if (typeof options === "number")
|
|
1082
|
-
return options;
|
|
1083
|
-
return { ...defaults, ...options }.mode;
|
|
1084
|
-
};
|
|
1085
|
-
module.exports.makeDir = async (dir, options) => {
|
|
1086
|
-
checkPath(dir);
|
|
1087
|
-
return fs4.mkdir(dir, {
|
|
1088
|
-
mode: getMode(options),
|
|
1089
|
-
recursive: true
|
|
1090
|
-
});
|
|
1091
|
-
};
|
|
1092
|
-
module.exports.makeDirSync = (dir, options) => {
|
|
1093
|
-
checkPath(dir);
|
|
1094
|
-
return fs4.mkdirSync(dir, {
|
|
1095
|
-
mode: getMode(options),
|
|
1096
|
-
recursive: true
|
|
1097
|
-
});
|
|
1098
|
-
};
|
|
1099
|
-
}
|
|
1100
|
-
});
|
|
1101
|
-
|
|
1102
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js
|
|
1103
|
-
var require_mkdirs = __commonJS({
|
|
1104
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports, module) {
|
|
1105
|
-
init_esm_shims();
|
|
1106
|
-
var u = require_universalify().fromPromise;
|
|
1107
|
-
var { makeDir: _makeDir, makeDirSync } = require_make_dir();
|
|
1108
|
-
var makeDir = u(_makeDir);
|
|
1109
|
-
module.exports = {
|
|
1110
|
-
mkdirs: makeDir,
|
|
1111
|
-
mkdirsSync: makeDirSync,
|
|
1112
|
-
// alias
|
|
1113
|
-
mkdirp: makeDir,
|
|
1114
|
-
mkdirpSync: makeDirSync,
|
|
1115
|
-
ensureDir: makeDir,
|
|
1116
|
-
ensureDirSync: makeDirSync
|
|
1117
|
-
};
|
|
1118
|
-
}
|
|
1119
|
-
});
|
|
1120
|
-
|
|
1121
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js
|
|
1122
|
-
var require_path_exists = __commonJS({
|
|
1123
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js"(exports, module) {
|
|
1124
|
-
init_esm_shims();
|
|
1125
|
-
var u = require_universalify().fromPromise;
|
|
1126
|
-
var fs4 = require_fs();
|
|
1127
|
-
function pathExists2(path5) {
|
|
1128
|
-
return fs4.access(path5).then(() => true).catch(() => false);
|
|
1129
|
-
}
|
|
1130
|
-
module.exports = {
|
|
1131
|
-
pathExists: u(pathExists2),
|
|
1132
|
-
pathExistsSync: fs4.existsSync
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
});
|
|
1136
|
-
|
|
1137
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js
|
|
1138
|
-
var require_utimes = __commonJS({
|
|
1139
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js"(exports, module) {
|
|
1140
|
-
init_esm_shims();
|
|
1141
|
-
var fs4 = require_fs();
|
|
1142
|
-
var u = require_universalify().fromPromise;
|
|
1143
|
-
async function utimesMillis(path5, atime, mtime) {
|
|
1144
|
-
const fd = await fs4.open(path5, "r+");
|
|
1145
|
-
let closeErr = null;
|
|
1146
|
-
try {
|
|
1147
|
-
await fs4.futimes(fd, atime, mtime);
|
|
1148
|
-
} finally {
|
|
1149
|
-
try {
|
|
1150
|
-
await fs4.close(fd);
|
|
1151
|
-
} catch (e) {
|
|
1152
|
-
closeErr = e;
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
if (closeErr) {
|
|
1156
|
-
throw closeErr;
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
function utimesMillisSync(path5, atime, mtime) {
|
|
1160
|
-
const fd = fs4.openSync(path5, "r+");
|
|
1161
|
-
fs4.futimesSync(fd, atime, mtime);
|
|
1162
|
-
return fs4.closeSync(fd);
|
|
1163
|
-
}
|
|
1164
|
-
module.exports = {
|
|
1165
|
-
utimesMillis: u(utimesMillis),
|
|
1166
|
-
utimesMillisSync
|
|
1167
|
-
};
|
|
1168
|
-
}
|
|
1169
|
-
});
|
|
1170
|
-
|
|
1171
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js
|
|
1172
|
-
var require_stat = __commonJS({
|
|
1173
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js"(exports, module) {
|
|
1174
|
-
init_esm_shims();
|
|
1175
|
-
var fs4 = require_fs();
|
|
1176
|
-
var path5 = __require("path");
|
|
1177
|
-
var u = require_universalify().fromPromise;
|
|
1178
|
-
function getStats(src, dest, opts) {
|
|
1179
|
-
const statFunc = opts.dereference ? (file) => fs4.stat(file, { bigint: true }) : (file) => fs4.lstat(file, { bigint: true });
|
|
1180
|
-
return Promise.all([
|
|
1181
|
-
statFunc(src),
|
|
1182
|
-
statFunc(dest).catch((err) => {
|
|
1183
|
-
if (err.code === "ENOENT")
|
|
1184
|
-
return null;
|
|
1185
|
-
throw err;
|
|
1186
|
-
})
|
|
1187
|
-
]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
|
|
1188
|
-
}
|
|
1189
|
-
function getStatsSync(src, dest, opts) {
|
|
1190
|
-
let destStat;
|
|
1191
|
-
const statFunc = opts.dereference ? (file) => fs4.statSync(file, { bigint: true }) : (file) => fs4.lstatSync(file, { bigint: true });
|
|
1192
|
-
const srcStat = statFunc(src);
|
|
1193
|
-
try {
|
|
1194
|
-
destStat = statFunc(dest);
|
|
1195
|
-
} catch (err) {
|
|
1196
|
-
if (err.code === "ENOENT")
|
|
1197
|
-
return { srcStat, destStat: null };
|
|
1198
|
-
throw err;
|
|
1199
|
-
}
|
|
1200
|
-
return { srcStat, destStat };
|
|
1201
|
-
}
|
|
1202
|
-
async function checkPaths(src, dest, funcName, opts) {
|
|
1203
|
-
const { srcStat, destStat } = await getStats(src, dest, opts);
|
|
1204
|
-
if (destStat) {
|
|
1205
|
-
if (areIdentical(srcStat, destStat)) {
|
|
1206
|
-
const srcBaseName = path5.basename(src);
|
|
1207
|
-
const destBaseName = path5.basename(dest);
|
|
1208
|
-
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1209
|
-
return { srcStat, destStat, isChangingCase: true };
|
|
1210
|
-
}
|
|
1211
|
-
throw new Error("Source and destination must not be the same.");
|
|
1212
|
-
}
|
|
1213
|
-
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1214
|
-
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1215
|
-
}
|
|
1216
|
-
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1217
|
-
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1221
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
1222
|
-
}
|
|
1223
|
-
return { srcStat, destStat };
|
|
1224
|
-
}
|
|
1225
|
-
function checkPathsSync(src, dest, funcName, opts) {
|
|
1226
|
-
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
1227
|
-
if (destStat) {
|
|
1228
|
-
if (areIdentical(srcStat, destStat)) {
|
|
1229
|
-
const srcBaseName = path5.basename(src);
|
|
1230
|
-
const destBaseName = path5.basename(dest);
|
|
1231
|
-
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1232
|
-
return { srcStat, destStat, isChangingCase: true };
|
|
1233
|
-
}
|
|
1234
|
-
throw new Error("Source and destination must not be the same.");
|
|
1235
|
-
}
|
|
1236
|
-
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1237
|
-
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1238
|
-
}
|
|
1239
|
-
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1240
|
-
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1244
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
1245
|
-
}
|
|
1246
|
-
return { srcStat, destStat };
|
|
1247
|
-
}
|
|
1248
|
-
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
1249
|
-
const srcParent = path5.resolve(path5.dirname(src));
|
|
1250
|
-
const destParent = path5.resolve(path5.dirname(dest));
|
|
1251
|
-
if (destParent === srcParent || destParent === path5.parse(destParent).root)
|
|
1252
|
-
return;
|
|
1253
|
-
let destStat;
|
|
1254
|
-
try {
|
|
1255
|
-
destStat = await fs4.stat(destParent, { bigint: true });
|
|
1256
|
-
} catch (err) {
|
|
1257
|
-
if (err.code === "ENOENT")
|
|
1258
|
-
return;
|
|
1259
|
-
throw err;
|
|
1260
|
-
}
|
|
1261
|
-
if (areIdentical(srcStat, destStat)) {
|
|
1262
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
1263
|
-
}
|
|
1264
|
-
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
1265
|
-
}
|
|
1266
|
-
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
1267
|
-
const srcParent = path5.resolve(path5.dirname(src));
|
|
1268
|
-
const destParent = path5.resolve(path5.dirname(dest));
|
|
1269
|
-
if (destParent === srcParent || destParent === path5.parse(destParent).root)
|
|
1270
|
-
return;
|
|
1271
|
-
let destStat;
|
|
1272
|
-
try {
|
|
1273
|
-
destStat = fs4.statSync(destParent, { bigint: true });
|
|
1274
|
-
} catch (err) {
|
|
1275
|
-
if (err.code === "ENOENT")
|
|
1276
|
-
return;
|
|
1277
|
-
throw err;
|
|
1278
|
-
}
|
|
1279
|
-
if (areIdentical(srcStat, destStat)) {
|
|
1280
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
1281
|
-
}
|
|
1282
|
-
return checkParentPathsSync(src, srcStat, destParent, funcName);
|
|
1283
|
-
}
|
|
1284
|
-
function areIdentical(srcStat, destStat) {
|
|
1285
|
-
return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
1286
|
-
}
|
|
1287
|
-
function isSrcSubdir(src, dest) {
|
|
1288
|
-
const srcArr = path5.resolve(src).split(path5.sep).filter((i) => i);
|
|
1289
|
-
const destArr = path5.resolve(dest).split(path5.sep).filter((i) => i);
|
|
1290
|
-
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
1291
|
-
}
|
|
1292
|
-
function errMsg(src, dest, funcName) {
|
|
1293
|
-
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
|
|
1294
|
-
}
|
|
1295
|
-
module.exports = {
|
|
1296
|
-
// checkPaths
|
|
1297
|
-
checkPaths: u(checkPaths),
|
|
1298
|
-
checkPathsSync,
|
|
1299
|
-
// checkParent
|
|
1300
|
-
checkParentPaths: u(checkParentPaths),
|
|
1301
|
-
checkParentPathsSync,
|
|
1302
|
-
// Misc
|
|
1303
|
-
isSrcSubdir,
|
|
1304
|
-
areIdentical
|
|
1305
|
-
};
|
|
1306
|
-
}
|
|
1307
|
-
});
|
|
1308
|
-
|
|
1309
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js
|
|
1310
|
-
var require_copy = __commonJS({
|
|
1311
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js"(exports, module) {
|
|
1312
|
-
init_esm_shims();
|
|
1313
|
-
var fs4 = require_fs();
|
|
1314
|
-
var path5 = __require("path");
|
|
1315
|
-
var { mkdirs } = require_mkdirs();
|
|
1316
|
-
var { pathExists: pathExists2 } = require_path_exists();
|
|
1317
|
-
var { utimesMillis } = require_utimes();
|
|
1318
|
-
var stat = require_stat();
|
|
1319
|
-
async function copy(src, dest, opts = {}) {
|
|
1320
|
-
if (typeof opts === "function") {
|
|
1321
|
-
opts = { filter: opts };
|
|
1322
|
-
}
|
|
1323
|
-
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1324
|
-
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1325
|
-
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
1326
|
-
process.emitWarning(
|
|
1327
|
-
"Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
|
|
1328
|
-
"Warning",
|
|
1329
|
-
"fs-extra-WARN0001"
|
|
1330
|
-
);
|
|
1331
|
-
}
|
|
1332
|
-
const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
|
|
1333
|
-
await stat.checkParentPaths(src, srcStat, dest, "copy");
|
|
1334
|
-
const include = await runFilter(src, dest, opts);
|
|
1335
|
-
if (!include)
|
|
1336
|
-
return;
|
|
1337
|
-
const destParent = path5.dirname(dest);
|
|
1338
|
-
const dirExists = await pathExists2(destParent);
|
|
1339
|
-
if (!dirExists) {
|
|
1340
|
-
await mkdirs(destParent);
|
|
1341
|
-
}
|
|
1342
|
-
await getStatsAndPerformCopy(destStat, src, dest, opts);
|
|
1343
|
-
}
|
|
1344
|
-
async function runFilter(src, dest, opts) {
|
|
1345
|
-
if (!opts.filter)
|
|
1346
|
-
return true;
|
|
1347
|
-
return opts.filter(src, dest);
|
|
1348
|
-
}
|
|
1349
|
-
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
1350
|
-
const statFn = opts.dereference ? fs4.stat : fs4.lstat;
|
|
1351
|
-
const srcStat = await statFn(src);
|
|
1352
|
-
if (srcStat.isDirectory())
|
|
1353
|
-
return onDir(srcStat, destStat, src, dest, opts);
|
|
1354
|
-
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
|
|
1355
|
-
return onFile(srcStat, destStat, src, dest, opts);
|
|
1356
|
-
if (srcStat.isSymbolicLink())
|
|
1357
|
-
return onLink(destStat, src, dest, opts);
|
|
1358
|
-
if (srcStat.isSocket())
|
|
1359
|
-
throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1360
|
-
if (srcStat.isFIFO())
|
|
1361
|
-
throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1362
|
-
throw new Error(`Unknown file: ${src}`);
|
|
1363
|
-
}
|
|
1364
|
-
async function onFile(srcStat, destStat, src, dest, opts) {
|
|
1365
|
-
if (!destStat)
|
|
1366
|
-
return copyFile(srcStat, src, dest, opts);
|
|
1367
|
-
if (opts.overwrite) {
|
|
1368
|
-
await fs4.unlink(dest);
|
|
1369
|
-
return copyFile(srcStat, src, dest, opts);
|
|
1370
|
-
}
|
|
1371
|
-
if (opts.errorOnExist) {
|
|
1372
|
-
throw new Error(`'${dest}' already exists`);
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
async function copyFile(srcStat, src, dest, opts) {
|
|
1376
|
-
await fs4.copyFile(src, dest);
|
|
1377
|
-
if (opts.preserveTimestamps) {
|
|
1378
|
-
if (fileIsNotWritable(srcStat.mode)) {
|
|
1379
|
-
await makeFileWritable(dest, srcStat.mode);
|
|
1380
|
-
}
|
|
1381
|
-
const updatedSrcStat = await fs4.stat(src);
|
|
1382
|
-
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1383
|
-
}
|
|
1384
|
-
return fs4.chmod(dest, srcStat.mode);
|
|
1385
|
-
}
|
|
1386
|
-
function fileIsNotWritable(srcMode) {
|
|
1387
|
-
return (srcMode & 128) === 0;
|
|
1388
|
-
}
|
|
1389
|
-
function makeFileWritable(dest, srcMode) {
|
|
1390
|
-
return fs4.chmod(dest, srcMode | 128);
|
|
1391
|
-
}
|
|
1392
|
-
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
1393
|
-
if (!destStat) {
|
|
1394
|
-
await fs4.mkdir(dest);
|
|
1395
|
-
}
|
|
1396
|
-
const items = await fs4.readdir(src);
|
|
1397
|
-
await Promise.all(items.map(async (item) => {
|
|
1398
|
-
const srcItem = path5.join(src, item);
|
|
1399
|
-
const destItem = path5.join(dest, item);
|
|
1400
|
-
const include = await runFilter(srcItem, destItem, opts);
|
|
1401
|
-
if (!include)
|
|
1402
|
-
return;
|
|
1403
|
-
const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
|
|
1404
|
-
return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
|
|
1405
|
-
}));
|
|
1406
|
-
if (!destStat) {
|
|
1407
|
-
await fs4.chmod(dest, srcStat.mode);
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
async function onLink(destStat, src, dest, opts) {
|
|
1411
|
-
let resolvedSrc = await fs4.readlink(src);
|
|
1412
|
-
if (opts.dereference) {
|
|
1413
|
-
resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
|
|
1414
|
-
}
|
|
1415
|
-
if (!destStat) {
|
|
1416
|
-
return fs4.symlink(resolvedSrc, dest);
|
|
1417
|
-
}
|
|
1418
|
-
let resolvedDest = null;
|
|
1419
|
-
try {
|
|
1420
|
-
resolvedDest = await fs4.readlink(dest);
|
|
1421
|
-
} catch (e) {
|
|
1422
|
-
if (e.code === "EINVAL" || e.code === "UNKNOWN")
|
|
1423
|
-
return fs4.symlink(resolvedSrc, dest);
|
|
1424
|
-
throw e;
|
|
1425
|
-
}
|
|
1426
|
-
if (opts.dereference) {
|
|
1427
|
-
resolvedDest = path5.resolve(process.cwd(), resolvedDest);
|
|
1428
|
-
}
|
|
1429
|
-
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1430
|
-
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1431
|
-
}
|
|
1432
|
-
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1433
|
-
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1434
|
-
}
|
|
1435
|
-
await fs4.unlink(dest);
|
|
1436
|
-
return fs4.symlink(resolvedSrc, dest);
|
|
1437
|
-
}
|
|
1438
|
-
module.exports = copy;
|
|
1439
|
-
}
|
|
1440
|
-
});
|
|
1441
|
-
|
|
1442
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js
|
|
1443
|
-
var require_copy_sync = __commonJS({
|
|
1444
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module) {
|
|
1445
|
-
init_esm_shims();
|
|
1446
|
-
var fs4 = require_graceful_fs();
|
|
1447
|
-
var path5 = __require("path");
|
|
1448
|
-
var mkdirsSync = require_mkdirs().mkdirsSync;
|
|
1449
|
-
var utimesMillisSync = require_utimes().utimesMillisSync;
|
|
1450
|
-
var stat = require_stat();
|
|
1451
|
-
function copySync(src, dest, opts) {
|
|
1452
|
-
if (typeof opts === "function") {
|
|
1453
|
-
opts = { filter: opts };
|
|
1454
|
-
}
|
|
1455
|
-
opts = opts || {};
|
|
1456
|
-
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1457
|
-
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1458
|
-
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
1459
|
-
process.emitWarning(
|
|
1460
|
-
"Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
|
|
1461
|
-
"Warning",
|
|
1462
|
-
"fs-extra-WARN0002"
|
|
1463
|
-
);
|
|
1464
|
-
}
|
|
1465
|
-
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
|
|
1466
|
-
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
1467
|
-
if (opts.filter && !opts.filter(src, dest))
|
|
1468
|
-
return;
|
|
1469
|
-
const destParent = path5.dirname(dest);
|
|
1470
|
-
if (!fs4.existsSync(destParent))
|
|
1471
|
-
mkdirsSync(destParent);
|
|
1472
|
-
return getStats(destStat, src, dest, opts);
|
|
1473
|
-
}
|
|
1474
|
-
function getStats(destStat, src, dest, opts) {
|
|
1475
|
-
const statSync = opts.dereference ? fs4.statSync : fs4.lstatSync;
|
|
1476
|
-
const srcStat = statSync(src);
|
|
1477
|
-
if (srcStat.isDirectory())
|
|
1478
|
-
return onDir(srcStat, destStat, src, dest, opts);
|
|
1479
|
-
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
|
|
1480
|
-
return onFile(srcStat, destStat, src, dest, opts);
|
|
1481
|
-
else if (srcStat.isSymbolicLink())
|
|
1482
|
-
return onLink(destStat, src, dest, opts);
|
|
1483
|
-
else if (srcStat.isSocket())
|
|
1484
|
-
throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1485
|
-
else if (srcStat.isFIFO())
|
|
1486
|
-
throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1487
|
-
throw new Error(`Unknown file: ${src}`);
|
|
1488
|
-
}
|
|
1489
|
-
function onFile(srcStat, destStat, src, dest, opts) {
|
|
1490
|
-
if (!destStat)
|
|
1491
|
-
return copyFile(srcStat, src, dest, opts);
|
|
1492
|
-
return mayCopyFile(srcStat, src, dest, opts);
|
|
1493
|
-
}
|
|
1494
|
-
function mayCopyFile(srcStat, src, dest, opts) {
|
|
1495
|
-
if (opts.overwrite) {
|
|
1496
|
-
fs4.unlinkSync(dest);
|
|
1497
|
-
return copyFile(srcStat, src, dest, opts);
|
|
1498
|
-
} else if (opts.errorOnExist) {
|
|
1499
|
-
throw new Error(`'${dest}' already exists`);
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
function copyFile(srcStat, src, dest, opts) {
|
|
1503
|
-
fs4.copyFileSync(src, dest);
|
|
1504
|
-
if (opts.preserveTimestamps)
|
|
1505
|
-
handleTimestamps(srcStat.mode, src, dest);
|
|
1506
|
-
return setDestMode(dest, srcStat.mode);
|
|
1507
|
-
}
|
|
1508
|
-
function handleTimestamps(srcMode, src, dest) {
|
|
1509
|
-
if (fileIsNotWritable(srcMode))
|
|
1510
|
-
makeFileWritable(dest, srcMode);
|
|
1511
|
-
return setDestTimestamps(src, dest);
|
|
1512
|
-
}
|
|
1513
|
-
function fileIsNotWritable(srcMode) {
|
|
1514
|
-
return (srcMode & 128) === 0;
|
|
1515
|
-
}
|
|
1516
|
-
function makeFileWritable(dest, srcMode) {
|
|
1517
|
-
return setDestMode(dest, srcMode | 128);
|
|
1518
|
-
}
|
|
1519
|
-
function setDestMode(dest, srcMode) {
|
|
1520
|
-
return fs4.chmodSync(dest, srcMode);
|
|
1521
|
-
}
|
|
1522
|
-
function setDestTimestamps(src, dest) {
|
|
1523
|
-
const updatedSrcStat = fs4.statSync(src);
|
|
1524
|
-
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1525
|
-
}
|
|
1526
|
-
function onDir(srcStat, destStat, src, dest, opts) {
|
|
1527
|
-
if (!destStat)
|
|
1528
|
-
return mkDirAndCopy(srcStat.mode, src, dest, opts);
|
|
1529
|
-
return copyDir(src, dest, opts);
|
|
1530
|
-
}
|
|
1531
|
-
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
1532
|
-
fs4.mkdirSync(dest);
|
|
1533
|
-
copyDir(src, dest, opts);
|
|
1534
|
-
return setDestMode(dest, srcMode);
|
|
1535
|
-
}
|
|
1536
|
-
function copyDir(src, dest, opts) {
|
|
1537
|
-
fs4.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
|
|
1538
|
-
}
|
|
1539
|
-
function copyDirItem(item, src, dest, opts) {
|
|
1540
|
-
const srcItem = path5.join(src, item);
|
|
1541
|
-
const destItem = path5.join(dest, item);
|
|
1542
|
-
if (opts.filter && !opts.filter(srcItem, destItem))
|
|
1543
|
-
return;
|
|
1544
|
-
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
1545
|
-
return getStats(destStat, srcItem, destItem, opts);
|
|
1546
|
-
}
|
|
1547
|
-
function onLink(destStat, src, dest, opts) {
|
|
1548
|
-
let resolvedSrc = fs4.readlinkSync(src);
|
|
1549
|
-
if (opts.dereference) {
|
|
1550
|
-
resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
|
|
1551
|
-
}
|
|
1552
|
-
if (!destStat) {
|
|
1553
|
-
return fs4.symlinkSync(resolvedSrc, dest);
|
|
1554
|
-
} else {
|
|
1555
|
-
let resolvedDest;
|
|
1556
|
-
try {
|
|
1557
|
-
resolvedDest = fs4.readlinkSync(dest);
|
|
1558
|
-
} catch (err) {
|
|
1559
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN")
|
|
1560
|
-
return fs4.symlinkSync(resolvedSrc, dest);
|
|
1561
|
-
throw err;
|
|
1562
|
-
}
|
|
1563
|
-
if (opts.dereference) {
|
|
1564
|
-
resolvedDest = path5.resolve(process.cwd(), resolvedDest);
|
|
1565
|
-
}
|
|
1566
|
-
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1567
|
-
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1568
|
-
}
|
|
1569
|
-
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1570
|
-
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1571
|
-
}
|
|
1572
|
-
return copyLink(resolvedSrc, dest);
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
function copyLink(resolvedSrc, dest) {
|
|
1576
|
-
fs4.unlinkSync(dest);
|
|
1577
|
-
return fs4.symlinkSync(resolvedSrc, dest);
|
|
1578
|
-
}
|
|
1579
|
-
module.exports = copySync;
|
|
1580
|
-
}
|
|
1581
|
-
});
|
|
1582
|
-
|
|
1583
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js
|
|
1584
|
-
var require_copy2 = __commonJS({
|
|
1585
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js"(exports, module) {
|
|
1586
|
-
init_esm_shims();
|
|
1587
|
-
var u = require_universalify().fromPromise;
|
|
1588
|
-
module.exports = {
|
|
1589
|
-
copy: u(require_copy()),
|
|
1590
|
-
copySync: require_copy_sync()
|
|
1591
|
-
};
|
|
1592
|
-
}
|
|
1593
|
-
});
|
|
1594
|
-
|
|
1595
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js
|
|
1596
|
-
var require_remove = __commonJS({
|
|
1597
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js"(exports, module) {
|
|
1598
|
-
init_esm_shims();
|
|
1599
|
-
var fs4 = require_graceful_fs();
|
|
1600
|
-
var u = require_universalify().fromCallback;
|
|
1601
|
-
function remove2(path5, callback) {
|
|
1602
|
-
fs4.rm(path5, { recursive: true, force: true }, callback);
|
|
1603
|
-
}
|
|
1604
|
-
function removeSync(path5) {
|
|
1605
|
-
fs4.rmSync(path5, { recursive: true, force: true });
|
|
1606
|
-
}
|
|
1607
|
-
module.exports = {
|
|
1608
|
-
remove: u(remove2),
|
|
1609
|
-
removeSync
|
|
1610
|
-
};
|
|
1611
|
-
}
|
|
1612
|
-
});
|
|
1613
|
-
|
|
1614
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js
|
|
1615
|
-
var require_empty = __commonJS({
|
|
1616
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js"(exports, module) {
|
|
1617
|
-
init_esm_shims();
|
|
1618
|
-
var u = require_universalify().fromPromise;
|
|
1619
|
-
var fs4 = require_fs();
|
|
1620
|
-
var path5 = __require("path");
|
|
1621
|
-
var mkdir = require_mkdirs();
|
|
1622
|
-
var remove2 = require_remove();
|
|
1623
|
-
var emptyDir = u(async function emptyDir2(dir) {
|
|
1624
|
-
let items;
|
|
1625
|
-
try {
|
|
1626
|
-
items = await fs4.readdir(dir);
|
|
1627
|
-
} catch {
|
|
1628
|
-
return mkdir.mkdirs(dir);
|
|
1629
|
-
}
|
|
1630
|
-
return Promise.all(items.map((item) => remove2.remove(path5.join(dir, item))));
|
|
1631
|
-
});
|
|
1632
|
-
function emptyDirSync(dir) {
|
|
1633
|
-
let items;
|
|
1634
|
-
try {
|
|
1635
|
-
items = fs4.readdirSync(dir);
|
|
1636
|
-
} catch {
|
|
1637
|
-
return mkdir.mkdirsSync(dir);
|
|
1638
|
-
}
|
|
1639
|
-
items.forEach((item) => {
|
|
1640
|
-
item = path5.join(dir, item);
|
|
1641
|
-
remove2.removeSync(item);
|
|
1642
|
-
});
|
|
1643
|
-
}
|
|
1644
|
-
module.exports = {
|
|
1645
|
-
emptyDirSync,
|
|
1646
|
-
emptydirSync: emptyDirSync,
|
|
1647
|
-
emptyDir,
|
|
1648
|
-
emptydir: emptyDir
|
|
1649
|
-
};
|
|
1650
|
-
}
|
|
1651
|
-
});
|
|
1652
|
-
|
|
1653
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js
|
|
1654
|
-
var require_file = __commonJS({
|
|
1655
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js"(exports, module) {
|
|
1656
|
-
init_esm_shims();
|
|
1657
|
-
var u = require_universalify().fromPromise;
|
|
1658
|
-
var path5 = __require("path");
|
|
1659
|
-
var fs4 = require_fs();
|
|
1660
|
-
var mkdir = require_mkdirs();
|
|
1661
|
-
async function createFile(file) {
|
|
1662
|
-
let stats;
|
|
1663
|
-
try {
|
|
1664
|
-
stats = await fs4.stat(file);
|
|
1665
|
-
} catch {
|
|
1666
|
-
}
|
|
1667
|
-
if (stats && stats.isFile())
|
|
1668
|
-
return;
|
|
1669
|
-
const dir = path5.dirname(file);
|
|
1670
|
-
let dirStats = null;
|
|
1671
|
-
try {
|
|
1672
|
-
dirStats = await fs4.stat(dir);
|
|
1673
|
-
} catch (err) {
|
|
1674
|
-
if (err.code === "ENOENT") {
|
|
1675
|
-
await mkdir.mkdirs(dir);
|
|
1676
|
-
await fs4.writeFile(file, "");
|
|
1677
|
-
return;
|
|
1678
|
-
} else {
|
|
1679
|
-
throw err;
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
if (dirStats.isDirectory()) {
|
|
1683
|
-
await fs4.writeFile(file, "");
|
|
1684
|
-
} else {
|
|
1685
|
-
await fs4.readdir(dir);
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
function createFileSync(file) {
|
|
1689
|
-
let stats;
|
|
1690
|
-
try {
|
|
1691
|
-
stats = fs4.statSync(file);
|
|
1692
|
-
} catch {
|
|
1693
|
-
}
|
|
1694
|
-
if (stats && stats.isFile())
|
|
1695
|
-
return;
|
|
1696
|
-
const dir = path5.dirname(file);
|
|
1697
|
-
try {
|
|
1698
|
-
if (!fs4.statSync(dir).isDirectory()) {
|
|
1699
|
-
fs4.readdirSync(dir);
|
|
1700
|
-
}
|
|
1701
|
-
} catch (err) {
|
|
1702
|
-
if (err && err.code === "ENOENT")
|
|
1703
|
-
mkdir.mkdirsSync(dir);
|
|
1704
|
-
else
|
|
1705
|
-
throw err;
|
|
1706
|
-
}
|
|
1707
|
-
fs4.writeFileSync(file, "");
|
|
1708
|
-
}
|
|
1709
|
-
module.exports = {
|
|
1710
|
-
createFile: u(createFile),
|
|
1711
|
-
createFileSync
|
|
1712
|
-
};
|
|
1713
|
-
}
|
|
1714
|
-
});
|
|
1715
|
-
|
|
1716
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js
|
|
1717
|
-
var require_link = __commonJS({
|
|
1718
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js"(exports, module) {
|
|
1719
|
-
init_esm_shims();
|
|
1720
|
-
var u = require_universalify().fromPromise;
|
|
1721
|
-
var path5 = __require("path");
|
|
1722
|
-
var fs4 = require_fs();
|
|
1723
|
-
var mkdir = require_mkdirs();
|
|
1724
|
-
var { pathExists: pathExists2 } = require_path_exists();
|
|
1725
|
-
var { areIdentical } = require_stat();
|
|
1726
|
-
async function createLink(srcpath, dstpath) {
|
|
1727
|
-
let dstStat;
|
|
1728
|
-
try {
|
|
1729
|
-
dstStat = await fs4.lstat(dstpath);
|
|
1730
|
-
} catch {
|
|
1731
|
-
}
|
|
1732
|
-
let srcStat;
|
|
1733
|
-
try {
|
|
1734
|
-
srcStat = await fs4.lstat(srcpath);
|
|
1735
|
-
} catch (err) {
|
|
1736
|
-
err.message = err.message.replace("lstat", "ensureLink");
|
|
1737
|
-
throw err;
|
|
1738
|
-
}
|
|
1739
|
-
if (dstStat && areIdentical(srcStat, dstStat))
|
|
1740
|
-
return;
|
|
1741
|
-
const dir = path5.dirname(dstpath);
|
|
1742
|
-
const dirExists = await pathExists2(dir);
|
|
1743
|
-
if (!dirExists) {
|
|
1744
|
-
await mkdir.mkdirs(dir);
|
|
1745
|
-
}
|
|
1746
|
-
await fs4.link(srcpath, dstpath);
|
|
1747
|
-
}
|
|
1748
|
-
function createLinkSync(srcpath, dstpath) {
|
|
1749
|
-
let dstStat;
|
|
1750
|
-
try {
|
|
1751
|
-
dstStat = fs4.lstatSync(dstpath);
|
|
1752
|
-
} catch {
|
|
1753
|
-
}
|
|
1754
|
-
try {
|
|
1755
|
-
const srcStat = fs4.lstatSync(srcpath);
|
|
1756
|
-
if (dstStat && areIdentical(srcStat, dstStat))
|
|
1757
|
-
return;
|
|
1758
|
-
} catch (err) {
|
|
1759
|
-
err.message = err.message.replace("lstat", "ensureLink");
|
|
1760
|
-
throw err;
|
|
1761
|
-
}
|
|
1762
|
-
const dir = path5.dirname(dstpath);
|
|
1763
|
-
const dirExists = fs4.existsSync(dir);
|
|
1764
|
-
if (dirExists)
|
|
1765
|
-
return fs4.linkSync(srcpath, dstpath);
|
|
1766
|
-
mkdir.mkdirsSync(dir);
|
|
1767
|
-
return fs4.linkSync(srcpath, dstpath);
|
|
1768
|
-
}
|
|
1769
|
-
module.exports = {
|
|
1770
|
-
createLink: u(createLink),
|
|
1771
|
-
createLinkSync
|
|
1772
|
-
};
|
|
1773
|
-
}
|
|
1774
|
-
});
|
|
1775
|
-
|
|
1776
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js
|
|
1777
|
-
var require_symlink_paths = __commonJS({
|
|
1778
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module) {
|
|
1779
|
-
init_esm_shims();
|
|
1780
|
-
var path5 = __require("path");
|
|
1781
|
-
var fs4 = require_fs();
|
|
1782
|
-
var { pathExists: pathExists2 } = require_path_exists();
|
|
1783
|
-
var u = require_universalify().fromPromise;
|
|
1784
|
-
async function symlinkPaths(srcpath, dstpath) {
|
|
1785
|
-
if (path5.isAbsolute(srcpath)) {
|
|
1786
|
-
try {
|
|
1787
|
-
await fs4.lstat(srcpath);
|
|
1788
|
-
} catch (err) {
|
|
1789
|
-
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1790
|
-
throw err;
|
|
1791
|
-
}
|
|
1792
|
-
return {
|
|
1793
|
-
toCwd: srcpath,
|
|
1794
|
-
toDst: srcpath
|
|
1795
|
-
};
|
|
1796
|
-
}
|
|
1797
|
-
const dstdir = path5.dirname(dstpath);
|
|
1798
|
-
const relativeToDst = path5.join(dstdir, srcpath);
|
|
1799
|
-
const exists = await pathExists2(relativeToDst);
|
|
1800
|
-
if (exists) {
|
|
1801
|
-
return {
|
|
1802
|
-
toCwd: relativeToDst,
|
|
1803
|
-
toDst: srcpath
|
|
1804
|
-
};
|
|
1805
|
-
}
|
|
1806
|
-
try {
|
|
1807
|
-
await fs4.lstat(srcpath);
|
|
1808
|
-
} catch (err) {
|
|
1809
|
-
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1810
|
-
throw err;
|
|
1811
|
-
}
|
|
1812
|
-
return {
|
|
1813
|
-
toCwd: srcpath,
|
|
1814
|
-
toDst: path5.relative(dstdir, srcpath)
|
|
1815
|
-
};
|
|
1816
|
-
}
|
|
1817
|
-
function symlinkPathsSync(srcpath, dstpath) {
|
|
1818
|
-
if (path5.isAbsolute(srcpath)) {
|
|
1819
|
-
const exists2 = fs4.existsSync(srcpath);
|
|
1820
|
-
if (!exists2)
|
|
1821
|
-
throw new Error("absolute srcpath does not exist");
|
|
1822
|
-
return {
|
|
1823
|
-
toCwd: srcpath,
|
|
1824
|
-
toDst: srcpath
|
|
1825
|
-
};
|
|
1826
|
-
}
|
|
1827
|
-
const dstdir = path5.dirname(dstpath);
|
|
1828
|
-
const relativeToDst = path5.join(dstdir, srcpath);
|
|
1829
|
-
const exists = fs4.existsSync(relativeToDst);
|
|
1830
|
-
if (exists) {
|
|
1831
|
-
return {
|
|
1832
|
-
toCwd: relativeToDst,
|
|
1833
|
-
toDst: srcpath
|
|
1834
|
-
};
|
|
1835
|
-
}
|
|
1836
|
-
const srcExists = fs4.existsSync(srcpath);
|
|
1837
|
-
if (!srcExists)
|
|
1838
|
-
throw new Error("relative srcpath does not exist");
|
|
1839
|
-
return {
|
|
1840
|
-
toCwd: srcpath,
|
|
1841
|
-
toDst: path5.relative(dstdir, srcpath)
|
|
1842
|
-
};
|
|
1843
|
-
}
|
|
1844
|
-
module.exports = {
|
|
1845
|
-
symlinkPaths: u(symlinkPaths),
|
|
1846
|
-
symlinkPathsSync
|
|
1847
|
-
};
|
|
1848
|
-
}
|
|
1849
|
-
});
|
|
1850
|
-
|
|
1851
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js
|
|
1852
|
-
var require_symlink_type = __commonJS({
|
|
1853
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module) {
|
|
1854
|
-
init_esm_shims();
|
|
1855
|
-
var fs4 = require_fs();
|
|
1856
|
-
var u = require_universalify().fromPromise;
|
|
1857
|
-
async function symlinkType(srcpath, type) {
|
|
1858
|
-
if (type)
|
|
1859
|
-
return type;
|
|
1860
|
-
let stats;
|
|
1861
|
-
try {
|
|
1862
|
-
stats = await fs4.lstat(srcpath);
|
|
1863
|
-
} catch {
|
|
1864
|
-
return "file";
|
|
1865
|
-
}
|
|
1866
|
-
return stats && stats.isDirectory() ? "dir" : "file";
|
|
1867
|
-
}
|
|
1868
|
-
function symlinkTypeSync(srcpath, type) {
|
|
1869
|
-
if (type)
|
|
1870
|
-
return type;
|
|
1871
|
-
let stats;
|
|
1872
|
-
try {
|
|
1873
|
-
stats = fs4.lstatSync(srcpath);
|
|
1874
|
-
} catch {
|
|
1875
|
-
return "file";
|
|
1876
|
-
}
|
|
1877
|
-
return stats && stats.isDirectory() ? "dir" : "file";
|
|
1878
|
-
}
|
|
1879
|
-
module.exports = {
|
|
1880
|
-
symlinkType: u(symlinkType),
|
|
1881
|
-
symlinkTypeSync
|
|
1882
|
-
};
|
|
1883
|
-
}
|
|
1884
|
-
});
|
|
1885
|
-
|
|
1886
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js
|
|
1887
|
-
var require_symlink = __commonJS({
|
|
1888
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module) {
|
|
1889
|
-
init_esm_shims();
|
|
1890
|
-
var u = require_universalify().fromPromise;
|
|
1891
|
-
var path5 = __require("path");
|
|
1892
|
-
var fs4 = require_fs();
|
|
1893
|
-
var { mkdirs, mkdirsSync } = require_mkdirs();
|
|
1894
|
-
var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
1895
|
-
var { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
1896
|
-
var { pathExists: pathExists2 } = require_path_exists();
|
|
1897
|
-
var { areIdentical } = require_stat();
|
|
1898
|
-
async function createSymlink(srcpath, dstpath, type) {
|
|
1899
|
-
let stats;
|
|
1900
|
-
try {
|
|
1901
|
-
stats = await fs4.lstat(dstpath);
|
|
1902
|
-
} catch {
|
|
1903
|
-
}
|
|
1904
|
-
if (stats && stats.isSymbolicLink()) {
|
|
1905
|
-
const [srcStat, dstStat] = await Promise.all([
|
|
1906
|
-
fs4.stat(srcpath),
|
|
1907
|
-
fs4.stat(dstpath)
|
|
1908
|
-
]);
|
|
1909
|
-
if (areIdentical(srcStat, dstStat))
|
|
1910
|
-
return;
|
|
1911
|
-
}
|
|
1912
|
-
const relative2 = await symlinkPaths(srcpath, dstpath);
|
|
1913
|
-
srcpath = relative2.toDst;
|
|
1914
|
-
const toType = await symlinkType(relative2.toCwd, type);
|
|
1915
|
-
const dir = path5.dirname(dstpath);
|
|
1916
|
-
if (!await pathExists2(dir)) {
|
|
1917
|
-
await mkdirs(dir);
|
|
1918
|
-
}
|
|
1919
|
-
return fs4.symlink(srcpath, dstpath, toType);
|
|
1920
|
-
}
|
|
1921
|
-
function createSymlinkSync(srcpath, dstpath, type) {
|
|
1922
|
-
let stats;
|
|
1923
|
-
try {
|
|
1924
|
-
stats = fs4.lstatSync(dstpath);
|
|
1925
|
-
} catch {
|
|
1926
|
-
}
|
|
1927
|
-
if (stats && stats.isSymbolicLink()) {
|
|
1928
|
-
const srcStat = fs4.statSync(srcpath);
|
|
1929
|
-
const dstStat = fs4.statSync(dstpath);
|
|
1930
|
-
if (areIdentical(srcStat, dstStat))
|
|
1931
|
-
return;
|
|
1932
|
-
}
|
|
1933
|
-
const relative2 = symlinkPathsSync(srcpath, dstpath);
|
|
1934
|
-
srcpath = relative2.toDst;
|
|
1935
|
-
type = symlinkTypeSync(relative2.toCwd, type);
|
|
1936
|
-
const dir = path5.dirname(dstpath);
|
|
1937
|
-
const exists = fs4.existsSync(dir);
|
|
1938
|
-
if (exists)
|
|
1939
|
-
return fs4.symlinkSync(srcpath, dstpath, type);
|
|
1940
|
-
mkdirsSync(dir);
|
|
1941
|
-
return fs4.symlinkSync(srcpath, dstpath, type);
|
|
1942
|
-
}
|
|
1943
|
-
module.exports = {
|
|
1944
|
-
createSymlink: u(createSymlink),
|
|
1945
|
-
createSymlinkSync
|
|
1946
|
-
};
|
|
1947
|
-
}
|
|
1948
|
-
});
|
|
1949
|
-
|
|
1950
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js
|
|
1951
|
-
var require_ensure = __commonJS({
|
|
1952
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js"(exports, module) {
|
|
1953
|
-
init_esm_shims();
|
|
1954
|
-
var { createFile, createFileSync } = require_file();
|
|
1955
|
-
var { createLink, createLinkSync } = require_link();
|
|
1956
|
-
var { createSymlink, createSymlinkSync } = require_symlink();
|
|
1957
|
-
module.exports = {
|
|
1958
|
-
// file
|
|
1959
|
-
createFile,
|
|
1960
|
-
createFileSync,
|
|
1961
|
-
ensureFile: createFile,
|
|
1962
|
-
ensureFileSync: createFileSync,
|
|
1963
|
-
// link
|
|
1964
|
-
createLink,
|
|
1965
|
-
createLinkSync,
|
|
1966
|
-
ensureLink: createLink,
|
|
1967
|
-
ensureLinkSync: createLinkSync,
|
|
1968
|
-
// symlink
|
|
1969
|
-
createSymlink,
|
|
1970
|
-
createSymlinkSync,
|
|
1971
|
-
ensureSymlink: createSymlink,
|
|
1972
|
-
ensureSymlinkSync: createSymlinkSync
|
|
1973
|
-
};
|
|
1974
|
-
}
|
|
1975
|
-
});
|
|
1976
|
-
|
|
1977
|
-
// ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js
|
|
1978
|
-
var require_utils2 = __commonJS({
|
|
1979
|
-
"../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports, module) {
|
|
1980
|
-
init_esm_shims();
|
|
1981
|
-
function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
|
|
1982
|
-
const EOF = finalEOL ? EOL : "";
|
|
1983
|
-
const str = JSON.stringify(obj, replacer, spaces);
|
|
1984
|
-
return str.replace(/\n/g, EOL) + EOF;
|
|
1985
|
-
}
|
|
1986
|
-
function stripBom(content) {
|
|
1987
|
-
if (Buffer.isBuffer(content))
|
|
1988
|
-
content = content.toString("utf8");
|
|
1989
|
-
return content.replace(/^\uFEFF/, "");
|
|
1990
|
-
}
|
|
1991
|
-
module.exports = { stringify, stripBom };
|
|
1992
|
-
}
|
|
1993
|
-
});
|
|
1994
|
-
|
|
1995
|
-
// ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js
|
|
1996
|
-
var require_jsonfile = __commonJS({
|
|
1997
|
-
"../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js"(exports, module) {
|
|
1998
|
-
init_esm_shims();
|
|
1999
|
-
var _fs;
|
|
2000
|
-
try {
|
|
2001
|
-
_fs = require_graceful_fs();
|
|
2002
|
-
} catch (_) {
|
|
2003
|
-
_fs = __require("fs");
|
|
2004
|
-
}
|
|
2005
|
-
var universalify = require_universalify();
|
|
2006
|
-
var { stringify, stripBom } = require_utils2();
|
|
2007
|
-
async function _readFile(file, options = {}) {
|
|
2008
|
-
if (typeof options === "string") {
|
|
2009
|
-
options = { encoding: options };
|
|
2010
|
-
}
|
|
2011
|
-
const fs4 = options.fs || _fs;
|
|
2012
|
-
const shouldThrow = "throws" in options ? options.throws : true;
|
|
2013
|
-
let data = await universalify.fromCallback(fs4.readFile)(file, options);
|
|
2014
|
-
data = stripBom(data);
|
|
2015
|
-
let obj;
|
|
2016
|
-
try {
|
|
2017
|
-
obj = JSON.parse(data, options ? options.reviver : null);
|
|
2018
|
-
} catch (err) {
|
|
2019
|
-
if (shouldThrow) {
|
|
2020
|
-
err.message = `${file}: ${err.message}`;
|
|
2021
|
-
throw err;
|
|
2022
|
-
} else {
|
|
2023
|
-
return null;
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
return obj;
|
|
2027
|
-
}
|
|
2028
|
-
var readFile = universalify.fromPromise(_readFile);
|
|
2029
|
-
function readFileSync(file, options = {}) {
|
|
2030
|
-
if (typeof options === "string") {
|
|
2031
|
-
options = { encoding: options };
|
|
2032
|
-
}
|
|
2033
|
-
const fs4 = options.fs || _fs;
|
|
2034
|
-
const shouldThrow = "throws" in options ? options.throws : true;
|
|
2035
|
-
try {
|
|
2036
|
-
let content = fs4.readFileSync(file, options);
|
|
2037
|
-
content = stripBom(content);
|
|
2038
|
-
return JSON.parse(content, options.reviver);
|
|
2039
|
-
} catch (err) {
|
|
2040
|
-
if (shouldThrow) {
|
|
2041
|
-
err.message = `${file}: ${err.message}`;
|
|
2042
|
-
throw err;
|
|
2043
|
-
} else {
|
|
2044
|
-
return null;
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
async function _writeFile(file, obj, options = {}) {
|
|
2049
|
-
const fs4 = options.fs || _fs;
|
|
2050
|
-
const str = stringify(obj, options);
|
|
2051
|
-
await universalify.fromCallback(fs4.writeFile)(file, str, options);
|
|
2052
|
-
}
|
|
2053
|
-
var writeFile = universalify.fromPromise(_writeFile);
|
|
2054
|
-
function writeFileSync(file, obj, options = {}) {
|
|
2055
|
-
const fs4 = options.fs || _fs;
|
|
2056
|
-
const str = stringify(obj, options);
|
|
2057
|
-
return fs4.writeFileSync(file, str, options);
|
|
2058
|
-
}
|
|
2059
|
-
var jsonfile = {
|
|
2060
|
-
readFile,
|
|
2061
|
-
readFileSync,
|
|
2062
|
-
writeFile,
|
|
2063
|
-
writeFileSync
|
|
2064
|
-
};
|
|
2065
|
-
module.exports = jsonfile;
|
|
2066
|
-
}
|
|
2067
|
-
});
|
|
2068
|
-
|
|
2069
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js
|
|
2070
|
-
var require_jsonfile2 = __commonJS({
|
|
2071
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports, module) {
|
|
2072
|
-
init_esm_shims();
|
|
2073
|
-
var jsonFile = require_jsonfile();
|
|
2074
|
-
module.exports = {
|
|
2075
|
-
// jsonfile exports
|
|
2076
|
-
readJson: jsonFile.readFile,
|
|
2077
|
-
readJsonSync: jsonFile.readFileSync,
|
|
2078
|
-
writeJson: jsonFile.writeFile,
|
|
2079
|
-
writeJsonSync: jsonFile.writeFileSync
|
|
2080
|
-
};
|
|
2081
|
-
}
|
|
2082
|
-
});
|
|
2083
|
-
|
|
2084
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js
|
|
2085
|
-
var require_output_file = __commonJS({
|
|
2086
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js"(exports, module) {
|
|
2087
|
-
init_esm_shims();
|
|
2088
|
-
var u = require_universalify().fromPromise;
|
|
2089
|
-
var fs4 = require_fs();
|
|
2090
|
-
var path5 = __require("path");
|
|
2091
|
-
var mkdir = require_mkdirs();
|
|
2092
|
-
var pathExists2 = require_path_exists().pathExists;
|
|
2093
|
-
async function outputFile(file, data, encoding = "utf-8") {
|
|
2094
|
-
const dir = path5.dirname(file);
|
|
2095
|
-
if (!await pathExists2(dir)) {
|
|
2096
|
-
await mkdir.mkdirs(dir);
|
|
2097
|
-
}
|
|
2098
|
-
return fs4.writeFile(file, data, encoding);
|
|
2099
|
-
}
|
|
2100
|
-
function outputFileSync(file, ...args) {
|
|
2101
|
-
const dir = path5.dirname(file);
|
|
2102
|
-
if (!fs4.existsSync(dir)) {
|
|
2103
|
-
mkdir.mkdirsSync(dir);
|
|
2104
|
-
}
|
|
2105
|
-
fs4.writeFileSync(file, ...args);
|
|
2106
|
-
}
|
|
2107
|
-
module.exports = {
|
|
2108
|
-
outputFile: u(outputFile),
|
|
2109
|
-
outputFileSync
|
|
2110
|
-
};
|
|
2111
|
-
}
|
|
2112
|
-
});
|
|
2113
|
-
|
|
2114
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js
|
|
2115
|
-
var require_output_json = __commonJS({
|
|
2116
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js"(exports, module) {
|
|
2117
|
-
init_esm_shims();
|
|
2118
|
-
var { stringify } = require_utils2();
|
|
2119
|
-
var { outputFile } = require_output_file();
|
|
2120
|
-
async function outputJson(file, data, options = {}) {
|
|
2121
|
-
const str = stringify(data, options);
|
|
2122
|
-
await outputFile(file, str, options);
|
|
2123
|
-
}
|
|
2124
|
-
module.exports = outputJson;
|
|
2125
|
-
}
|
|
2126
|
-
});
|
|
2127
|
-
|
|
2128
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js
|
|
2129
|
-
var require_output_json_sync = __commonJS({
|
|
2130
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module) {
|
|
2131
|
-
init_esm_shims();
|
|
2132
|
-
var { stringify } = require_utils2();
|
|
2133
|
-
var { outputFileSync } = require_output_file();
|
|
2134
|
-
function outputJsonSync(file, data, options) {
|
|
2135
|
-
const str = stringify(data, options);
|
|
2136
|
-
outputFileSync(file, str, options);
|
|
2137
|
-
}
|
|
2138
|
-
module.exports = outputJsonSync;
|
|
2139
|
-
}
|
|
2140
|
-
});
|
|
2141
|
-
|
|
2142
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js
|
|
2143
|
-
var require_json = __commonJS({
|
|
2144
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js"(exports, module) {
|
|
2145
|
-
init_esm_shims();
|
|
2146
|
-
var u = require_universalify().fromPromise;
|
|
2147
|
-
var jsonFile = require_jsonfile2();
|
|
2148
|
-
jsonFile.outputJson = u(require_output_json());
|
|
2149
|
-
jsonFile.outputJsonSync = require_output_json_sync();
|
|
2150
|
-
jsonFile.outputJSON = jsonFile.outputJson;
|
|
2151
|
-
jsonFile.outputJSONSync = jsonFile.outputJsonSync;
|
|
2152
|
-
jsonFile.writeJSON = jsonFile.writeJson;
|
|
2153
|
-
jsonFile.writeJSONSync = jsonFile.writeJsonSync;
|
|
2154
|
-
jsonFile.readJSON = jsonFile.readJson;
|
|
2155
|
-
jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
2156
|
-
module.exports = jsonFile;
|
|
2157
|
-
}
|
|
2158
|
-
});
|
|
2159
|
-
|
|
2160
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js
|
|
2161
|
-
var require_move = __commonJS({
|
|
2162
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js"(exports, module) {
|
|
2163
|
-
init_esm_shims();
|
|
2164
|
-
var fs4 = require_fs();
|
|
2165
|
-
var path5 = __require("path");
|
|
2166
|
-
var { copy } = require_copy2();
|
|
2167
|
-
var { remove: remove2 } = require_remove();
|
|
2168
|
-
var { mkdirp } = require_mkdirs();
|
|
2169
|
-
var { pathExists: pathExists2 } = require_path_exists();
|
|
2170
|
-
var stat = require_stat();
|
|
2171
|
-
async function move(src, dest, opts = {}) {
|
|
2172
|
-
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2173
|
-
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
|
|
2174
|
-
await stat.checkParentPaths(src, srcStat, dest, "move");
|
|
2175
|
-
const destParent = path5.dirname(dest);
|
|
2176
|
-
const parsedParentPath = path5.parse(destParent);
|
|
2177
|
-
if (parsedParentPath.root !== destParent) {
|
|
2178
|
-
await mkdirp(destParent);
|
|
2179
|
-
}
|
|
2180
|
-
return doRename(src, dest, overwrite, isChangingCase);
|
|
2181
|
-
}
|
|
2182
|
-
async function doRename(src, dest, overwrite, isChangingCase) {
|
|
2183
|
-
if (!isChangingCase) {
|
|
2184
|
-
if (overwrite) {
|
|
2185
|
-
await remove2(dest);
|
|
2186
|
-
} else if (await pathExists2(dest)) {
|
|
2187
|
-
throw new Error("dest already exists.");
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
try {
|
|
2191
|
-
await fs4.rename(src, dest);
|
|
2192
|
-
} catch (err) {
|
|
2193
|
-
if (err.code !== "EXDEV") {
|
|
2194
|
-
throw err;
|
|
2195
|
-
}
|
|
2196
|
-
await moveAcrossDevice(src, dest, overwrite);
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
async function moveAcrossDevice(src, dest, overwrite) {
|
|
2200
|
-
const opts = {
|
|
2201
|
-
overwrite,
|
|
2202
|
-
errorOnExist: true,
|
|
2203
|
-
preserveTimestamps: true
|
|
2204
|
-
};
|
|
2205
|
-
await copy(src, dest, opts);
|
|
2206
|
-
return remove2(src);
|
|
2207
|
-
}
|
|
2208
|
-
module.exports = move;
|
|
2209
|
-
}
|
|
2210
|
-
});
|
|
2211
|
-
|
|
2212
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js
|
|
2213
|
-
var require_move_sync = __commonJS({
|
|
2214
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js"(exports, module) {
|
|
2215
|
-
init_esm_shims();
|
|
2216
|
-
var fs4 = require_graceful_fs();
|
|
2217
|
-
var path5 = __require("path");
|
|
2218
|
-
var copySync = require_copy2().copySync;
|
|
2219
|
-
var removeSync = require_remove().removeSync;
|
|
2220
|
-
var mkdirpSync = require_mkdirs().mkdirpSync;
|
|
2221
|
-
var stat = require_stat();
|
|
2222
|
-
function moveSync(src, dest, opts) {
|
|
2223
|
-
opts = opts || {};
|
|
2224
|
-
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2225
|
-
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
2226
|
-
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
2227
|
-
if (!isParentRoot(dest))
|
|
2228
|
-
mkdirpSync(path5.dirname(dest));
|
|
2229
|
-
return doRename(src, dest, overwrite, isChangingCase);
|
|
2230
|
-
}
|
|
2231
|
-
function isParentRoot(dest) {
|
|
2232
|
-
const parent = path5.dirname(dest);
|
|
2233
|
-
const parsedPath = path5.parse(parent);
|
|
2234
|
-
return parsedPath.root === parent;
|
|
2235
|
-
}
|
|
2236
|
-
function doRename(src, dest, overwrite, isChangingCase) {
|
|
2237
|
-
if (isChangingCase)
|
|
2238
|
-
return rename(src, dest, overwrite);
|
|
2239
|
-
if (overwrite) {
|
|
2240
|
-
removeSync(dest);
|
|
2241
|
-
return rename(src, dest, overwrite);
|
|
2242
|
-
}
|
|
2243
|
-
if (fs4.existsSync(dest))
|
|
2244
|
-
throw new Error("dest already exists.");
|
|
2245
|
-
return rename(src, dest, overwrite);
|
|
2246
|
-
}
|
|
2247
|
-
function rename(src, dest, overwrite) {
|
|
2248
|
-
try {
|
|
2249
|
-
fs4.renameSync(src, dest);
|
|
2250
|
-
} catch (err) {
|
|
2251
|
-
if (err.code !== "EXDEV")
|
|
2252
|
-
throw err;
|
|
2253
|
-
return moveAcrossDevice(src, dest, overwrite);
|
|
2254
|
-
}
|
|
2255
|
-
}
|
|
2256
|
-
function moveAcrossDevice(src, dest, overwrite) {
|
|
2257
|
-
const opts = {
|
|
2258
|
-
overwrite,
|
|
2259
|
-
errorOnExist: true,
|
|
2260
|
-
preserveTimestamps: true
|
|
2261
|
-
};
|
|
2262
|
-
copySync(src, dest, opts);
|
|
2263
|
-
return removeSync(src);
|
|
2264
|
-
}
|
|
2265
|
-
module.exports = moveSync;
|
|
2266
|
-
}
|
|
2267
|
-
});
|
|
2268
|
-
|
|
2269
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js
|
|
2270
|
-
var require_move2 = __commonJS({
|
|
2271
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js"(exports, module) {
|
|
2272
|
-
init_esm_shims();
|
|
2273
|
-
var u = require_universalify().fromPromise;
|
|
2274
|
-
module.exports = {
|
|
2275
|
-
move: u(require_move()),
|
|
2276
|
-
moveSync: require_move_sync()
|
|
2277
|
-
};
|
|
2278
|
-
}
|
|
2279
|
-
});
|
|
2280
|
-
|
|
2281
|
-
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js
|
|
2282
|
-
var require_lib = __commonJS({
|
|
2283
|
-
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js"(exports, module) {
|
|
2284
|
-
init_esm_shims();
|
|
2285
|
-
module.exports = {
|
|
2286
|
-
// Export promiseified graceful-fs:
|
|
2287
|
-
...require_fs(),
|
|
2288
|
-
// Export extra methods:
|
|
2289
|
-
...require_copy2(),
|
|
2290
|
-
...require_empty(),
|
|
2291
|
-
...require_ensure(),
|
|
2292
|
-
...require_json(),
|
|
2293
|
-
...require_mkdirs(),
|
|
2294
|
-
...require_move2(),
|
|
2295
|
-
...require_output_file(),
|
|
2296
|
-
...require_path_exists(),
|
|
2297
|
-
...require_remove()
|
|
2298
|
-
};
|
|
2299
|
-
}
|
|
2300
|
-
});
|
|
22
|
+
createRequire(import.meta.url);
|
|
2301
23
|
|
|
2302
24
|
// ../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js
|
|
2303
25
|
var require_lodash = __commonJS({
|
|
@@ -2436,14 +158,14 @@ var require_lodash = __commonJS({
|
|
|
2436
158
|
var reIsNative = RegExp(
|
|
2437
159
|
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
2438
160
|
);
|
|
2439
|
-
var
|
|
2440
|
-
var
|
|
2441
|
-
var
|
|
161
|
+
var Buffer = moduleExports ? root.Buffer : void 0;
|
|
162
|
+
var Symbol = root.Symbol;
|
|
163
|
+
var Uint8Array = root.Uint8Array;
|
|
2442
164
|
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
2443
165
|
var splice = arrayProto.splice;
|
|
2444
|
-
var symToStringTag =
|
|
166
|
+
var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
|
|
2445
167
|
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
2446
|
-
var nativeIsBuffer =
|
|
168
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
|
|
2447
169
|
var nativeKeys = overArg(Object.keys, Object);
|
|
2448
170
|
var DataView = getNative(root, "DataView");
|
|
2449
171
|
var Map2 = getNative(root, "Map");
|
|
@@ -2456,7 +178,7 @@ var require_lodash = __commonJS({
|
|
|
2456
178
|
var promiseCtorString = toSource(Promise2);
|
|
2457
179
|
var setCtorString = toSource(Set2);
|
|
2458
180
|
var weakMapCtorString = toSource(WeakMap2);
|
|
2459
|
-
var symbolProto =
|
|
181
|
+
var symbolProto = Symbol ? Symbol.prototype : void 0;
|
|
2460
182
|
var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
2461
183
|
function Hash(entries) {
|
|
2462
184
|
var index = -1, length = entries == null ? 0 : entries.length;
|
|
@@ -2786,7 +508,7 @@ var require_lodash = __commonJS({
|
|
|
2786
508
|
object = object.buffer;
|
|
2787
509
|
other = other.buffer;
|
|
2788
510
|
case arrayBufferTag:
|
|
2789
|
-
if (object.byteLength != other.byteLength || !equalFunc(new
|
|
511
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
2790
512
|
return false;
|
|
2791
513
|
}
|
|
2792
514
|
return true;
|
|
@@ -2947,573 +669,65 @@ var require_lodash = __commonJS({
|
|
|
2947
669
|
return funcToString.call(func);
|
|
2948
670
|
} catch (e) {
|
|
2949
671
|
}
|
|
2950
|
-
try {
|
|
2951
|
-
return func + "";
|
|
2952
|
-
} catch (e) {
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
return "";
|
|
2956
|
-
}
|
|
2957
|
-
function eq(value, other) {
|
|
2958
|
-
return value === other || value !== value && other !== other;
|
|
2959
|
-
}
|
|
2960
|
-
var isArguments = baseIsArguments(/* @__PURE__ */ function() {
|
|
2961
|
-
return arguments;
|
|
2962
|
-
}()) ? baseIsArguments : function(value) {
|
|
2963
|
-
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
2964
|
-
};
|
|
2965
|
-
var isArray = Array.isArray;
|
|
2966
|
-
function isArrayLike(value) {
|
|
2967
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
2968
|
-
}
|
|
2969
|
-
var isBuffer = nativeIsBuffer || stubFalse;
|
|
2970
|
-
function isEqual2(value, other) {
|
|
2971
|
-
return baseIsEqual(value, other);
|
|
2972
|
-
}
|
|
2973
|
-
function isFunction(value) {
|
|
2974
|
-
if (!isObject(value)) {
|
|
2975
|
-
return false;
|
|
2976
|
-
}
|
|
2977
|
-
var tag = baseGetTag(value);
|
|
2978
|
-
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
2979
|
-
}
|
|
2980
|
-
function isLength(value) {
|
|
2981
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
2982
|
-
}
|
|
2983
|
-
function isObject(value) {
|
|
2984
|
-
var type = typeof value;
|
|
2985
|
-
return value != null && (type == "object" || type == "function");
|
|
2986
|
-
}
|
|
2987
|
-
function isObjectLike(value) {
|
|
2988
|
-
return value != null && typeof value == "object";
|
|
2989
|
-
}
|
|
2990
|
-
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
2991
|
-
function keys(object) {
|
|
2992
|
-
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
2993
|
-
}
|
|
2994
|
-
function stubArray() {
|
|
2995
|
-
return [];
|
|
2996
|
-
}
|
|
2997
|
-
function stubFalse() {
|
|
2998
|
-
return false;
|
|
2999
|
-
}
|
|
3000
|
-
module.exports = isEqual2;
|
|
3001
|
-
}
|
|
3002
|
-
});
|
|
3003
|
-
|
|
3004
|
-
// src/index.ts
|
|
3005
|
-
init_esm_shims();
|
|
3006
|
-
|
|
3007
|
-
// src/build.ts
|
|
3008
|
-
init_esm_shims();
|
|
3009
|
-
|
|
3010
|
-
// ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/node.js
|
|
3011
|
-
init_esm_shims();
|
|
3012
|
-
|
|
3013
|
-
// ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/chunk-5WCZOS7T.js
|
|
3014
|
-
init_esm_shims();
|
|
3015
|
-
var b = {
|
|
3016
|
-
reset: [0, 0],
|
|
3017
|
-
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
3018
|
-
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
3019
|
-
italic: [3, 23],
|
|
3020
|
-
underline: [4, 24],
|
|
3021
|
-
inverse: [7, 27],
|
|
3022
|
-
hidden: [8, 28],
|
|
3023
|
-
strikethrough: [9, 29],
|
|
3024
|
-
black: [30, 39],
|
|
3025
|
-
red: [31, 39],
|
|
3026
|
-
green: [32, 39],
|
|
3027
|
-
yellow: [33, 39],
|
|
3028
|
-
blue: [34, 39],
|
|
3029
|
-
magenta: [35, 39],
|
|
3030
|
-
cyan: [36, 39],
|
|
3031
|
-
white: [37, 39],
|
|
3032
|
-
gray: [90, 39],
|
|
3033
|
-
bgBlack: [40, 49],
|
|
3034
|
-
bgRed: [41, 49],
|
|
3035
|
-
bgGreen: [42, 49],
|
|
3036
|
-
bgYellow: [43, 49],
|
|
3037
|
-
bgBlue: [44, 49],
|
|
3038
|
-
bgMagenta: [45, 49],
|
|
3039
|
-
bgCyan: [46, 49],
|
|
3040
|
-
bgWhite: [47, 49]
|
|
3041
|
-
};
|
|
3042
|
-
var C = Object.entries(b);
|
|
3043
|
-
function d(r2) {
|
|
3044
|
-
return String(r2);
|
|
3045
|
-
}
|
|
3046
|
-
d.open = "";
|
|
3047
|
-
d.close = "";
|
|
3048
|
-
function p(r2 = false) {
|
|
3049
|
-
let n = typeof process != "undefined" ? process : void 0, t = (n == null ? void 0 : n.env) || {}, a = (n == null ? void 0 : n.argv) || [];
|
|
3050
|
-
return !("NO_COLOR" in t || a.includes("--no-color")) && !("GITHUB_ACTIONS" in t) && ("FORCE_COLOR" in t || a.includes("--color") || (n == null ? void 0 : n.platform) === "win32" || r2 && t.TERM !== "dumb" || "CI" in t) || typeof window != "undefined" && !!window.chrome;
|
|
3051
|
-
}
|
|
3052
|
-
function w(r2 = false) {
|
|
3053
|
-
let n = p(r2), t = (e, o, c, i) => {
|
|
3054
|
-
let u = e.substring(0, i) + c, s = e.substring(i + o.length), l = s.indexOf(o);
|
|
3055
|
-
return ~l ? u + t(s, o, c, l) : u + s;
|
|
3056
|
-
}, a = (e, o, c = e) => {
|
|
3057
|
-
let i = (u) => {
|
|
3058
|
-
let s = String(u), l = s.indexOf(o, e.length);
|
|
3059
|
-
return ~l ? e + t(s, o, c, l) + o : e + s + o;
|
|
3060
|
-
};
|
|
3061
|
-
return i.open = e, i.close = o, i;
|
|
3062
|
-
}, g = {
|
|
3063
|
-
isColorSupported: n
|
|
3064
|
-
}, f = (e) => `\x1B[${e}m`;
|
|
3065
|
-
for (let [e, o] of C)
|
|
3066
|
-
g[e] = n ? a(
|
|
3067
|
-
f(o[0]),
|
|
3068
|
-
f(o[1]),
|
|
3069
|
-
o[2]
|
|
3070
|
-
) : d;
|
|
3071
|
-
return g;
|
|
3072
|
-
}
|
|
3073
|
-
var p2 = w(isatty(1));
|
|
3074
|
-
|
|
3075
|
-
// src/fs/clean.ts
|
|
3076
|
-
init_esm_shims();
|
|
3077
|
-
var import_fs_extra = __toESM(require_lib(), 1);
|
|
3078
|
-
async function clean(path5) {
|
|
3079
|
-
return (0, import_fs_extra.remove)(path5);
|
|
3080
|
-
}
|
|
3081
|
-
|
|
3082
|
-
// src/fs/read.ts
|
|
3083
|
-
init_esm_shims();
|
|
3084
|
-
var import_fs_extra2 = __toESM(require_lib(), 1);
|
|
3085
|
-
function slash(path5, platform = "linux") {
|
|
3086
|
-
const isWindowsPath = /^\\\\\?\\/.test(path5);
|
|
3087
|
-
if (["linux", "mac"].includes(platform) && !isWindowsPath) {
|
|
3088
|
-
return path5.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
|
|
3089
|
-
}
|
|
3090
|
-
return path5.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
|
|
3091
|
-
}
|
|
3092
|
-
function getRelativePath(rootDir, filePath, platform = "linux") {
|
|
3093
|
-
if (!rootDir || !filePath) {
|
|
3094
|
-
throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ""} ${filePath || ""}`);
|
|
3095
|
-
}
|
|
3096
|
-
const relativePath = relative(rootDir, filePath);
|
|
3097
|
-
const slashedPath = slash(relativePath, platform);
|
|
3098
|
-
if (slashedPath.startsWith("../")) {
|
|
3099
|
-
return slashedPath.replace(basename(slashedPath), basename(slashedPath, extname(filePath)));
|
|
3100
|
-
}
|
|
3101
|
-
return `./${slashedPath.replace(basename(slashedPath), basename(slashedPath, extname(filePath)))}`;
|
|
3102
|
-
}
|
|
3103
|
-
var reader = switcher(
|
|
3104
|
-
{
|
|
3105
|
-
node: async (path5) => {
|
|
3106
|
-
return import_fs_extra2.default.readFile(path5, { encoding: "utf8" });
|
|
3107
|
-
},
|
|
3108
|
-
bun: async (path5) => {
|
|
3109
|
-
const file = Bun.file(path5);
|
|
3110
|
-
return file.text();
|
|
3111
|
-
}
|
|
3112
|
-
},
|
|
3113
|
-
"node"
|
|
3114
|
-
);
|
|
3115
|
-
switcher(
|
|
3116
|
-
{
|
|
3117
|
-
node: (path5) => {
|
|
3118
|
-
return import_fs_extra2.default.readFileSync(path5, { encoding: "utf8" });
|
|
3119
|
-
},
|
|
3120
|
-
bun: () => {
|
|
3121
|
-
throw new Error("Bun cannot read sync");
|
|
3122
|
-
}
|
|
3123
|
-
},
|
|
3124
|
-
"node"
|
|
3125
|
-
);
|
|
3126
|
-
async function read(path5) {
|
|
3127
|
-
return reader(path5);
|
|
3128
|
-
}
|
|
3129
|
-
|
|
3130
|
-
// src/utils/URLPath.ts
|
|
3131
|
-
init_esm_shims();
|
|
3132
|
-
|
|
3133
|
-
// src/transformers/index.ts
|
|
3134
|
-
init_esm_shims();
|
|
3135
|
-
|
|
3136
|
-
// src/transformers/casing.ts
|
|
3137
|
-
init_esm_shims();
|
|
3138
|
-
|
|
3139
|
-
// ../../node_modules/.pnpm/change-case@5.2.0/node_modules/change-case/dist/index.js
|
|
3140
|
-
init_esm_shims();
|
|
3141
|
-
var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
3142
|
-
var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
3143
|
-
var SPLIT_NUMBER_LOWER_RE = /(\d)(\p{Ll})/gu;
|
|
3144
|
-
var SPLIT_LETTER_NUMBER_RE = /(\p{L})(\d)/gu;
|
|
3145
|
-
var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
|
|
3146
|
-
var SPLIT_REPLACE_VALUE = "$1\0$2";
|
|
3147
|
-
var DEFAULT_PREFIX_CHARACTERS = "";
|
|
3148
|
-
function split(input, options) {
|
|
3149
|
-
let result = input.trim();
|
|
3150
|
-
result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
|
|
3151
|
-
if (options?.separateNumbers) {
|
|
3152
|
-
result = result.replace(SPLIT_NUMBER_LOWER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_LETTER_NUMBER_RE, SPLIT_REPLACE_VALUE);
|
|
3153
|
-
}
|
|
3154
|
-
result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
|
|
3155
|
-
let start = 0;
|
|
3156
|
-
let end = result.length;
|
|
3157
|
-
while (result.charAt(start) === "\0")
|
|
3158
|
-
start++;
|
|
3159
|
-
if (start === end)
|
|
3160
|
-
return [];
|
|
3161
|
-
while (result.charAt(end - 1) === "\0")
|
|
3162
|
-
end--;
|
|
3163
|
-
return result.slice(start, end).split(/\0/g);
|
|
3164
|
-
}
|
|
3165
|
-
function camelCase(input, options) {
|
|
3166
|
-
const prefix = getPrefix(input, options?.prefixCharacters);
|
|
3167
|
-
const lower = lowerFactory(options?.locale);
|
|
3168
|
-
const upper = upperFactory(options?.locale);
|
|
3169
|
-
const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
|
|
3170
|
-
return prefix + split(input, options).map((word, index) => {
|
|
3171
|
-
if (index === 0)
|
|
3172
|
-
return lower(word);
|
|
3173
|
-
return transform(word, index);
|
|
3174
|
-
}).join(options?.delimiter ?? "");
|
|
3175
|
-
}
|
|
3176
|
-
function pascalCase(input, options) {
|
|
3177
|
-
const prefix = getPrefix(input, options?.prefixCharacters);
|
|
3178
|
-
const lower = lowerFactory(options?.locale);
|
|
3179
|
-
const upper = upperFactory(options?.locale);
|
|
3180
|
-
const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
|
|
3181
|
-
return prefix + split(input, options).map(transform).join(options?.delimiter ?? "");
|
|
3182
|
-
}
|
|
3183
|
-
function lowerFactory(locale) {
|
|
3184
|
-
return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
|
|
3185
|
-
}
|
|
3186
|
-
function upperFactory(locale) {
|
|
3187
|
-
return locale === false ? (input) => input.toUpperCase() : (input) => input.toLocaleUpperCase(locale);
|
|
3188
|
-
}
|
|
3189
|
-
function capitalCaseTransformFactory(lower, upper) {
|
|
3190
|
-
return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
|
|
3191
|
-
}
|
|
3192
|
-
function pascalCaseTransformFactory(lower, upper) {
|
|
3193
|
-
return (word, index) => {
|
|
3194
|
-
const char0 = word[0];
|
|
3195
|
-
const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
|
|
3196
|
-
return initial + lower(word.slice(1));
|
|
3197
|
-
};
|
|
3198
|
-
}
|
|
3199
|
-
function getPrefix(input, prefixCharacters = DEFAULT_PREFIX_CHARACTERS) {
|
|
3200
|
-
let prefix = "";
|
|
3201
|
-
for (let i = 0; i < input.length; i++) {
|
|
3202
|
-
const char = input.charAt(i);
|
|
3203
|
-
if (prefixCharacters.includes(char)) {
|
|
3204
|
-
prefix += char;
|
|
3205
|
-
} else {
|
|
3206
|
-
break;
|
|
3207
|
-
}
|
|
3208
|
-
}
|
|
3209
|
-
return prefix;
|
|
3210
|
-
}
|
|
3211
|
-
|
|
3212
|
-
// src/transformers/casing.ts
|
|
3213
|
-
function camelCase2(text) {
|
|
3214
|
-
return camelCase(text, { delimiter: "", mergeAmbiguousCharacters: true });
|
|
3215
|
-
}
|
|
3216
|
-
function pascalCase2(text) {
|
|
3217
|
-
return pascalCase(text, { delimiter: "", mergeAmbiguousCharacters: true });
|
|
3218
|
-
}
|
|
3219
|
-
|
|
3220
|
-
// src/transformers/combineCodes.ts
|
|
3221
|
-
init_esm_shims();
|
|
3222
|
-
function combineCodes(codes) {
|
|
3223
|
-
return codes.join("\n");
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3226
|
-
// src/transformers/createJSDocBlockText.ts
|
|
3227
|
-
init_esm_shims();
|
|
3228
|
-
function createJSDocBlockText({ comments }) {
|
|
3229
|
-
const filteredComments = comments.filter(Boolean);
|
|
3230
|
-
if (!filteredComments.length) {
|
|
3231
|
-
return "";
|
|
3232
|
-
}
|
|
3233
|
-
return `/**
|
|
3234
|
-
* ${filteredComments.join("\n * ")}
|
|
3235
|
-
*/`;
|
|
3236
|
-
}
|
|
3237
|
-
|
|
3238
|
-
// src/transformers/escape.ts
|
|
3239
|
-
init_esm_shims();
|
|
3240
|
-
function escape(text) {
|
|
3241
|
-
return text ? text.replaceAll("`", "\\`") : "";
|
|
3242
|
-
}
|
|
3243
|
-
function jsStringEscape(input) {
|
|
3244
|
-
return `${input}`.replace(/["'\\\n\r\u2028\u2029]/g, (character) => {
|
|
3245
|
-
switch (character) {
|
|
3246
|
-
case '"':
|
|
3247
|
-
case "'":
|
|
3248
|
-
case "\\":
|
|
3249
|
-
return "\\" + character;
|
|
3250
|
-
case "\n":
|
|
3251
|
-
return "\\n";
|
|
3252
|
-
case "\r":
|
|
3253
|
-
return "\\r";
|
|
3254
|
-
case "\u2028":
|
|
3255
|
-
return "\\u2028";
|
|
3256
|
-
case "\u2029":
|
|
3257
|
-
return "\\u2029";
|
|
3258
|
-
default:
|
|
3259
|
-
return "";
|
|
3260
|
-
}
|
|
3261
|
-
});
|
|
3262
|
-
}
|
|
3263
|
-
|
|
3264
|
-
// src/transformers/indent.ts
|
|
3265
|
-
init_esm_shims();
|
|
3266
|
-
function createIndent(size) {
|
|
3267
|
-
return Array.from({ length: size + 1 }).join(" ");
|
|
3268
|
-
}
|
|
3269
|
-
|
|
3270
|
-
// src/transformers/nameSorter.ts
|
|
3271
|
-
init_esm_shims();
|
|
3272
|
-
function nameSorter(a, b2) {
|
|
3273
|
-
if (a.name < b2.name) {
|
|
3274
|
-
return -1;
|
|
3275
|
-
}
|
|
3276
|
-
if (a.name > b2.name) {
|
|
3277
|
-
return 1;
|
|
3278
|
-
}
|
|
3279
|
-
return 0;
|
|
3280
|
-
}
|
|
3281
|
-
|
|
3282
|
-
// src/transformers/searchAndReplace.ts
|
|
3283
|
-
init_esm_shims();
|
|
3284
|
-
function searchAndReplace(options) {
|
|
3285
|
-
const { text, replaceBy, prefix = "", key } = options;
|
|
3286
|
-
const searchValues = options.searchValues?.(prefix, key) || [
|
|
3287
|
-
`${prefix}["${key}"]`,
|
|
3288
|
-
`${prefix}['${key}']`,
|
|
3289
|
-
`${prefix}[\`${key}\`]`,
|
|
3290
|
-
`${prefix}"${key}"`,
|
|
3291
|
-
`${prefix}'${key}'`,
|
|
3292
|
-
`${prefix}\`${key}\``,
|
|
3293
|
-
new RegExp(`${prefix}${key}`, "g")
|
|
3294
|
-
];
|
|
3295
|
-
return searchValues.reduce((prev, searchValue) => {
|
|
3296
|
-
return prev.toString().replaceAll(searchValue, replaceBy);
|
|
3297
|
-
}, text);
|
|
3298
|
-
}
|
|
3299
|
-
|
|
3300
|
-
// src/transformers/transformReservedWord.ts
|
|
3301
|
-
init_esm_shims();
|
|
3302
|
-
var reservedWords = [
|
|
3303
|
-
"abstract",
|
|
3304
|
-
"arguments",
|
|
3305
|
-
"boolean",
|
|
3306
|
-
"break",
|
|
3307
|
-
"byte",
|
|
3308
|
-
"case",
|
|
3309
|
-
"catch",
|
|
3310
|
-
"char",
|
|
3311
|
-
"class",
|
|
3312
|
-
"const",
|
|
3313
|
-
"continue",
|
|
3314
|
-
"debugger",
|
|
3315
|
-
"default",
|
|
3316
|
-
"delete",
|
|
3317
|
-
"do",
|
|
3318
|
-
"double",
|
|
3319
|
-
"else",
|
|
3320
|
-
"enum",
|
|
3321
|
-
"eval",
|
|
3322
|
-
"export",
|
|
3323
|
-
"extends",
|
|
3324
|
-
"false",
|
|
3325
|
-
"final",
|
|
3326
|
-
"finally",
|
|
3327
|
-
"float",
|
|
3328
|
-
"for",
|
|
3329
|
-
"function",
|
|
3330
|
-
"goto",
|
|
3331
|
-
"if",
|
|
3332
|
-
"implements",
|
|
3333
|
-
"import",
|
|
3334
|
-
"in",
|
|
3335
|
-
"instanceof",
|
|
3336
|
-
"int",
|
|
3337
|
-
"interface",
|
|
3338
|
-
"let",
|
|
3339
|
-
"long",
|
|
3340
|
-
"native",
|
|
3341
|
-
"new",
|
|
3342
|
-
"null",
|
|
3343
|
-
"package",
|
|
3344
|
-
"private",
|
|
3345
|
-
"protected",
|
|
3346
|
-
"public",
|
|
3347
|
-
"return",
|
|
3348
|
-
"short",
|
|
3349
|
-
"static",
|
|
3350
|
-
"super",
|
|
3351
|
-
"switch",
|
|
3352
|
-
"synchronized",
|
|
3353
|
-
"this",
|
|
3354
|
-
"throw",
|
|
3355
|
-
"throws",
|
|
3356
|
-
"transient",
|
|
3357
|
-
"true",
|
|
3358
|
-
"try",
|
|
3359
|
-
"typeof",
|
|
3360
|
-
"var",
|
|
3361
|
-
"void",
|
|
3362
|
-
"volatile",
|
|
3363
|
-
"while",
|
|
3364
|
-
"with",
|
|
3365
|
-
"yield",
|
|
3366
|
-
"Array",
|
|
3367
|
-
"Date",
|
|
3368
|
-
"eval",
|
|
3369
|
-
"function",
|
|
3370
|
-
"hasOwnProperty",
|
|
3371
|
-
"Infinity",
|
|
3372
|
-
"isFinite",
|
|
3373
|
-
"isNaN",
|
|
3374
|
-
"isPrototypeOf",
|
|
3375
|
-
"length",
|
|
3376
|
-
"Math",
|
|
3377
|
-
"name",
|
|
3378
|
-
"NaN",
|
|
3379
|
-
"Number",
|
|
3380
|
-
"Object",
|
|
3381
|
-
"prototype",
|
|
3382
|
-
"String",
|
|
3383
|
-
"toString",
|
|
3384
|
-
"undefined",
|
|
3385
|
-
"valueOf"
|
|
3386
|
-
];
|
|
3387
|
-
function transformReservedWord(word) {
|
|
3388
|
-
if (word && reservedWords.includes(word) || word?.match(/^\d/)) {
|
|
3389
|
-
return `_${word}`;
|
|
3390
|
-
}
|
|
3391
|
-
return word;
|
|
3392
|
-
}
|
|
3393
|
-
|
|
3394
|
-
// src/transformers/trim.ts
|
|
3395
|
-
init_esm_shims();
|
|
3396
|
-
function trim(text) {
|
|
3397
|
-
return text.replaceAll(/\n/g, "").trim();
|
|
3398
|
-
}
|
|
3399
|
-
function trimExtName(text) {
|
|
3400
|
-
return text.replace(/\.[^/.]+$/, "");
|
|
3401
|
-
}
|
|
3402
|
-
|
|
3403
|
-
// src/transformers/index.ts
|
|
3404
|
-
var transformers_default = {
|
|
3405
|
-
combineCodes,
|
|
3406
|
-
escape,
|
|
3407
|
-
jsStringEscape,
|
|
3408
|
-
createIndent,
|
|
3409
|
-
transformReservedWord,
|
|
3410
|
-
nameSorter,
|
|
3411
|
-
searchAndReplace,
|
|
3412
|
-
trim,
|
|
3413
|
-
trimExtName,
|
|
3414
|
-
JSDoc: {
|
|
3415
|
-
createJSDocBlockText
|
|
3416
|
-
},
|
|
3417
|
-
camelCase: camelCase2,
|
|
3418
|
-
pascalCase: pascalCase2
|
|
3419
|
-
};
|
|
3420
|
-
|
|
3421
|
-
// src/utils/URLPath.ts
|
|
3422
|
-
var URLPath = class {
|
|
3423
|
-
constructor(path5) {
|
|
3424
|
-
this.path = path5;
|
|
3425
|
-
return this;
|
|
3426
|
-
}
|
|
3427
|
-
/**
|
|
3428
|
-
* Convert Swagger path to URLPath(syntax of Express)
|
|
3429
|
-
* @example /pet/{petId} => /pet/:petId
|
|
3430
|
-
*/
|
|
3431
|
-
get URL() {
|
|
3432
|
-
return this.toURLPath();
|
|
3433
|
-
}
|
|
3434
|
-
get isURL() {
|
|
3435
|
-
try {
|
|
3436
|
-
const url = new URL(this.path);
|
|
3437
|
-
if (url?.href) {
|
|
3438
|
-
return true;
|
|
672
|
+
try {
|
|
673
|
+
return func + "";
|
|
674
|
+
} catch (e) {
|
|
675
|
+
}
|
|
3439
676
|
}
|
|
3440
|
-
|
|
3441
|
-
return false;
|
|
677
|
+
return "";
|
|
3442
678
|
}
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
*/
|
|
3451
|
-
get template() {
|
|
3452
|
-
return this.toTemplateString();
|
|
3453
|
-
}
|
|
3454
|
-
get object() {
|
|
3455
|
-
return this.toObject();
|
|
3456
|
-
}
|
|
3457
|
-
get params() {
|
|
3458
|
-
return this.getParams();
|
|
3459
|
-
}
|
|
3460
|
-
toObject({ type = "path", replacer, stringify } = {}) {
|
|
3461
|
-
const object = {
|
|
3462
|
-
url: type === "path" ? this.toURLPath() : this.toTemplateString(replacer),
|
|
3463
|
-
params: this.getParams()
|
|
679
|
+
function eq(value, other) {
|
|
680
|
+
return value === other || value !== value && other !== other;
|
|
681
|
+
}
|
|
682
|
+
var isArguments = baseIsArguments(/* @__PURE__ */ function() {
|
|
683
|
+
return arguments;
|
|
684
|
+
}()) ? baseIsArguments : function(value) {
|
|
685
|
+
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
3464
686
|
};
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
687
|
+
var isArray = Array.isArray;
|
|
688
|
+
function isArrayLike(value) {
|
|
689
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
690
|
+
}
|
|
691
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
|
692
|
+
function isEqual2(value, other) {
|
|
693
|
+
return baseIsEqual(value, other);
|
|
694
|
+
}
|
|
695
|
+
function isFunction(value) {
|
|
696
|
+
if (!isObject(value)) {
|
|
697
|
+
return false;
|
|
3471
698
|
}
|
|
3472
|
-
|
|
699
|
+
var tag = baseGetTag(value);
|
|
700
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
3473
701
|
}
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
/**
|
|
3477
|
-
* Convert Swagger path to template literals/ template strings(camelcase)
|
|
3478
|
-
* @example /pet/{petId} => `/pet/${petId}`
|
|
3479
|
-
* @example /account/monetary-accountID => `/account/${monetaryAccountId}`
|
|
3480
|
-
* @example /account/userID => `/account/${userId}`
|
|
3481
|
-
*/
|
|
3482
|
-
toTemplateString(replacer) {
|
|
3483
|
-
const regex = /{(\w|-)*}/g;
|
|
3484
|
-
const found = this.path.match(regex);
|
|
3485
|
-
let newPath = this.path.replaceAll("{", "${");
|
|
3486
|
-
if (found) {
|
|
3487
|
-
newPath = found.reduce((prev, curr) => {
|
|
3488
|
-
const pathParam = replacer ? replacer(transformers_default.camelCase(curr)) : transformers_default.camelCase(curr);
|
|
3489
|
-
const replacement = `\${${pathParam}}`;
|
|
3490
|
-
return prev.replace(curr, replacement);
|
|
3491
|
-
}, this.path);
|
|
3492
|
-
}
|
|
3493
|
-
return `\`${newPath}\``;
|
|
3494
|
-
}
|
|
3495
|
-
getParams(replacer) {
|
|
3496
|
-
const regex = /{(\w|-)*}/g;
|
|
3497
|
-
const found = this.path.match(regex);
|
|
3498
|
-
if (!found) {
|
|
3499
|
-
return void 0;
|
|
702
|
+
function isLength(value) {
|
|
703
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
3500
704
|
}
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
705
|
+
function isObject(value) {
|
|
706
|
+
var type = typeof value;
|
|
707
|
+
return value != null && (type == "object" || type == "function");
|
|
708
|
+
}
|
|
709
|
+
function isObjectLike(value) {
|
|
710
|
+
return value != null && typeof value == "object";
|
|
711
|
+
}
|
|
712
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
713
|
+
function keys(object) {
|
|
714
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
715
|
+
}
|
|
716
|
+
function stubArray() {
|
|
717
|
+
return [];
|
|
718
|
+
}
|
|
719
|
+
function stubFalse() {
|
|
720
|
+
return false;
|
|
721
|
+
}
|
|
722
|
+
module.exports = isEqual2;
|
|
3515
723
|
}
|
|
3516
|
-
};
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
// src/index.ts
|
|
727
|
+
init_esm_shims();
|
|
728
|
+
|
|
729
|
+
// src/build.ts
|
|
730
|
+
init_esm_shims();
|
|
3517
731
|
|
|
3518
732
|
// src/config.ts
|
|
3519
733
|
init_esm_shims();
|
|
@@ -3528,80 +742,6 @@ function isInputPath(result) {
|
|
|
3528
742
|
init_esm_shims();
|
|
3529
743
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
3530
744
|
|
|
3531
|
-
// src/fs/write.ts
|
|
3532
|
-
init_esm_shims();
|
|
3533
|
-
var import_fs_extra3 = __toESM(require_lib(), 1);
|
|
3534
|
-
async function saveCreateDirectory(path5) {
|
|
3535
|
-
const passedPath = dirname(resolve(path5));
|
|
3536
|
-
await import_fs_extra3.default.mkdir(passedPath, { recursive: true });
|
|
3537
|
-
}
|
|
3538
|
-
var writer = switcher(
|
|
3539
|
-
{
|
|
3540
|
-
node: async (path5, data) => {
|
|
3541
|
-
try {
|
|
3542
|
-
await import_fs_extra3.default.stat(resolve(path5));
|
|
3543
|
-
const oldContent = await import_fs_extra3.default.readFile(resolve(path5), { encoding: "utf-8" });
|
|
3544
|
-
if (oldContent?.toString() === data?.toString()) {
|
|
3545
|
-
return;
|
|
3546
|
-
}
|
|
3547
|
-
} catch (_err) {
|
|
3548
|
-
}
|
|
3549
|
-
await saveCreateDirectory(path5);
|
|
3550
|
-
await import_fs_extra3.default.writeFile(resolve(path5), data, { encoding: "utf-8" });
|
|
3551
|
-
const savedData = await import_fs_extra3.default.readFile(resolve(path5), { encoding: "utf-8" });
|
|
3552
|
-
if (savedData?.toString() !== data?.toString()) {
|
|
3553
|
-
throw new Error(`Sanity check failed for ${path5}
|
|
3554
|
-
|
|
3555
|
-
Data[${data.length}]:
|
|
3556
|
-
${data}
|
|
3557
|
-
|
|
3558
|
-
Saved[${savedData.length}]:
|
|
3559
|
-
${savedData}
|
|
3560
|
-
`);
|
|
3561
|
-
}
|
|
3562
|
-
return savedData;
|
|
3563
|
-
},
|
|
3564
|
-
bun: async (path5, data) => {
|
|
3565
|
-
try {
|
|
3566
|
-
await saveCreateDirectory(path5);
|
|
3567
|
-
await Bun.write(resolve(path5), data);
|
|
3568
|
-
const file = Bun.file(resolve(path5));
|
|
3569
|
-
const savedData = await file.text();
|
|
3570
|
-
if (savedData?.toString() !== data?.toString()) {
|
|
3571
|
-
throw new Error(`Sanity check failed for ${path5}
|
|
3572
|
-
|
|
3573
|
-
Data[${data.length}]:
|
|
3574
|
-
${data}
|
|
3575
|
-
|
|
3576
|
-
Saved[${savedData.length}]:
|
|
3577
|
-
${savedData}
|
|
3578
|
-
`);
|
|
3579
|
-
}
|
|
3580
|
-
return savedData;
|
|
3581
|
-
} catch (e) {
|
|
3582
|
-
console.log(e, resolve(path5));
|
|
3583
|
-
}
|
|
3584
|
-
}
|
|
3585
|
-
},
|
|
3586
|
-
"node"
|
|
3587
|
-
);
|
|
3588
|
-
async function write(data, path5) {
|
|
3589
|
-
if (data.trim() === "") {
|
|
3590
|
-
return void 0;
|
|
3591
|
-
}
|
|
3592
|
-
return writer(path5, data.trim());
|
|
3593
|
-
}
|
|
3594
|
-
|
|
3595
|
-
// src/utils/timeout.ts
|
|
3596
|
-
init_esm_shims();
|
|
3597
|
-
async function timeout(ms) {
|
|
3598
|
-
return new Promise((resolve3) => {
|
|
3599
|
-
setTimeout(() => {
|
|
3600
|
-
resolve3(true);
|
|
3601
|
-
}, ms);
|
|
3602
|
-
});
|
|
3603
|
-
}
|
|
3604
|
-
|
|
3605
745
|
// src/BarrelManager.ts
|
|
3606
746
|
init_esm_shims();
|
|
3607
747
|
|
|
@@ -3669,10 +809,10 @@ var TreeNode = class _TreeNode {
|
|
|
3669
809
|
}
|
|
3670
810
|
return this;
|
|
3671
811
|
}
|
|
3672
|
-
static build(
|
|
812
|
+
static build(path3, options = {}) {
|
|
3673
813
|
try {
|
|
3674
814
|
const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean);
|
|
3675
|
-
const filteredTree = dirTree(
|
|
815
|
+
const filteredTree = dirTree(path3, { extensions: options.extensions, exclude: [/node_modules/, ...exclude] });
|
|
3676
816
|
if (!filteredTree) {
|
|
3677
817
|
return null;
|
|
3678
818
|
}
|
|
@@ -3712,9 +852,9 @@ var BarrelManager = class {
|
|
|
3712
852
|
return [];
|
|
3713
853
|
}
|
|
3714
854
|
if (treeNode2.children.length > 1) {
|
|
3715
|
-
const indexPath =
|
|
855
|
+
const indexPath = path.resolve(treeNode2.data.path, "index.ts");
|
|
3716
856
|
const exports = treeNode2.children.filter(Boolean).map((file) => {
|
|
3717
|
-
const importPath = file.data.type === "directory" ? `./${file.data.name}/index` : `./${
|
|
857
|
+
const importPath = file.data.type === "directory" ? `./${file.data.name}/index` : `./${trimExtName(file.data.name)}`;
|
|
3718
858
|
if (importPath.endsWith("index") && file.data.type === "file") {
|
|
3719
859
|
return void 0;
|
|
3720
860
|
}
|
|
@@ -3734,8 +874,8 @@ var BarrelManager = class {
|
|
|
3734
874
|
});
|
|
3735
875
|
} else if (treeNode2.children.length === 1) {
|
|
3736
876
|
const [treeNodeChild] = treeNode2.children;
|
|
3737
|
-
const indexPath =
|
|
3738
|
-
const importPath = treeNodeChild.data.type === "directory" ? `./${treeNodeChild.data.name}/index` : `./${
|
|
877
|
+
const indexPath = path.resolve(treeNode2.data.path, "index.ts");
|
|
878
|
+
const importPath = treeNodeChild.data.type === "directory" ? `./${treeNodeChild.data.name}/index` : `./${trimExtName(treeNodeChild.data.name)}`;
|
|
3739
879
|
const exports = [
|
|
3740
880
|
{
|
|
3741
881
|
path: extName ? `${importPath}${extName}` : importPath,
|
|
@@ -3766,25 +906,16 @@ _options = new WeakMap();
|
|
|
3766
906
|
var KubbFile;
|
|
3767
907
|
((KubbFile2) => {
|
|
3768
908
|
})(KubbFile || (KubbFile = {}));
|
|
3769
|
-
var _cache, _task,
|
|
909
|
+
var _cache, _task, _queue, _add, add_fn, _addOrAppend, addOrAppend_fn;
|
|
3770
910
|
var _FileManager = class _FileManager {
|
|
3771
|
-
constructor(
|
|
3772
|
-
__privateAdd(this, _validate);
|
|
911
|
+
constructor({ task = async (file) => file, queue = new PQueue() } = {}) {
|
|
3773
912
|
__privateAdd(this, _add);
|
|
3774
913
|
__privateAdd(this, _addOrAppend);
|
|
3775
914
|
__privateAdd(this, _cache, /* @__PURE__ */ new Map());
|
|
3776
915
|
__privateAdd(this, _task, void 0);
|
|
3777
|
-
__privateAdd(this, _isWriting, false);
|
|
3778
|
-
/**
|
|
3779
|
-
* Timeout between writes
|
|
3780
|
-
*/
|
|
3781
|
-
__privateAdd(this, _timeout, 0);
|
|
3782
916
|
__privateAdd(this, _queue, void 0);
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
__privateSet(this, _queue, options.queue);
|
|
3786
|
-
__privateSet(this, _timeout, options.timeout || 0);
|
|
3787
|
-
}
|
|
917
|
+
__privateSet(this, _task, task);
|
|
918
|
+
__privateSet(this, _queue, queue);
|
|
3788
919
|
return this;
|
|
3789
920
|
}
|
|
3790
921
|
get files() {
|
|
@@ -3795,10 +926,10 @@ var _FileManager = class _FileManager {
|
|
|
3795
926
|
return files;
|
|
3796
927
|
}
|
|
3797
928
|
get isExecuting() {
|
|
3798
|
-
return __privateGet(this, _queue)
|
|
929
|
+
return __privateGet(this, _queue).size !== 0 && __privateGet(this, _queue).pending !== 0;
|
|
3799
930
|
}
|
|
3800
931
|
async add(...files) {
|
|
3801
|
-
const promises = files.map((file) => {
|
|
932
|
+
const promises = combineFiles(files).map((file) => {
|
|
3802
933
|
if (file.override) {
|
|
3803
934
|
return __privateMethod(this, _add, add_fn).call(this, file);
|
|
3804
935
|
}
|
|
@@ -3815,7 +946,7 @@ var _FileManager = class _FileManager {
|
|
|
3815
946
|
if (!exportType) {
|
|
3816
947
|
return void 0;
|
|
3817
948
|
}
|
|
3818
|
-
const exportPath = output.path.startsWith("./") ? output.path : `./${output.path}`;
|
|
949
|
+
const exportPath = output.path.startsWith("./") ? trimExtName(output.path) : `./${trimExtName(output.path)}`;
|
|
3819
950
|
const barrelManager = new BarrelManager({ extName: output.extName, ...options });
|
|
3820
951
|
const files = barrelManager.getIndexes(resolve(root, output.path));
|
|
3821
952
|
if (!files) {
|
|
@@ -3829,10 +960,10 @@ var _FileManager = class _FileManager {
|
|
|
3829
960
|
output.exportAs ? {
|
|
3830
961
|
name: output.exportAs,
|
|
3831
962
|
asAlias: true,
|
|
3832
|
-
path: exportPath,
|
|
963
|
+
path: output.extName ? `${exportPath}${output.extName}` : exportPath,
|
|
3833
964
|
isTypeOnly: options.isTypeOnly
|
|
3834
965
|
} : {
|
|
3835
|
-
path: exportPath,
|
|
966
|
+
path: output.extName ? `${exportPath}${output.extName}` : exportPath,
|
|
3836
967
|
isTypeOnly: options.isTypeOnly
|
|
3837
968
|
}
|
|
3838
969
|
]
|
|
@@ -3857,25 +988,18 @@ var _FileManager = class _FileManager {
|
|
|
3857
988
|
});
|
|
3858
989
|
return cache;
|
|
3859
990
|
}
|
|
3860
|
-
get(
|
|
3861
|
-
return __privateGet(this, _cache).get(
|
|
991
|
+
get(path3) {
|
|
992
|
+
return __privateGet(this, _cache).get(path3);
|
|
3862
993
|
}
|
|
3863
|
-
remove(
|
|
3864
|
-
const cacheItem = this.get(
|
|
994
|
+
remove(path3) {
|
|
995
|
+
const cacheItem = this.get(path3);
|
|
3865
996
|
if (!cacheItem) {
|
|
3866
997
|
return;
|
|
3867
998
|
}
|
|
3868
|
-
__privateGet(this, _cache).delete(
|
|
999
|
+
__privateGet(this, _cache).delete(path3);
|
|
3869
1000
|
}
|
|
3870
1001
|
async write(...params) {
|
|
3871
|
-
|
|
3872
|
-
__privateSet(this, _isWriting, true);
|
|
3873
|
-
const text = await write(...params);
|
|
3874
|
-
__privateSet(this, _isWriting, false);
|
|
3875
|
-
return text;
|
|
3876
|
-
}
|
|
3877
|
-
await timeout(__privateGet(this, _timeout));
|
|
3878
|
-
return this.write(...params);
|
|
1002
|
+
return write(...params);
|
|
3879
1003
|
}
|
|
3880
1004
|
async read(...params) {
|
|
3881
1005
|
return read(...params);
|
|
@@ -3884,11 +1008,14 @@ var _FileManager = class _FileManager {
|
|
|
3884
1008
|
static getSource(file) {
|
|
3885
1009
|
return getSource(file);
|
|
3886
1010
|
}
|
|
3887
|
-
static
|
|
3888
|
-
|
|
1011
|
+
static combineFiles(files) {
|
|
1012
|
+
return combineFiles(files);
|
|
1013
|
+
}
|
|
1014
|
+
static getMode(path3) {
|
|
1015
|
+
if (!path3) {
|
|
3889
1016
|
return "directory";
|
|
3890
1017
|
}
|
|
3891
|
-
return extname(
|
|
1018
|
+
return extname(path3) ? "file" : "directory";
|
|
3892
1019
|
}
|
|
3893
1020
|
static get extensions() {
|
|
3894
1021
|
return [".js", ".ts", ".tsx"];
|
|
@@ -3899,25 +1026,19 @@ var _FileManager = class _FileManager {
|
|
|
3899
1026
|
};
|
|
3900
1027
|
_cache = new WeakMap();
|
|
3901
1028
|
_task = new WeakMap();
|
|
3902
|
-
_isWriting = new WeakMap();
|
|
3903
|
-
_timeout = new WeakMap();
|
|
3904
1029
|
_queue = new WeakMap();
|
|
3905
|
-
_validate = new WeakSet();
|
|
3906
1030
|
_add = new WeakSet();
|
|
3907
1031
|
add_fn = async function(file) {
|
|
3908
1032
|
const controller = new AbortController();
|
|
3909
|
-
const resolvedFile = { id:
|
|
1033
|
+
const resolvedFile = { id: crypto.randomUUID(), name: trimExtName(file.baseName), ...file };
|
|
3910
1034
|
__privateGet(this, _cache).set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }]);
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
);
|
|
3919
|
-
}
|
|
3920
|
-
return resolvedFile;
|
|
1035
|
+
return __privateGet(this, _queue).add(
|
|
1036
|
+
async () => {
|
|
1037
|
+
var _a;
|
|
1038
|
+
return (_a = __privateGet(this, _task)) == null ? void 0 : _a.call(this, resolvedFile);
|
|
1039
|
+
},
|
|
1040
|
+
{ signal: controller.signal }
|
|
1041
|
+
);
|
|
3921
1042
|
};
|
|
3922
1043
|
_addOrAppend = new WeakSet();
|
|
3923
1044
|
addOrAppend_fn = async function(file) {
|
|
@@ -3937,6 +1058,34 @@ ${file.source}` : "",
|
|
|
3937
1058
|
return __privateMethod(this, _add, add_fn).call(this, file);
|
|
3938
1059
|
};
|
|
3939
1060
|
var FileManager = _FileManager;
|
|
1061
|
+
function combineFiles(files) {
|
|
1062
|
+
return files.filter(Boolean).reduce((acc, file) => {
|
|
1063
|
+
const prevIndex = acc.findIndex((item) => item.path === file.path);
|
|
1064
|
+
if (prevIndex === -1) {
|
|
1065
|
+
return [...acc, file];
|
|
1066
|
+
}
|
|
1067
|
+
const prev = acc[prevIndex];
|
|
1068
|
+
if (prev && file.override) {
|
|
1069
|
+
acc[prevIndex] = {
|
|
1070
|
+
imports: [],
|
|
1071
|
+
exports: [],
|
|
1072
|
+
...file
|
|
1073
|
+
};
|
|
1074
|
+
return acc;
|
|
1075
|
+
}
|
|
1076
|
+
if (prev) {
|
|
1077
|
+
acc[prevIndex] = {
|
|
1078
|
+
...file,
|
|
1079
|
+
source: prev.source && file.source ? `${prev.source}
|
|
1080
|
+
${file.source}` : "",
|
|
1081
|
+
imports: [...prev.imports || [], ...file.imports || []],
|
|
1082
|
+
exports: [...prev.exports || [], ...file.exports || []],
|
|
1083
|
+
env: { ...prev.env || {}, ...file.env || {} }
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
return acc;
|
|
1087
|
+
}, []);
|
|
1088
|
+
}
|
|
3940
1089
|
function getSource(file) {
|
|
3941
1090
|
if (!FileManager.isExtensionAllowed(file.baseName)) {
|
|
3942
1091
|
return file.source;
|
|
@@ -3944,7 +1093,7 @@ function getSource(file) {
|
|
|
3944
1093
|
const exports = file.exports ? combineExports(file.exports) : [];
|
|
3945
1094
|
const imports = file.imports ? combineImports(file.imports, exports, file.source) : [];
|
|
3946
1095
|
const importNodes = imports.filter((item) => {
|
|
3947
|
-
return item.path !==
|
|
1096
|
+
return item.path !== trimExtName(file.path);
|
|
3948
1097
|
}).map((item) => {
|
|
3949
1098
|
return factory.createImportDeclaration({
|
|
3950
1099
|
name: item.name,
|
|
@@ -4050,85 +1199,14 @@ function getEnvSource(source, env) {
|
|
|
4050
1199
|
throw new TypeError(`Environment should be in upperCase for ${key}`);
|
|
4051
1200
|
}
|
|
4052
1201
|
if (typeof replaceBy === "string") {
|
|
4053
|
-
prev =
|
|
4054
|
-
prev =
|
|
1202
|
+
prev = searchAndReplace({ text: prev.replaceAll(`process.env.${key}`, replaceBy), replaceBy, prefix: "process.env", key });
|
|
1203
|
+
prev = searchAndReplace({ text: prev.replaceAll(new RegExp(`(declare const).*
|
|
4055
1204
|
`, "ig"), ""), replaceBy, key });
|
|
4056
1205
|
}
|
|
4057
1206
|
return prev;
|
|
4058
1207
|
}, source);
|
|
4059
1208
|
}
|
|
4060
1209
|
|
|
4061
|
-
// src/logger.ts
|
|
4062
|
-
init_esm_shims();
|
|
4063
|
-
var LogLevel = {
|
|
4064
|
-
silent: "silent",
|
|
4065
|
-
info: "info",
|
|
4066
|
-
debug: "debug"
|
|
4067
|
-
};
|
|
4068
|
-
function createLogger({ logLevel, name, spinner }) {
|
|
4069
|
-
const logs = [];
|
|
4070
|
-
const log = (message) => {
|
|
4071
|
-
if (message && spinner) {
|
|
4072
|
-
spinner.text = message;
|
|
4073
|
-
logs.push(message);
|
|
4074
|
-
}
|
|
4075
|
-
};
|
|
4076
|
-
const error = (message) => {
|
|
4077
|
-
if (message) {
|
|
4078
|
-
throw new Error(message || "Something went wrong");
|
|
4079
|
-
}
|
|
4080
|
-
};
|
|
4081
|
-
const warn = (message) => {
|
|
4082
|
-
if (message && spinner) {
|
|
4083
|
-
spinner.warn(p2.yellow(message));
|
|
4084
|
-
logs.push(message);
|
|
4085
|
-
}
|
|
4086
|
-
};
|
|
4087
|
-
const info = (message) => {
|
|
4088
|
-
if (message && spinner && logLevel !== LogLevel.silent) {
|
|
4089
|
-
spinner.info(message);
|
|
4090
|
-
logs.push(message);
|
|
4091
|
-
}
|
|
4092
|
-
};
|
|
4093
|
-
const logger = {
|
|
4094
|
-
name,
|
|
4095
|
-
logLevel,
|
|
4096
|
-
log,
|
|
4097
|
-
error,
|
|
4098
|
-
warn,
|
|
4099
|
-
info,
|
|
4100
|
-
spinner,
|
|
4101
|
-
logs
|
|
4102
|
-
};
|
|
4103
|
-
return logger;
|
|
4104
|
-
}
|
|
4105
|
-
var defaultColours = ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"];
|
|
4106
|
-
function randomColour(text, colours = defaultColours) {
|
|
4107
|
-
if (!text) {
|
|
4108
|
-
return "white";
|
|
4109
|
-
}
|
|
4110
|
-
const random = seedrandom(text);
|
|
4111
|
-
const colour = colours.at(Math.floor(random() * colours.length)) || "white";
|
|
4112
|
-
return colour;
|
|
4113
|
-
}
|
|
4114
|
-
function randomCliColour(text, colors = defaultColours) {
|
|
4115
|
-
const colours = w(true);
|
|
4116
|
-
if (!text) {
|
|
4117
|
-
return colours.white(text);
|
|
4118
|
-
}
|
|
4119
|
-
const colour = randomColour(text, colors);
|
|
4120
|
-
const isDark = colour.includes("dark");
|
|
4121
|
-
const key = colour.replace("dark", "").toLowerCase();
|
|
4122
|
-
const formatter = colours[key];
|
|
4123
|
-
if (isDark) {
|
|
4124
|
-
return p2.bold(formatter(text));
|
|
4125
|
-
}
|
|
4126
|
-
if (typeof formatter !== "function") {
|
|
4127
|
-
throw new Error("Formatter for picoColor is not of type function/Formatter");
|
|
4128
|
-
}
|
|
4129
|
-
return formatter(text);
|
|
4130
|
-
}
|
|
4131
|
-
|
|
4132
1210
|
// src/PluginManager.ts
|
|
4133
1211
|
init_esm_shims();
|
|
4134
1212
|
|
|
@@ -4155,91 +1233,6 @@ var EventEmitter = class {
|
|
|
4155
1233
|
};
|
|
4156
1234
|
_emitter = new WeakMap();
|
|
4157
1235
|
|
|
4158
|
-
// src/utils/Queue.ts
|
|
4159
|
-
init_esm_shims();
|
|
4160
|
-
var _queue2, _workerCount, _maxParallel, _debug, _work, work_fn;
|
|
4161
|
-
var Queue = class {
|
|
4162
|
-
constructor(maxParallel, debug = false) {
|
|
4163
|
-
__privateAdd(this, _work);
|
|
4164
|
-
__privateAdd(this, _queue2, []);
|
|
4165
|
-
this.eventEmitter = new EventEmitter();
|
|
4166
|
-
__privateAdd(this, _workerCount, 0);
|
|
4167
|
-
__privateAdd(this, _maxParallel, void 0);
|
|
4168
|
-
__privateAdd(this, _debug, false);
|
|
4169
|
-
__privateSet(this, _maxParallel, maxParallel);
|
|
4170
|
-
__privateSet(this, _debug, debug);
|
|
4171
|
-
}
|
|
4172
|
-
run(job, options = { controller: new AbortController(), name: crypto2.randomUUID(), description: "" }) {
|
|
4173
|
-
return new Promise((resolve3, reject) => {
|
|
4174
|
-
const item = { reject, resolve: resolve3, job, name: options.name, description: options.description || options.name };
|
|
4175
|
-
options.controller?.signal.addEventListener("abort", () => {
|
|
4176
|
-
__privateSet(this, _queue2, __privateGet(this, _queue2).filter((queueItem) => queueItem.name === item.name));
|
|
4177
|
-
reject("Aborted");
|
|
4178
|
-
});
|
|
4179
|
-
__privateGet(this, _queue2).push(item);
|
|
4180
|
-
__privateMethod(this, _work, work_fn).call(this);
|
|
4181
|
-
});
|
|
4182
|
-
}
|
|
4183
|
-
runSync(job, options = { controller: new AbortController(), name: crypto2.randomUUID(), description: "" }) {
|
|
4184
|
-
new Promise((resolve3, reject) => {
|
|
4185
|
-
const item = { reject, resolve: resolve3, job, name: options.name, description: options.description || options.name };
|
|
4186
|
-
options.controller?.signal.addEventListener("abort", () => {
|
|
4187
|
-
__privateSet(this, _queue2, __privateGet(this, _queue2).filter((queueItem) => queueItem.name === item.name));
|
|
4188
|
-
});
|
|
4189
|
-
__privateGet(this, _queue2).push(item);
|
|
4190
|
-
__privateMethod(this, _work, work_fn).call(this);
|
|
4191
|
-
});
|
|
4192
|
-
}
|
|
4193
|
-
get hasJobs() {
|
|
4194
|
-
return __privateGet(this, _workerCount) > 0 || __privateGet(this, _queue2).length > 0;
|
|
4195
|
-
}
|
|
4196
|
-
get count() {
|
|
4197
|
-
return __privateGet(this, _workerCount);
|
|
4198
|
-
}
|
|
4199
|
-
};
|
|
4200
|
-
_queue2 = new WeakMap();
|
|
4201
|
-
_workerCount = new WeakMap();
|
|
4202
|
-
_maxParallel = new WeakMap();
|
|
4203
|
-
_debug = new WeakMap();
|
|
4204
|
-
_work = new WeakSet();
|
|
4205
|
-
work_fn = function() {
|
|
4206
|
-
if (__privateGet(this, _workerCount) >= __privateGet(this, _maxParallel)) {
|
|
4207
|
-
return;
|
|
4208
|
-
}
|
|
4209
|
-
__privateWrapper(this, _workerCount)._++;
|
|
4210
|
-
let entry;
|
|
4211
|
-
while (entry = __privateGet(this, _queue2).shift()) {
|
|
4212
|
-
const { reject, resolve: resolve3, job, name, description } = entry;
|
|
4213
|
-
if (__privateGet(this, _debug)) {
|
|
4214
|
-
performance.mark(name + "_start");
|
|
4215
|
-
}
|
|
4216
|
-
job().then((result) => {
|
|
4217
|
-
this.eventEmitter.emit("jobDone", result);
|
|
4218
|
-
resolve3(result);
|
|
4219
|
-
if (__privateGet(this, _debug)) {
|
|
4220
|
-
performance.mark(name + "_stop");
|
|
4221
|
-
performance.measure(description, name + "_start", name + "_stop");
|
|
4222
|
-
}
|
|
4223
|
-
}).catch((err) => {
|
|
4224
|
-
this.eventEmitter.emit("jobFailed", err);
|
|
4225
|
-
reject(err);
|
|
4226
|
-
});
|
|
4227
|
-
}
|
|
4228
|
-
__privateWrapper(this, _workerCount)._--;
|
|
4229
|
-
};
|
|
4230
|
-
|
|
4231
|
-
// src/utils/uniqueName.ts
|
|
4232
|
-
init_esm_shims();
|
|
4233
|
-
function setUniqueName(originalName, data) {
|
|
4234
|
-
let used = data[originalName] || 0;
|
|
4235
|
-
if (used) {
|
|
4236
|
-
data[originalName] = ++used;
|
|
4237
|
-
return originalName;
|
|
4238
|
-
}
|
|
4239
|
-
data[originalName] = 1;
|
|
4240
|
-
return originalName;
|
|
4241
|
-
}
|
|
4242
|
-
|
|
4243
1236
|
// src/errors.ts
|
|
4244
1237
|
init_esm_shims();
|
|
4245
1238
|
var Warning = class extends Error {
|
|
@@ -4323,8 +1316,8 @@ var definePlugin = createPlugin((options) => {
|
|
|
4323
1316
|
};
|
|
4324
1317
|
},
|
|
4325
1318
|
resolvePath(baseName) {
|
|
4326
|
-
const root =
|
|
4327
|
-
return
|
|
1319
|
+
const root = path.resolve(this.config.root, this.config.output.path);
|
|
1320
|
+
return path.resolve(root, baseName);
|
|
4328
1321
|
},
|
|
4329
1322
|
resolveName(name) {
|
|
4330
1323
|
return name;
|
|
@@ -4436,7 +1429,7 @@ var PluginManager = class {
|
|
|
4436
1429
|
parameters: [params.baseName, params.directory, params.options]
|
|
4437
1430
|
});
|
|
4438
1431
|
if (paths && paths?.length > 1 && this.logger.logLevel === LogLevel.debug) {
|
|
4439
|
-
this.logger.
|
|
1432
|
+
this.logger.debug(
|
|
4440
1433
|
`Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
|
|
4441
1434
|
|
|
4442
1435
|
Paths: ${JSON.stringify(paths, void 0, 2)}
|
|
@@ -4460,7 +1453,7 @@ Falling back on the first item.
|
|
|
4460
1453
|
parameters: [params.name, params.type]
|
|
4461
1454
|
});
|
|
4462
1455
|
if (names && names?.length > 1 && this.logger.logLevel === LogLevel.debug) {
|
|
4463
|
-
this.logger.
|
|
1456
|
+
this.logger.debug(
|
|
4464
1457
|
`Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
|
|
4465
1458
|
|
|
4466
1459
|
Names: ${JSON.stringify(names, void 0, 2)}
|
|
@@ -4479,8 +1472,8 @@ Falling back on the first item.
|
|
|
4479
1472
|
};
|
|
4480
1473
|
this.config = config;
|
|
4481
1474
|
this.logger = options.logger;
|
|
4482
|
-
this.queue = new
|
|
4483
|
-
this.fileManager = new FileManager({ task: options.task, queue: this.queue
|
|
1475
|
+
this.queue = new PQueue({ concurrency: 1 });
|
|
1476
|
+
this.fileManager = new FileManager({ task: options.task, queue: this.queue });
|
|
4484
1477
|
__privateSet(this, _promiseManager, new PromiseManager({ nullCheck: (state) => !!state?.result }));
|
|
4485
1478
|
const plugins = config.plugins || [];
|
|
4486
1479
|
const core = definePlugin({
|
|
@@ -4669,9 +1662,9 @@ Falling back on the first item.
|
|
|
4669
1662
|
const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
|
|
4670
1663
|
if (this.logger.logLevel === LogLevel.debug) {
|
|
4671
1664
|
if (corePlugin) {
|
|
4672
|
-
this.logger.
|
|
1665
|
+
this.logger.debug(`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`);
|
|
4673
1666
|
} else {
|
|
4674
|
-
this.logger.
|
|
1667
|
+
this.logger.debug(`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`);
|
|
4675
1668
|
}
|
|
4676
1669
|
}
|
|
4677
1670
|
return corePlugin ? [corePlugin] : [];
|
|
@@ -4721,11 +1714,11 @@ getSortedPlugins_fn = function(hookName) {
|
|
|
4721
1714
|
}
|
|
4722
1715
|
}
|
|
4723
1716
|
return plugin;
|
|
4724
|
-
}).sort((a,
|
|
4725
|
-
if (
|
|
1717
|
+
}).sort((a, b) => {
|
|
1718
|
+
if (b.pre?.includes(a.name)) {
|
|
4726
1719
|
return 1;
|
|
4727
1720
|
}
|
|
4728
|
-
if (
|
|
1721
|
+
if (b.post?.includes(a.name)) {
|
|
4729
1722
|
return -1;
|
|
4730
1723
|
}
|
|
4731
1724
|
return 0;
|
|
@@ -4821,9 +1814,6 @@ parse_fn = function(plugin, pluginManager, context) {
|
|
|
4821
1814
|
const usedPluginNames = __privateGet(pluginManager, _usedPluginNames);
|
|
4822
1815
|
setUniqueName(plugin.name, usedPluginNames);
|
|
4823
1816
|
const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
|
|
4824
|
-
if (plugin.name !== "core" && usedPluginNames[plugin.name] >= 2) {
|
|
4825
|
-
pluginManager.logger.warn("Using multiple of the same plugin is an experimental feature");
|
|
4826
|
-
}
|
|
4827
1817
|
if (!plugin.transform) {
|
|
4828
1818
|
plugin.transform = function transform(code) {
|
|
4829
1819
|
return code;
|
|
@@ -4849,6 +1839,7 @@ async function transformReducer(_previousCode, result, _plugin) {
|
|
|
4849
1839
|
}
|
|
4850
1840
|
async function setup(options) {
|
|
4851
1841
|
const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options;
|
|
1842
|
+
let count = 0;
|
|
4852
1843
|
try {
|
|
4853
1844
|
if (isInputPath(config) && !new URLPath(config.input.path).isURL) {
|
|
4854
1845
|
await read(config.input.path);
|
|
@@ -4856,7 +1847,7 @@ async function setup(options) {
|
|
|
4856
1847
|
} catch (e) {
|
|
4857
1848
|
if (isInputPath(config)) {
|
|
4858
1849
|
throw new Error(
|
|
4859
|
-
"Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " +
|
|
1850
|
+
"Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " + p.dim(config.input.path),
|
|
4860
1851
|
{
|
|
4861
1852
|
cause: e
|
|
4862
1853
|
}
|
|
@@ -4866,76 +1857,95 @@ async function setup(options) {
|
|
|
4866
1857
|
if (config.output.clean) {
|
|
4867
1858
|
await clean(config.output.path);
|
|
4868
1859
|
}
|
|
4869
|
-
const
|
|
4870
|
-
const { path:
|
|
4871
|
-
let
|
|
1860
|
+
const task = async (file) => {
|
|
1861
|
+
const { path: path3 } = file;
|
|
1862
|
+
let source = FileManager.getSource(file);
|
|
4872
1863
|
const { result: loadedResult } = await pluginManager.hookFirst({
|
|
4873
1864
|
hookName: "load",
|
|
4874
|
-
parameters: [
|
|
1865
|
+
parameters: [path3]
|
|
4875
1866
|
});
|
|
4876
1867
|
if (loadedResult && isPromise(loadedResult)) {
|
|
4877
|
-
|
|
1868
|
+
source = await loadedResult;
|
|
4878
1869
|
}
|
|
4879
1870
|
if (loadedResult && !isPromise(loadedResult)) {
|
|
4880
|
-
|
|
1871
|
+
source = loadedResult;
|
|
4881
1872
|
}
|
|
4882
|
-
if (
|
|
4883
|
-
|
|
1873
|
+
if (source) {
|
|
1874
|
+
source = await pluginManager.hookReduceArg0({
|
|
4884
1875
|
hookName: "transform",
|
|
4885
|
-
parameters: [
|
|
1876
|
+
parameters: [source, path3],
|
|
4886
1877
|
reduce: transformReducer
|
|
4887
1878
|
});
|
|
4888
1879
|
if (config.output.write || config.output.write === void 0) {
|
|
4889
1880
|
if (file.meta?.pluginKey) {
|
|
4890
|
-
|
|
1881
|
+
await pluginManager.hookForPlugin({
|
|
4891
1882
|
pluginKey: file.meta?.pluginKey,
|
|
4892
1883
|
hookName: "writeFile",
|
|
4893
|
-
parameters: [
|
|
1884
|
+
parameters: [source, path3]
|
|
4894
1885
|
});
|
|
4895
1886
|
}
|
|
4896
|
-
|
|
1887
|
+
await pluginManager.hookFirst({
|
|
4897
1888
|
hookName: "writeFile",
|
|
4898
|
-
parameters: [
|
|
1889
|
+
parameters: [source, path3]
|
|
4899
1890
|
});
|
|
4900
1891
|
}
|
|
4901
1892
|
}
|
|
1893
|
+
return {
|
|
1894
|
+
...file,
|
|
1895
|
+
source: source || ""
|
|
1896
|
+
};
|
|
4902
1897
|
};
|
|
4903
|
-
const pluginManager = new PluginManager(config, { logger, task
|
|
1898
|
+
const pluginManager = new PluginManager(config, { logger, task });
|
|
4904
1899
|
pluginManager.on("execute", (executer) => {
|
|
4905
1900
|
const { hookName, parameters, plugin } = executer;
|
|
4906
1901
|
if (hookName === "writeFile" && logger.spinner) {
|
|
4907
1902
|
const [code] = parameters;
|
|
4908
|
-
if (logger.logLevel === LogLevel.info) {
|
|
4909
|
-
logger.spinner.start(`\u{1F4BE} Writing`);
|
|
4910
|
-
}
|
|
4911
1903
|
if (logger.logLevel === LogLevel.debug) {
|
|
4912
|
-
logger.
|
|
1904
|
+
logger.debug(`PluginKey ${p.dim(JSON.stringify(plugin.key))}
|
|
4913
1905
|
with source
|
|
4914
1906
|
|
|
4915
1907
|
${code}`);
|
|
4916
1908
|
}
|
|
4917
1909
|
}
|
|
4918
1910
|
});
|
|
1911
|
+
pluginManager.queue.on("add", () => {
|
|
1912
|
+
if (logger.logLevel !== LogLevel.info) {
|
|
1913
|
+
return;
|
|
1914
|
+
}
|
|
1915
|
+
if (logger.spinner && count === 0) {
|
|
1916
|
+
logger.spinner?.start(`\u{1F4BE} Writing`);
|
|
1917
|
+
}
|
|
1918
|
+
});
|
|
1919
|
+
pluginManager.queue.on("active", () => {
|
|
1920
|
+
if (logger.logLevel !== LogLevel.info) {
|
|
1921
|
+
return;
|
|
1922
|
+
}
|
|
1923
|
+
if (logger.spinner && pluginManager.queue.size > 0) {
|
|
1924
|
+
const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
|
|
1925
|
+
logger.spinner.suffixText = p.dim(text);
|
|
1926
|
+
}
|
|
1927
|
+
++count;
|
|
1928
|
+
});
|
|
1929
|
+
pluginManager.queue.on("completed", () => {
|
|
1930
|
+
if (logger.logLevel !== LogLevel.info) {
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
if (logger.spinner) {
|
|
1934
|
+
const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
|
|
1935
|
+
logger.spinner.suffixText = p.dim(text);
|
|
1936
|
+
}
|
|
1937
|
+
});
|
|
4919
1938
|
pluginManager.on("executed", (executer) => {
|
|
4920
1939
|
const { hookName, plugin, output, parameters } = executer;
|
|
4921
|
-
const messsage = `${randomCliColour(plugin.name)} Executing ${hookName}`;
|
|
4922
|
-
if (logger.logLevel === LogLevel.info && logger.spinner) {
|
|
4923
|
-
if (hookName === "writeFile") {
|
|
4924
|
-
const [_code, path5] = parameters;
|
|
4925
|
-
logger.spinner.suffixText = p2.dim(path5);
|
|
4926
|
-
} else {
|
|
4927
|
-
logger.spinner.suffixText = messsage;
|
|
4928
|
-
}
|
|
4929
|
-
}
|
|
4930
1940
|
if (logger.logLevel === LogLevel.debug) {
|
|
4931
|
-
logger.info(messsage);
|
|
4932
1941
|
const logs = [
|
|
4933
|
-
|
|
1942
|
+
`${randomCliColour(plugin.name)} Executing ${hookName}`,
|
|
1943
|
+
parameters && `${p.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,
|
|
4934
1944
|
JSON.stringify(parameters, void 0, 2),
|
|
4935
|
-
output && `${
|
|
1945
|
+
output && `${p.bgWhite("Output")} ${randomCliColour(plugin.name)} ${hookName}`,
|
|
4936
1946
|
output
|
|
4937
1947
|
].filter(Boolean);
|
|
4938
|
-
|
|
1948
|
+
logger.debug(logs.join("\n"));
|
|
4939
1949
|
}
|
|
4940
1950
|
});
|
|
4941
1951
|
return pluginManager;
|
|
@@ -4948,7 +1958,7 @@ async function build(options) {
|
|
|
4948
1958
|
parameters: [options.config]
|
|
4949
1959
|
});
|
|
4950
1960
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
4951
|
-
if (
|
|
1961
|
+
if (logger.logLevel === LogLevel.info && logger.spinner) {
|
|
4952
1962
|
logger.spinner.suffixText = "";
|
|
4953
1963
|
logger.spinner.succeed(`\u{1F4BE} Writing completed`);
|
|
4954
1964
|
}
|
|
@@ -4963,7 +1973,7 @@ async function safeBuild(options) {
|
|
|
4963
1973
|
parameters: [options.config]
|
|
4964
1974
|
});
|
|
4965
1975
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
4966
|
-
if (
|
|
1976
|
+
if (logger.logLevel === LogLevel.info && logger.spinner) {
|
|
4967
1977
|
logger.spinner.suffixText = "";
|
|
4968
1978
|
logger.spinner.succeed(`\u{1F4BE} Writing completed`);
|
|
4969
1979
|
}
|
|
@@ -5003,298 +2013,6 @@ _context = new WeakMap();
|
|
|
5003
2013
|
|
|
5004
2014
|
// src/PackageManager.ts
|
|
5005
2015
|
init_esm_shims();
|
|
5006
|
-
|
|
5007
|
-
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
5008
|
-
init_esm_shims();
|
|
5009
|
-
|
|
5010
|
-
// ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
|
|
5011
|
-
init_esm_shims();
|
|
5012
|
-
|
|
5013
|
-
// ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
|
|
5014
|
-
init_esm_shims();
|
|
5015
|
-
|
|
5016
|
-
// ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
|
|
5017
|
-
init_esm_shims();
|
|
5018
|
-
|
|
5019
|
-
// ../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js
|
|
5020
|
-
init_esm_shims();
|
|
5021
|
-
var Node = class {
|
|
5022
|
-
constructor(value) {
|
|
5023
|
-
__publicField(this, "value");
|
|
5024
|
-
__publicField(this, "next");
|
|
5025
|
-
this.value = value;
|
|
5026
|
-
}
|
|
5027
|
-
};
|
|
5028
|
-
var _head, _tail, _size;
|
|
5029
|
-
var Queue2 = class {
|
|
5030
|
-
constructor() {
|
|
5031
|
-
__privateAdd(this, _head, void 0);
|
|
5032
|
-
__privateAdd(this, _tail, void 0);
|
|
5033
|
-
__privateAdd(this, _size, void 0);
|
|
5034
|
-
this.clear();
|
|
5035
|
-
}
|
|
5036
|
-
enqueue(value) {
|
|
5037
|
-
const node = new Node(value);
|
|
5038
|
-
if (__privateGet(this, _head)) {
|
|
5039
|
-
__privateGet(this, _tail).next = node;
|
|
5040
|
-
__privateSet(this, _tail, node);
|
|
5041
|
-
} else {
|
|
5042
|
-
__privateSet(this, _head, node);
|
|
5043
|
-
__privateSet(this, _tail, node);
|
|
5044
|
-
}
|
|
5045
|
-
__privateWrapper(this, _size)._++;
|
|
5046
|
-
}
|
|
5047
|
-
dequeue() {
|
|
5048
|
-
const current = __privateGet(this, _head);
|
|
5049
|
-
if (!current) {
|
|
5050
|
-
return;
|
|
5051
|
-
}
|
|
5052
|
-
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
5053
|
-
__privateWrapper(this, _size)._--;
|
|
5054
|
-
return current.value;
|
|
5055
|
-
}
|
|
5056
|
-
clear() {
|
|
5057
|
-
__privateSet(this, _head, void 0);
|
|
5058
|
-
__privateSet(this, _tail, void 0);
|
|
5059
|
-
__privateSet(this, _size, 0);
|
|
5060
|
-
}
|
|
5061
|
-
get size() {
|
|
5062
|
-
return __privateGet(this, _size);
|
|
5063
|
-
}
|
|
5064
|
-
*[Symbol.iterator]() {
|
|
5065
|
-
let current = __privateGet(this, _head);
|
|
5066
|
-
while (current) {
|
|
5067
|
-
yield current.value;
|
|
5068
|
-
current = current.next;
|
|
5069
|
-
}
|
|
5070
|
-
}
|
|
5071
|
-
};
|
|
5072
|
-
_head = new WeakMap();
|
|
5073
|
-
_tail = new WeakMap();
|
|
5074
|
-
_size = new WeakMap();
|
|
5075
|
-
|
|
5076
|
-
// ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
|
|
5077
|
-
function pLimit(concurrency) {
|
|
5078
|
-
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
5079
|
-
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
5080
|
-
}
|
|
5081
|
-
const queue = new Queue2();
|
|
5082
|
-
let activeCount = 0;
|
|
5083
|
-
const next = () => {
|
|
5084
|
-
activeCount--;
|
|
5085
|
-
if (queue.size > 0) {
|
|
5086
|
-
queue.dequeue()();
|
|
5087
|
-
}
|
|
5088
|
-
};
|
|
5089
|
-
const run = async (fn, resolve3, args) => {
|
|
5090
|
-
activeCount++;
|
|
5091
|
-
const result = (async () => fn(...args))();
|
|
5092
|
-
resolve3(result);
|
|
5093
|
-
try {
|
|
5094
|
-
await result;
|
|
5095
|
-
} catch {
|
|
5096
|
-
}
|
|
5097
|
-
next();
|
|
5098
|
-
};
|
|
5099
|
-
const enqueue = (fn, resolve3, args) => {
|
|
5100
|
-
queue.enqueue(run.bind(void 0, fn, resolve3, args));
|
|
5101
|
-
(async () => {
|
|
5102
|
-
await Promise.resolve();
|
|
5103
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
5104
|
-
queue.dequeue()();
|
|
5105
|
-
}
|
|
5106
|
-
})();
|
|
5107
|
-
};
|
|
5108
|
-
const generator = (fn, ...args) => new Promise((resolve3) => {
|
|
5109
|
-
enqueue(fn, resolve3, args);
|
|
5110
|
-
});
|
|
5111
|
-
Object.defineProperties(generator, {
|
|
5112
|
-
activeCount: {
|
|
5113
|
-
get: () => activeCount
|
|
5114
|
-
},
|
|
5115
|
-
pendingCount: {
|
|
5116
|
-
get: () => queue.size
|
|
5117
|
-
},
|
|
5118
|
-
clearQueue: {
|
|
5119
|
-
value: () => {
|
|
5120
|
-
queue.clear();
|
|
5121
|
-
}
|
|
5122
|
-
}
|
|
5123
|
-
});
|
|
5124
|
-
return generator;
|
|
5125
|
-
}
|
|
5126
|
-
|
|
5127
|
-
// ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
|
|
5128
|
-
var EndError = class extends Error {
|
|
5129
|
-
constructor(value) {
|
|
5130
|
-
super();
|
|
5131
|
-
this.value = value;
|
|
5132
|
-
}
|
|
5133
|
-
};
|
|
5134
|
-
var testElement = async (element, tester) => tester(await element);
|
|
5135
|
-
var finder = async (element) => {
|
|
5136
|
-
const values = await Promise.all(element);
|
|
5137
|
-
if (values[1] === true) {
|
|
5138
|
-
throw new EndError(values[0]);
|
|
5139
|
-
}
|
|
5140
|
-
return false;
|
|
5141
|
-
};
|
|
5142
|
-
async function pLocate(iterable, tester, {
|
|
5143
|
-
concurrency = Number.POSITIVE_INFINITY,
|
|
5144
|
-
preserveOrder = true
|
|
5145
|
-
} = {}) {
|
|
5146
|
-
const limit = pLimit(concurrency);
|
|
5147
|
-
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
|
|
5148
|
-
const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
|
|
5149
|
-
try {
|
|
5150
|
-
await Promise.all(items.map((element) => checkLimit(finder, element)));
|
|
5151
|
-
} catch (error) {
|
|
5152
|
-
if (error instanceof EndError) {
|
|
5153
|
-
return error.value;
|
|
5154
|
-
}
|
|
5155
|
-
throw error;
|
|
5156
|
-
}
|
|
5157
|
-
}
|
|
5158
|
-
|
|
5159
|
-
// ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
|
|
5160
|
-
var typeMappings = {
|
|
5161
|
-
directory: "isDirectory",
|
|
5162
|
-
file: "isFile"
|
|
5163
|
-
};
|
|
5164
|
-
function checkType(type) {
|
|
5165
|
-
if (Object.hasOwnProperty.call(typeMappings, type)) {
|
|
5166
|
-
return;
|
|
5167
|
-
}
|
|
5168
|
-
throw new Error(`Invalid type specified: ${type}`);
|
|
5169
|
-
}
|
|
5170
|
-
var matchType = (type, stat) => stat[typeMappings[type]]();
|
|
5171
|
-
var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
5172
|
-
async function locatePath(paths, {
|
|
5173
|
-
cwd = process2.cwd(),
|
|
5174
|
-
type = "file",
|
|
5175
|
-
allowSymlinks = true,
|
|
5176
|
-
concurrency,
|
|
5177
|
-
preserveOrder
|
|
5178
|
-
} = {}) {
|
|
5179
|
-
checkType(type);
|
|
5180
|
-
cwd = toPath(cwd);
|
|
5181
|
-
const statFunction = allowSymlinks ? promises.stat : promises.lstat;
|
|
5182
|
-
return pLocate(paths, async (path_) => {
|
|
5183
|
-
try {
|
|
5184
|
-
const stat = await statFunction(path4.resolve(cwd, path_));
|
|
5185
|
-
return matchType(type, stat);
|
|
5186
|
-
} catch {
|
|
5187
|
-
return false;
|
|
5188
|
-
}
|
|
5189
|
-
}, { concurrency, preserveOrder });
|
|
5190
|
-
}
|
|
5191
|
-
function locatePathSync(paths, {
|
|
5192
|
-
cwd = process2.cwd(),
|
|
5193
|
-
type = "file",
|
|
5194
|
-
allowSymlinks = true
|
|
5195
|
-
} = {}) {
|
|
5196
|
-
checkType(type);
|
|
5197
|
-
cwd = toPath(cwd);
|
|
5198
|
-
const statFunction = allowSymlinks ? fs3.statSync : fs3.lstatSync;
|
|
5199
|
-
for (const path_ of paths) {
|
|
5200
|
-
try {
|
|
5201
|
-
const stat = statFunction(path4.resolve(cwd, path_), {
|
|
5202
|
-
throwIfNoEntry: false
|
|
5203
|
-
});
|
|
5204
|
-
if (!stat) {
|
|
5205
|
-
continue;
|
|
5206
|
-
}
|
|
5207
|
-
if (matchType(type, stat)) {
|
|
5208
|
-
return path_;
|
|
5209
|
-
}
|
|
5210
|
-
} catch {
|
|
5211
|
-
}
|
|
5212
|
-
}
|
|
5213
|
-
}
|
|
5214
|
-
|
|
5215
|
-
// ../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js
|
|
5216
|
-
init_esm_shims();
|
|
5217
|
-
function toPath2(urlOrPath) {
|
|
5218
|
-
return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
5219
|
-
}
|
|
5220
|
-
|
|
5221
|
-
// ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
|
|
5222
|
-
init_esm_shims();
|
|
5223
|
-
|
|
5224
|
-
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
5225
|
-
var findUpStop = Symbol("findUpStop");
|
|
5226
|
-
async function findUpMultiple(name, options = {}) {
|
|
5227
|
-
let directory = path4.resolve(toPath2(options.cwd) ?? "");
|
|
5228
|
-
const { root } = path4.parse(directory);
|
|
5229
|
-
const stopAt = path4.resolve(directory, toPath2(options.stopAt ?? root));
|
|
5230
|
-
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
5231
|
-
const paths = [name].flat();
|
|
5232
|
-
const runMatcher = async (locateOptions) => {
|
|
5233
|
-
if (typeof name !== "function") {
|
|
5234
|
-
return locatePath(paths, locateOptions);
|
|
5235
|
-
}
|
|
5236
|
-
const foundPath = await name(locateOptions.cwd);
|
|
5237
|
-
if (typeof foundPath === "string") {
|
|
5238
|
-
return locatePath([foundPath], locateOptions);
|
|
5239
|
-
}
|
|
5240
|
-
return foundPath;
|
|
5241
|
-
};
|
|
5242
|
-
const matches = [];
|
|
5243
|
-
while (true) {
|
|
5244
|
-
const foundPath = await runMatcher({ ...options, cwd: directory });
|
|
5245
|
-
if (foundPath === findUpStop) {
|
|
5246
|
-
break;
|
|
5247
|
-
}
|
|
5248
|
-
if (foundPath) {
|
|
5249
|
-
matches.push(path4.resolve(directory, foundPath));
|
|
5250
|
-
}
|
|
5251
|
-
if (directory === stopAt || matches.length >= limit) {
|
|
5252
|
-
break;
|
|
5253
|
-
}
|
|
5254
|
-
directory = path4.dirname(directory);
|
|
5255
|
-
}
|
|
5256
|
-
return matches;
|
|
5257
|
-
}
|
|
5258
|
-
function findUpMultipleSync(name, options = {}) {
|
|
5259
|
-
let directory = path4.resolve(toPath2(options.cwd) ?? "");
|
|
5260
|
-
const { root } = path4.parse(directory);
|
|
5261
|
-
const stopAt = path4.resolve(directory, toPath2(options.stopAt) ?? root);
|
|
5262
|
-
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
5263
|
-
const paths = [name].flat();
|
|
5264
|
-
const runMatcher = (locateOptions) => {
|
|
5265
|
-
if (typeof name !== "function") {
|
|
5266
|
-
return locatePathSync(paths, locateOptions);
|
|
5267
|
-
}
|
|
5268
|
-
const foundPath = name(locateOptions.cwd);
|
|
5269
|
-
if (typeof foundPath === "string") {
|
|
5270
|
-
return locatePathSync([foundPath], locateOptions);
|
|
5271
|
-
}
|
|
5272
|
-
return foundPath;
|
|
5273
|
-
};
|
|
5274
|
-
const matches = [];
|
|
5275
|
-
while (true) {
|
|
5276
|
-
const foundPath = runMatcher({ ...options, cwd: directory });
|
|
5277
|
-
if (foundPath === findUpStop) {
|
|
5278
|
-
break;
|
|
5279
|
-
}
|
|
5280
|
-
if (foundPath) {
|
|
5281
|
-
matches.push(path4.resolve(directory, foundPath));
|
|
5282
|
-
}
|
|
5283
|
-
if (directory === stopAt || matches.length >= limit) {
|
|
5284
|
-
break;
|
|
5285
|
-
}
|
|
5286
|
-
directory = path4.dirname(directory);
|
|
5287
|
-
}
|
|
5288
|
-
return matches;
|
|
5289
|
-
}
|
|
5290
|
-
async function findUp(name, options = {}) {
|
|
5291
|
-
const matches = await findUpMultiple(name, { ...options, limit: 1 });
|
|
5292
|
-
return matches[0];
|
|
5293
|
-
}
|
|
5294
|
-
function findUpSync(name, options = {}) {
|
|
5295
|
-
const matches = findUpMultipleSync(name, { ...options, limit: 1 });
|
|
5296
|
-
return matches[0];
|
|
5297
|
-
}
|
|
5298
2016
|
var _cache2, _cwd, _SLASHES, _match, match_fn;
|
|
5299
2017
|
var _PackageManager = class _PackageManager {
|
|
5300
2018
|
constructor(workspace) {
|
|
@@ -5318,17 +2036,17 @@ var _PackageManager = class _PackageManager {
|
|
|
5318
2036
|
}
|
|
5319
2037
|
return directory;
|
|
5320
2038
|
}
|
|
5321
|
-
getLocation(
|
|
5322
|
-
let location =
|
|
2039
|
+
getLocation(path3) {
|
|
2040
|
+
let location = path3;
|
|
5323
2041
|
if (__privateGet(this, _cwd)) {
|
|
5324
2042
|
const require2 = mod.createRequire(this.normalizeDirectory(__privateGet(this, _cwd)));
|
|
5325
|
-
location = require2.resolve(
|
|
2043
|
+
location = require2.resolve(path3);
|
|
5326
2044
|
}
|
|
5327
2045
|
return location;
|
|
5328
2046
|
}
|
|
5329
|
-
async import(
|
|
2047
|
+
async import(path3) {
|
|
5330
2048
|
try {
|
|
5331
|
-
let location = this.getLocation(
|
|
2049
|
+
let location = this.getLocation(path3);
|
|
5332
2050
|
if (os.platform() == "win32") {
|
|
5333
2051
|
location = pathToFileURL(location).href;
|
|
5334
2052
|
}
|