@pubinfo/commitlint 2.0.0-rc.3 → 2.0.0-rc.4
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/bin/commit.js +1 -1
- package/dist/index.d.ts +17 -61
- package/dist/index.js +2 -2
- package/dist/lint.message-TYD-xclw.js +2341 -0
- package/dist/run.d.ts +3 -1
- package/dist/run.js +119 -1
- package/package.json +1 -1
- package/dist/run-Ckp4pYFS.d.ts +0 -4
- package/dist/run-kpuZDnr9.js +0 -587
|
@@ -0,0 +1,2341 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { execSync, spawn } from "node:child_process";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import process$1 from "node:process";
|
|
5
|
+
import CZGPackage from "czg/package.json" with { type: "json" };
|
|
6
|
+
import fs from "node:fs";
|
|
7
|
+
|
|
8
|
+
//#region rolldown:runtime
|
|
9
|
+
var __create = Object.create;
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __commonJS = (cb, mod) => function() {
|
|
16
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
20
|
+
key = keys[i];
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
22
|
+
get: ((k) => from[k]).bind(null, key),
|
|
23
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
29
|
+
value: mod,
|
|
30
|
+
enumerable: true
|
|
31
|
+
}) : target, mod));
|
|
32
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/config/index.ts
|
|
36
|
+
const notWip = [
|
|
37
|
+
"main",
|
|
38
|
+
"master",
|
|
39
|
+
"dev",
|
|
40
|
+
"test",
|
|
41
|
+
"release"
|
|
42
|
+
];
|
|
43
|
+
function isMainBranch() {
|
|
44
|
+
try {
|
|
45
|
+
try {
|
|
46
|
+
const currentBranch = execSync("git branch --show-current", { encoding: "utf8" }).trim();
|
|
47
|
+
if (currentBranch) return notWip.includes(currentBranch);
|
|
48
|
+
} catch {
|
|
49
|
+
try {
|
|
50
|
+
const currentBranch = execSync("git symbolic-ref --short HEAD", { encoding: "utf8" }).trim();
|
|
51
|
+
return notWip.includes(currentBranch);
|
|
52
|
+
} catch {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
function generateCommitTypes() {
|
|
62
|
+
const allTypes = [
|
|
63
|
+
"feat",
|
|
64
|
+
"fix",
|
|
65
|
+
"docs",
|
|
66
|
+
"style",
|
|
67
|
+
"refactor",
|
|
68
|
+
"perf",
|
|
69
|
+
"test",
|
|
70
|
+
"build",
|
|
71
|
+
"ci",
|
|
72
|
+
"chore",
|
|
73
|
+
"revert",
|
|
74
|
+
"types",
|
|
75
|
+
"release",
|
|
76
|
+
"init",
|
|
77
|
+
"wip"
|
|
78
|
+
];
|
|
79
|
+
if (isMainBranch()) return allTypes.filter((type) => type !== "wip");
|
|
80
|
+
return allTypes;
|
|
81
|
+
}
|
|
82
|
+
function generateCzGitTypes() {
|
|
83
|
+
const all = [
|
|
84
|
+
{
|
|
85
|
+
value: "feat",
|
|
86
|
+
name: "feat: ✨ 新功能",
|
|
87
|
+
emoji: ":sparkles:"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
value: "fix",
|
|
91
|
+
name: "fix: 🐛 修复缺陷",
|
|
92
|
+
emoji: ":bug:"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
value: "types",
|
|
96
|
+
name: "types: 🎨 类型相关",
|
|
97
|
+
emoji: ":art:"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
value: "docs",
|
|
101
|
+
name: "docs: 📝 文档更新",
|
|
102
|
+
emoji: ":memo:"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
value: "style",
|
|
106
|
+
name: "style: 💄 代码格式",
|
|
107
|
+
emoji: ":lipstick:"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
value: "refactor",
|
|
111
|
+
name: "refactor: ♻️ 代码重构",
|
|
112
|
+
emoji: ":recycle:"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
value: "perf",
|
|
116
|
+
name: "perf: ⚡️ 性能提升",
|
|
117
|
+
emoji: ":zap:"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
value: "test",
|
|
121
|
+
name: "test: ✅ 测试相关",
|
|
122
|
+
emoji: ":white_check_mark:"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
value: "build",
|
|
126
|
+
name: "build: 📦️ 构建相关",
|
|
127
|
+
emoji: ":package:"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
value: "release",
|
|
131
|
+
name: "release: 🔖 版本提升",
|
|
132
|
+
emoji: ":bookmark:"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
value: "ci",
|
|
136
|
+
name: "ci: 🎡 持续集成",
|
|
137
|
+
emoji: ":ferris_wheel:"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
value: "revert",
|
|
141
|
+
name: "revert: ⏪️ 回退代码",
|
|
142
|
+
emoji: ":rewind:"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
value: "chore",
|
|
146
|
+
name: "chore: 🔨 其他修改",
|
|
147
|
+
emoji: ":hammer:"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
value: "init",
|
|
151
|
+
name: "init: 🎉 初始化",
|
|
152
|
+
emoji: ":tada:"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
value: "wip",
|
|
156
|
+
name: "wip: 🚧 工作进行中",
|
|
157
|
+
emoji: ":construction:"
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
if (isMainBranch()) return all.filter((t) => t.value !== "wip");
|
|
161
|
+
return all;
|
|
162
|
+
}
|
|
163
|
+
const commitPreset = {
|
|
164
|
+
extends: ["@commitlint/config-conventional"],
|
|
165
|
+
rules: {
|
|
166
|
+
"scope-enum": [0],
|
|
167
|
+
"type-enum": [
|
|
168
|
+
2,
|
|
169
|
+
"always",
|
|
170
|
+
generateCommitTypes()
|
|
171
|
+
],
|
|
172
|
+
"type-empty": [2, "never"],
|
|
173
|
+
"type-case": [
|
|
174
|
+
2,
|
|
175
|
+
"always",
|
|
176
|
+
"lower-case"
|
|
177
|
+
],
|
|
178
|
+
"subject-empty": [2, "never"],
|
|
179
|
+
"subject-full-stop": [
|
|
180
|
+
2,
|
|
181
|
+
"never",
|
|
182
|
+
"."
|
|
183
|
+
],
|
|
184
|
+
"subject-case": [
|
|
185
|
+
2,
|
|
186
|
+
"never",
|
|
187
|
+
[
|
|
188
|
+
"sentence-case",
|
|
189
|
+
"start-case",
|
|
190
|
+
"pascal-case",
|
|
191
|
+
"upper-case"
|
|
192
|
+
]
|
|
193
|
+
],
|
|
194
|
+
"header-max-length": [
|
|
195
|
+
2,
|
|
196
|
+
"always",
|
|
197
|
+
100
|
|
198
|
+
],
|
|
199
|
+
"body-leading-blank": [1, "always"],
|
|
200
|
+
"footer-leading-blank": [1, "always"]
|
|
201
|
+
},
|
|
202
|
+
prompt: {
|
|
203
|
+
alias: { fd: "docs: fix typos" },
|
|
204
|
+
messages: {
|
|
205
|
+
scope: "选择一个提交范围 (可回车跳过):",
|
|
206
|
+
customScope: "请输入自定义的提交范围 :",
|
|
207
|
+
type: "选择你要提交的类型 :",
|
|
208
|
+
subject: "填写简短精炼的变更描述 :\n",
|
|
209
|
+
body: "填写更加详细的变更描述(可选)。使用 \"|\" 换行 :\n",
|
|
210
|
+
breaking: "列举非兼容性重大的变更(可选)。使用 \"|\" 换行 :\n",
|
|
211
|
+
footerPrefixsSelect: "选择关联issue前缀(可选):",
|
|
212
|
+
customFooterPrefixs: "输入自定义issue前缀 :",
|
|
213
|
+
footer: "列举关联issue (可选) 例如: #31, #I3244 :\n",
|
|
214
|
+
confirmCommit: "是否提交或修改commit ?"
|
|
215
|
+
},
|
|
216
|
+
types: generateCzGitTypes(),
|
|
217
|
+
useEmoji: false,
|
|
218
|
+
emojiAlign: "center",
|
|
219
|
+
themeColorCode: "",
|
|
220
|
+
enableMultipleScopes: true,
|
|
221
|
+
skipQuestions: ["scope"],
|
|
222
|
+
defaultScope: "___CUSTOM___:",
|
|
223
|
+
customScopesAlign: "bottom",
|
|
224
|
+
customScopesAlias: "custom",
|
|
225
|
+
emptyScopesAlias: "empty",
|
|
226
|
+
upperCaseSubject: false,
|
|
227
|
+
markBreakingChangeMode: true,
|
|
228
|
+
allowBreakingChanges: ["feat", "fix"],
|
|
229
|
+
breaklineNumber: 100,
|
|
230
|
+
breaklineChar: "|",
|
|
231
|
+
issuePrefixs: [{
|
|
232
|
+
value: "link",
|
|
233
|
+
name: "link: 链接 ISSUES 进行中"
|
|
234
|
+
}, {
|
|
235
|
+
value: "closed",
|
|
236
|
+
name: "closed: 标记 ISSUES 已完成"
|
|
237
|
+
}],
|
|
238
|
+
customIssuePrefixsAlign: "top",
|
|
239
|
+
emptyIssuePrefixsAlias: "skip",
|
|
240
|
+
customIssuePrefixsAlias: "custom",
|
|
241
|
+
allowCustomIssuePrefixs: true,
|
|
242
|
+
allowEmptyIssuePrefixs: true,
|
|
243
|
+
confirmColorize: true,
|
|
244
|
+
maxHeaderLength: Number.POSITIVE_INFINITY,
|
|
245
|
+
maxSubjectLength: Number.POSITIVE_INFINITY,
|
|
246
|
+
minSubjectLength: 0,
|
|
247
|
+
scopeOverrides: void 0,
|
|
248
|
+
defaultBody: "",
|
|
249
|
+
defaultIssues: "",
|
|
250
|
+
defaultSubject: ""
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
function loadCommitConfig() {
|
|
254
|
+
return commitPreset;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
|
|
259
|
+
var require_universalify = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js": ((exports) => {
|
|
260
|
+
exports.fromCallback = function(fn) {
|
|
261
|
+
return Object.defineProperty(function(...args) {
|
|
262
|
+
if (typeof args[args.length - 1] === "function") fn.apply(this, args);
|
|
263
|
+
else return new Promise((resolve$1, reject) => {
|
|
264
|
+
args.push((err, res) => err != null ? reject(err) : resolve$1(res));
|
|
265
|
+
fn.apply(this, args);
|
|
266
|
+
});
|
|
267
|
+
}, "name", { value: fn.name });
|
|
268
|
+
};
|
|
269
|
+
exports.fromPromise = function(fn) {
|
|
270
|
+
return Object.defineProperty(function(...args) {
|
|
271
|
+
const cb = args[args.length - 1];
|
|
272
|
+
if (typeof cb !== "function") return fn.apply(this, args);
|
|
273
|
+
else {
|
|
274
|
+
args.pop();
|
|
275
|
+
fn.apply(this, args).then((r) => cb(null, r), cb);
|
|
276
|
+
}
|
|
277
|
+
}, "name", { value: fn.name });
|
|
278
|
+
};
|
|
279
|
+
}) });
|
|
280
|
+
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
|
|
283
|
+
var require_polyfills = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js": ((exports, module) => {
|
|
284
|
+
var constants = __require("constants");
|
|
285
|
+
var origCwd = process.cwd;
|
|
286
|
+
var cwd = null;
|
|
287
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
288
|
+
process.cwd = function() {
|
|
289
|
+
if (!cwd) cwd = origCwd.call(process);
|
|
290
|
+
return cwd;
|
|
291
|
+
};
|
|
292
|
+
try {
|
|
293
|
+
process.cwd();
|
|
294
|
+
} catch (er) {}
|
|
295
|
+
if (typeof process.chdir === "function") {
|
|
296
|
+
var chdir = process.chdir;
|
|
297
|
+
process.chdir = function(d) {
|
|
298
|
+
cwd = null;
|
|
299
|
+
chdir.call(process, d);
|
|
300
|
+
};
|
|
301
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
302
|
+
}
|
|
303
|
+
module.exports = patch$1;
|
|
304
|
+
function patch$1(fs$22) {
|
|
305
|
+
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs$22);
|
|
306
|
+
if (!fs$22.lutimes) patchLutimes(fs$22);
|
|
307
|
+
fs$22.chown = chownFix(fs$22.chown);
|
|
308
|
+
fs$22.fchown = chownFix(fs$22.fchown);
|
|
309
|
+
fs$22.lchown = chownFix(fs$22.lchown);
|
|
310
|
+
fs$22.chmod = chmodFix(fs$22.chmod);
|
|
311
|
+
fs$22.fchmod = chmodFix(fs$22.fchmod);
|
|
312
|
+
fs$22.lchmod = chmodFix(fs$22.lchmod);
|
|
313
|
+
fs$22.chownSync = chownFixSync(fs$22.chownSync);
|
|
314
|
+
fs$22.fchownSync = chownFixSync(fs$22.fchownSync);
|
|
315
|
+
fs$22.lchownSync = chownFixSync(fs$22.lchownSync);
|
|
316
|
+
fs$22.chmodSync = chmodFixSync(fs$22.chmodSync);
|
|
317
|
+
fs$22.fchmodSync = chmodFixSync(fs$22.fchmodSync);
|
|
318
|
+
fs$22.lchmodSync = chmodFixSync(fs$22.lchmodSync);
|
|
319
|
+
fs$22.stat = statFix(fs$22.stat);
|
|
320
|
+
fs$22.fstat = statFix(fs$22.fstat);
|
|
321
|
+
fs$22.lstat = statFix(fs$22.lstat);
|
|
322
|
+
fs$22.statSync = statFixSync(fs$22.statSync);
|
|
323
|
+
fs$22.fstatSync = statFixSync(fs$22.fstatSync);
|
|
324
|
+
fs$22.lstatSync = statFixSync(fs$22.lstatSync);
|
|
325
|
+
if (fs$22.chmod && !fs$22.lchmod) {
|
|
326
|
+
fs$22.lchmod = function(path$12, mode, cb) {
|
|
327
|
+
if (cb) process.nextTick(cb);
|
|
328
|
+
};
|
|
329
|
+
fs$22.lchmodSync = function() {};
|
|
330
|
+
}
|
|
331
|
+
if (fs$22.chown && !fs$22.lchown) {
|
|
332
|
+
fs$22.lchown = function(path$12, uid, gid, cb) {
|
|
333
|
+
if (cb) process.nextTick(cb);
|
|
334
|
+
};
|
|
335
|
+
fs$22.lchownSync = function() {};
|
|
336
|
+
}
|
|
337
|
+
if (platform === "win32") fs$22.rename = typeof fs$22.rename !== "function" ? fs$22.rename : (function(fs$rename) {
|
|
338
|
+
function rename$1(from, to, cb) {
|
|
339
|
+
var start = Date.now();
|
|
340
|
+
var backoff = 0;
|
|
341
|
+
fs$rename(from, to, function CB(er) {
|
|
342
|
+
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
343
|
+
setTimeout(function() {
|
|
344
|
+
fs$22.stat(to, function(stater, st) {
|
|
345
|
+
if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
|
|
346
|
+
else cb(er);
|
|
347
|
+
});
|
|
348
|
+
}, backoff);
|
|
349
|
+
if (backoff < 100) backoff += 10;
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
if (cb) cb(er);
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename$1, fs$rename);
|
|
356
|
+
return rename$1;
|
|
357
|
+
})(fs$22.rename);
|
|
358
|
+
fs$22.read = typeof fs$22.read !== "function" ? fs$22.read : (function(fs$read) {
|
|
359
|
+
function read(fd, buffer, offset, length, position, callback_) {
|
|
360
|
+
var callback;
|
|
361
|
+
if (callback_ && typeof callback_ === "function") {
|
|
362
|
+
var eagCounter = 0;
|
|
363
|
+
callback = function(er, _, __) {
|
|
364
|
+
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
365
|
+
eagCounter++;
|
|
366
|
+
return fs$read.call(fs$22, fd, buffer, offset, length, position, callback);
|
|
367
|
+
}
|
|
368
|
+
callback_.apply(this, arguments);
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
return fs$read.call(fs$22, fd, buffer, offset, length, position, callback);
|
|
372
|
+
}
|
|
373
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
374
|
+
return read;
|
|
375
|
+
})(fs$22.read);
|
|
376
|
+
fs$22.readSync = typeof fs$22.readSync !== "function" ? fs$22.readSync : (function(fs$readSync) {
|
|
377
|
+
return function(fd, buffer, offset, length, position) {
|
|
378
|
+
var eagCounter = 0;
|
|
379
|
+
while (true) try {
|
|
380
|
+
return fs$readSync.call(fs$22, fd, buffer, offset, length, position);
|
|
381
|
+
} catch (er) {
|
|
382
|
+
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
383
|
+
eagCounter++;
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
throw er;
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
})(fs$22.readSync);
|
|
390
|
+
function patchLchmod(fs$23) {
|
|
391
|
+
fs$23.lchmod = function(path$12, mode, callback) {
|
|
392
|
+
fs$23.open(path$12, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
393
|
+
if (err) {
|
|
394
|
+
if (callback) callback(err);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
fs$23.fchmod(fd, mode, function(err$1) {
|
|
398
|
+
fs$23.close(fd, function(err2) {
|
|
399
|
+
if (callback) callback(err$1 || err2);
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
fs$23.lchmodSync = function(path$12, mode) {
|
|
405
|
+
var fd = fs$23.openSync(path$12, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
406
|
+
var threw = true;
|
|
407
|
+
var ret;
|
|
408
|
+
try {
|
|
409
|
+
ret = fs$23.fchmodSync(fd, mode);
|
|
410
|
+
threw = false;
|
|
411
|
+
} finally {
|
|
412
|
+
if (threw) try {
|
|
413
|
+
fs$23.closeSync(fd);
|
|
414
|
+
} catch (er) {}
|
|
415
|
+
else fs$23.closeSync(fd);
|
|
416
|
+
}
|
|
417
|
+
return ret;
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
function patchLutimes(fs$23) {
|
|
421
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs$23.futimes) {
|
|
422
|
+
fs$23.lutimes = function(path$12, at, mt, cb) {
|
|
423
|
+
fs$23.open(path$12, constants.O_SYMLINK, function(er, fd) {
|
|
424
|
+
if (er) {
|
|
425
|
+
if (cb) cb(er);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
fs$23.futimes(fd, at, mt, function(er$1) {
|
|
429
|
+
fs$23.close(fd, function(er2) {
|
|
430
|
+
if (cb) cb(er$1 || er2);
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
fs$23.lutimesSync = function(path$12, at, mt) {
|
|
436
|
+
var fd = fs$23.openSync(path$12, constants.O_SYMLINK);
|
|
437
|
+
var ret;
|
|
438
|
+
var threw = true;
|
|
439
|
+
try {
|
|
440
|
+
ret = fs$23.futimesSync(fd, at, mt);
|
|
441
|
+
threw = false;
|
|
442
|
+
} finally {
|
|
443
|
+
if (threw) try {
|
|
444
|
+
fs$23.closeSync(fd);
|
|
445
|
+
} catch (er) {}
|
|
446
|
+
else fs$23.closeSync(fd);
|
|
447
|
+
}
|
|
448
|
+
return ret;
|
|
449
|
+
};
|
|
450
|
+
} else if (fs$23.futimes) {
|
|
451
|
+
fs$23.lutimes = function(_a, _b, _c, cb) {
|
|
452
|
+
if (cb) process.nextTick(cb);
|
|
453
|
+
};
|
|
454
|
+
fs$23.lutimesSync = function() {};
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
function chmodFix(orig) {
|
|
458
|
+
if (!orig) return orig;
|
|
459
|
+
return function(target, mode, cb) {
|
|
460
|
+
return orig.call(fs$22, target, mode, function(er) {
|
|
461
|
+
if (chownErOk(er)) er = null;
|
|
462
|
+
if (cb) cb.apply(this, arguments);
|
|
463
|
+
});
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
function chmodFixSync(orig) {
|
|
467
|
+
if (!orig) return orig;
|
|
468
|
+
return function(target, mode) {
|
|
469
|
+
try {
|
|
470
|
+
return orig.call(fs$22, target, mode);
|
|
471
|
+
} catch (er) {
|
|
472
|
+
if (!chownErOk(er)) throw er;
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
function chownFix(orig) {
|
|
477
|
+
if (!orig) return orig;
|
|
478
|
+
return function(target, uid, gid, cb) {
|
|
479
|
+
return orig.call(fs$22, target, uid, gid, function(er) {
|
|
480
|
+
if (chownErOk(er)) er = null;
|
|
481
|
+
if (cb) cb.apply(this, arguments);
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
function chownFixSync(orig) {
|
|
486
|
+
if (!orig) return orig;
|
|
487
|
+
return function(target, uid, gid) {
|
|
488
|
+
try {
|
|
489
|
+
return orig.call(fs$22, target, uid, gid);
|
|
490
|
+
} catch (er) {
|
|
491
|
+
if (!chownErOk(er)) throw er;
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
function statFix(orig) {
|
|
496
|
+
if (!orig) return orig;
|
|
497
|
+
return function(target, options, cb) {
|
|
498
|
+
if (typeof options === "function") {
|
|
499
|
+
cb = options;
|
|
500
|
+
options = null;
|
|
501
|
+
}
|
|
502
|
+
function callback(er, stats) {
|
|
503
|
+
if (stats) {
|
|
504
|
+
if (stats.uid < 0) stats.uid += 4294967296;
|
|
505
|
+
if (stats.gid < 0) stats.gid += 4294967296;
|
|
506
|
+
}
|
|
507
|
+
if (cb) cb.apply(this, arguments);
|
|
508
|
+
}
|
|
509
|
+
return options ? orig.call(fs$22, target, options, callback) : orig.call(fs$22, target, callback);
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
function statFixSync(orig) {
|
|
513
|
+
if (!orig) return orig;
|
|
514
|
+
return function(target, options) {
|
|
515
|
+
var stats = options ? orig.call(fs$22, target, options) : orig.call(fs$22, target);
|
|
516
|
+
if (stats) {
|
|
517
|
+
if (stats.uid < 0) stats.uid += 4294967296;
|
|
518
|
+
if (stats.gid < 0) stats.gid += 4294967296;
|
|
519
|
+
}
|
|
520
|
+
return stats;
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function chownErOk(er) {
|
|
524
|
+
if (!er) return true;
|
|
525
|
+
if (er.code === "ENOSYS") return true;
|
|
526
|
+
if (!process.getuid || process.getuid() !== 0) {
|
|
527
|
+
if (er.code === "EINVAL" || er.code === "EPERM") return true;
|
|
528
|
+
}
|
|
529
|
+
return false;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}) });
|
|
533
|
+
|
|
534
|
+
//#endregion
|
|
535
|
+
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
|
|
536
|
+
var require_legacy_streams = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js": ((exports, module) => {
|
|
537
|
+
var Stream = __require("stream").Stream;
|
|
538
|
+
module.exports = legacy$1;
|
|
539
|
+
function legacy$1(fs$22) {
|
|
540
|
+
return {
|
|
541
|
+
ReadStream,
|
|
542
|
+
WriteStream
|
|
543
|
+
};
|
|
544
|
+
function ReadStream(path$12, options) {
|
|
545
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path$12, options);
|
|
546
|
+
Stream.call(this);
|
|
547
|
+
var self = this;
|
|
548
|
+
this.path = path$12;
|
|
549
|
+
this.fd = null;
|
|
550
|
+
this.readable = true;
|
|
551
|
+
this.paused = false;
|
|
552
|
+
this.flags = "r";
|
|
553
|
+
this.mode = 438;
|
|
554
|
+
this.bufferSize = 64 * 1024;
|
|
555
|
+
options = options || {};
|
|
556
|
+
var keys = Object.keys(options);
|
|
557
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
558
|
+
var key = keys[index];
|
|
559
|
+
this[key] = options[key];
|
|
560
|
+
}
|
|
561
|
+
if (this.encoding) this.setEncoding(this.encoding);
|
|
562
|
+
if (this.start !== void 0) {
|
|
563
|
+
if ("number" !== typeof this.start) throw TypeError("start must be a Number");
|
|
564
|
+
if (this.end === void 0) this.end = Infinity;
|
|
565
|
+
else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
|
|
566
|
+
if (this.start > this.end) throw new Error("start must be <= end");
|
|
567
|
+
this.pos = this.start;
|
|
568
|
+
}
|
|
569
|
+
if (this.fd !== null) {
|
|
570
|
+
process.nextTick(function() {
|
|
571
|
+
self._read();
|
|
572
|
+
});
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
fs$22.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
576
|
+
if (err) {
|
|
577
|
+
self.emit("error", err);
|
|
578
|
+
self.readable = false;
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
self.fd = fd;
|
|
582
|
+
self.emit("open", fd);
|
|
583
|
+
self._read();
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
function WriteStream(path$12, options) {
|
|
587
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path$12, options);
|
|
588
|
+
Stream.call(this);
|
|
589
|
+
this.path = path$12;
|
|
590
|
+
this.fd = null;
|
|
591
|
+
this.writable = true;
|
|
592
|
+
this.flags = "w";
|
|
593
|
+
this.encoding = "binary";
|
|
594
|
+
this.mode = 438;
|
|
595
|
+
this.bytesWritten = 0;
|
|
596
|
+
options = options || {};
|
|
597
|
+
var keys = Object.keys(options);
|
|
598
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
599
|
+
var key = keys[index];
|
|
600
|
+
this[key] = options[key];
|
|
601
|
+
}
|
|
602
|
+
if (this.start !== void 0) {
|
|
603
|
+
if ("number" !== typeof this.start) throw TypeError("start must be a Number");
|
|
604
|
+
if (this.start < 0) throw new Error("start must be >= zero");
|
|
605
|
+
this.pos = this.start;
|
|
606
|
+
}
|
|
607
|
+
this.busy = false;
|
|
608
|
+
this._queue = [];
|
|
609
|
+
if (this.fd === null) {
|
|
610
|
+
this._open = fs$22.open;
|
|
611
|
+
this._queue.push([
|
|
612
|
+
this._open,
|
|
613
|
+
this.path,
|
|
614
|
+
this.flags,
|
|
615
|
+
this.mode,
|
|
616
|
+
void 0
|
|
617
|
+
]);
|
|
618
|
+
this.flush();
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}) });
|
|
623
|
+
|
|
624
|
+
//#endregion
|
|
625
|
+
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
|
|
626
|
+
var require_clone = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js": ((exports, module) => {
|
|
627
|
+
module.exports = clone$1;
|
|
628
|
+
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
629
|
+
return obj.__proto__;
|
|
630
|
+
};
|
|
631
|
+
function clone$1(obj) {
|
|
632
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
633
|
+
if (obj instanceof Object) var copy$2 = { __proto__: getPrototypeOf(obj) };
|
|
634
|
+
else var copy$2 = Object.create(null);
|
|
635
|
+
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
636
|
+
Object.defineProperty(copy$2, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
637
|
+
});
|
|
638
|
+
return copy$2;
|
|
639
|
+
}
|
|
640
|
+
}) });
|
|
641
|
+
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
644
|
+
var require_graceful_fs = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js": ((exports, module) => {
|
|
645
|
+
var fs$21 = __require("fs");
|
|
646
|
+
var polyfills = require_polyfills();
|
|
647
|
+
var legacy = require_legacy_streams();
|
|
648
|
+
var clone = require_clone();
|
|
649
|
+
var util = __require("util");
|
|
650
|
+
/* istanbul ignore next - node 0.x polyfill */
|
|
651
|
+
var gracefulQueue;
|
|
652
|
+
var previousSymbol;
|
|
653
|
+
/* istanbul ignore else - node 0.x polyfill */
|
|
654
|
+
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
655
|
+
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
656
|
+
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
657
|
+
} else {
|
|
658
|
+
gracefulQueue = "___graceful-fs.queue";
|
|
659
|
+
previousSymbol = "___graceful-fs.previous";
|
|
660
|
+
}
|
|
661
|
+
function noop() {}
|
|
662
|
+
function publishQueue(context, queue$1) {
|
|
663
|
+
Object.defineProperty(context, gracefulQueue, { get: function() {
|
|
664
|
+
return queue$1;
|
|
665
|
+
} });
|
|
666
|
+
}
|
|
667
|
+
var debug = noop;
|
|
668
|
+
if (util.debuglog) debug = util.debuglog("gfs4");
|
|
669
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
|
|
670
|
+
var m = util.format.apply(util, arguments);
|
|
671
|
+
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
672
|
+
console.error(m);
|
|
673
|
+
};
|
|
674
|
+
if (!fs$21[gracefulQueue]) {
|
|
675
|
+
var queue = global[gracefulQueue] || [];
|
|
676
|
+
publishQueue(fs$21, queue);
|
|
677
|
+
fs$21.close = (function(fs$close) {
|
|
678
|
+
function close(fd, cb) {
|
|
679
|
+
return fs$close.call(fs$21, fd, function(err) {
|
|
680
|
+
if (!err) resetQueue();
|
|
681
|
+
if (typeof cb === "function") cb.apply(this, arguments);
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
685
|
+
return close;
|
|
686
|
+
})(fs$21.close);
|
|
687
|
+
fs$21.closeSync = (function(fs$closeSync) {
|
|
688
|
+
function closeSync(fd) {
|
|
689
|
+
fs$closeSync.apply(fs$21, arguments);
|
|
690
|
+
resetQueue();
|
|
691
|
+
}
|
|
692
|
+
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
693
|
+
return closeSync;
|
|
694
|
+
})(fs$21.closeSync);
|
|
695
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
696
|
+
debug(fs$21[gracefulQueue]);
|
|
697
|
+
__require("assert").equal(fs$21[gracefulQueue].length, 0);
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
if (!global[gracefulQueue]) publishQueue(global, fs$21[gracefulQueue]);
|
|
701
|
+
module.exports = patch(clone(fs$21));
|
|
702
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$21.__patched) {
|
|
703
|
+
module.exports = patch(fs$21);
|
|
704
|
+
fs$21.__patched = true;
|
|
705
|
+
}
|
|
706
|
+
function patch(fs$22) {
|
|
707
|
+
polyfills(fs$22);
|
|
708
|
+
fs$22.gracefulify = patch;
|
|
709
|
+
fs$22.createReadStream = createReadStream;
|
|
710
|
+
fs$22.createWriteStream = createWriteStream;
|
|
711
|
+
var fs$readFile = fs$22.readFile;
|
|
712
|
+
fs$22.readFile = readFile$1;
|
|
713
|
+
function readFile$1(path$12, options, cb) {
|
|
714
|
+
if (typeof options === "function") cb = options, options = null;
|
|
715
|
+
return go$readFile(path$12, options, cb);
|
|
716
|
+
function go$readFile(path$13, options$1, cb$1, startTime) {
|
|
717
|
+
return fs$readFile(path$13, options$1, function(err) {
|
|
718
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
719
|
+
go$readFile,
|
|
720
|
+
[
|
|
721
|
+
path$13,
|
|
722
|
+
options$1,
|
|
723
|
+
cb$1
|
|
724
|
+
],
|
|
725
|
+
err,
|
|
726
|
+
startTime || Date.now(),
|
|
727
|
+
Date.now()
|
|
728
|
+
]);
|
|
729
|
+
else if (typeof cb$1 === "function") cb$1.apply(this, arguments);
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
var fs$writeFile = fs$22.writeFile;
|
|
734
|
+
fs$22.writeFile = writeFile$1;
|
|
735
|
+
function writeFile$1(path$12, data, options, cb) {
|
|
736
|
+
if (typeof options === "function") cb = options, options = null;
|
|
737
|
+
return go$writeFile(path$12, data, options, cb);
|
|
738
|
+
function go$writeFile(path$13, data$1, options$1, cb$1, startTime) {
|
|
739
|
+
return fs$writeFile(path$13, data$1, options$1, function(err) {
|
|
740
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
741
|
+
go$writeFile,
|
|
742
|
+
[
|
|
743
|
+
path$13,
|
|
744
|
+
data$1,
|
|
745
|
+
options$1,
|
|
746
|
+
cb$1
|
|
747
|
+
],
|
|
748
|
+
err,
|
|
749
|
+
startTime || Date.now(),
|
|
750
|
+
Date.now()
|
|
751
|
+
]);
|
|
752
|
+
else if (typeof cb$1 === "function") cb$1.apply(this, arguments);
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
var fs$appendFile = fs$22.appendFile;
|
|
757
|
+
if (fs$appendFile) fs$22.appendFile = appendFile;
|
|
758
|
+
function appendFile(path$12, data, options, cb) {
|
|
759
|
+
if (typeof options === "function") cb = options, options = null;
|
|
760
|
+
return go$appendFile(path$12, data, options, cb);
|
|
761
|
+
function go$appendFile(path$13, data$1, options$1, cb$1, startTime) {
|
|
762
|
+
return fs$appendFile(path$13, data$1, options$1, function(err) {
|
|
763
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
764
|
+
go$appendFile,
|
|
765
|
+
[
|
|
766
|
+
path$13,
|
|
767
|
+
data$1,
|
|
768
|
+
options$1,
|
|
769
|
+
cb$1
|
|
770
|
+
],
|
|
771
|
+
err,
|
|
772
|
+
startTime || Date.now(),
|
|
773
|
+
Date.now()
|
|
774
|
+
]);
|
|
775
|
+
else if (typeof cb$1 === "function") cb$1.apply(this, arguments);
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
var fs$copyFile = fs$22.copyFile;
|
|
780
|
+
if (fs$copyFile) fs$22.copyFile = copyFile$2;
|
|
781
|
+
function copyFile$2(src, dest, flags, cb) {
|
|
782
|
+
if (typeof flags === "function") {
|
|
783
|
+
cb = flags;
|
|
784
|
+
flags = 0;
|
|
785
|
+
}
|
|
786
|
+
return go$copyFile(src, dest, flags, cb);
|
|
787
|
+
function go$copyFile(src$1, dest$1, flags$1, cb$1, startTime) {
|
|
788
|
+
return fs$copyFile(src$1, dest$1, flags$1, function(err) {
|
|
789
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
790
|
+
go$copyFile,
|
|
791
|
+
[
|
|
792
|
+
src$1,
|
|
793
|
+
dest$1,
|
|
794
|
+
flags$1,
|
|
795
|
+
cb$1
|
|
796
|
+
],
|
|
797
|
+
err,
|
|
798
|
+
startTime || Date.now(),
|
|
799
|
+
Date.now()
|
|
800
|
+
]);
|
|
801
|
+
else if (typeof cb$1 === "function") cb$1.apply(this, arguments);
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
var fs$readdir = fs$22.readdir;
|
|
806
|
+
fs$22.readdir = readdir;
|
|
807
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
808
|
+
function readdir(path$12, options, cb) {
|
|
809
|
+
if (typeof options === "function") cb = options, options = null;
|
|
810
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir$1(path$13, options$1, cb$1, startTime) {
|
|
811
|
+
return fs$readdir(path$13, fs$readdirCallback(path$13, options$1, cb$1, startTime));
|
|
812
|
+
} : function go$readdir$1(path$13, options$1, cb$1, startTime) {
|
|
813
|
+
return fs$readdir(path$13, options$1, fs$readdirCallback(path$13, options$1, cb$1, startTime));
|
|
814
|
+
};
|
|
815
|
+
return go$readdir(path$12, options, cb);
|
|
816
|
+
function fs$readdirCallback(path$13, options$1, cb$1, startTime) {
|
|
817
|
+
return function(err, files) {
|
|
818
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
819
|
+
go$readdir,
|
|
820
|
+
[
|
|
821
|
+
path$13,
|
|
822
|
+
options$1,
|
|
823
|
+
cb$1
|
|
824
|
+
],
|
|
825
|
+
err,
|
|
826
|
+
startTime || Date.now(),
|
|
827
|
+
Date.now()
|
|
828
|
+
]);
|
|
829
|
+
else {
|
|
830
|
+
if (files && files.sort) files.sort();
|
|
831
|
+
if (typeof cb$1 === "function") cb$1.call(this, err, files);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
if (process.version.substr(0, 4) === "v0.8") {
|
|
837
|
+
var legStreams = legacy(fs$22);
|
|
838
|
+
ReadStream = legStreams.ReadStream;
|
|
839
|
+
WriteStream = legStreams.WriteStream;
|
|
840
|
+
}
|
|
841
|
+
var fs$ReadStream = fs$22.ReadStream;
|
|
842
|
+
if (fs$ReadStream) {
|
|
843
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
844
|
+
ReadStream.prototype.open = ReadStream$open;
|
|
845
|
+
}
|
|
846
|
+
var fs$WriteStream = fs$22.WriteStream;
|
|
847
|
+
if (fs$WriteStream) {
|
|
848
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
849
|
+
WriteStream.prototype.open = WriteStream$open;
|
|
850
|
+
}
|
|
851
|
+
Object.defineProperty(fs$22, "ReadStream", {
|
|
852
|
+
get: function() {
|
|
853
|
+
return ReadStream;
|
|
854
|
+
},
|
|
855
|
+
set: function(val) {
|
|
856
|
+
ReadStream = val;
|
|
857
|
+
},
|
|
858
|
+
enumerable: true,
|
|
859
|
+
configurable: true
|
|
860
|
+
});
|
|
861
|
+
Object.defineProperty(fs$22, "WriteStream", {
|
|
862
|
+
get: function() {
|
|
863
|
+
return WriteStream;
|
|
864
|
+
},
|
|
865
|
+
set: function(val) {
|
|
866
|
+
WriteStream = val;
|
|
867
|
+
},
|
|
868
|
+
enumerable: true,
|
|
869
|
+
configurable: true
|
|
870
|
+
});
|
|
871
|
+
var FileReadStream = ReadStream;
|
|
872
|
+
Object.defineProperty(fs$22, "FileReadStream", {
|
|
873
|
+
get: function() {
|
|
874
|
+
return FileReadStream;
|
|
875
|
+
},
|
|
876
|
+
set: function(val) {
|
|
877
|
+
FileReadStream = val;
|
|
878
|
+
},
|
|
879
|
+
enumerable: true,
|
|
880
|
+
configurable: true
|
|
881
|
+
});
|
|
882
|
+
var FileWriteStream = WriteStream;
|
|
883
|
+
Object.defineProperty(fs$22, "FileWriteStream", {
|
|
884
|
+
get: function() {
|
|
885
|
+
return FileWriteStream;
|
|
886
|
+
},
|
|
887
|
+
set: function(val) {
|
|
888
|
+
FileWriteStream = val;
|
|
889
|
+
},
|
|
890
|
+
enumerable: true,
|
|
891
|
+
configurable: true
|
|
892
|
+
});
|
|
893
|
+
function ReadStream(path$12, options) {
|
|
894
|
+
if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
|
|
895
|
+
else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
896
|
+
}
|
|
897
|
+
function ReadStream$open() {
|
|
898
|
+
var that = this;
|
|
899
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
900
|
+
if (err) {
|
|
901
|
+
if (that.autoClose) that.destroy();
|
|
902
|
+
that.emit("error", err);
|
|
903
|
+
} else {
|
|
904
|
+
that.fd = fd;
|
|
905
|
+
that.emit("open", fd);
|
|
906
|
+
that.read();
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
function WriteStream(path$12, options) {
|
|
911
|
+
if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
|
|
912
|
+
else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
913
|
+
}
|
|
914
|
+
function WriteStream$open() {
|
|
915
|
+
var that = this;
|
|
916
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
917
|
+
if (err) {
|
|
918
|
+
that.destroy();
|
|
919
|
+
that.emit("error", err);
|
|
920
|
+
} else {
|
|
921
|
+
that.fd = fd;
|
|
922
|
+
that.emit("open", fd);
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
function createReadStream(path$12, options) {
|
|
927
|
+
return new fs$22.ReadStream(path$12, options);
|
|
928
|
+
}
|
|
929
|
+
function createWriteStream(path$12, options) {
|
|
930
|
+
return new fs$22.WriteStream(path$12, options);
|
|
931
|
+
}
|
|
932
|
+
var fs$open = fs$22.open;
|
|
933
|
+
fs$22.open = open;
|
|
934
|
+
function open(path$12, flags, mode, cb) {
|
|
935
|
+
if (typeof mode === "function") cb = mode, mode = null;
|
|
936
|
+
return go$open(path$12, flags, mode, cb);
|
|
937
|
+
function go$open(path$13, flags$1, mode$1, cb$1, startTime) {
|
|
938
|
+
return fs$open(path$13, flags$1, mode$1, function(err, fd) {
|
|
939
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
940
|
+
go$open,
|
|
941
|
+
[
|
|
942
|
+
path$13,
|
|
943
|
+
flags$1,
|
|
944
|
+
mode$1,
|
|
945
|
+
cb$1
|
|
946
|
+
],
|
|
947
|
+
err,
|
|
948
|
+
startTime || Date.now(),
|
|
949
|
+
Date.now()
|
|
950
|
+
]);
|
|
951
|
+
else if (typeof cb$1 === "function") cb$1.apply(this, arguments);
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
return fs$22;
|
|
956
|
+
}
|
|
957
|
+
function enqueue(elem) {
|
|
958
|
+
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
959
|
+
fs$21[gracefulQueue].push(elem);
|
|
960
|
+
retry();
|
|
961
|
+
}
|
|
962
|
+
var retryTimer;
|
|
963
|
+
function resetQueue() {
|
|
964
|
+
var now = Date.now();
|
|
965
|
+
for (var i = 0; i < fs$21[gracefulQueue].length; ++i) if (fs$21[gracefulQueue][i].length > 2) {
|
|
966
|
+
fs$21[gracefulQueue][i][3] = now;
|
|
967
|
+
fs$21[gracefulQueue][i][4] = now;
|
|
968
|
+
}
|
|
969
|
+
retry();
|
|
970
|
+
}
|
|
971
|
+
function retry() {
|
|
972
|
+
clearTimeout(retryTimer);
|
|
973
|
+
retryTimer = void 0;
|
|
974
|
+
if (fs$21[gracefulQueue].length === 0) return;
|
|
975
|
+
var elem = fs$21[gracefulQueue].shift();
|
|
976
|
+
var fn = elem[0];
|
|
977
|
+
var args = elem[1];
|
|
978
|
+
var err = elem[2];
|
|
979
|
+
var startTime = elem[3];
|
|
980
|
+
var lastTime = elem[4];
|
|
981
|
+
if (startTime === void 0) {
|
|
982
|
+
debug("RETRY", fn.name, args);
|
|
983
|
+
fn.apply(null, args);
|
|
984
|
+
} else if (Date.now() - startTime >= 6e4) {
|
|
985
|
+
debug("TIMEOUT", fn.name, args);
|
|
986
|
+
var cb = args.pop();
|
|
987
|
+
if (typeof cb === "function") cb.call(null, err);
|
|
988
|
+
} else {
|
|
989
|
+
var sinceAttempt = Date.now() - lastTime;
|
|
990
|
+
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
991
|
+
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
992
|
+
if (sinceAttempt >= desiredDelay) {
|
|
993
|
+
debug("RETRY", fn.name, args);
|
|
994
|
+
fn.apply(null, args.concat([startTime]));
|
|
995
|
+
} else fs$21[gracefulQueue].push(elem);
|
|
996
|
+
}
|
|
997
|
+
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
998
|
+
}
|
|
999
|
+
}) });
|
|
1000
|
+
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/fs/index.js
|
|
1003
|
+
var require_fs = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/fs/index.js": ((exports) => {
|
|
1004
|
+
const u$15 = require_universalify().fromCallback;
|
|
1005
|
+
const fs$20 = require_graceful_fs();
|
|
1006
|
+
const api = [
|
|
1007
|
+
"access",
|
|
1008
|
+
"appendFile",
|
|
1009
|
+
"chmod",
|
|
1010
|
+
"chown",
|
|
1011
|
+
"close",
|
|
1012
|
+
"copyFile",
|
|
1013
|
+
"cp",
|
|
1014
|
+
"fchmod",
|
|
1015
|
+
"fchown",
|
|
1016
|
+
"fdatasync",
|
|
1017
|
+
"fstat",
|
|
1018
|
+
"fsync",
|
|
1019
|
+
"ftruncate",
|
|
1020
|
+
"futimes",
|
|
1021
|
+
"glob",
|
|
1022
|
+
"lchmod",
|
|
1023
|
+
"lchown",
|
|
1024
|
+
"lutimes",
|
|
1025
|
+
"link",
|
|
1026
|
+
"lstat",
|
|
1027
|
+
"mkdir",
|
|
1028
|
+
"mkdtemp",
|
|
1029
|
+
"open",
|
|
1030
|
+
"opendir",
|
|
1031
|
+
"readdir",
|
|
1032
|
+
"readFile",
|
|
1033
|
+
"readlink",
|
|
1034
|
+
"realpath",
|
|
1035
|
+
"rename",
|
|
1036
|
+
"rm",
|
|
1037
|
+
"rmdir",
|
|
1038
|
+
"stat",
|
|
1039
|
+
"statfs",
|
|
1040
|
+
"symlink",
|
|
1041
|
+
"truncate",
|
|
1042
|
+
"unlink",
|
|
1043
|
+
"utimes",
|
|
1044
|
+
"writeFile"
|
|
1045
|
+
].filter((key) => {
|
|
1046
|
+
return typeof fs$20[key] === "function";
|
|
1047
|
+
});
|
|
1048
|
+
Object.assign(exports, fs$20);
|
|
1049
|
+
api.forEach((method) => {
|
|
1050
|
+
exports[method] = u$15(fs$20[method]);
|
|
1051
|
+
});
|
|
1052
|
+
exports.exists = function(filename, callback) {
|
|
1053
|
+
if (typeof callback === "function") return fs$20.exists(filename, callback);
|
|
1054
|
+
return new Promise((resolve$1) => {
|
|
1055
|
+
return fs$20.exists(filename, resolve$1);
|
|
1056
|
+
});
|
|
1057
|
+
};
|
|
1058
|
+
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
1059
|
+
if (typeof callback === "function") return fs$20.read(fd, buffer, offset, length, position, callback);
|
|
1060
|
+
return new Promise((resolve$1, reject) => {
|
|
1061
|
+
fs$20.read(fd, buffer, offset, length, position, (err, bytesRead, buffer$1) => {
|
|
1062
|
+
if (err) return reject(err);
|
|
1063
|
+
resolve$1({
|
|
1064
|
+
bytesRead,
|
|
1065
|
+
buffer: buffer$1
|
|
1066
|
+
});
|
|
1067
|
+
});
|
|
1068
|
+
});
|
|
1069
|
+
};
|
|
1070
|
+
exports.write = function(fd, buffer, ...args) {
|
|
1071
|
+
if (typeof args[args.length - 1] === "function") return fs$20.write(fd, buffer, ...args);
|
|
1072
|
+
return new Promise((resolve$1, reject) => {
|
|
1073
|
+
fs$20.write(fd, buffer, ...args, (err, bytesWritten, buffer$1) => {
|
|
1074
|
+
if (err) return reject(err);
|
|
1075
|
+
resolve$1({
|
|
1076
|
+
bytesWritten,
|
|
1077
|
+
buffer: buffer$1
|
|
1078
|
+
});
|
|
1079
|
+
});
|
|
1080
|
+
});
|
|
1081
|
+
};
|
|
1082
|
+
exports.readv = function(fd, buffers, ...args) {
|
|
1083
|
+
if (typeof args[args.length - 1] === "function") return fs$20.readv(fd, buffers, ...args);
|
|
1084
|
+
return new Promise((resolve$1, reject) => {
|
|
1085
|
+
fs$20.readv(fd, buffers, ...args, (err, bytesRead, buffers$1) => {
|
|
1086
|
+
if (err) return reject(err);
|
|
1087
|
+
resolve$1({
|
|
1088
|
+
bytesRead,
|
|
1089
|
+
buffers: buffers$1
|
|
1090
|
+
});
|
|
1091
|
+
});
|
|
1092
|
+
});
|
|
1093
|
+
};
|
|
1094
|
+
exports.writev = function(fd, buffers, ...args) {
|
|
1095
|
+
if (typeof args[args.length - 1] === "function") return fs$20.writev(fd, buffers, ...args);
|
|
1096
|
+
return new Promise((resolve$1, reject) => {
|
|
1097
|
+
fs$20.writev(fd, buffers, ...args, (err, bytesWritten, buffers$1) => {
|
|
1098
|
+
if (err) return reject(err);
|
|
1099
|
+
resolve$1({
|
|
1100
|
+
bytesWritten,
|
|
1101
|
+
buffers: buffers$1
|
|
1102
|
+
});
|
|
1103
|
+
});
|
|
1104
|
+
});
|
|
1105
|
+
};
|
|
1106
|
+
if (typeof fs$20.realpath.native === "function") exports.realpath.native = u$15(fs$20.realpath.native);
|
|
1107
|
+
else process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003");
|
|
1108
|
+
}) });
|
|
1109
|
+
|
|
1110
|
+
//#endregion
|
|
1111
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/utils.js
|
|
1112
|
+
var require_utils$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/utils.js": ((exports, module) => {
|
|
1113
|
+
const path$11 = __require("path");
|
|
1114
|
+
module.exports.checkPath = function checkPath$1(pth) {
|
|
1115
|
+
if (process.platform === "win32") {
|
|
1116
|
+
if (/[<>:"|?*]/.test(pth.replace(path$11.parse(pth).root, ""))) {
|
|
1117
|
+
const error = /* @__PURE__ */ new Error(`Path contains invalid characters: ${pth}`);
|
|
1118
|
+
error.code = "EINVAL";
|
|
1119
|
+
throw error;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
}) });
|
|
1124
|
+
|
|
1125
|
+
//#endregion
|
|
1126
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/make-dir.js
|
|
1127
|
+
var require_make_dir = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/make-dir.js": ((exports, module) => {
|
|
1128
|
+
const fs$19 = require_fs();
|
|
1129
|
+
const { checkPath } = require_utils$1();
|
|
1130
|
+
const getMode = (options) => {
|
|
1131
|
+
const defaults = { mode: 511 };
|
|
1132
|
+
if (typeof options === "number") return options;
|
|
1133
|
+
return {
|
|
1134
|
+
...defaults,
|
|
1135
|
+
...options
|
|
1136
|
+
}.mode;
|
|
1137
|
+
};
|
|
1138
|
+
module.exports.makeDir = async (dir, options) => {
|
|
1139
|
+
checkPath(dir);
|
|
1140
|
+
return fs$19.mkdir(dir, {
|
|
1141
|
+
mode: getMode(options),
|
|
1142
|
+
recursive: true
|
|
1143
|
+
});
|
|
1144
|
+
};
|
|
1145
|
+
module.exports.makeDirSync = (dir, options) => {
|
|
1146
|
+
checkPath(dir);
|
|
1147
|
+
return fs$19.mkdirSync(dir, {
|
|
1148
|
+
mode: getMode(options),
|
|
1149
|
+
recursive: true
|
|
1150
|
+
});
|
|
1151
|
+
};
|
|
1152
|
+
}) });
|
|
1153
|
+
|
|
1154
|
+
//#endregion
|
|
1155
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/index.js
|
|
1156
|
+
var require_mkdirs = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/index.js": ((exports, module) => {
|
|
1157
|
+
const u$14 = require_universalify().fromPromise;
|
|
1158
|
+
const { makeDir: _makeDir, makeDirSync } = require_make_dir();
|
|
1159
|
+
const makeDir = u$14(_makeDir);
|
|
1160
|
+
module.exports = {
|
|
1161
|
+
mkdirs: makeDir,
|
|
1162
|
+
mkdirsSync: makeDirSync,
|
|
1163
|
+
mkdirp: makeDir,
|
|
1164
|
+
mkdirpSync: makeDirSync,
|
|
1165
|
+
ensureDir: makeDir,
|
|
1166
|
+
ensureDirSync: makeDirSync
|
|
1167
|
+
};
|
|
1168
|
+
}) });
|
|
1169
|
+
|
|
1170
|
+
//#endregion
|
|
1171
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/path-exists/index.js
|
|
1172
|
+
var require_path_exists = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/path-exists/index.js": ((exports, module) => {
|
|
1173
|
+
const u$13 = require_universalify().fromPromise;
|
|
1174
|
+
const fs$18 = require_fs();
|
|
1175
|
+
function pathExists$6(path$12) {
|
|
1176
|
+
return fs$18.access(path$12).then(() => true).catch(() => false);
|
|
1177
|
+
}
|
|
1178
|
+
module.exports = {
|
|
1179
|
+
pathExists: u$13(pathExists$6),
|
|
1180
|
+
pathExistsSync: fs$18.existsSync
|
|
1181
|
+
};
|
|
1182
|
+
}) });
|
|
1183
|
+
|
|
1184
|
+
//#endregion
|
|
1185
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/utimes.js
|
|
1186
|
+
var require_utimes = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/utimes.js": ((exports, module) => {
|
|
1187
|
+
const fs$17 = require_fs();
|
|
1188
|
+
const u$12 = require_universalify().fromPromise;
|
|
1189
|
+
async function utimesMillis$1(path$12, atime, mtime) {
|
|
1190
|
+
const fd = await fs$17.open(path$12, "r+");
|
|
1191
|
+
let closeErr = null;
|
|
1192
|
+
try {
|
|
1193
|
+
await fs$17.futimes(fd, atime, mtime);
|
|
1194
|
+
} finally {
|
|
1195
|
+
try {
|
|
1196
|
+
await fs$17.close(fd);
|
|
1197
|
+
} catch (e) {
|
|
1198
|
+
closeErr = e;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
if (closeErr) throw closeErr;
|
|
1202
|
+
}
|
|
1203
|
+
function utimesMillisSync$1(path$12, atime, mtime) {
|
|
1204
|
+
const fd = fs$17.openSync(path$12, "r+");
|
|
1205
|
+
fs$17.futimesSync(fd, atime, mtime);
|
|
1206
|
+
return fs$17.closeSync(fd);
|
|
1207
|
+
}
|
|
1208
|
+
module.exports = {
|
|
1209
|
+
utimesMillis: u$12(utimesMillis$1),
|
|
1210
|
+
utimesMillisSync: utimesMillisSync$1
|
|
1211
|
+
};
|
|
1212
|
+
}) });
|
|
1213
|
+
|
|
1214
|
+
//#endregion
|
|
1215
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/stat.js
|
|
1216
|
+
var require_stat = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/stat.js": ((exports, module) => {
|
|
1217
|
+
const fs$16 = require_fs();
|
|
1218
|
+
const path$10 = __require("path");
|
|
1219
|
+
const u$11 = require_universalify().fromPromise;
|
|
1220
|
+
function getStats$1(src, dest, opts) {
|
|
1221
|
+
const statFunc = opts.dereference ? (file) => fs$16.stat(file, { bigint: true }) : (file) => fs$16.lstat(file, { bigint: true });
|
|
1222
|
+
return Promise.all([statFunc(src), statFunc(dest).catch((err) => {
|
|
1223
|
+
if (err.code === "ENOENT") return null;
|
|
1224
|
+
throw err;
|
|
1225
|
+
})]).then(([srcStat, destStat]) => ({
|
|
1226
|
+
srcStat,
|
|
1227
|
+
destStat
|
|
1228
|
+
}));
|
|
1229
|
+
}
|
|
1230
|
+
function getStatsSync(src, dest, opts) {
|
|
1231
|
+
let destStat;
|
|
1232
|
+
const statFunc = opts.dereference ? (file) => fs$16.statSync(file, { bigint: true }) : (file) => fs$16.lstatSync(file, { bigint: true });
|
|
1233
|
+
const srcStat = statFunc(src);
|
|
1234
|
+
try {
|
|
1235
|
+
destStat = statFunc(dest);
|
|
1236
|
+
} catch (err) {
|
|
1237
|
+
if (err.code === "ENOENT") return {
|
|
1238
|
+
srcStat,
|
|
1239
|
+
destStat: null
|
|
1240
|
+
};
|
|
1241
|
+
throw err;
|
|
1242
|
+
}
|
|
1243
|
+
return {
|
|
1244
|
+
srcStat,
|
|
1245
|
+
destStat
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
async function checkPaths(src, dest, funcName, opts) {
|
|
1249
|
+
const { srcStat, destStat } = await getStats$1(src, dest, opts);
|
|
1250
|
+
if (destStat) {
|
|
1251
|
+
if (areIdentical$2(srcStat, destStat)) {
|
|
1252
|
+
const srcBaseName = path$10.basename(src);
|
|
1253
|
+
const destBaseName = path$10.basename(dest);
|
|
1254
|
+
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) return {
|
|
1255
|
+
srcStat,
|
|
1256
|
+
destStat,
|
|
1257
|
+
isChangingCase: true
|
|
1258
|
+
};
|
|
1259
|
+
throw new Error("Source and destination must not be the same.");
|
|
1260
|
+
}
|
|
1261
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1262
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1263
|
+
}
|
|
1264
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) throw new Error(errMsg(src, dest, funcName));
|
|
1265
|
+
return {
|
|
1266
|
+
srcStat,
|
|
1267
|
+
destStat
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
function checkPathsSync(src, dest, funcName, opts) {
|
|
1271
|
+
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
1272
|
+
if (destStat) {
|
|
1273
|
+
if (areIdentical$2(srcStat, destStat)) {
|
|
1274
|
+
const srcBaseName = path$10.basename(src);
|
|
1275
|
+
const destBaseName = path$10.basename(dest);
|
|
1276
|
+
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) return {
|
|
1277
|
+
srcStat,
|
|
1278
|
+
destStat,
|
|
1279
|
+
isChangingCase: true
|
|
1280
|
+
};
|
|
1281
|
+
throw new Error("Source and destination must not be the same.");
|
|
1282
|
+
}
|
|
1283
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1284
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1285
|
+
}
|
|
1286
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) throw new Error(errMsg(src, dest, funcName));
|
|
1287
|
+
return {
|
|
1288
|
+
srcStat,
|
|
1289
|
+
destStat
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
1293
|
+
const srcParent = path$10.resolve(path$10.dirname(src));
|
|
1294
|
+
const destParent = path$10.resolve(path$10.dirname(dest));
|
|
1295
|
+
if (destParent === srcParent || destParent === path$10.parse(destParent).root) return;
|
|
1296
|
+
let destStat;
|
|
1297
|
+
try {
|
|
1298
|
+
destStat = await fs$16.stat(destParent, { bigint: true });
|
|
1299
|
+
} catch (err) {
|
|
1300
|
+
if (err.code === "ENOENT") return;
|
|
1301
|
+
throw err;
|
|
1302
|
+
}
|
|
1303
|
+
if (areIdentical$2(srcStat, destStat)) throw new Error(errMsg(src, dest, funcName));
|
|
1304
|
+
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
1305
|
+
}
|
|
1306
|
+
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
1307
|
+
const srcParent = path$10.resolve(path$10.dirname(src));
|
|
1308
|
+
const destParent = path$10.resolve(path$10.dirname(dest));
|
|
1309
|
+
if (destParent === srcParent || destParent === path$10.parse(destParent).root) return;
|
|
1310
|
+
let destStat;
|
|
1311
|
+
try {
|
|
1312
|
+
destStat = fs$16.statSync(destParent, { bigint: true });
|
|
1313
|
+
} catch (err) {
|
|
1314
|
+
if (err.code === "ENOENT") return;
|
|
1315
|
+
throw err;
|
|
1316
|
+
}
|
|
1317
|
+
if (areIdentical$2(srcStat, destStat)) throw new Error(errMsg(src, dest, funcName));
|
|
1318
|
+
return checkParentPathsSync(src, srcStat, destParent, funcName);
|
|
1319
|
+
}
|
|
1320
|
+
function areIdentical$2(srcStat, destStat) {
|
|
1321
|
+
return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
1322
|
+
}
|
|
1323
|
+
function isSrcSubdir(src, dest) {
|
|
1324
|
+
const srcArr = path$10.resolve(src).split(path$10.sep).filter((i) => i);
|
|
1325
|
+
const destArr = path$10.resolve(dest).split(path$10.sep).filter((i) => i);
|
|
1326
|
+
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
1327
|
+
}
|
|
1328
|
+
function errMsg(src, dest, funcName) {
|
|
1329
|
+
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
|
|
1330
|
+
}
|
|
1331
|
+
module.exports = {
|
|
1332
|
+
checkPaths: u$11(checkPaths),
|
|
1333
|
+
checkPathsSync,
|
|
1334
|
+
checkParentPaths: u$11(checkParentPaths),
|
|
1335
|
+
checkParentPathsSync,
|
|
1336
|
+
isSrcSubdir,
|
|
1337
|
+
areIdentical: areIdentical$2
|
|
1338
|
+
};
|
|
1339
|
+
}) });
|
|
1340
|
+
|
|
1341
|
+
//#endregion
|
|
1342
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy.js
|
|
1343
|
+
var require_copy$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy.js": ((exports, module) => {
|
|
1344
|
+
const fs$15 = require_fs();
|
|
1345
|
+
const path$9 = __require("path");
|
|
1346
|
+
const { mkdirs: mkdirs$1 } = require_mkdirs();
|
|
1347
|
+
const { pathExists: pathExists$5 } = require_path_exists();
|
|
1348
|
+
const { utimesMillis } = require_utimes();
|
|
1349
|
+
const stat$3 = require_stat();
|
|
1350
|
+
async function copy$1(src, dest, opts = {}) {
|
|
1351
|
+
if (typeof opts === "function") opts = { filter: opts };
|
|
1352
|
+
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1353
|
+
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1354
|
+
if (opts.preserveTimestamps && process.arch === "ia32") process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0001");
|
|
1355
|
+
const { srcStat, destStat } = await stat$3.checkPaths(src, dest, "copy", opts);
|
|
1356
|
+
await stat$3.checkParentPaths(src, srcStat, dest, "copy");
|
|
1357
|
+
if (!await runFilter(src, dest, opts)) return;
|
|
1358
|
+
const destParent = path$9.dirname(dest);
|
|
1359
|
+
if (!await pathExists$5(destParent)) await mkdirs$1(destParent);
|
|
1360
|
+
await getStatsAndPerformCopy(destStat, src, dest, opts);
|
|
1361
|
+
}
|
|
1362
|
+
async function runFilter(src, dest, opts) {
|
|
1363
|
+
if (!opts.filter) return true;
|
|
1364
|
+
return opts.filter(src, dest);
|
|
1365
|
+
}
|
|
1366
|
+
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
1367
|
+
const srcStat = await (opts.dereference ? fs$15.stat : fs$15.lstat)(src);
|
|
1368
|
+
if (srcStat.isDirectory()) return onDir$1(srcStat, destStat, src, dest, opts);
|
|
1369
|
+
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile$1(srcStat, destStat, src, dest, opts);
|
|
1370
|
+
if (srcStat.isSymbolicLink()) return onLink$1(destStat, src, dest, opts);
|
|
1371
|
+
if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1372
|
+
if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1373
|
+
throw new Error(`Unknown file: ${src}`);
|
|
1374
|
+
}
|
|
1375
|
+
async function onFile$1(srcStat, destStat, src, dest, opts) {
|
|
1376
|
+
if (!destStat) return copyFile$1(srcStat, src, dest, opts);
|
|
1377
|
+
if (opts.overwrite) {
|
|
1378
|
+
await fs$15.unlink(dest);
|
|
1379
|
+
return copyFile$1(srcStat, src, dest, opts);
|
|
1380
|
+
}
|
|
1381
|
+
if (opts.errorOnExist) throw new Error(`'${dest}' already exists`);
|
|
1382
|
+
}
|
|
1383
|
+
async function copyFile$1(srcStat, src, dest, opts) {
|
|
1384
|
+
await fs$15.copyFile(src, dest);
|
|
1385
|
+
if (opts.preserveTimestamps) {
|
|
1386
|
+
if (fileIsNotWritable$1(srcStat.mode)) await makeFileWritable$1(dest, srcStat.mode);
|
|
1387
|
+
const updatedSrcStat = await fs$15.stat(src);
|
|
1388
|
+
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1389
|
+
}
|
|
1390
|
+
return fs$15.chmod(dest, srcStat.mode);
|
|
1391
|
+
}
|
|
1392
|
+
function fileIsNotWritable$1(srcMode) {
|
|
1393
|
+
return (srcMode & 128) === 0;
|
|
1394
|
+
}
|
|
1395
|
+
function makeFileWritable$1(dest, srcMode) {
|
|
1396
|
+
return fs$15.chmod(dest, srcMode | 128);
|
|
1397
|
+
}
|
|
1398
|
+
async function onDir$1(srcStat, destStat, src, dest, opts) {
|
|
1399
|
+
if (!destStat) await fs$15.mkdir(dest);
|
|
1400
|
+
const promises = [];
|
|
1401
|
+
for await (const item of await fs$15.opendir(src)) {
|
|
1402
|
+
const srcItem = path$9.join(src, item.name);
|
|
1403
|
+
const destItem = path$9.join(dest, item.name);
|
|
1404
|
+
promises.push(runFilter(srcItem, destItem, opts).then((include) => {
|
|
1405
|
+
if (include) return stat$3.checkPaths(srcItem, destItem, "copy", opts).then(({ destStat: destStat$1 }) => {
|
|
1406
|
+
return getStatsAndPerformCopy(destStat$1, srcItem, destItem, opts);
|
|
1407
|
+
});
|
|
1408
|
+
}));
|
|
1409
|
+
}
|
|
1410
|
+
await Promise.all(promises);
|
|
1411
|
+
if (!destStat) await fs$15.chmod(dest, srcStat.mode);
|
|
1412
|
+
}
|
|
1413
|
+
async function onLink$1(destStat, src, dest, opts) {
|
|
1414
|
+
let resolvedSrc = await fs$15.readlink(src);
|
|
1415
|
+
if (opts.dereference) resolvedSrc = path$9.resolve(process.cwd(), resolvedSrc);
|
|
1416
|
+
if (!destStat) return fs$15.symlink(resolvedSrc, dest);
|
|
1417
|
+
let resolvedDest = null;
|
|
1418
|
+
try {
|
|
1419
|
+
resolvedDest = await fs$15.readlink(dest);
|
|
1420
|
+
} catch (e) {
|
|
1421
|
+
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs$15.symlink(resolvedSrc, dest);
|
|
1422
|
+
throw e;
|
|
1423
|
+
}
|
|
1424
|
+
if (opts.dereference) resolvedDest = path$9.resolve(process.cwd(), resolvedDest);
|
|
1425
|
+
if (stat$3.isSrcSubdir(resolvedSrc, resolvedDest)) throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1426
|
+
if (stat$3.isSrcSubdir(resolvedDest, resolvedSrc)) throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1427
|
+
await fs$15.unlink(dest);
|
|
1428
|
+
return fs$15.symlink(resolvedSrc, dest);
|
|
1429
|
+
}
|
|
1430
|
+
module.exports = copy$1;
|
|
1431
|
+
}) });
|
|
1432
|
+
|
|
1433
|
+
//#endregion
|
|
1434
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy-sync.js
|
|
1435
|
+
var require_copy_sync = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy-sync.js": ((exports, module) => {
|
|
1436
|
+
const fs$14 = require_graceful_fs();
|
|
1437
|
+
const path$8 = __require("path");
|
|
1438
|
+
const mkdirsSync$1 = require_mkdirs().mkdirsSync;
|
|
1439
|
+
const utimesMillisSync = require_utimes().utimesMillisSync;
|
|
1440
|
+
const stat$2 = require_stat();
|
|
1441
|
+
function copySync$1(src, dest, opts) {
|
|
1442
|
+
if (typeof opts === "function") opts = { filter: opts };
|
|
1443
|
+
opts = opts || {};
|
|
1444
|
+
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1445
|
+
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1446
|
+
if (opts.preserveTimestamps && process.arch === "ia32") process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0002");
|
|
1447
|
+
const { srcStat, destStat } = stat$2.checkPathsSync(src, dest, "copy", opts);
|
|
1448
|
+
stat$2.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
1449
|
+
if (opts.filter && !opts.filter(src, dest)) return;
|
|
1450
|
+
const destParent = path$8.dirname(dest);
|
|
1451
|
+
if (!fs$14.existsSync(destParent)) mkdirsSync$1(destParent);
|
|
1452
|
+
return getStats(destStat, src, dest, opts);
|
|
1453
|
+
}
|
|
1454
|
+
function getStats(destStat, src, dest, opts) {
|
|
1455
|
+
const srcStat = (opts.dereference ? fs$14.statSync : fs$14.lstatSync)(src);
|
|
1456
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
1457
|
+
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
1458
|
+
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
|
|
1459
|
+
else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1460
|
+
else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1461
|
+
throw new Error(`Unknown file: ${src}`);
|
|
1462
|
+
}
|
|
1463
|
+
function onFile(srcStat, destStat, src, dest, opts) {
|
|
1464
|
+
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
1465
|
+
return mayCopyFile(srcStat, src, dest, opts);
|
|
1466
|
+
}
|
|
1467
|
+
function mayCopyFile(srcStat, src, dest, opts) {
|
|
1468
|
+
if (opts.overwrite) {
|
|
1469
|
+
fs$14.unlinkSync(dest);
|
|
1470
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1471
|
+
} else if (opts.errorOnExist) throw new Error(`'${dest}' already exists`);
|
|
1472
|
+
}
|
|
1473
|
+
function copyFile(srcStat, src, dest, opts) {
|
|
1474
|
+
fs$14.copyFileSync(src, dest);
|
|
1475
|
+
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
|
|
1476
|
+
return setDestMode(dest, srcStat.mode);
|
|
1477
|
+
}
|
|
1478
|
+
function handleTimestamps(srcMode, src, dest) {
|
|
1479
|
+
if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
|
|
1480
|
+
return setDestTimestamps(src, dest);
|
|
1481
|
+
}
|
|
1482
|
+
function fileIsNotWritable(srcMode) {
|
|
1483
|
+
return (srcMode & 128) === 0;
|
|
1484
|
+
}
|
|
1485
|
+
function makeFileWritable(dest, srcMode) {
|
|
1486
|
+
return setDestMode(dest, srcMode | 128);
|
|
1487
|
+
}
|
|
1488
|
+
function setDestMode(dest, srcMode) {
|
|
1489
|
+
return fs$14.chmodSync(dest, srcMode);
|
|
1490
|
+
}
|
|
1491
|
+
function setDestTimestamps(src, dest) {
|
|
1492
|
+
const updatedSrcStat = fs$14.statSync(src);
|
|
1493
|
+
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1494
|
+
}
|
|
1495
|
+
function onDir(srcStat, destStat, src, dest, opts) {
|
|
1496
|
+
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
|
|
1497
|
+
return copyDir(src, dest, opts);
|
|
1498
|
+
}
|
|
1499
|
+
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
1500
|
+
fs$14.mkdirSync(dest);
|
|
1501
|
+
copyDir(src, dest, opts);
|
|
1502
|
+
return setDestMode(dest, srcMode);
|
|
1503
|
+
}
|
|
1504
|
+
function copyDir(src, dest, opts) {
|
|
1505
|
+
const dir = fs$14.opendirSync(src);
|
|
1506
|
+
try {
|
|
1507
|
+
let dirent;
|
|
1508
|
+
while ((dirent = dir.readSync()) !== null) copyDirItem(dirent.name, src, dest, opts);
|
|
1509
|
+
} finally {
|
|
1510
|
+
dir.closeSync();
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
function copyDirItem(item, src, dest, opts) {
|
|
1514
|
+
const srcItem = path$8.join(src, item);
|
|
1515
|
+
const destItem = path$8.join(dest, item);
|
|
1516
|
+
if (opts.filter && !opts.filter(srcItem, destItem)) return;
|
|
1517
|
+
const { destStat } = stat$2.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
1518
|
+
return getStats(destStat, srcItem, destItem, opts);
|
|
1519
|
+
}
|
|
1520
|
+
function onLink(destStat, src, dest, opts) {
|
|
1521
|
+
let resolvedSrc = fs$14.readlinkSync(src);
|
|
1522
|
+
if (opts.dereference) resolvedSrc = path$8.resolve(process.cwd(), resolvedSrc);
|
|
1523
|
+
if (!destStat) return fs$14.symlinkSync(resolvedSrc, dest);
|
|
1524
|
+
else {
|
|
1525
|
+
let resolvedDest;
|
|
1526
|
+
try {
|
|
1527
|
+
resolvedDest = fs$14.readlinkSync(dest);
|
|
1528
|
+
} catch (err) {
|
|
1529
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs$14.symlinkSync(resolvedSrc, dest);
|
|
1530
|
+
throw err;
|
|
1531
|
+
}
|
|
1532
|
+
if (opts.dereference) resolvedDest = path$8.resolve(process.cwd(), resolvedDest);
|
|
1533
|
+
if (stat$2.isSrcSubdir(resolvedSrc, resolvedDest)) throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1534
|
+
if (stat$2.isSrcSubdir(resolvedDest, resolvedSrc)) throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1535
|
+
return copyLink(resolvedSrc, dest);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
function copyLink(resolvedSrc, dest) {
|
|
1539
|
+
fs$14.unlinkSync(dest);
|
|
1540
|
+
return fs$14.symlinkSync(resolvedSrc, dest);
|
|
1541
|
+
}
|
|
1542
|
+
module.exports = copySync$1;
|
|
1543
|
+
}) });
|
|
1544
|
+
|
|
1545
|
+
//#endregion
|
|
1546
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/index.js
|
|
1547
|
+
var require_copy = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/index.js": ((exports, module) => {
|
|
1548
|
+
const u$10 = require_universalify().fromPromise;
|
|
1549
|
+
module.exports = {
|
|
1550
|
+
copy: u$10(require_copy$1()),
|
|
1551
|
+
copySync: require_copy_sync()
|
|
1552
|
+
};
|
|
1553
|
+
}) });
|
|
1554
|
+
|
|
1555
|
+
//#endregion
|
|
1556
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/remove/index.js
|
|
1557
|
+
var require_remove = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/remove/index.js": ((exports, module) => {
|
|
1558
|
+
const fs$13 = require_graceful_fs();
|
|
1559
|
+
const u$9 = require_universalify().fromCallback;
|
|
1560
|
+
function remove$2(path$12, callback) {
|
|
1561
|
+
fs$13.rm(path$12, {
|
|
1562
|
+
recursive: true,
|
|
1563
|
+
force: true
|
|
1564
|
+
}, callback);
|
|
1565
|
+
}
|
|
1566
|
+
function removeSync$1(path$12) {
|
|
1567
|
+
fs$13.rmSync(path$12, {
|
|
1568
|
+
recursive: true,
|
|
1569
|
+
force: true
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
module.exports = {
|
|
1573
|
+
remove: u$9(remove$2),
|
|
1574
|
+
removeSync: removeSync$1
|
|
1575
|
+
};
|
|
1576
|
+
}) });
|
|
1577
|
+
|
|
1578
|
+
//#endregion
|
|
1579
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/empty/index.js
|
|
1580
|
+
var require_empty = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/empty/index.js": ((exports, module) => {
|
|
1581
|
+
const u$8 = require_universalify().fromPromise;
|
|
1582
|
+
const fs$12 = require_fs();
|
|
1583
|
+
const path$7 = __require("path");
|
|
1584
|
+
const mkdir$3 = require_mkdirs();
|
|
1585
|
+
const remove$1 = require_remove();
|
|
1586
|
+
const emptyDir = u$8(async function emptyDir$1(dir) {
|
|
1587
|
+
let items;
|
|
1588
|
+
try {
|
|
1589
|
+
items = await fs$12.readdir(dir);
|
|
1590
|
+
} catch {
|
|
1591
|
+
return mkdir$3.mkdirs(dir);
|
|
1592
|
+
}
|
|
1593
|
+
return Promise.all(items.map((item) => remove$1.remove(path$7.join(dir, item))));
|
|
1594
|
+
});
|
|
1595
|
+
function emptyDirSync(dir) {
|
|
1596
|
+
let items;
|
|
1597
|
+
try {
|
|
1598
|
+
items = fs$12.readdirSync(dir);
|
|
1599
|
+
} catch {
|
|
1600
|
+
return mkdir$3.mkdirsSync(dir);
|
|
1601
|
+
}
|
|
1602
|
+
items.forEach((item) => {
|
|
1603
|
+
item = path$7.join(dir, item);
|
|
1604
|
+
remove$1.removeSync(item);
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
module.exports = {
|
|
1608
|
+
emptyDirSync,
|
|
1609
|
+
emptydirSync: emptyDirSync,
|
|
1610
|
+
emptyDir,
|
|
1611
|
+
emptydir: emptyDir
|
|
1612
|
+
};
|
|
1613
|
+
}) });
|
|
1614
|
+
|
|
1615
|
+
//#endregion
|
|
1616
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/file.js
|
|
1617
|
+
var require_file = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/file.js": ((exports, module) => {
|
|
1618
|
+
const u$7 = require_universalify().fromPromise;
|
|
1619
|
+
const path$6 = __require("path");
|
|
1620
|
+
const fs$11 = require_fs();
|
|
1621
|
+
const mkdir$2 = require_mkdirs();
|
|
1622
|
+
async function createFile$1(file) {
|
|
1623
|
+
let stats;
|
|
1624
|
+
try {
|
|
1625
|
+
stats = await fs$11.stat(file);
|
|
1626
|
+
} catch {}
|
|
1627
|
+
if (stats && stats.isFile()) return;
|
|
1628
|
+
const dir = path$6.dirname(file);
|
|
1629
|
+
let dirStats = null;
|
|
1630
|
+
try {
|
|
1631
|
+
dirStats = await fs$11.stat(dir);
|
|
1632
|
+
} catch (err) {
|
|
1633
|
+
if (err.code === "ENOENT") {
|
|
1634
|
+
await mkdir$2.mkdirs(dir);
|
|
1635
|
+
await fs$11.writeFile(file, "");
|
|
1636
|
+
return;
|
|
1637
|
+
} else throw err;
|
|
1638
|
+
}
|
|
1639
|
+
if (dirStats.isDirectory()) await fs$11.writeFile(file, "");
|
|
1640
|
+
else await fs$11.readdir(dir);
|
|
1641
|
+
}
|
|
1642
|
+
function createFileSync$1(file) {
|
|
1643
|
+
let stats;
|
|
1644
|
+
try {
|
|
1645
|
+
stats = fs$11.statSync(file);
|
|
1646
|
+
} catch {}
|
|
1647
|
+
if (stats && stats.isFile()) return;
|
|
1648
|
+
const dir = path$6.dirname(file);
|
|
1649
|
+
try {
|
|
1650
|
+
if (!fs$11.statSync(dir).isDirectory()) fs$11.readdirSync(dir);
|
|
1651
|
+
} catch (err) {
|
|
1652
|
+
if (err && err.code === "ENOENT") mkdir$2.mkdirsSync(dir);
|
|
1653
|
+
else throw err;
|
|
1654
|
+
}
|
|
1655
|
+
fs$11.writeFileSync(file, "");
|
|
1656
|
+
}
|
|
1657
|
+
module.exports = {
|
|
1658
|
+
createFile: u$7(createFile$1),
|
|
1659
|
+
createFileSync: createFileSync$1
|
|
1660
|
+
};
|
|
1661
|
+
}) });
|
|
1662
|
+
|
|
1663
|
+
//#endregion
|
|
1664
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/link.js
|
|
1665
|
+
var require_link = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/link.js": ((exports, module) => {
|
|
1666
|
+
const u$6 = require_universalify().fromPromise;
|
|
1667
|
+
const path$5 = __require("path");
|
|
1668
|
+
const fs$10 = require_fs();
|
|
1669
|
+
const mkdir$1 = require_mkdirs();
|
|
1670
|
+
const { pathExists: pathExists$4 } = require_path_exists();
|
|
1671
|
+
const { areIdentical: areIdentical$1 } = require_stat();
|
|
1672
|
+
async function createLink$1(srcpath, dstpath) {
|
|
1673
|
+
let dstStat;
|
|
1674
|
+
try {
|
|
1675
|
+
dstStat = await fs$10.lstat(dstpath);
|
|
1676
|
+
} catch {}
|
|
1677
|
+
let srcStat;
|
|
1678
|
+
try {
|
|
1679
|
+
srcStat = await fs$10.lstat(srcpath);
|
|
1680
|
+
} catch (err) {
|
|
1681
|
+
err.message = err.message.replace("lstat", "ensureLink");
|
|
1682
|
+
throw err;
|
|
1683
|
+
}
|
|
1684
|
+
if (dstStat && areIdentical$1(srcStat, dstStat)) return;
|
|
1685
|
+
const dir = path$5.dirname(dstpath);
|
|
1686
|
+
if (!await pathExists$4(dir)) await mkdir$1.mkdirs(dir);
|
|
1687
|
+
await fs$10.link(srcpath, dstpath);
|
|
1688
|
+
}
|
|
1689
|
+
function createLinkSync$1(srcpath, dstpath) {
|
|
1690
|
+
let dstStat;
|
|
1691
|
+
try {
|
|
1692
|
+
dstStat = fs$10.lstatSync(dstpath);
|
|
1693
|
+
} catch {}
|
|
1694
|
+
try {
|
|
1695
|
+
const srcStat = fs$10.lstatSync(srcpath);
|
|
1696
|
+
if (dstStat && areIdentical$1(srcStat, dstStat)) return;
|
|
1697
|
+
} catch (err) {
|
|
1698
|
+
err.message = err.message.replace("lstat", "ensureLink");
|
|
1699
|
+
throw err;
|
|
1700
|
+
}
|
|
1701
|
+
const dir = path$5.dirname(dstpath);
|
|
1702
|
+
if (fs$10.existsSync(dir)) return fs$10.linkSync(srcpath, dstpath);
|
|
1703
|
+
mkdir$1.mkdirsSync(dir);
|
|
1704
|
+
return fs$10.linkSync(srcpath, dstpath);
|
|
1705
|
+
}
|
|
1706
|
+
module.exports = {
|
|
1707
|
+
createLink: u$6(createLink$1),
|
|
1708
|
+
createLinkSync: createLinkSync$1
|
|
1709
|
+
};
|
|
1710
|
+
}) });
|
|
1711
|
+
|
|
1712
|
+
//#endregion
|
|
1713
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-paths.js
|
|
1714
|
+
var require_symlink_paths = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-paths.js": ((exports, module) => {
|
|
1715
|
+
const path$4 = __require("path");
|
|
1716
|
+
const fs$9 = require_fs();
|
|
1717
|
+
const { pathExists: pathExists$3 } = require_path_exists();
|
|
1718
|
+
const u$5 = require_universalify().fromPromise;
|
|
1719
|
+
/**
|
|
1720
|
+
* Function that returns two types of paths, one relative to symlink, and one
|
|
1721
|
+
* relative to the current working directory. Checks if path is absolute or
|
|
1722
|
+
* relative. If the path is relative, this function checks if the path is
|
|
1723
|
+
* relative to symlink or relative to current working directory. This is an
|
|
1724
|
+
* initiative to find a smarter `srcpath` to supply when building symlinks.
|
|
1725
|
+
* This allows you to determine which path to use out of one of three possible
|
|
1726
|
+
* types of source paths. The first is an absolute path. This is detected by
|
|
1727
|
+
* `path.isAbsolute()`. When an absolute path is provided, it is checked to
|
|
1728
|
+
* see if it exists. If it does it's used, if not an error is returned
|
|
1729
|
+
* (callback)/ thrown (sync). The other two options for `srcpath` are a
|
|
1730
|
+
* relative url. By default Node's `fs.symlink` works by creating a symlink
|
|
1731
|
+
* using `dstpath` and expects the `srcpath` to be relative to the newly
|
|
1732
|
+
* created symlink. If you provide a `srcpath` that does not exist on the file
|
|
1733
|
+
* system it results in a broken symlink. To minimize this, the function
|
|
1734
|
+
* checks to see if the 'relative to symlink' source file exists, and if it
|
|
1735
|
+
* does it will use it. If it does not, it checks if there's a file that
|
|
1736
|
+
* exists that is relative to the current working directory, if does its used.
|
|
1737
|
+
* This preserves the expectations of the original fs.symlink spec and adds
|
|
1738
|
+
* the ability to pass in `relative to current working direcotry` paths.
|
|
1739
|
+
*/
|
|
1740
|
+
async function symlinkPaths$1(srcpath, dstpath) {
|
|
1741
|
+
if (path$4.isAbsolute(srcpath)) {
|
|
1742
|
+
try {
|
|
1743
|
+
await fs$9.lstat(srcpath);
|
|
1744
|
+
} catch (err) {
|
|
1745
|
+
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1746
|
+
throw err;
|
|
1747
|
+
}
|
|
1748
|
+
return {
|
|
1749
|
+
toCwd: srcpath,
|
|
1750
|
+
toDst: srcpath
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
const dstdir = path$4.dirname(dstpath);
|
|
1754
|
+
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
1755
|
+
if (await pathExists$3(relativeToDst)) return {
|
|
1756
|
+
toCwd: relativeToDst,
|
|
1757
|
+
toDst: srcpath
|
|
1758
|
+
};
|
|
1759
|
+
try {
|
|
1760
|
+
await fs$9.lstat(srcpath);
|
|
1761
|
+
} catch (err) {
|
|
1762
|
+
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1763
|
+
throw err;
|
|
1764
|
+
}
|
|
1765
|
+
return {
|
|
1766
|
+
toCwd: srcpath,
|
|
1767
|
+
toDst: path$4.relative(dstdir, srcpath)
|
|
1768
|
+
};
|
|
1769
|
+
}
|
|
1770
|
+
function symlinkPathsSync$1(srcpath, dstpath) {
|
|
1771
|
+
if (path$4.isAbsolute(srcpath)) {
|
|
1772
|
+
if (!fs$9.existsSync(srcpath)) throw new Error("absolute srcpath does not exist");
|
|
1773
|
+
return {
|
|
1774
|
+
toCwd: srcpath,
|
|
1775
|
+
toDst: srcpath
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
const dstdir = path$4.dirname(dstpath);
|
|
1779
|
+
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
1780
|
+
if (fs$9.existsSync(relativeToDst)) return {
|
|
1781
|
+
toCwd: relativeToDst,
|
|
1782
|
+
toDst: srcpath
|
|
1783
|
+
};
|
|
1784
|
+
if (!fs$9.existsSync(srcpath)) throw new Error("relative srcpath does not exist");
|
|
1785
|
+
return {
|
|
1786
|
+
toCwd: srcpath,
|
|
1787
|
+
toDst: path$4.relative(dstdir, srcpath)
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
module.exports = {
|
|
1791
|
+
symlinkPaths: u$5(symlinkPaths$1),
|
|
1792
|
+
symlinkPathsSync: symlinkPathsSync$1
|
|
1793
|
+
};
|
|
1794
|
+
}) });
|
|
1795
|
+
|
|
1796
|
+
//#endregion
|
|
1797
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-type.js
|
|
1798
|
+
var require_symlink_type = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-type.js": ((exports, module) => {
|
|
1799
|
+
const fs$8 = require_fs();
|
|
1800
|
+
const u$4 = require_universalify().fromPromise;
|
|
1801
|
+
async function symlinkType$1(srcpath, type) {
|
|
1802
|
+
if (type) return type;
|
|
1803
|
+
let stats;
|
|
1804
|
+
try {
|
|
1805
|
+
stats = await fs$8.lstat(srcpath);
|
|
1806
|
+
} catch {
|
|
1807
|
+
return "file";
|
|
1808
|
+
}
|
|
1809
|
+
return stats && stats.isDirectory() ? "dir" : "file";
|
|
1810
|
+
}
|
|
1811
|
+
function symlinkTypeSync$1(srcpath, type) {
|
|
1812
|
+
if (type) return type;
|
|
1813
|
+
let stats;
|
|
1814
|
+
try {
|
|
1815
|
+
stats = fs$8.lstatSync(srcpath);
|
|
1816
|
+
} catch {
|
|
1817
|
+
return "file";
|
|
1818
|
+
}
|
|
1819
|
+
return stats && stats.isDirectory() ? "dir" : "file";
|
|
1820
|
+
}
|
|
1821
|
+
module.exports = {
|
|
1822
|
+
symlinkType: u$4(symlinkType$1),
|
|
1823
|
+
symlinkTypeSync: symlinkTypeSync$1
|
|
1824
|
+
};
|
|
1825
|
+
}) });
|
|
1826
|
+
|
|
1827
|
+
//#endregion
|
|
1828
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink.js
|
|
1829
|
+
var require_symlink = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink.js": ((exports, module) => {
|
|
1830
|
+
const u$3 = require_universalify().fromPromise;
|
|
1831
|
+
const path$3 = __require("path");
|
|
1832
|
+
const fs$7 = require_fs();
|
|
1833
|
+
const { mkdirs, mkdirsSync } = require_mkdirs();
|
|
1834
|
+
const { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
1835
|
+
const { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
1836
|
+
const { pathExists: pathExists$2 } = require_path_exists();
|
|
1837
|
+
const { areIdentical } = require_stat();
|
|
1838
|
+
async function createSymlink$1(srcpath, dstpath, type) {
|
|
1839
|
+
let stats;
|
|
1840
|
+
try {
|
|
1841
|
+
stats = await fs$7.lstat(dstpath);
|
|
1842
|
+
} catch {}
|
|
1843
|
+
if (stats && stats.isSymbolicLink()) {
|
|
1844
|
+
const [srcStat, dstStat] = await Promise.all([fs$7.stat(srcpath), fs$7.stat(dstpath)]);
|
|
1845
|
+
if (areIdentical(srcStat, dstStat)) return;
|
|
1846
|
+
}
|
|
1847
|
+
const relative = await symlinkPaths(srcpath, dstpath);
|
|
1848
|
+
srcpath = relative.toDst;
|
|
1849
|
+
const toType = await symlinkType(relative.toCwd, type);
|
|
1850
|
+
const dir = path$3.dirname(dstpath);
|
|
1851
|
+
if (!await pathExists$2(dir)) await mkdirs(dir);
|
|
1852
|
+
return fs$7.symlink(srcpath, dstpath, toType);
|
|
1853
|
+
}
|
|
1854
|
+
function createSymlinkSync$1(srcpath, dstpath, type) {
|
|
1855
|
+
let stats;
|
|
1856
|
+
try {
|
|
1857
|
+
stats = fs$7.lstatSync(dstpath);
|
|
1858
|
+
} catch {}
|
|
1859
|
+
if (stats && stats.isSymbolicLink()) {
|
|
1860
|
+
const srcStat = fs$7.statSync(srcpath);
|
|
1861
|
+
const dstStat = fs$7.statSync(dstpath);
|
|
1862
|
+
if (areIdentical(srcStat, dstStat)) return;
|
|
1863
|
+
}
|
|
1864
|
+
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
1865
|
+
srcpath = relative.toDst;
|
|
1866
|
+
type = symlinkTypeSync(relative.toCwd, type);
|
|
1867
|
+
const dir = path$3.dirname(dstpath);
|
|
1868
|
+
if (fs$7.existsSync(dir)) return fs$7.symlinkSync(srcpath, dstpath, type);
|
|
1869
|
+
mkdirsSync(dir);
|
|
1870
|
+
return fs$7.symlinkSync(srcpath, dstpath, type);
|
|
1871
|
+
}
|
|
1872
|
+
module.exports = {
|
|
1873
|
+
createSymlink: u$3(createSymlink$1),
|
|
1874
|
+
createSymlinkSync: createSymlinkSync$1
|
|
1875
|
+
};
|
|
1876
|
+
}) });
|
|
1877
|
+
|
|
1878
|
+
//#endregion
|
|
1879
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/index.js
|
|
1880
|
+
var require_ensure = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/index.js": ((exports, module) => {
|
|
1881
|
+
const { createFile, createFileSync } = require_file();
|
|
1882
|
+
const { createLink, createLinkSync } = require_link();
|
|
1883
|
+
const { createSymlink, createSymlinkSync } = require_symlink();
|
|
1884
|
+
module.exports = {
|
|
1885
|
+
createFile,
|
|
1886
|
+
createFileSync,
|
|
1887
|
+
ensureFile: createFile,
|
|
1888
|
+
ensureFileSync: createFileSync,
|
|
1889
|
+
createLink,
|
|
1890
|
+
createLinkSync,
|
|
1891
|
+
ensureLink: createLink,
|
|
1892
|
+
ensureLinkSync: createLinkSync,
|
|
1893
|
+
createSymlink,
|
|
1894
|
+
createSymlinkSync,
|
|
1895
|
+
ensureSymlink: createSymlink,
|
|
1896
|
+
ensureSymlinkSync: createSymlinkSync
|
|
1897
|
+
};
|
|
1898
|
+
}) });
|
|
1899
|
+
|
|
1900
|
+
//#endregion
|
|
1901
|
+
//#region ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js
|
|
1902
|
+
var require_utils = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js": ((exports, module) => {
|
|
1903
|
+
function stringify$3(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
|
|
1904
|
+
const EOF = finalEOL ? EOL : "";
|
|
1905
|
+
return JSON.stringify(obj, replacer, spaces).replace(/\n/g, EOL) + EOF;
|
|
1906
|
+
}
|
|
1907
|
+
function stripBom$1(content) {
|
|
1908
|
+
if (Buffer.isBuffer(content)) content = content.toString("utf8");
|
|
1909
|
+
return content.replace(/^\uFEFF/, "");
|
|
1910
|
+
}
|
|
1911
|
+
module.exports = {
|
|
1912
|
+
stringify: stringify$3,
|
|
1913
|
+
stripBom: stripBom$1
|
|
1914
|
+
};
|
|
1915
|
+
}) });
|
|
1916
|
+
|
|
1917
|
+
//#endregion
|
|
1918
|
+
//#region ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js
|
|
1919
|
+
var require_jsonfile$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js": ((exports, module) => {
|
|
1920
|
+
let _fs;
|
|
1921
|
+
try {
|
|
1922
|
+
_fs = require_graceful_fs();
|
|
1923
|
+
} catch (_) {
|
|
1924
|
+
_fs = __require("fs");
|
|
1925
|
+
}
|
|
1926
|
+
const universalify = require_universalify();
|
|
1927
|
+
const { stringify: stringify$2, stripBom } = require_utils();
|
|
1928
|
+
async function _readFile(file, options = {}) {
|
|
1929
|
+
if (typeof options === "string") options = { encoding: options };
|
|
1930
|
+
const fs$22 = options.fs || _fs;
|
|
1931
|
+
const shouldThrow = "throws" in options ? options.throws : true;
|
|
1932
|
+
let data = await universalify.fromCallback(fs$22.readFile)(file, options);
|
|
1933
|
+
data = stripBom(data);
|
|
1934
|
+
let obj;
|
|
1935
|
+
try {
|
|
1936
|
+
obj = JSON.parse(data, options ? options.reviver : null);
|
|
1937
|
+
} catch (err) {
|
|
1938
|
+
if (shouldThrow) {
|
|
1939
|
+
err.message = `${file}: ${err.message}`;
|
|
1940
|
+
throw err;
|
|
1941
|
+
} else return null;
|
|
1942
|
+
}
|
|
1943
|
+
return obj;
|
|
1944
|
+
}
|
|
1945
|
+
const readFile = universalify.fromPromise(_readFile);
|
|
1946
|
+
function readFileSync(file, options = {}) {
|
|
1947
|
+
if (typeof options === "string") options = { encoding: options };
|
|
1948
|
+
const fs$22 = options.fs || _fs;
|
|
1949
|
+
const shouldThrow = "throws" in options ? options.throws : true;
|
|
1950
|
+
try {
|
|
1951
|
+
let content = fs$22.readFileSync(file, options);
|
|
1952
|
+
content = stripBom(content);
|
|
1953
|
+
return JSON.parse(content, options.reviver);
|
|
1954
|
+
} catch (err) {
|
|
1955
|
+
if (shouldThrow) {
|
|
1956
|
+
err.message = `${file}: ${err.message}`;
|
|
1957
|
+
throw err;
|
|
1958
|
+
} else return null;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
async function _writeFile(file, obj, options = {}) {
|
|
1962
|
+
const fs$22 = options.fs || _fs;
|
|
1963
|
+
const str = stringify$2(obj, options);
|
|
1964
|
+
await universalify.fromCallback(fs$22.writeFile)(file, str, options);
|
|
1965
|
+
}
|
|
1966
|
+
const writeFile = universalify.fromPromise(_writeFile);
|
|
1967
|
+
function writeFileSync(file, obj, options = {}) {
|
|
1968
|
+
const fs$22 = options.fs || _fs;
|
|
1969
|
+
const str = stringify$2(obj, options);
|
|
1970
|
+
return fs$22.writeFileSync(file, str, options);
|
|
1971
|
+
}
|
|
1972
|
+
const jsonfile = {
|
|
1973
|
+
readFile,
|
|
1974
|
+
readFileSync,
|
|
1975
|
+
writeFile,
|
|
1976
|
+
writeFileSync
|
|
1977
|
+
};
|
|
1978
|
+
module.exports = jsonfile;
|
|
1979
|
+
}) });
|
|
1980
|
+
|
|
1981
|
+
//#endregion
|
|
1982
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/jsonfile.js
|
|
1983
|
+
var require_jsonfile = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/jsonfile.js": ((exports, module) => {
|
|
1984
|
+
const jsonFile$1 = require_jsonfile$1();
|
|
1985
|
+
module.exports = {
|
|
1986
|
+
readJson: jsonFile$1.readFile,
|
|
1987
|
+
readJsonSync: jsonFile$1.readFileSync,
|
|
1988
|
+
writeJson: jsonFile$1.writeFile,
|
|
1989
|
+
writeJsonSync: jsonFile$1.writeFileSync
|
|
1990
|
+
};
|
|
1991
|
+
}) });
|
|
1992
|
+
|
|
1993
|
+
//#endregion
|
|
1994
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/output-file/index.js
|
|
1995
|
+
var require_output_file = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/output-file/index.js": ((exports, module) => {
|
|
1996
|
+
const u$2 = require_universalify().fromPromise;
|
|
1997
|
+
const fs$6 = require_fs();
|
|
1998
|
+
const path$2 = __require("path");
|
|
1999
|
+
const mkdir = require_mkdirs();
|
|
2000
|
+
const pathExists$1 = require_path_exists().pathExists;
|
|
2001
|
+
async function outputFile$1(file, data, encoding = "utf-8") {
|
|
2002
|
+
const dir = path$2.dirname(file);
|
|
2003
|
+
if (!await pathExists$1(dir)) await mkdir.mkdirs(dir);
|
|
2004
|
+
return fs$6.writeFile(file, data, encoding);
|
|
2005
|
+
}
|
|
2006
|
+
function outputFileSync$1(file, ...args) {
|
|
2007
|
+
const dir = path$2.dirname(file);
|
|
2008
|
+
if (!fs$6.existsSync(dir)) mkdir.mkdirsSync(dir);
|
|
2009
|
+
fs$6.writeFileSync(file, ...args);
|
|
2010
|
+
}
|
|
2011
|
+
module.exports = {
|
|
2012
|
+
outputFile: u$2(outputFile$1),
|
|
2013
|
+
outputFileSync: outputFileSync$1
|
|
2014
|
+
};
|
|
2015
|
+
}) });
|
|
2016
|
+
|
|
2017
|
+
//#endregion
|
|
2018
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json.js
|
|
2019
|
+
var require_output_json = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json.js": ((exports, module) => {
|
|
2020
|
+
const { stringify: stringify$1 } = require_utils();
|
|
2021
|
+
const { outputFile } = require_output_file();
|
|
2022
|
+
async function outputJson(file, data, options = {}) {
|
|
2023
|
+
const str = stringify$1(data, options);
|
|
2024
|
+
await outputFile(file, str, options);
|
|
2025
|
+
}
|
|
2026
|
+
module.exports = outputJson;
|
|
2027
|
+
}) });
|
|
2028
|
+
|
|
2029
|
+
//#endregion
|
|
2030
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json-sync.js
|
|
2031
|
+
var require_output_json_sync = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json-sync.js": ((exports, module) => {
|
|
2032
|
+
const { stringify } = require_utils();
|
|
2033
|
+
const { outputFileSync } = require_output_file();
|
|
2034
|
+
function outputJsonSync(file, data, options) {
|
|
2035
|
+
const str = stringify(data, options);
|
|
2036
|
+
outputFileSync(file, str, options);
|
|
2037
|
+
}
|
|
2038
|
+
module.exports = outputJsonSync;
|
|
2039
|
+
}) });
|
|
2040
|
+
|
|
2041
|
+
//#endregion
|
|
2042
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/index.js
|
|
2043
|
+
var require_json = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/index.js": ((exports, module) => {
|
|
2044
|
+
const u$1 = require_universalify().fromPromise;
|
|
2045
|
+
const jsonFile = require_jsonfile();
|
|
2046
|
+
jsonFile.outputJson = u$1(require_output_json());
|
|
2047
|
+
jsonFile.outputJsonSync = require_output_json_sync();
|
|
2048
|
+
jsonFile.outputJSON = jsonFile.outputJson;
|
|
2049
|
+
jsonFile.outputJSONSync = jsonFile.outputJsonSync;
|
|
2050
|
+
jsonFile.writeJSON = jsonFile.writeJson;
|
|
2051
|
+
jsonFile.writeJSONSync = jsonFile.writeJsonSync;
|
|
2052
|
+
jsonFile.readJSON = jsonFile.readJson;
|
|
2053
|
+
jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
2054
|
+
module.exports = jsonFile;
|
|
2055
|
+
}) });
|
|
2056
|
+
|
|
2057
|
+
//#endregion
|
|
2058
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move.js
|
|
2059
|
+
var require_move$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move.js": ((exports, module) => {
|
|
2060
|
+
const fs$5 = require_fs();
|
|
2061
|
+
const path$1 = __require("path");
|
|
2062
|
+
const { copy } = require_copy();
|
|
2063
|
+
const { remove } = require_remove();
|
|
2064
|
+
const { mkdirp } = require_mkdirs();
|
|
2065
|
+
const { pathExists } = require_path_exists();
|
|
2066
|
+
const stat$1 = require_stat();
|
|
2067
|
+
async function move(src, dest, opts = {}) {
|
|
2068
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2069
|
+
const { srcStat, isChangingCase = false } = await stat$1.checkPaths(src, dest, "move", opts);
|
|
2070
|
+
await stat$1.checkParentPaths(src, srcStat, dest, "move");
|
|
2071
|
+
const destParent = path$1.dirname(dest);
|
|
2072
|
+
if (path$1.parse(destParent).root !== destParent) await mkdirp(destParent);
|
|
2073
|
+
return doRename$1(src, dest, overwrite, isChangingCase);
|
|
2074
|
+
}
|
|
2075
|
+
async function doRename$1(src, dest, overwrite, isChangingCase) {
|
|
2076
|
+
if (!isChangingCase) {
|
|
2077
|
+
if (overwrite) await remove(dest);
|
|
2078
|
+
else if (await pathExists(dest)) throw new Error("dest already exists.");
|
|
2079
|
+
}
|
|
2080
|
+
try {
|
|
2081
|
+
await fs$5.rename(src, dest);
|
|
2082
|
+
} catch (err) {
|
|
2083
|
+
if (err.code !== "EXDEV") throw err;
|
|
2084
|
+
await moveAcrossDevice$1(src, dest, overwrite);
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
async function moveAcrossDevice$1(src, dest, overwrite) {
|
|
2088
|
+
await copy(src, dest, {
|
|
2089
|
+
overwrite,
|
|
2090
|
+
errorOnExist: true,
|
|
2091
|
+
preserveTimestamps: true
|
|
2092
|
+
});
|
|
2093
|
+
return remove(src);
|
|
2094
|
+
}
|
|
2095
|
+
module.exports = move;
|
|
2096
|
+
}) });
|
|
2097
|
+
|
|
2098
|
+
//#endregion
|
|
2099
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move-sync.js
|
|
2100
|
+
var require_move_sync = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move-sync.js": ((exports, module) => {
|
|
2101
|
+
const fs$4 = require_graceful_fs();
|
|
2102
|
+
const path = __require("path");
|
|
2103
|
+
const copySync = require_copy().copySync;
|
|
2104
|
+
const removeSync = require_remove().removeSync;
|
|
2105
|
+
const mkdirpSync = require_mkdirs().mkdirpSync;
|
|
2106
|
+
const stat = require_stat();
|
|
2107
|
+
function moveSync(src, dest, opts) {
|
|
2108
|
+
opts = opts || {};
|
|
2109
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2110
|
+
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
2111
|
+
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
2112
|
+
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest));
|
|
2113
|
+
return doRename(src, dest, overwrite, isChangingCase);
|
|
2114
|
+
}
|
|
2115
|
+
function isParentRoot(dest) {
|
|
2116
|
+
const parent = path.dirname(dest);
|
|
2117
|
+
return path.parse(parent).root === parent;
|
|
2118
|
+
}
|
|
2119
|
+
function doRename(src, dest, overwrite, isChangingCase) {
|
|
2120
|
+
if (isChangingCase) return rename(src, dest, overwrite);
|
|
2121
|
+
if (overwrite) {
|
|
2122
|
+
removeSync(dest);
|
|
2123
|
+
return rename(src, dest, overwrite);
|
|
2124
|
+
}
|
|
2125
|
+
if (fs$4.existsSync(dest)) throw new Error("dest already exists.");
|
|
2126
|
+
return rename(src, dest, overwrite);
|
|
2127
|
+
}
|
|
2128
|
+
function rename(src, dest, overwrite) {
|
|
2129
|
+
try {
|
|
2130
|
+
fs$4.renameSync(src, dest);
|
|
2131
|
+
} catch (err) {
|
|
2132
|
+
if (err.code !== "EXDEV") throw err;
|
|
2133
|
+
return moveAcrossDevice(src, dest, overwrite);
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
function moveAcrossDevice(src, dest, overwrite) {
|
|
2137
|
+
copySync(src, dest, {
|
|
2138
|
+
overwrite,
|
|
2139
|
+
errorOnExist: true,
|
|
2140
|
+
preserveTimestamps: true
|
|
2141
|
+
});
|
|
2142
|
+
return removeSync(src);
|
|
2143
|
+
}
|
|
2144
|
+
module.exports = moveSync;
|
|
2145
|
+
}) });
|
|
2146
|
+
|
|
2147
|
+
//#endregion
|
|
2148
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/index.js
|
|
2149
|
+
var require_move = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/index.js": ((exports, module) => {
|
|
2150
|
+
const u = require_universalify().fromPromise;
|
|
2151
|
+
module.exports = {
|
|
2152
|
+
move: u(require_move$1()),
|
|
2153
|
+
moveSync: require_move_sync()
|
|
2154
|
+
};
|
|
2155
|
+
}) });
|
|
2156
|
+
|
|
2157
|
+
//#endregion
|
|
2158
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/index.js
|
|
2159
|
+
var require_lib = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/index.js": ((exports, module) => {
|
|
2160
|
+
module.exports = {
|
|
2161
|
+
...require_fs(),
|
|
2162
|
+
...require_copy(),
|
|
2163
|
+
...require_empty(),
|
|
2164
|
+
...require_ensure(),
|
|
2165
|
+
...require_json(),
|
|
2166
|
+
...require_mkdirs(),
|
|
2167
|
+
...require_move(),
|
|
2168
|
+
...require_output_file(),
|
|
2169
|
+
...require_path_exists(),
|
|
2170
|
+
...require_remove()
|
|
2171
|
+
};
|
|
2172
|
+
}) });
|
|
2173
|
+
|
|
2174
|
+
//#endregion
|
|
2175
|
+
//#region src/init/cz.config.ts
|
|
2176
|
+
var import_lib$2 = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
2177
|
+
function createCzConfig(cwd$1 = process$1.cwd()) {
|
|
2178
|
+
const target = resolve(cwd$1, "cz.config.cjs");
|
|
2179
|
+
if (import_lib$2.default.existsSync(target)) import_lib$2.default.unlinkSync(target);
|
|
2180
|
+
try {
|
|
2181
|
+
const cfg = {
|
|
2182
|
+
$schema: `https://raw.githubusercontent.com/Zhengqbbb/cz-git/refs/tags/v${CZGPackage.version}/docs/public/schema/cz-git.json`,
|
|
2183
|
+
...commitPreset.prompt,
|
|
2184
|
+
types: commitPreset.prompt?.types?.map((t) => ({
|
|
2185
|
+
value: t.value,
|
|
2186
|
+
name: t.name,
|
|
2187
|
+
emoji: t.emoji
|
|
2188
|
+
})),
|
|
2189
|
+
scopes: commitPreset.prompt?.scopes
|
|
2190
|
+
};
|
|
2191
|
+
const content = `module.exports = ${JSON.stringify(cfg, null, 2)}\n`;
|
|
2192
|
+
import_lib$2.default.writeFileSync(target, content, "utf8");
|
|
2193
|
+
return true;
|
|
2194
|
+
} catch {
|
|
2195
|
+
return false;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
function runCzConfig(czConfigPath, cwd$1 = process$1.cwd()) {
|
|
2199
|
+
const packagePath = resolve(cwd$1, "package.json");
|
|
2200
|
+
if (!import_lib$2.default.existsSync(packagePath)) return false;
|
|
2201
|
+
try {
|
|
2202
|
+
const raw = import_lib$2.default.readFileSync(packagePath, "utf8");
|
|
2203
|
+
const json = JSON.parse(raw);
|
|
2204
|
+
const desiredPath = "node_modules/cz-git";
|
|
2205
|
+
const desiredCzConfig = czConfigPath;
|
|
2206
|
+
json.config = json.config || {};
|
|
2207
|
+
json.config.commitizen = json.config.commitizen || {};
|
|
2208
|
+
let changed = false;
|
|
2209
|
+
if (json.config.commitizen.path !== desiredPath) {
|
|
2210
|
+
json.config.commitizen.path = desiredPath;
|
|
2211
|
+
changed = true;
|
|
2212
|
+
}
|
|
2213
|
+
const currentCz = json.config.commitizen.czConfig;
|
|
2214
|
+
const normalize = (p) => p ? p.replace(/^\.\/?/, "") : p;
|
|
2215
|
+
const isOldRoot = normalize(currentCz) === "cz.config.cjs" || normalize(currentCz) === "cz.config.js";
|
|
2216
|
+
if (!currentCz || isOldRoot || normalize(currentCz) === "cz.config.mjs") {
|
|
2217
|
+
if (currentCz !== desiredCzConfig) {
|
|
2218
|
+
json.config.commitizen.czConfig = desiredCzConfig;
|
|
2219
|
+
changed = true;
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
if (!changed) return false;
|
|
2223
|
+
import_lib$2.default.writeFileSync(packagePath, `${JSON.stringify(json, null, 2)}\n`, "utf8");
|
|
2224
|
+
return true;
|
|
2225
|
+
} catch {
|
|
2226
|
+
return false;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
//#endregion
|
|
2231
|
+
//#region src/init/git.message.ts
|
|
2232
|
+
var import_lib$1 = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
2233
|
+
function createGitMessage(rootPath = process$1.cwd()) {
|
|
2234
|
+
const target = resolve(rootPath, ".gitmessage");
|
|
2235
|
+
if (import_lib$1.default.existsSync(target)) import_lib$1.default.unlinkSync(target);
|
|
2236
|
+
const types = (commitPreset.prompt?.types || []).map((t) => t.value).join(", ");
|
|
2237
|
+
const scopes = (commitPreset.prompt?.scopes || []).join(", ");
|
|
2238
|
+
const tpl = `# Commit Message 模板 (首行: <type>(<scope>): <subject>)\n# 可用类型: ${types}\n# 可用范围: ${scopes}\n# 示例: feat(core): add http client abstraction\n# 空行后可写入 body, 使用 | 换行 (交互模式会自动处理)\n`;
|
|
2239
|
+
import_lib$1.default.writeFileSync(target, tpl, "utf8");
|
|
2240
|
+
return true;
|
|
2241
|
+
}
|
|
2242
|
+
function runGitMessage(rootPath = process$1.cwd()) {
|
|
2243
|
+
try {
|
|
2244
|
+
if (execSync("git config --get commit.template", {
|
|
2245
|
+
cwd: rootPath,
|
|
2246
|
+
stdio: "pipe"
|
|
2247
|
+
}).toString().trim()) return false;
|
|
2248
|
+
} catch {}
|
|
2249
|
+
try {
|
|
2250
|
+
execSync("git config commit.template .gitmessage", {
|
|
2251
|
+
cwd: rootPath,
|
|
2252
|
+
stdio: "ignore"
|
|
2253
|
+
});
|
|
2254
|
+
return true;
|
|
2255
|
+
} catch {
|
|
2256
|
+
return false;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
//#endregion
|
|
2261
|
+
//#region src/init/simple.git.hook.ts
|
|
2262
|
+
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
2263
|
+
function runSimpleGitHooks(script = "pubinfo-commit", cwd$1 = process$1.cwd()) {
|
|
2264
|
+
const pkgPath = resolve(cwd$1, "package.json");
|
|
2265
|
+
if (!import_lib.default.existsSync(pkgPath)) return false;
|
|
2266
|
+
try {
|
|
2267
|
+
const raw = import_lib.default.readFileSync(pkgPath, "utf8");
|
|
2268
|
+
const json = JSON.parse(raw);
|
|
2269
|
+
json["simple-git-hooks"] = json["simple-git-hooks"] || {};
|
|
2270
|
+
const desiredPre = "pnpm lint-staged";
|
|
2271
|
+
if (json["simple-git-hooks"]["pre-commit"] !== desiredPre) json["simple-git-hooks"]["pre-commit"] = desiredPre;
|
|
2272
|
+
const desiredCommitMsg = `pnpm exec ${script} --edit $1`;
|
|
2273
|
+
if (json["simple-git-hooks"]["commit-msg"] !== desiredCommitMsg) json["simple-git-hooks"]["commit-msg"] = desiredCommitMsg;
|
|
2274
|
+
import_lib.default.writeFileSync(pkgPath, `${JSON.stringify(json, null, 2)}\n`, "utf8");
|
|
2275
|
+
return true;
|
|
2276
|
+
} catch {
|
|
2277
|
+
return false;
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
function runNpx(cwd$1 = process$1.cwd()) {
|
|
2281
|
+
try {
|
|
2282
|
+
execSync("npx simple-git-hooks", {
|
|
2283
|
+
cwd: cwd$1,
|
|
2284
|
+
stdio: "ignore"
|
|
2285
|
+
});
|
|
2286
|
+
return true;
|
|
2287
|
+
} catch {
|
|
2288
|
+
return false;
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
//#endregion
|
|
2293
|
+
//#region src/prompt/index.ts
|
|
2294
|
+
async function runPrompt() {
|
|
2295
|
+
try {
|
|
2296
|
+
const require$1 = createRequire(import.meta.url);
|
|
2297
|
+
try {
|
|
2298
|
+
const czg = require$1("czg");
|
|
2299
|
+
if (czg && typeof czg.default === "function") {
|
|
2300
|
+
const api$1 = await czg.default({ emoji: false });
|
|
2301
|
+
if (api$1 && api$1.raw) return { raw: api$1.raw };
|
|
2302
|
+
}
|
|
2303
|
+
} catch {}
|
|
2304
|
+
const bin = resolve(process$1.cwd(), "node_modules/.bin/czg");
|
|
2305
|
+
if (fs.existsSync(bin)) {
|
|
2306
|
+
await new Promise((res) => {
|
|
2307
|
+
const child = spawn(bin, [], { stdio: "inherit" });
|
|
2308
|
+
child.on("exit", () => res());
|
|
2309
|
+
child.on("error", () => res());
|
|
2310
|
+
});
|
|
2311
|
+
const msgPath = resolve(process$1.cwd(), ".git/COMMIT_EDITMSG");
|
|
2312
|
+
if (fs.existsSync(msgPath)) return { raw: fs.readFileSync(msgPath, "utf8").trim() };
|
|
2313
|
+
}
|
|
2314
|
+
return null;
|
|
2315
|
+
} catch {
|
|
2316
|
+
return null;
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
//#endregion
|
|
2321
|
+
//#region src/utils/lint.message.ts
|
|
2322
|
+
async function lintMessage(message) {
|
|
2323
|
+
try {
|
|
2324
|
+
const result = await (await import("@commitlint/lint")).default(message, commitPreset.rules, commitPreset);
|
|
2325
|
+
if (!result.valid) {
|
|
2326
|
+
console.error("✖ Commit message failed lint:\n");
|
|
2327
|
+
for (const err of result.errors) console.error(` • ${err.message}`);
|
|
2328
|
+
process$1.exit(1);
|
|
2329
|
+
}
|
|
2330
|
+
} catch (e) {
|
|
2331
|
+
console.error("[pubinfo-commit] lint failed to run:", e);
|
|
2332
|
+
}
|
|
2333
|
+
return true;
|
|
2334
|
+
}
|
|
2335
|
+
async function lintAndReturn(message) {
|
|
2336
|
+
await lintMessage(message);
|
|
2337
|
+
return message;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
//#endregion
|
|
2341
|
+
export { commitPreset, createCzConfig, createGitMessage, lintAndReturn, lintMessage, loadCommitConfig, runCzConfig, runGitMessage, runNpx, runPrompt, runSimpleGitHooks };
|