@rspress/plugin-playground 0.0.0-next-20230927072732 → 0.0.0-next-20231020055855

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.
@@ -1,2660 +1,12 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined")
11
- return require.apply(this, arguments);
12
- throw new Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __esm = (fn, res) => function __init() {
15
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
16
- };
17
- var __commonJS = (cb, mod) => function __require2() {
18
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, { get: all[name], enumerable: true });
23
- };
24
- var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") {
26
- for (let key of __getOwnPropNames(from))
27
- if (!__hasOwnProp.call(to, key) && key !== except)
28
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
- }
30
- return to;
31
- };
32
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
33
- // If the importer is in node compatibility mode or this is not an ESM
34
- // file that has been converted to a CommonJS file using a Babel-
35
- // compatible transform (i.e. "__esModule" has not been set), then set
36
- // "default" to the CommonJS "module.exports" for node compatibility.
37
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
38
- mod
39
- ));
40
-
41
- // ../../node_modules/.pnpm/universalify@2.0.0/node_modules/universalify/index.js
42
- var require_universalify = __commonJS({
43
- "../../node_modules/.pnpm/universalify@2.0.0/node_modules/universalify/index.js"(exports) {
44
- "use strict";
45
- exports.fromCallback = function(fn) {
46
- return Object.defineProperty(function(...args) {
47
- if (typeof args[args.length - 1] === "function")
48
- fn.apply(this, args);
49
- else {
50
- return new Promise((resolve, reject) => {
51
- fn.call(this, ...args, (err, res) => err != null ? reject(err) : resolve(res));
52
- });
53
- }
54
- }, "name", {
55
- value: fn.name
56
- });
57
- };
58
- exports.fromPromise = function(fn) {
59
- return Object.defineProperty(function(...args) {
60
- const cb = args[args.length - 1];
61
- if (typeof cb !== "function")
62
- return fn.apply(this, args);
63
- else
64
- fn.apply(this, args.slice(0, -1)).then((r) => cb(null, r), cb);
65
- }, "name", {
66
- value: fn.name
67
- });
68
- };
69
- }
70
- });
71
-
72
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
73
- var require_polyfills = __commonJS({
74
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module) {
75
- var constants = __require("constants");
76
- var origCwd = process.cwd;
77
- var cwd = null;
78
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
79
- process.cwd = function() {
80
- if (!cwd)
81
- cwd = origCwd.call(process);
82
- return cwd;
83
- };
84
- try {
85
- process.cwd();
86
- } catch (er) {
87
- }
88
- if (typeof process.chdir === "function") {
89
- chdir = process.chdir;
90
- process.chdir = function(d) {
91
- cwd = null;
92
- chdir.call(process, d);
93
- };
94
- if (Object.setPrototypeOf)
95
- Object.setPrototypeOf(process.chdir, chdir);
96
- }
97
- var chdir;
98
- module.exports = patch;
99
- function patch(fs2) {
100
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
101
- patchLchmod(fs2);
102
- }
103
- if (!fs2.lutimes) {
104
- patchLutimes(fs2);
105
- }
106
- fs2.chown = chownFix(fs2.chown);
107
- fs2.fchown = chownFix(fs2.fchown);
108
- fs2.lchown = chownFix(fs2.lchown);
109
- fs2.chmod = chmodFix(fs2.chmod);
110
- fs2.fchmod = chmodFix(fs2.fchmod);
111
- fs2.lchmod = chmodFix(fs2.lchmod);
112
- fs2.chownSync = chownFixSync(fs2.chownSync);
113
- fs2.fchownSync = chownFixSync(fs2.fchownSync);
114
- fs2.lchownSync = chownFixSync(fs2.lchownSync);
115
- fs2.chmodSync = chmodFixSync(fs2.chmodSync);
116
- fs2.fchmodSync = chmodFixSync(fs2.fchmodSync);
117
- fs2.lchmodSync = chmodFixSync(fs2.lchmodSync);
118
- fs2.stat = statFix(fs2.stat);
119
- fs2.fstat = statFix(fs2.fstat);
120
- fs2.lstat = statFix(fs2.lstat);
121
- fs2.statSync = statFixSync(fs2.statSync);
122
- fs2.fstatSync = statFixSync(fs2.fstatSync);
123
- fs2.lstatSync = statFixSync(fs2.lstatSync);
124
- if (fs2.chmod && !fs2.lchmod) {
125
- fs2.lchmod = function(path4, mode, cb) {
126
- if (cb)
127
- process.nextTick(cb);
128
- };
129
- fs2.lchmodSync = function() {
130
- };
131
- }
132
- if (fs2.chown && !fs2.lchown) {
133
- fs2.lchown = function(path4, uid, gid, cb) {
134
- if (cb)
135
- process.nextTick(cb);
136
- };
137
- fs2.lchownSync = function() {
138
- };
139
- }
140
- if (platform === "win32") {
141
- fs2.rename = typeof fs2.rename !== "function" ? fs2.rename : function(fs$rename) {
142
- function rename(from, to, cb) {
143
- var start = Date.now();
144
- var backoff = 0;
145
- fs$rename(from, to, function CB(er) {
146
- if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
147
- setTimeout(function() {
148
- fs2.stat(to, function(stater, st) {
149
- if (stater && stater.code === "ENOENT")
150
- fs$rename(from, to, CB);
151
- else
152
- cb(er);
153
- });
154
- }, backoff);
155
- if (backoff < 100)
156
- backoff += 10;
157
- return;
158
- }
159
- if (cb)
160
- cb(er);
161
- });
162
- }
163
- if (Object.setPrototypeOf)
164
- Object.setPrototypeOf(rename, fs$rename);
165
- return rename;
166
- }(fs2.rename);
167
- }
168
- fs2.read = typeof fs2.read !== "function" ? fs2.read : function(fs$read) {
169
- function read(fd, buffer, offset, length, position, callback_) {
170
- var callback;
171
- if (callback_ && typeof callback_ === "function") {
172
- var eagCounter = 0;
173
- callback = function(er, _, __) {
174
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
175
- eagCounter++;
176
- return fs$read.call(fs2, fd, buffer, offset, length, position, callback);
177
- }
178
- callback_.apply(this, arguments);
179
- };
180
- }
181
- return fs$read.call(fs2, fd, buffer, offset, length, position, callback);
182
- }
183
- if (Object.setPrototypeOf)
184
- Object.setPrototypeOf(read, fs$read);
185
- return read;
186
- }(fs2.read);
187
- fs2.readSync = typeof fs2.readSync !== "function" ? fs2.readSync : function(fs$readSync) {
188
- return function(fd, buffer, offset, length, position) {
189
- var eagCounter = 0;
190
- while (true) {
191
- try {
192
- return fs$readSync.call(fs2, fd, buffer, offset, length, position);
193
- } catch (er) {
194
- if (er.code === "EAGAIN" && eagCounter < 10) {
195
- eagCounter++;
196
- continue;
197
- }
198
- throw er;
199
- }
200
- }
201
- };
202
- }(fs2.readSync);
203
- function patchLchmod(fs3) {
204
- fs3.lchmod = function(path4, mode, callback) {
205
- fs3.open(path4, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
206
- if (err) {
207
- if (callback)
208
- callback(err);
209
- return;
210
- }
211
- fs3.fchmod(fd, mode, function(err2) {
212
- fs3.close(fd, function(err22) {
213
- if (callback)
214
- callback(err2 || err22);
215
- });
216
- });
217
- });
218
- };
219
- fs3.lchmodSync = function(path4, mode) {
220
- var fd = fs3.openSync(path4, constants.O_WRONLY | constants.O_SYMLINK, mode);
221
- var threw = true;
222
- var ret;
223
- try {
224
- ret = fs3.fchmodSync(fd, mode);
225
- threw = false;
226
- } finally {
227
- if (threw) {
228
- try {
229
- fs3.closeSync(fd);
230
- } catch (er) {
231
- }
232
- } else {
233
- fs3.closeSync(fd);
234
- }
235
- }
236
- return ret;
237
- };
238
- }
239
- function patchLutimes(fs3) {
240
- if (constants.hasOwnProperty("O_SYMLINK") && fs3.futimes) {
241
- fs3.lutimes = function(path4, at, mt, cb) {
242
- fs3.open(path4, constants.O_SYMLINK, function(er, fd) {
243
- if (er) {
244
- if (cb)
245
- cb(er);
246
- return;
247
- }
248
- fs3.futimes(fd, at, mt, function(er2) {
249
- fs3.close(fd, function(er22) {
250
- if (cb)
251
- cb(er2 || er22);
252
- });
253
- });
254
- });
255
- };
256
- fs3.lutimesSync = function(path4, at, mt) {
257
- var fd = fs3.openSync(path4, constants.O_SYMLINK);
258
- var ret;
259
- var threw = true;
260
- try {
261
- ret = fs3.futimesSync(fd, at, mt);
262
- threw = false;
263
- } finally {
264
- if (threw) {
265
- try {
266
- fs3.closeSync(fd);
267
- } catch (er) {
268
- }
269
- } else {
270
- fs3.closeSync(fd);
271
- }
272
- }
273
- return ret;
274
- };
275
- } else if (fs3.futimes) {
276
- fs3.lutimes = function(_a, _b, _c, cb) {
277
- if (cb)
278
- process.nextTick(cb);
279
- };
280
- fs3.lutimesSync = function() {
281
- };
282
- }
283
- }
284
- function chmodFix(orig) {
285
- if (!orig)
286
- return orig;
287
- return function(target, mode, cb) {
288
- return orig.call(fs2, target, mode, function(er) {
289
- if (chownErOk(er))
290
- er = null;
291
- if (cb)
292
- cb.apply(this, arguments);
293
- });
294
- };
295
- }
296
- function chmodFixSync(orig) {
297
- if (!orig)
298
- return orig;
299
- return function(target, mode) {
300
- try {
301
- return orig.call(fs2, target, mode);
302
- } catch (er) {
303
- if (!chownErOk(er))
304
- throw er;
305
- }
306
- };
307
- }
308
- function chownFix(orig) {
309
- if (!orig)
310
- return orig;
311
- return function(target, uid, gid, cb) {
312
- return orig.call(fs2, target, uid, gid, function(er) {
313
- if (chownErOk(er))
314
- er = null;
315
- if (cb)
316
- cb.apply(this, arguments);
317
- });
318
- };
319
- }
320
- function chownFixSync(orig) {
321
- if (!orig)
322
- return orig;
323
- return function(target, uid, gid) {
324
- try {
325
- return orig.call(fs2, target, uid, gid);
326
- } catch (er) {
327
- if (!chownErOk(er))
328
- throw er;
329
- }
330
- };
331
- }
332
- function statFix(orig) {
333
- if (!orig)
334
- return orig;
335
- return function(target, options, cb) {
336
- if (typeof options === "function") {
337
- cb = options;
338
- options = null;
339
- }
340
- function callback(er, stats) {
341
- if (stats) {
342
- if (stats.uid < 0)
343
- stats.uid += 4294967296;
344
- if (stats.gid < 0)
345
- stats.gid += 4294967296;
346
- }
347
- if (cb)
348
- cb.apply(this, arguments);
349
- }
350
- return options ? orig.call(fs2, target, options, callback) : orig.call(fs2, target, callback);
351
- };
352
- }
353
- function statFixSync(orig) {
354
- if (!orig)
355
- return orig;
356
- return function(target, options) {
357
- var stats = options ? orig.call(fs2, target, options) : orig.call(fs2, target);
358
- if (stats) {
359
- if (stats.uid < 0)
360
- stats.uid += 4294967296;
361
- if (stats.gid < 0)
362
- stats.gid += 4294967296;
363
- }
364
- return stats;
365
- };
366
- }
367
- function chownErOk(er) {
368
- if (!er)
369
- return true;
370
- if (er.code === "ENOSYS")
371
- return true;
372
- var nonroot = !process.getuid || process.getuid() !== 0;
373
- if (nonroot) {
374
- if (er.code === "EINVAL" || er.code === "EPERM")
375
- return true;
376
- }
377
- return false;
378
- }
379
- }
380
- }
381
- });
382
-
383
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
384
- var require_legacy_streams = __commonJS({
385
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module) {
386
- var Stream = __require("stream").Stream;
387
- module.exports = legacy;
388
- function legacy(fs2) {
389
- return {
390
- ReadStream,
391
- WriteStream
392
- };
393
- function ReadStream(path4, options) {
394
- if (!(this instanceof ReadStream))
395
- return new ReadStream(path4, options);
396
- Stream.call(this);
397
- var self = this;
398
- this.path = path4;
399
- this.fd = null;
400
- this.readable = true;
401
- this.paused = false;
402
- this.flags = "r";
403
- this.mode = 438;
404
- this.bufferSize = 64 * 1024;
405
- options = options || {};
406
- var keys = Object.keys(options);
407
- for (var index = 0, length = keys.length; index < length; index++) {
408
- var key = keys[index];
409
- this[key] = options[key];
410
- }
411
- if (this.encoding)
412
- this.setEncoding(this.encoding);
413
- if (this.start !== void 0) {
414
- if ("number" !== typeof this.start) {
415
- throw TypeError("start must be a Number");
416
- }
417
- if (this.end === void 0) {
418
- this.end = Infinity;
419
- } else if ("number" !== typeof this.end) {
420
- throw TypeError("end must be a Number");
421
- }
422
- if (this.start > this.end) {
423
- throw new Error("start must be <= end");
424
- }
425
- this.pos = this.start;
426
- }
427
- if (this.fd !== null) {
428
- process.nextTick(function() {
429
- self._read();
430
- });
431
- return;
432
- }
433
- fs2.open(this.path, this.flags, this.mode, function(err, fd) {
434
- if (err) {
435
- self.emit("error", err);
436
- self.readable = false;
437
- return;
438
- }
439
- self.fd = fd;
440
- self.emit("open", fd);
441
- self._read();
442
- });
443
- }
444
- function WriteStream(path4, options) {
445
- if (!(this instanceof WriteStream))
446
- return new WriteStream(path4, options);
447
- Stream.call(this);
448
- this.path = path4;
449
- this.fd = null;
450
- this.writable = true;
451
- this.flags = "w";
452
- this.encoding = "binary";
453
- this.mode = 438;
454
- this.bytesWritten = 0;
455
- options = options || {};
456
- var keys = Object.keys(options);
457
- for (var index = 0, length = keys.length; index < length; index++) {
458
- var key = keys[index];
459
- this[key] = options[key];
460
- }
461
- if (this.start !== void 0) {
462
- if ("number" !== typeof this.start) {
463
- throw TypeError("start must be a Number");
464
- }
465
- if (this.start < 0) {
466
- throw new Error("start must be >= zero");
467
- }
468
- this.pos = this.start;
469
- }
470
- this.busy = false;
471
- this._queue = [];
472
- if (this.fd === null) {
473
- this._open = fs2.open;
474
- this._queue.push([
475
- this._open,
476
- this.path,
477
- this.flags,
478
- this.mode,
479
- void 0
480
- ]);
481
- this.flush();
482
- }
483
- }
484
- }
485
- }
486
- });
487
-
488
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
489
- var require_clone = __commonJS({
490
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports, module) {
491
- "use strict";
492
- module.exports = clone;
493
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
494
- return obj.__proto__;
495
- };
496
- function clone(obj) {
497
- if (obj === null || typeof obj !== "object")
498
- return obj;
499
- if (obj instanceof Object)
500
- var copy = {
501
- __proto__: getPrototypeOf(obj)
502
- };
503
- else
504
- var copy = /* @__PURE__ */ Object.create(null);
505
- Object.getOwnPropertyNames(obj).forEach(function(key) {
506
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
507
- });
508
- return copy;
509
- }
510
- }
511
- });
512
-
513
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
514
- var require_graceful_fs = __commonJS({
515
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module) {
516
- var fs2 = __require("fs");
517
- var polyfills = require_polyfills();
518
- var legacy = require_legacy_streams();
519
- var clone = require_clone();
520
- var util = __require("util");
521
- var gracefulQueue;
522
- var previousSymbol;
523
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
524
- gracefulQueue = Symbol.for("graceful-fs.queue");
525
- previousSymbol = Symbol.for("graceful-fs.previous");
526
- } else {
527
- gracefulQueue = "___graceful-fs.queue";
528
- previousSymbol = "___graceful-fs.previous";
529
- }
530
- function noop() {
531
- }
532
- function publishQueue(context, queue2) {
533
- Object.defineProperty(context, gracefulQueue, {
534
- get: function() {
535
- return queue2;
536
- }
537
- });
538
- }
539
- var debug = noop;
540
- if (util.debuglog)
541
- debug = util.debuglog("gfs4");
542
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
543
- debug = function() {
544
- var m = util.format.apply(util, arguments);
545
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
546
- console.error(m);
547
- };
548
- if (!fs2[gracefulQueue]) {
549
- queue = global[gracefulQueue] || [];
550
- publishQueue(fs2, queue);
551
- fs2.close = function(fs$close) {
552
- function close(fd, cb) {
553
- return fs$close.call(fs2, fd, function(err) {
554
- if (!err) {
555
- resetQueue();
556
- }
557
- if (typeof cb === "function")
558
- cb.apply(this, arguments);
559
- });
560
- }
561
- Object.defineProperty(close, previousSymbol, {
562
- value: fs$close
563
- });
564
- return close;
565
- }(fs2.close);
566
- fs2.closeSync = function(fs$closeSync) {
567
- function closeSync(fd) {
568
- fs$closeSync.apply(fs2, arguments);
569
- resetQueue();
570
- }
571
- Object.defineProperty(closeSync, previousSymbol, {
572
- value: fs$closeSync
573
- });
574
- return closeSync;
575
- }(fs2.closeSync);
576
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
577
- process.on("exit", function() {
578
- debug(fs2[gracefulQueue]);
579
- __require("assert").equal(fs2[gracefulQueue].length, 0);
580
- });
581
- }
582
- }
583
- var queue;
584
- if (!global[gracefulQueue]) {
585
- publishQueue(global, fs2[gracefulQueue]);
586
- }
587
- module.exports = patch(clone(fs2));
588
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs2.__patched) {
589
- module.exports = patch(fs2);
590
- fs2.__patched = true;
591
- }
592
- function patch(fs3) {
593
- polyfills(fs3);
594
- fs3.gracefulify = patch;
595
- fs3.createReadStream = createReadStream;
596
- fs3.createWriteStream = createWriteStream;
597
- var fs$readFile = fs3.readFile;
598
- fs3.readFile = readFile;
599
- function readFile(path4, options, cb) {
600
- if (typeof options === "function")
601
- cb = options, options = null;
602
- return go$readFile(path4, options, cb);
603
- function go$readFile(path5, options2, cb2, startTime) {
604
- return fs$readFile(path5, options2, function(err) {
605
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
606
- enqueue([
607
- go$readFile,
608
- [
609
- path5,
610
- options2,
611
- cb2
612
- ],
613
- err,
614
- startTime || Date.now(),
615
- Date.now()
616
- ]);
617
- else {
618
- if (typeof cb2 === "function")
619
- cb2.apply(this, arguments);
620
- }
621
- });
622
- }
623
- }
624
- var fs$writeFile = fs3.writeFile;
625
- fs3.writeFile = writeFile;
626
- function writeFile(path4, data, options, cb) {
627
- if (typeof options === "function")
628
- cb = options, options = null;
629
- return go$writeFile(path4, data, options, cb);
630
- function go$writeFile(path5, data2, options2, cb2, startTime) {
631
- return fs$writeFile(path5, data2, options2, function(err) {
632
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
633
- enqueue([
634
- go$writeFile,
635
- [
636
- path5,
637
- data2,
638
- options2,
639
- cb2
640
- ],
641
- err,
642
- startTime || Date.now(),
643
- Date.now()
644
- ]);
645
- else {
646
- if (typeof cb2 === "function")
647
- cb2.apply(this, arguments);
648
- }
649
- });
650
- }
651
- }
652
- var fs$appendFile = fs3.appendFile;
653
- if (fs$appendFile)
654
- fs3.appendFile = appendFile;
655
- function appendFile(path4, data, options, cb) {
656
- if (typeof options === "function")
657
- cb = options, options = null;
658
- return go$appendFile(path4, data, options, cb);
659
- function go$appendFile(path5, data2, options2, cb2, startTime) {
660
- return fs$appendFile(path5, data2, options2, function(err) {
661
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
662
- enqueue([
663
- go$appendFile,
664
- [
665
- path5,
666
- data2,
667
- options2,
668
- cb2
669
- ],
670
- err,
671
- startTime || Date.now(),
672
- Date.now()
673
- ]);
674
- else {
675
- if (typeof cb2 === "function")
676
- cb2.apply(this, arguments);
677
- }
678
- });
679
- }
680
- }
681
- var fs$copyFile = fs3.copyFile;
682
- if (fs$copyFile)
683
- fs3.copyFile = copyFile;
684
- function copyFile(src, dest, flags, cb) {
685
- if (typeof flags === "function") {
686
- cb = flags;
687
- flags = 0;
688
- }
689
- return go$copyFile(src, dest, flags, cb);
690
- function go$copyFile(src2, dest2, flags2, cb2, startTime) {
691
- return fs$copyFile(src2, dest2, flags2, function(err) {
692
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
693
- enqueue([
694
- go$copyFile,
695
- [
696
- src2,
697
- dest2,
698
- flags2,
699
- cb2
700
- ],
701
- err,
702
- startTime || Date.now(),
703
- Date.now()
704
- ]);
705
- else {
706
- if (typeof cb2 === "function")
707
- cb2.apply(this, arguments);
708
- }
709
- });
710
- }
711
- }
712
- var fs$readdir = fs3.readdir;
713
- fs3.readdir = readdir;
714
- var noReaddirOptionVersions = /^v[0-5]\./;
715
- function readdir(path4, options, cb) {
716
- if (typeof options === "function")
717
- cb = options, options = null;
718
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path5, options2, cb2, startTime) {
719
- return fs$readdir(path5, fs$readdirCallback(path5, options2, cb2, startTime));
720
- } : function go$readdir2(path5, options2, cb2, startTime) {
721
- return fs$readdir(path5, options2, fs$readdirCallback(path5, options2, cb2, startTime));
722
- };
723
- return go$readdir(path4, options, cb);
724
- function fs$readdirCallback(path5, options2, cb2, startTime) {
725
- return function(err, files) {
726
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
727
- enqueue([
728
- go$readdir,
729
- [
730
- path5,
731
- options2,
732
- cb2
733
- ],
734
- err,
735
- startTime || Date.now(),
736
- Date.now()
737
- ]);
738
- else {
739
- if (files && files.sort)
740
- files.sort();
741
- if (typeof cb2 === "function")
742
- cb2.call(this, err, files);
743
- }
744
- };
745
- }
746
- }
747
- if (process.version.substr(0, 4) === "v0.8") {
748
- var legStreams = legacy(fs3);
749
- ReadStream = legStreams.ReadStream;
750
- WriteStream = legStreams.WriteStream;
751
- }
752
- var fs$ReadStream = fs3.ReadStream;
753
- if (fs$ReadStream) {
754
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
755
- ReadStream.prototype.open = ReadStream$open;
756
- }
757
- var fs$WriteStream = fs3.WriteStream;
758
- if (fs$WriteStream) {
759
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
760
- WriteStream.prototype.open = WriteStream$open;
761
- }
762
- Object.defineProperty(fs3, "ReadStream", {
763
- get: function() {
764
- return ReadStream;
765
- },
766
- set: function(val) {
767
- ReadStream = val;
768
- },
769
- enumerable: true,
770
- configurable: true
771
- });
772
- Object.defineProperty(fs3, "WriteStream", {
773
- get: function() {
774
- return WriteStream;
775
- },
776
- set: function(val) {
777
- WriteStream = val;
778
- },
779
- enumerable: true,
780
- configurable: true
781
- });
782
- var FileReadStream = ReadStream;
783
- Object.defineProperty(fs3, "FileReadStream", {
784
- get: function() {
785
- return FileReadStream;
786
- },
787
- set: function(val) {
788
- FileReadStream = val;
789
- },
790
- enumerable: true,
791
- configurable: true
792
- });
793
- var FileWriteStream = WriteStream;
794
- Object.defineProperty(fs3, "FileWriteStream", {
795
- get: function() {
796
- return FileWriteStream;
797
- },
798
- set: function(val) {
799
- FileWriteStream = val;
800
- },
801
- enumerable: true,
802
- configurable: true
803
- });
804
- function ReadStream(path4, options) {
805
- if (this instanceof ReadStream)
806
- return fs$ReadStream.apply(this, arguments), this;
807
- else
808
- return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
809
- }
810
- function ReadStream$open() {
811
- var that = this;
812
- open(that.path, that.flags, that.mode, function(err, fd) {
813
- if (err) {
814
- if (that.autoClose)
815
- that.destroy();
816
- that.emit("error", err);
817
- } else {
818
- that.fd = fd;
819
- that.emit("open", fd);
820
- that.read();
821
- }
822
- });
823
- }
824
- function WriteStream(path4, options) {
825
- if (this instanceof WriteStream)
826
- return fs$WriteStream.apply(this, arguments), this;
827
- else
828
- return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
829
- }
830
- function WriteStream$open() {
831
- var that = this;
832
- open(that.path, that.flags, that.mode, function(err, fd) {
833
- if (err) {
834
- that.destroy();
835
- that.emit("error", err);
836
- } else {
837
- that.fd = fd;
838
- that.emit("open", fd);
839
- }
840
- });
841
- }
842
- function createReadStream(path4, options) {
843
- return new fs3.ReadStream(path4, options);
844
- }
845
- function createWriteStream(path4, options) {
846
- return new fs3.WriteStream(path4, options);
847
- }
848
- var fs$open = fs3.open;
849
- fs3.open = open;
850
- function open(path4, flags, mode, cb) {
851
- if (typeof mode === "function")
852
- cb = mode, mode = null;
853
- return go$open(path4, flags, mode, cb);
854
- function go$open(path5, flags2, mode2, cb2, startTime) {
855
- return fs$open(path5, flags2, mode2, function(err, fd) {
856
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
857
- enqueue([
858
- go$open,
859
- [
860
- path5,
861
- flags2,
862
- mode2,
863
- cb2
864
- ],
865
- err,
866
- startTime || Date.now(),
867
- Date.now()
868
- ]);
869
- else {
870
- if (typeof cb2 === "function")
871
- cb2.apply(this, arguments);
872
- }
873
- });
874
- }
875
- }
876
- return fs3;
877
- }
878
- function enqueue(elem) {
879
- debug("ENQUEUE", elem[0].name, elem[1]);
880
- fs2[gracefulQueue].push(elem);
881
- retry();
882
- }
883
- var retryTimer;
884
- function resetQueue() {
885
- var now = Date.now();
886
- for (var i = 0; i < fs2[gracefulQueue].length; ++i) {
887
- if (fs2[gracefulQueue][i].length > 2) {
888
- fs2[gracefulQueue][i][3] = now;
889
- fs2[gracefulQueue][i][4] = now;
890
- }
891
- }
892
- retry();
893
- }
894
- function retry() {
895
- clearTimeout(retryTimer);
896
- retryTimer = void 0;
897
- if (fs2[gracefulQueue].length === 0)
898
- return;
899
- var elem = fs2[gracefulQueue].shift();
900
- var fn = elem[0];
901
- var args = elem[1];
902
- var err = elem[2];
903
- var startTime = elem[3];
904
- var lastTime = elem[4];
905
- if (startTime === void 0) {
906
- debug("RETRY", fn.name, args);
907
- fn.apply(null, args);
908
- } else if (Date.now() - startTime >= 6e4) {
909
- debug("TIMEOUT", fn.name, args);
910
- var cb = args.pop();
911
- if (typeof cb === "function")
912
- cb.call(null, err);
913
- } else {
914
- var sinceAttempt = Date.now() - lastTime;
915
- var sinceStart = Math.max(lastTime - startTime, 1);
916
- var desiredDelay = Math.min(sinceStart * 1.2, 100);
917
- if (sinceAttempt >= desiredDelay) {
918
- debug("RETRY", fn.name, args);
919
- fn.apply(null, args.concat([
920
- startTime
921
- ]));
922
- } else {
923
- fs2[gracefulQueue].push(elem);
924
- }
925
- }
926
- if (retryTimer === void 0) {
927
- retryTimer = setTimeout(retry, 0);
928
- }
929
- }
930
- }
931
- });
932
-
933
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/fs/index.js
934
- var require_fs = __commonJS({
935
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/fs/index.js"(exports) {
936
- "use strict";
937
- var u = require_universalify().fromCallback;
938
- var fs2 = require_graceful_fs();
939
- var api = [
940
- "access",
941
- "appendFile",
942
- "chmod",
943
- "chown",
944
- "close",
945
- "copyFile",
946
- "fchmod",
947
- "fchown",
948
- "fdatasync",
949
- "fstat",
950
- "fsync",
951
- "ftruncate",
952
- "futimes",
953
- "lchmod",
954
- "lchown",
955
- "link",
956
- "lstat",
957
- "mkdir",
958
- "mkdtemp",
959
- "open",
960
- "opendir",
961
- "readdir",
962
- "readFile",
963
- "readlink",
964
- "realpath",
965
- "rename",
966
- "rm",
967
- "rmdir",
968
- "stat",
969
- "symlink",
970
- "truncate",
971
- "unlink",
972
- "utimes",
973
- "writeFile"
974
- ].filter((key) => {
975
- return typeof fs2[key] === "function";
976
- });
977
- Object.assign(exports, fs2);
978
- api.forEach((method) => {
979
- exports[method] = u(fs2[method]);
980
- });
981
- exports.exists = function(filename, callback) {
982
- if (typeof callback === "function") {
983
- return fs2.exists(filename, callback);
984
- }
985
- return new Promise((resolve) => {
986
- return fs2.exists(filename, resolve);
987
- });
988
- };
989
- exports.read = function(fd, buffer, offset, length, position, callback) {
990
- if (typeof callback === "function") {
991
- return fs2.read(fd, buffer, offset, length, position, callback);
992
- }
993
- return new Promise((resolve, reject) => {
994
- fs2.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
995
- if (err)
996
- return reject(err);
997
- resolve({
998
- bytesRead,
999
- buffer: buffer2
1000
- });
1001
- });
1002
- });
1003
- };
1004
- exports.write = function(fd, buffer, ...args) {
1005
- if (typeof args[args.length - 1] === "function") {
1006
- return fs2.write(fd, buffer, ...args);
1007
- }
1008
- return new Promise((resolve, reject) => {
1009
- fs2.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
1010
- if (err)
1011
- return reject(err);
1012
- resolve({
1013
- bytesWritten,
1014
- buffer: buffer2
1015
- });
1016
- });
1017
- });
1018
- };
1019
- exports.readv = function(fd, buffers, ...args) {
1020
- if (typeof args[args.length - 1] === "function") {
1021
- return fs2.readv(fd, buffers, ...args);
1022
- }
1023
- return new Promise((resolve, reject) => {
1024
- fs2.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
1025
- if (err)
1026
- return reject(err);
1027
- resolve({
1028
- bytesRead,
1029
- buffers: buffers2
1030
- });
1031
- });
1032
- });
1033
- };
1034
- exports.writev = function(fd, buffers, ...args) {
1035
- if (typeof args[args.length - 1] === "function") {
1036
- return fs2.writev(fd, buffers, ...args);
1037
- }
1038
- return new Promise((resolve, reject) => {
1039
- fs2.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
1040
- if (err)
1041
- return reject(err);
1042
- resolve({
1043
- bytesWritten,
1044
- buffers: buffers2
1045
- });
1046
- });
1047
- });
1048
- };
1049
- if (typeof fs2.realpath.native === "function") {
1050
- exports.realpath.native = u(fs2.realpath.native);
1051
- } else {
1052
- process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003");
1053
- }
1054
- }
1055
- });
1056
-
1057
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/utils.js
1058
- var require_utils = __commonJS({
1059
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module) {
1060
- "use strict";
1061
- var path4 = __require("path");
1062
- module.exports.checkPath = function checkPath(pth) {
1063
- if (process.platform === "win32") {
1064
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path4.parse(pth).root, ""));
1065
- if (pathHasInvalidWinCharacters) {
1066
- const error = new Error(`Path contains invalid characters: ${pth}`);
1067
- error.code = "EINVAL";
1068
- throw error;
1069
- }
1070
- }
1071
- };
1072
- }
1073
- });
1074
-
1075
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/make-dir.js
1076
- var require_make_dir = __commonJS({
1077
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module) {
1078
- "use strict";
1079
- var fs2 = require_fs();
1080
- var { checkPath } = require_utils();
1081
- var getMode = (options) => {
1082
- const defaults = {
1083
- mode: 511
1084
- };
1085
- if (typeof options === "number")
1086
- return options;
1087
- return {
1088
- ...defaults,
1089
- ...options
1090
- }.mode;
1091
- };
1092
- module.exports.makeDir = async (dir, options) => {
1093
- checkPath(dir);
1094
- return fs2.mkdir(dir, {
1095
- mode: getMode(options),
1096
- recursive: true
1097
- });
1098
- };
1099
- module.exports.makeDirSync = (dir, options) => {
1100
- checkPath(dir);
1101
- return fs2.mkdirSync(dir, {
1102
- mode: getMode(options),
1103
- recursive: true
1104
- });
1105
- };
1106
- }
1107
- });
1108
-
1109
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/index.js
1110
- var require_mkdirs = __commonJS({
1111
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/index.js"(exports, module) {
1112
- "use strict";
1113
- var u = require_universalify().fromPromise;
1114
- var { makeDir: _makeDir, makeDirSync } = require_make_dir();
1115
- var makeDir = u(_makeDir);
1116
- module.exports = {
1117
- mkdirs: makeDir,
1118
- mkdirsSync: makeDirSync,
1119
- // alias
1120
- mkdirp: makeDir,
1121
- mkdirpSync: makeDirSync,
1122
- ensureDir: makeDir,
1123
- ensureDirSync: makeDirSync
1124
- };
1125
- }
1126
- });
1127
-
1128
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/path-exists/index.js
1129
- var require_path_exists = __commonJS({
1130
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/path-exists/index.js"(exports, module) {
1131
- "use strict";
1132
- var u = require_universalify().fromPromise;
1133
- var fs2 = require_fs();
1134
- function pathExists(path4) {
1135
- return fs2.access(path4).then(() => true).catch(() => false);
1136
- }
1137
- module.exports = {
1138
- pathExists: u(pathExists),
1139
- pathExistsSync: fs2.existsSync
1140
- };
1141
- }
1142
- });
1143
-
1144
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/util/utimes.js
1145
- var require_utimes = __commonJS({
1146
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/util/utimes.js"(exports, module) {
1147
- "use strict";
1148
- var fs2 = require_graceful_fs();
1149
- function utimesMillis(path4, atime, mtime, callback) {
1150
- fs2.open(path4, "r+", (err, fd) => {
1151
- if (err)
1152
- return callback(err);
1153
- fs2.futimes(fd, atime, mtime, (futimesErr) => {
1154
- fs2.close(fd, (closeErr) => {
1155
- if (callback)
1156
- callback(futimesErr || closeErr);
1157
- });
1158
- });
1159
- });
1160
- }
1161
- function utimesMillisSync(path4, atime, mtime) {
1162
- const fd = fs2.openSync(path4, "r+");
1163
- fs2.futimesSync(fd, atime, mtime);
1164
- return fs2.closeSync(fd);
1165
- }
1166
- module.exports = {
1167
- utimesMillis,
1168
- utimesMillisSync
1169
- };
1170
- }
1171
- });
1172
-
1173
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/util/stat.js
1174
- var require_stat = __commonJS({
1175
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/util/stat.js"(exports, module) {
1176
- "use strict";
1177
- var fs2 = require_fs();
1178
- var path4 = __require("path");
1179
- var util = __require("util");
1180
- function getStats(src, dest, opts) {
1181
- const statFunc = opts.dereference ? (file) => fs2.stat(file, {
1182
- bigint: true
1183
- }) : (file) => fs2.lstat(file, {
1184
- bigint: true
1185
- });
1186
- return Promise.all([
1187
- statFunc(src),
1188
- statFunc(dest).catch((err) => {
1189
- if (err.code === "ENOENT")
1190
- return null;
1191
- throw err;
1192
- })
1193
- ]).then(([srcStat, destStat]) => ({
1194
- srcStat,
1195
- destStat
1196
- }));
1197
- }
1198
- function getStatsSync(src, dest, opts) {
1199
- let destStat;
1200
- const statFunc = opts.dereference ? (file) => fs2.statSync(file, {
1201
- bigint: true
1202
- }) : (file) => fs2.lstatSync(file, {
1203
- bigint: true
1204
- });
1205
- const srcStat = statFunc(src);
1206
- try {
1207
- destStat = statFunc(dest);
1208
- } catch (err) {
1209
- if (err.code === "ENOENT")
1210
- return {
1211
- srcStat,
1212
- destStat: null
1213
- };
1214
- throw err;
1215
- }
1216
- return {
1217
- srcStat,
1218
- destStat
1219
- };
1220
- }
1221
- function checkPaths(src, dest, funcName, opts, cb) {
1222
- util.callbackify(getStats)(src, dest, opts, (err, stats) => {
1223
- if (err)
1224
- return cb(err);
1225
- const { srcStat, destStat } = stats;
1226
- if (destStat) {
1227
- if (areIdentical(srcStat, destStat)) {
1228
- const srcBaseName = path4.basename(src);
1229
- const destBaseName = path4.basename(dest);
1230
- if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1231
- return cb(null, {
1232
- srcStat,
1233
- destStat,
1234
- isChangingCase: true
1235
- });
1236
- }
1237
- return cb(new Error("Source and destination must not be the same."));
1238
- }
1239
- if (srcStat.isDirectory() && !destStat.isDirectory()) {
1240
- return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));
1241
- }
1242
- if (!srcStat.isDirectory() && destStat.isDirectory()) {
1243
- return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`));
1244
- }
1245
- }
1246
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1247
- return cb(new Error(errMsg(src, dest, funcName)));
1248
- }
1249
- return cb(null, {
1250
- srcStat,
1251
- destStat
1252
- });
1253
- });
1254
- }
1255
- function checkPathsSync(src, dest, funcName, opts) {
1256
- const { srcStat, destStat } = getStatsSync(src, dest, opts);
1257
- if (destStat) {
1258
- if (areIdentical(srcStat, destStat)) {
1259
- const srcBaseName = path4.basename(src);
1260
- const destBaseName = path4.basename(dest);
1261
- if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1262
- return {
1263
- srcStat,
1264
- destStat,
1265
- isChangingCase: true
1266
- };
1267
- }
1268
- throw new Error("Source and destination must not be the same.");
1269
- }
1270
- if (srcStat.isDirectory() && !destStat.isDirectory()) {
1271
- throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1272
- }
1273
- if (!srcStat.isDirectory() && destStat.isDirectory()) {
1274
- throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1275
- }
1276
- }
1277
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1278
- throw new Error(errMsg(src, dest, funcName));
1279
- }
1280
- return {
1281
- srcStat,
1282
- destStat
1283
- };
1284
- }
1285
- function checkParentPaths(src, srcStat, dest, funcName, cb) {
1286
- const srcParent = path4.resolve(path4.dirname(src));
1287
- const destParent = path4.resolve(path4.dirname(dest));
1288
- if (destParent === srcParent || destParent === path4.parse(destParent).root)
1289
- return cb();
1290
- fs2.stat(destParent, {
1291
- bigint: true
1292
- }, (err, destStat) => {
1293
- if (err) {
1294
- if (err.code === "ENOENT")
1295
- return cb();
1296
- return cb(err);
1297
- }
1298
- if (areIdentical(srcStat, destStat)) {
1299
- return cb(new Error(errMsg(src, dest, funcName)));
1300
- }
1301
- return checkParentPaths(src, srcStat, destParent, funcName, cb);
1302
- });
1303
- }
1304
- function checkParentPathsSync(src, srcStat, dest, funcName) {
1305
- const srcParent = path4.resolve(path4.dirname(src));
1306
- const destParent = path4.resolve(path4.dirname(dest));
1307
- if (destParent === srcParent || destParent === path4.parse(destParent).root)
1308
- return;
1309
- let destStat;
1310
- try {
1311
- destStat = fs2.statSync(destParent, {
1312
- bigint: true
1313
- });
1314
- } catch (err) {
1315
- if (err.code === "ENOENT")
1316
- return;
1317
- throw err;
1318
- }
1319
- if (areIdentical(srcStat, destStat)) {
1320
- throw new Error(errMsg(src, dest, funcName));
1321
- }
1322
- return checkParentPathsSync(src, srcStat, destParent, funcName);
1323
- }
1324
- function areIdentical(srcStat, destStat) {
1325
- return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
1326
- }
1327
- function isSrcSubdir(src, dest) {
1328
- const srcArr = path4.resolve(src).split(path4.sep).filter((i) => i);
1329
- const destArr = path4.resolve(dest).split(path4.sep).filter((i) => i);
1330
- return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true);
1331
- }
1332
- function errMsg(src, dest, funcName) {
1333
- return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
1334
- }
1335
- module.exports = {
1336
- checkPaths,
1337
- checkPathsSync,
1338
- checkParentPaths,
1339
- checkParentPathsSync,
1340
- isSrcSubdir,
1341
- areIdentical
1342
- };
1343
- }
1344
- });
1345
-
1346
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/copy.js
1347
- var require_copy = __commonJS({
1348
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/copy.js"(exports, module) {
1349
- "use strict";
1350
- var fs2 = require_graceful_fs();
1351
- var path4 = __require("path");
1352
- var mkdirs = require_mkdirs().mkdirs;
1353
- var pathExists = require_path_exists().pathExists;
1354
- var utimesMillis = require_utimes().utimesMillis;
1355
- var stat = require_stat();
1356
- function copy(src, dest, opts, cb) {
1357
- if (typeof opts === "function" && !cb) {
1358
- cb = opts;
1359
- opts = {};
1360
- } else if (typeof opts === "function") {
1361
- opts = {
1362
- filter: opts
1363
- };
1364
- }
1365
- cb = cb || function() {
1366
- };
1367
- opts = opts || {};
1368
- opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1369
- opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1370
- if (opts.preserveTimestamps && process.arch === "ia32") {
1371
- 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");
1372
- }
1373
- stat.checkPaths(src, dest, "copy", opts, (err, stats) => {
1374
- if (err)
1375
- return cb(err);
1376
- const { srcStat, destStat } = stats;
1377
- stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => {
1378
- if (err2)
1379
- return cb(err2);
1380
- runFilter(src, dest, opts, (err3, include) => {
1381
- if (err3)
1382
- return cb(err3);
1383
- if (!include)
1384
- return cb();
1385
- checkParentDir(destStat, src, dest, opts, cb);
1386
- });
1387
- });
1388
- });
1389
- }
1390
- function checkParentDir(destStat, src, dest, opts, cb) {
1391
- const destParent = path4.dirname(dest);
1392
- pathExists(destParent, (err, dirExists) => {
1393
- if (err)
1394
- return cb(err);
1395
- if (dirExists)
1396
- return getStats(destStat, src, dest, opts, cb);
1397
- mkdirs(destParent, (err2) => {
1398
- if (err2)
1399
- return cb(err2);
1400
- return getStats(destStat, src, dest, opts, cb);
1401
- });
1402
- });
1403
- }
1404
- function runFilter(src, dest, opts, cb) {
1405
- if (!opts.filter)
1406
- return cb(null, true);
1407
- Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error));
1408
- }
1409
- function getStats(destStat, src, dest, opts, cb) {
1410
- const stat2 = opts.dereference ? fs2.stat : fs2.lstat;
1411
- stat2(src, (err, srcStat) => {
1412
- if (err)
1413
- return cb(err);
1414
- if (srcStat.isDirectory())
1415
- return onDir(srcStat, destStat, src, dest, opts, cb);
1416
- else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
1417
- return onFile(srcStat, destStat, src, dest, opts, cb);
1418
- else if (srcStat.isSymbolicLink())
1419
- return onLink(destStat, src, dest, opts, cb);
1420
- else if (srcStat.isSocket())
1421
- return cb(new Error(`Cannot copy a socket file: ${src}`));
1422
- else if (srcStat.isFIFO())
1423
- return cb(new Error(`Cannot copy a FIFO pipe: ${src}`));
1424
- return cb(new Error(`Unknown file: ${src}`));
1425
- });
1426
- }
1427
- function onFile(srcStat, destStat, src, dest, opts, cb) {
1428
- if (!destStat)
1429
- return copyFile(srcStat, src, dest, opts, cb);
1430
- return mayCopyFile(srcStat, src, dest, opts, cb);
1431
- }
1432
- function mayCopyFile(srcStat, src, dest, opts, cb) {
1433
- if (opts.overwrite) {
1434
- fs2.unlink(dest, (err) => {
1435
- if (err)
1436
- return cb(err);
1437
- return copyFile(srcStat, src, dest, opts, cb);
1438
- });
1439
- } else if (opts.errorOnExist) {
1440
- return cb(new Error(`'${dest}' already exists`));
1441
- } else
1442
- return cb();
1443
- }
1444
- function copyFile(srcStat, src, dest, opts, cb) {
1445
- fs2.copyFile(src, dest, (err) => {
1446
- if (err)
1447
- return cb(err);
1448
- if (opts.preserveTimestamps)
1449
- return handleTimestampsAndMode(srcStat.mode, src, dest, cb);
1450
- return setDestMode(dest, srcStat.mode, cb);
1451
- });
1452
- }
1453
- function handleTimestampsAndMode(srcMode, src, dest, cb) {
1454
- if (fileIsNotWritable(srcMode)) {
1455
- return makeFileWritable(dest, srcMode, (err) => {
1456
- if (err)
1457
- return cb(err);
1458
- return setDestTimestampsAndMode(srcMode, src, dest, cb);
1459
- });
1460
- }
1461
- return setDestTimestampsAndMode(srcMode, src, dest, cb);
1462
- }
1463
- function fileIsNotWritable(srcMode) {
1464
- return (srcMode & 128) === 0;
1465
- }
1466
- function makeFileWritable(dest, srcMode, cb) {
1467
- return setDestMode(dest, srcMode | 128, cb);
1468
- }
1469
- function setDestTimestampsAndMode(srcMode, src, dest, cb) {
1470
- setDestTimestamps(src, dest, (err) => {
1471
- if (err)
1472
- return cb(err);
1473
- return setDestMode(dest, srcMode, cb);
1474
- });
1475
- }
1476
- function setDestMode(dest, srcMode, cb) {
1477
- return fs2.chmod(dest, srcMode, cb);
1478
- }
1479
- function setDestTimestamps(src, dest, cb) {
1480
- fs2.stat(src, (err, updatedSrcStat) => {
1481
- if (err)
1482
- return cb(err);
1483
- return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb);
1484
- });
1485
- }
1486
- function onDir(srcStat, destStat, src, dest, opts, cb) {
1487
- if (!destStat)
1488
- return mkDirAndCopy(srcStat.mode, src, dest, opts, cb);
1489
- return copyDir(src, dest, opts, cb);
1490
- }
1491
- function mkDirAndCopy(srcMode, src, dest, opts, cb) {
1492
- fs2.mkdir(dest, (err) => {
1493
- if (err)
1494
- return cb(err);
1495
- copyDir(src, dest, opts, (err2) => {
1496
- if (err2)
1497
- return cb(err2);
1498
- return setDestMode(dest, srcMode, cb);
1499
- });
1500
- });
1501
- }
1502
- function copyDir(src, dest, opts, cb) {
1503
- fs2.readdir(src, (err, items) => {
1504
- if (err)
1505
- return cb(err);
1506
- return copyDirItems(items, src, dest, opts, cb);
1507
- });
1508
- }
1509
- function copyDirItems(items, src, dest, opts, cb) {
1510
- const item = items.pop();
1511
- if (!item)
1512
- return cb();
1513
- return copyDirItem(items, item, src, dest, opts, cb);
1514
- }
1515
- function copyDirItem(items, item, src, dest, opts, cb) {
1516
- const srcItem = path4.join(src, item);
1517
- const destItem = path4.join(dest, item);
1518
- runFilter(srcItem, destItem, opts, (err, include) => {
1519
- if (err)
1520
- return cb(err);
1521
- if (!include)
1522
- return copyDirItems(items, src, dest, opts, cb);
1523
- stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => {
1524
- if (err2)
1525
- return cb(err2);
1526
- const { destStat } = stats;
1527
- getStats(destStat, srcItem, destItem, opts, (err3) => {
1528
- if (err3)
1529
- return cb(err3);
1530
- return copyDirItems(items, src, dest, opts, cb);
1531
- });
1532
- });
1533
- });
1534
- }
1535
- function onLink(destStat, src, dest, opts, cb) {
1536
- fs2.readlink(src, (err, resolvedSrc) => {
1537
- if (err)
1538
- return cb(err);
1539
- if (opts.dereference) {
1540
- resolvedSrc = path4.resolve(process.cwd(), resolvedSrc);
1541
- }
1542
- if (!destStat) {
1543
- return fs2.symlink(resolvedSrc, dest, cb);
1544
- } else {
1545
- fs2.readlink(dest, (err2, resolvedDest) => {
1546
- if (err2) {
1547
- if (err2.code === "EINVAL" || err2.code === "UNKNOWN")
1548
- return fs2.symlink(resolvedSrc, dest, cb);
1549
- return cb(err2);
1550
- }
1551
- if (opts.dereference) {
1552
- resolvedDest = path4.resolve(process.cwd(), resolvedDest);
1553
- }
1554
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1555
- return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`));
1556
- }
1557
- if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
1558
- return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`));
1559
- }
1560
- return copyLink(resolvedSrc, dest, cb);
1561
- });
1562
- }
1563
- });
1564
- }
1565
- function copyLink(resolvedSrc, dest, cb) {
1566
- fs2.unlink(dest, (err) => {
1567
- if (err)
1568
- return cb(err);
1569
- return fs2.symlink(resolvedSrc, dest, cb);
1570
- });
1571
- }
1572
- module.exports = copy;
1573
- }
1574
- });
1575
-
1576
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/copy-sync.js
1577
- var require_copy_sync = __commonJS({
1578
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module) {
1579
- "use strict";
1580
- var fs2 = require_graceful_fs();
1581
- var path4 = __require("path");
1582
- var mkdirsSync = require_mkdirs().mkdirsSync;
1583
- var utimesMillisSync = require_utimes().utimesMillisSync;
1584
- var stat = require_stat();
1585
- function copySync(src, dest, opts) {
1586
- if (typeof opts === "function") {
1587
- opts = {
1588
- filter: opts
1589
- };
1590
- }
1591
- opts = opts || {};
1592
- opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1593
- opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1594
- if (opts.preserveTimestamps && process.arch === "ia32") {
1595
- 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");
1596
- }
1597
- const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
1598
- stat.checkParentPathsSync(src, srcStat, dest, "copy");
1599
- if (opts.filter && !opts.filter(src, dest))
1600
- return;
1601
- const destParent = path4.dirname(dest);
1602
- if (!fs2.existsSync(destParent))
1603
- mkdirsSync(destParent);
1604
- return getStats(destStat, src, dest, opts);
1605
- }
1606
- function getStats(destStat, src, dest, opts) {
1607
- const statSync = opts.dereference ? fs2.statSync : fs2.lstatSync;
1608
- const srcStat = statSync(src);
1609
- if (srcStat.isDirectory())
1610
- return onDir(srcStat, destStat, src, dest, opts);
1611
- else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
1612
- return onFile(srcStat, destStat, src, dest, opts);
1613
- else if (srcStat.isSymbolicLink())
1614
- return onLink(destStat, src, dest, opts);
1615
- else if (srcStat.isSocket())
1616
- throw new Error(`Cannot copy a socket file: ${src}`);
1617
- else if (srcStat.isFIFO())
1618
- throw new Error(`Cannot copy a FIFO pipe: ${src}`);
1619
- throw new Error(`Unknown file: ${src}`);
1620
- }
1621
- function onFile(srcStat, destStat, src, dest, opts) {
1622
- if (!destStat)
1623
- return copyFile(srcStat, src, dest, opts);
1624
- return mayCopyFile(srcStat, src, dest, opts);
1625
- }
1626
- function mayCopyFile(srcStat, src, dest, opts) {
1627
- if (opts.overwrite) {
1628
- fs2.unlinkSync(dest);
1629
- return copyFile(srcStat, src, dest, opts);
1630
- } else if (opts.errorOnExist) {
1631
- throw new Error(`'${dest}' already exists`);
1632
- }
1633
- }
1634
- function copyFile(srcStat, src, dest, opts) {
1635
- fs2.copyFileSync(src, dest);
1636
- if (opts.preserveTimestamps)
1637
- handleTimestamps(srcStat.mode, src, dest);
1638
- return setDestMode(dest, srcStat.mode);
1639
- }
1640
- function handleTimestamps(srcMode, src, dest) {
1641
- if (fileIsNotWritable(srcMode))
1642
- makeFileWritable(dest, srcMode);
1643
- return setDestTimestamps(src, dest);
1644
- }
1645
- function fileIsNotWritable(srcMode) {
1646
- return (srcMode & 128) === 0;
1647
- }
1648
- function makeFileWritable(dest, srcMode) {
1649
- return setDestMode(dest, srcMode | 128);
1650
- }
1651
- function setDestMode(dest, srcMode) {
1652
- return fs2.chmodSync(dest, srcMode);
1653
- }
1654
- function setDestTimestamps(src, dest) {
1655
- const updatedSrcStat = fs2.statSync(src);
1656
- return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1657
- }
1658
- function onDir(srcStat, destStat, src, dest, opts) {
1659
- if (!destStat)
1660
- return mkDirAndCopy(srcStat.mode, src, dest, opts);
1661
- return copyDir(src, dest, opts);
1662
- }
1663
- function mkDirAndCopy(srcMode, src, dest, opts) {
1664
- fs2.mkdirSync(dest);
1665
- copyDir(src, dest, opts);
1666
- return setDestMode(dest, srcMode);
1667
- }
1668
- function copyDir(src, dest, opts) {
1669
- fs2.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
1670
- }
1671
- function copyDirItem(item, src, dest, opts) {
1672
- const srcItem = path4.join(src, item);
1673
- const destItem = path4.join(dest, item);
1674
- if (opts.filter && !opts.filter(srcItem, destItem))
1675
- return;
1676
- const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
1677
- return getStats(destStat, srcItem, destItem, opts);
1678
- }
1679
- function onLink(destStat, src, dest, opts) {
1680
- let resolvedSrc = fs2.readlinkSync(src);
1681
- if (opts.dereference) {
1682
- resolvedSrc = path4.resolve(process.cwd(), resolvedSrc);
1683
- }
1684
- if (!destStat) {
1685
- return fs2.symlinkSync(resolvedSrc, dest);
1686
- } else {
1687
- let resolvedDest;
1688
- try {
1689
- resolvedDest = fs2.readlinkSync(dest);
1690
- } catch (err) {
1691
- if (err.code === "EINVAL" || err.code === "UNKNOWN")
1692
- return fs2.symlinkSync(resolvedSrc, dest);
1693
- throw err;
1694
- }
1695
- if (opts.dereference) {
1696
- resolvedDest = path4.resolve(process.cwd(), resolvedDest);
1697
- }
1698
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1699
- throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
1700
- }
1701
- if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
1702
- throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
1703
- }
1704
- return copyLink(resolvedSrc, dest);
1705
- }
1706
- }
1707
- function copyLink(resolvedSrc, dest) {
1708
- fs2.unlinkSync(dest);
1709
- return fs2.symlinkSync(resolvedSrc, dest);
1710
- }
1711
- module.exports = copySync;
1712
- }
1713
- });
1714
-
1715
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/index.js
1716
- var require_copy2 = __commonJS({
1717
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/index.js"(exports, module) {
1718
- "use strict";
1719
- var u = require_universalify().fromCallback;
1720
- module.exports = {
1721
- copy: u(require_copy()),
1722
- copySync: require_copy_sync()
1723
- };
1724
- }
1725
- });
1726
-
1727
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/remove/index.js
1728
- var require_remove = __commonJS({
1729
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/remove/index.js"(exports, module) {
1730
- "use strict";
1731
- var fs2 = require_graceful_fs();
1732
- var u = require_universalify().fromCallback;
1733
- function remove(path4, callback) {
1734
- fs2.rm(path4, {
1735
- recursive: true,
1736
- force: true
1737
- }, callback);
1738
- }
1739
- function removeSync(path4) {
1740
- fs2.rmSync(path4, {
1741
- recursive: true,
1742
- force: true
1743
- });
1744
- }
1745
- module.exports = {
1746
- remove: u(remove),
1747
- removeSync
1748
- };
1749
- }
1750
- });
1751
-
1752
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/empty/index.js
1753
- var require_empty = __commonJS({
1754
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/empty/index.js"(exports, module) {
1755
- "use strict";
1756
- var u = require_universalify().fromPromise;
1757
- var fs2 = require_fs();
1758
- var path4 = __require("path");
1759
- var mkdir = require_mkdirs();
1760
- var remove = require_remove();
1761
- var emptyDir = u(async function emptyDir2(dir) {
1762
- let items;
1763
- try {
1764
- items = await fs2.readdir(dir);
1765
- } catch {
1766
- return mkdir.mkdirs(dir);
1767
- }
1768
- return Promise.all(items.map((item) => remove.remove(path4.join(dir, item))));
1769
- });
1770
- function emptyDirSync(dir) {
1771
- let items;
1772
- try {
1773
- items = fs2.readdirSync(dir);
1774
- } catch {
1775
- return mkdir.mkdirsSync(dir);
1776
- }
1777
- items.forEach((item) => {
1778
- item = path4.join(dir, item);
1779
- remove.removeSync(item);
1780
- });
1781
- }
1782
- module.exports = {
1783
- emptyDirSync,
1784
- emptydirSync: emptyDirSync,
1785
- emptyDir,
1786
- emptydir: emptyDir
1787
- };
1788
- }
1789
- });
1790
-
1791
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/file.js
1792
- var require_file = __commonJS({
1793
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/file.js"(exports, module) {
1794
- "use strict";
1795
- var u = require_universalify().fromCallback;
1796
- var path4 = __require("path");
1797
- var fs2 = require_graceful_fs();
1798
- var mkdir = require_mkdirs();
1799
- function createFile(file, callback) {
1800
- function makeFile() {
1801
- fs2.writeFile(file, "", (err) => {
1802
- if (err)
1803
- return callback(err);
1804
- callback();
1805
- });
1806
- }
1807
- fs2.stat(file, (err, stats) => {
1808
- if (!err && stats.isFile())
1809
- return callback();
1810
- const dir = path4.dirname(file);
1811
- fs2.stat(dir, (err2, stats2) => {
1812
- if (err2) {
1813
- if (err2.code === "ENOENT") {
1814
- return mkdir.mkdirs(dir, (err3) => {
1815
- if (err3)
1816
- return callback(err3);
1817
- makeFile();
1818
- });
1819
- }
1820
- return callback(err2);
1821
- }
1822
- if (stats2.isDirectory())
1823
- makeFile();
1824
- else {
1825
- fs2.readdir(dir, (err3) => {
1826
- if (err3)
1827
- return callback(err3);
1828
- });
1829
- }
1830
- });
1831
- });
1832
- }
1833
- function createFileSync(file) {
1834
- let stats;
1835
- try {
1836
- stats = fs2.statSync(file);
1837
- } catch {
1838
- }
1839
- if (stats && stats.isFile())
1840
- return;
1841
- const dir = path4.dirname(file);
1842
- try {
1843
- if (!fs2.statSync(dir).isDirectory()) {
1844
- fs2.readdirSync(dir);
1845
- }
1846
- } catch (err) {
1847
- if (err && err.code === "ENOENT")
1848
- mkdir.mkdirsSync(dir);
1849
- else
1850
- throw err;
1851
- }
1852
- fs2.writeFileSync(file, "");
1853
- }
1854
- module.exports = {
1855
- createFile: u(createFile),
1856
- createFileSync
1857
- };
1858
- }
1859
- });
1860
-
1861
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/link.js
1862
- var require_link = __commonJS({
1863
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/link.js"(exports, module) {
1864
- "use strict";
1865
- var u = require_universalify().fromCallback;
1866
- var path4 = __require("path");
1867
- var fs2 = require_graceful_fs();
1868
- var mkdir = require_mkdirs();
1869
- var pathExists = require_path_exists().pathExists;
1870
- var { areIdentical } = require_stat();
1871
- function createLink(srcpath, dstpath, callback) {
1872
- function makeLink(srcpath2, dstpath2) {
1873
- fs2.link(srcpath2, dstpath2, (err) => {
1874
- if (err)
1875
- return callback(err);
1876
- callback(null);
1877
- });
1878
- }
1879
- fs2.lstat(dstpath, (_, dstStat) => {
1880
- fs2.lstat(srcpath, (err, srcStat) => {
1881
- if (err) {
1882
- err.message = err.message.replace("lstat", "ensureLink");
1883
- return callback(err);
1884
- }
1885
- if (dstStat && areIdentical(srcStat, dstStat))
1886
- return callback(null);
1887
- const dir = path4.dirname(dstpath);
1888
- pathExists(dir, (err2, dirExists) => {
1889
- if (err2)
1890
- return callback(err2);
1891
- if (dirExists)
1892
- return makeLink(srcpath, dstpath);
1893
- mkdir.mkdirs(dir, (err3) => {
1894
- if (err3)
1895
- return callback(err3);
1896
- makeLink(srcpath, dstpath);
1897
- });
1898
- });
1899
- });
1900
- });
1901
- }
1902
- function createLinkSync(srcpath, dstpath) {
1903
- let dstStat;
1904
- try {
1905
- dstStat = fs2.lstatSync(dstpath);
1906
- } catch {
1907
- }
1908
- try {
1909
- const srcStat = fs2.lstatSync(srcpath);
1910
- if (dstStat && areIdentical(srcStat, dstStat))
1911
- return;
1912
- } catch (err) {
1913
- err.message = err.message.replace("lstat", "ensureLink");
1914
- throw err;
1915
- }
1916
- const dir = path4.dirname(dstpath);
1917
- const dirExists = fs2.existsSync(dir);
1918
- if (dirExists)
1919
- return fs2.linkSync(srcpath, dstpath);
1920
- mkdir.mkdirsSync(dir);
1921
- return fs2.linkSync(srcpath, dstpath);
1922
- }
1923
- module.exports = {
1924
- createLink: u(createLink),
1925
- createLinkSync
1926
- };
1927
- }
1928
- });
1929
-
1930
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink-paths.js
1931
- var require_symlink_paths = __commonJS({
1932
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module) {
1933
- "use strict";
1934
- var path4 = __require("path");
1935
- var fs2 = require_graceful_fs();
1936
- var pathExists = require_path_exists().pathExists;
1937
- function symlinkPaths(srcpath, dstpath, callback) {
1938
- if (path4.isAbsolute(srcpath)) {
1939
- return fs2.lstat(srcpath, (err) => {
1940
- if (err) {
1941
- err.message = err.message.replace("lstat", "ensureSymlink");
1942
- return callback(err);
1943
- }
1944
- return callback(null, {
1945
- toCwd: srcpath,
1946
- toDst: srcpath
1947
- });
1948
- });
1949
- } else {
1950
- const dstdir = path4.dirname(dstpath);
1951
- const relativeToDst = path4.join(dstdir, srcpath);
1952
- return pathExists(relativeToDst, (err, exists) => {
1953
- if (err)
1954
- return callback(err);
1955
- if (exists) {
1956
- return callback(null, {
1957
- toCwd: relativeToDst,
1958
- toDst: srcpath
1959
- });
1960
- } else {
1961
- return fs2.lstat(srcpath, (err2) => {
1962
- if (err2) {
1963
- err2.message = err2.message.replace("lstat", "ensureSymlink");
1964
- return callback(err2);
1965
- }
1966
- return callback(null, {
1967
- toCwd: srcpath,
1968
- toDst: path4.relative(dstdir, srcpath)
1969
- });
1970
- });
1971
- }
1972
- });
1973
- }
1974
- }
1975
- function symlinkPathsSync(srcpath, dstpath) {
1976
- let exists;
1977
- if (path4.isAbsolute(srcpath)) {
1978
- exists = fs2.existsSync(srcpath);
1979
- if (!exists)
1980
- throw new Error("absolute srcpath does not exist");
1981
- return {
1982
- toCwd: srcpath,
1983
- toDst: srcpath
1984
- };
1985
- } else {
1986
- const dstdir = path4.dirname(dstpath);
1987
- const relativeToDst = path4.join(dstdir, srcpath);
1988
- exists = fs2.existsSync(relativeToDst);
1989
- if (exists) {
1990
- return {
1991
- toCwd: relativeToDst,
1992
- toDst: srcpath
1993
- };
1994
- } else {
1995
- exists = fs2.existsSync(srcpath);
1996
- if (!exists)
1997
- throw new Error("relative srcpath does not exist");
1998
- return {
1999
- toCwd: srcpath,
2000
- toDst: path4.relative(dstdir, srcpath)
2001
- };
2002
- }
2003
- }
2004
- }
2005
- module.exports = {
2006
- symlinkPaths,
2007
- symlinkPathsSync
2008
- };
2009
- }
2010
- });
2011
-
2012
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink-type.js
2013
- var require_symlink_type = __commonJS({
2014
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module) {
2015
- "use strict";
2016
- var fs2 = require_graceful_fs();
2017
- function symlinkType(srcpath, type, callback) {
2018
- callback = typeof type === "function" ? type : callback;
2019
- type = typeof type === "function" ? false : type;
2020
- if (type)
2021
- return callback(null, type);
2022
- fs2.lstat(srcpath, (err, stats) => {
2023
- if (err)
2024
- return callback(null, "file");
2025
- type = stats && stats.isDirectory() ? "dir" : "file";
2026
- callback(null, type);
2027
- });
2028
- }
2029
- function symlinkTypeSync(srcpath, type) {
2030
- let stats;
2031
- if (type)
2032
- return type;
2033
- try {
2034
- stats = fs2.lstatSync(srcpath);
2035
- } catch {
2036
- return "file";
2037
- }
2038
- return stats && stats.isDirectory() ? "dir" : "file";
2039
- }
2040
- module.exports = {
2041
- symlinkType,
2042
- symlinkTypeSync
2043
- };
2044
- }
2045
- });
2046
-
2047
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink.js
2048
- var require_symlink = __commonJS({
2049
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module) {
2050
- "use strict";
2051
- var u = require_universalify().fromCallback;
2052
- var path4 = __require("path");
2053
- var fs2 = require_fs();
2054
- var _mkdirs = require_mkdirs();
2055
- var mkdirs = _mkdirs.mkdirs;
2056
- var mkdirsSync = _mkdirs.mkdirsSync;
2057
- var _symlinkPaths = require_symlink_paths();
2058
- var symlinkPaths = _symlinkPaths.symlinkPaths;
2059
- var symlinkPathsSync = _symlinkPaths.symlinkPathsSync;
2060
- var _symlinkType = require_symlink_type();
2061
- var symlinkType = _symlinkType.symlinkType;
2062
- var symlinkTypeSync = _symlinkType.symlinkTypeSync;
2063
- var pathExists = require_path_exists().pathExists;
2064
- var { areIdentical } = require_stat();
2065
- function createSymlink(srcpath, dstpath, type, callback) {
2066
- callback = typeof type === "function" ? type : callback;
2067
- type = typeof type === "function" ? false : type;
2068
- fs2.lstat(dstpath, (err, stats) => {
2069
- if (!err && stats.isSymbolicLink()) {
2070
- Promise.all([
2071
- fs2.stat(srcpath),
2072
- fs2.stat(dstpath)
2073
- ]).then(([srcStat, dstStat]) => {
2074
- if (areIdentical(srcStat, dstStat))
2075
- return callback(null);
2076
- _createSymlink(srcpath, dstpath, type, callback);
2077
- });
2078
- } else
2079
- _createSymlink(srcpath, dstpath, type, callback);
2080
- });
2081
- }
2082
- function _createSymlink(srcpath, dstpath, type, callback) {
2083
- symlinkPaths(srcpath, dstpath, (err, relative) => {
2084
- if (err)
2085
- return callback(err);
2086
- srcpath = relative.toDst;
2087
- symlinkType(relative.toCwd, type, (err2, type2) => {
2088
- if (err2)
2089
- return callback(err2);
2090
- const dir = path4.dirname(dstpath);
2091
- pathExists(dir, (err3, dirExists) => {
2092
- if (err3)
2093
- return callback(err3);
2094
- if (dirExists)
2095
- return fs2.symlink(srcpath, dstpath, type2, callback);
2096
- mkdirs(dir, (err4) => {
2097
- if (err4)
2098
- return callback(err4);
2099
- fs2.symlink(srcpath, dstpath, type2, callback);
2100
- });
2101
- });
2102
- });
2103
- });
2104
- }
2105
- function createSymlinkSync(srcpath, dstpath, type) {
2106
- let stats;
2107
- try {
2108
- stats = fs2.lstatSync(dstpath);
2109
- } catch {
2110
- }
2111
- if (stats && stats.isSymbolicLink()) {
2112
- const srcStat = fs2.statSync(srcpath);
2113
- const dstStat = fs2.statSync(dstpath);
2114
- if (areIdentical(srcStat, dstStat))
2115
- return;
2116
- }
2117
- const relative = symlinkPathsSync(srcpath, dstpath);
2118
- srcpath = relative.toDst;
2119
- type = symlinkTypeSync(relative.toCwd, type);
2120
- const dir = path4.dirname(dstpath);
2121
- const exists = fs2.existsSync(dir);
2122
- if (exists)
2123
- return fs2.symlinkSync(srcpath, dstpath, type);
2124
- mkdirsSync(dir);
2125
- return fs2.symlinkSync(srcpath, dstpath, type);
2126
- }
2127
- module.exports = {
2128
- createSymlink: u(createSymlink),
2129
- createSymlinkSync
2130
- };
2131
- }
2132
- });
2133
-
2134
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/index.js
2135
- var require_ensure = __commonJS({
2136
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/index.js"(exports, module) {
2137
- "use strict";
2138
- var { createFile, createFileSync } = require_file();
2139
- var { createLink, createLinkSync } = require_link();
2140
- var { createSymlink, createSymlinkSync } = require_symlink();
2141
- module.exports = {
2142
- // file
2143
- createFile,
2144
- createFileSync,
2145
- ensureFile: createFile,
2146
- ensureFileSync: createFileSync,
2147
- // link
2148
- createLink,
2149
- createLinkSync,
2150
- ensureLink: createLink,
2151
- ensureLinkSync: createLinkSync,
2152
- // symlink
2153
- createSymlink,
2154
- createSymlinkSync,
2155
- ensureSymlink: createSymlink,
2156
- ensureSymlinkSync: createSymlinkSync
2157
- };
2158
- }
2159
- });
2160
-
2161
- // ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js
2162
- var require_utils2 = __commonJS({
2163
- "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports, module) {
2164
- function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
2165
- const EOF = finalEOL ? EOL : "";
2166
- const str = JSON.stringify(obj, replacer, spaces);
2167
- return str.replace(/\n/g, EOL) + EOF;
2168
- }
2169
- function stripBom(content) {
2170
- if (Buffer.isBuffer(content))
2171
- content = content.toString("utf8");
2172
- return content.replace(/^\uFEFF/, "");
2173
- }
2174
- module.exports = {
2175
- stringify,
2176
- stripBom
2177
- };
2178
- }
2179
- });
2180
-
2181
- // ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js
2182
- var require_jsonfile = __commonJS({
2183
- "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js"(exports, module) {
2184
- var _fs;
2185
- try {
2186
- _fs = require_graceful_fs();
2187
- } catch (_) {
2188
- _fs = __require("fs");
2189
- }
2190
- var universalify = require_universalify();
2191
- var { stringify, stripBom } = require_utils2();
2192
- async function _readFile(file, options = {}) {
2193
- if (typeof options === "string") {
2194
- options = {
2195
- encoding: options
2196
- };
2197
- }
2198
- const fs2 = options.fs || _fs;
2199
- const shouldThrow = "throws" in options ? options.throws : true;
2200
- let data = await universalify.fromCallback(fs2.readFile)(file, options);
2201
- data = stripBom(data);
2202
- let obj;
2203
- try {
2204
- obj = JSON.parse(data, options ? options.reviver : null);
2205
- } catch (err) {
2206
- if (shouldThrow) {
2207
- err.message = `${file}: ${err.message}`;
2208
- throw err;
2209
- } else {
2210
- return null;
2211
- }
2212
- }
2213
- return obj;
2214
- }
2215
- var readFile = universalify.fromPromise(_readFile);
2216
- function readFileSync(file, options = {}) {
2217
- if (typeof options === "string") {
2218
- options = {
2219
- encoding: options
2220
- };
2221
- }
2222
- const fs2 = options.fs || _fs;
2223
- const shouldThrow = "throws" in options ? options.throws : true;
2224
- try {
2225
- let content = fs2.readFileSync(file, options);
2226
- content = stripBom(content);
2227
- return JSON.parse(content, options.reviver);
2228
- } catch (err) {
2229
- if (shouldThrow) {
2230
- err.message = `${file}: ${err.message}`;
2231
- throw err;
2232
- } else {
2233
- return null;
2234
- }
2235
- }
2236
- }
2237
- async function _writeFile(file, obj, options = {}) {
2238
- const fs2 = options.fs || _fs;
2239
- const str = stringify(obj, options);
2240
- await universalify.fromCallback(fs2.writeFile)(file, str, options);
2241
- }
2242
- var writeFile = universalify.fromPromise(_writeFile);
2243
- function writeFileSync(file, obj, options = {}) {
2244
- const fs2 = options.fs || _fs;
2245
- const str = stringify(obj, options);
2246
- return fs2.writeFileSync(file, str, options);
2247
- }
2248
- var jsonfile = {
2249
- readFile,
2250
- readFileSync,
2251
- writeFile,
2252
- writeFileSync
2253
- };
2254
- module.exports = jsonfile;
2255
- }
2256
- });
2257
-
2258
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/jsonfile.js
2259
- var require_jsonfile2 = __commonJS({
2260
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/jsonfile.js"(exports, module) {
2261
- "use strict";
2262
- var jsonFile = require_jsonfile();
2263
- module.exports = {
2264
- // jsonfile exports
2265
- readJson: jsonFile.readFile,
2266
- readJsonSync: jsonFile.readFileSync,
2267
- writeJson: jsonFile.writeFile,
2268
- writeJsonSync: jsonFile.writeFileSync
2269
- };
2270
- }
2271
- });
2272
-
2273
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/output-file/index.js
2274
- var require_output_file = __commonJS({
2275
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/output-file/index.js"(exports, module) {
2276
- "use strict";
2277
- var u = require_universalify().fromCallback;
2278
- var fs2 = require_graceful_fs();
2279
- var path4 = __require("path");
2280
- var mkdir = require_mkdirs();
2281
- var pathExists = require_path_exists().pathExists;
2282
- function outputFile(file, data, encoding, callback) {
2283
- if (typeof encoding === "function") {
2284
- callback = encoding;
2285
- encoding = "utf8";
2286
- }
2287
- const dir = path4.dirname(file);
2288
- pathExists(dir, (err, itDoes) => {
2289
- if (err)
2290
- return callback(err);
2291
- if (itDoes)
2292
- return fs2.writeFile(file, data, encoding, callback);
2293
- mkdir.mkdirs(dir, (err2) => {
2294
- if (err2)
2295
- return callback(err2);
2296
- fs2.writeFile(file, data, encoding, callback);
2297
- });
2298
- });
2299
- }
2300
- function outputFileSync(file, ...args) {
2301
- const dir = path4.dirname(file);
2302
- if (fs2.existsSync(dir)) {
2303
- return fs2.writeFileSync(file, ...args);
2304
- }
2305
- mkdir.mkdirsSync(dir);
2306
- fs2.writeFileSync(file, ...args);
2307
- }
2308
- module.exports = {
2309
- outputFile: u(outputFile),
2310
- outputFileSync
2311
- };
2312
- }
2313
- });
2314
-
2315
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/output-json.js
2316
- var require_output_json = __commonJS({
2317
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/output-json.js"(exports, module) {
2318
- "use strict";
2319
- var { stringify } = require_utils2();
2320
- var { outputFile } = require_output_file();
2321
- async function outputJson(file, data, options = {}) {
2322
- const str = stringify(data, options);
2323
- await outputFile(file, str, options);
2324
- }
2325
- module.exports = outputJson;
2326
- }
2327
- });
2328
-
2329
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/output-json-sync.js
2330
- var require_output_json_sync = __commonJS({
2331
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module) {
2332
- "use strict";
2333
- var { stringify } = require_utils2();
2334
- var { outputFileSync } = require_output_file();
2335
- function outputJsonSync(file, data, options) {
2336
- const str = stringify(data, options);
2337
- outputFileSync(file, str, options);
2338
- }
2339
- module.exports = outputJsonSync;
2340
- }
2341
- });
2342
-
2343
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/index.js
2344
- var require_json = __commonJS({
2345
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/index.js"(exports, module) {
2346
- "use strict";
2347
- var u = require_universalify().fromPromise;
2348
- var jsonFile = require_jsonfile2();
2349
- jsonFile.outputJson = u(require_output_json());
2350
- jsonFile.outputJsonSync = require_output_json_sync();
2351
- jsonFile.outputJSON = jsonFile.outputJson;
2352
- jsonFile.outputJSONSync = jsonFile.outputJsonSync;
2353
- jsonFile.writeJSON = jsonFile.writeJson;
2354
- jsonFile.writeJSONSync = jsonFile.writeJsonSync;
2355
- jsonFile.readJSON = jsonFile.readJson;
2356
- jsonFile.readJSONSync = jsonFile.readJsonSync;
2357
- module.exports = jsonFile;
2358
- }
2359
- });
2360
-
2361
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/move.js
2362
- var require_move = __commonJS({
2363
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/move.js"(exports, module) {
2364
- "use strict";
2365
- var fs2 = require_graceful_fs();
2366
- var path4 = __require("path");
2367
- var copy = require_copy2().copy;
2368
- var remove = require_remove().remove;
2369
- var mkdirp = require_mkdirs().mkdirp;
2370
- var pathExists = require_path_exists().pathExists;
2371
- var stat = require_stat();
2372
- function move(src, dest, opts, cb) {
2373
- if (typeof opts === "function") {
2374
- cb = opts;
2375
- opts = {};
2376
- }
2377
- opts = opts || {};
2378
- const overwrite = opts.overwrite || opts.clobber || false;
2379
- stat.checkPaths(src, dest, "move", opts, (err, stats) => {
2380
- if (err)
2381
- return cb(err);
2382
- const { srcStat, isChangingCase = false } = stats;
2383
- stat.checkParentPaths(src, srcStat, dest, "move", (err2) => {
2384
- if (err2)
2385
- return cb(err2);
2386
- if (isParentRoot(dest))
2387
- return doRename(src, dest, overwrite, isChangingCase, cb);
2388
- mkdirp(path4.dirname(dest), (err3) => {
2389
- if (err3)
2390
- return cb(err3);
2391
- return doRename(src, dest, overwrite, isChangingCase, cb);
2392
- });
2393
- });
2394
- });
2395
- }
2396
- function isParentRoot(dest) {
2397
- const parent = path4.dirname(dest);
2398
- const parsedPath = path4.parse(parent);
2399
- return parsedPath.root === parent;
2400
- }
2401
- function doRename(src, dest, overwrite, isChangingCase, cb) {
2402
- if (isChangingCase)
2403
- return rename(src, dest, overwrite, cb);
2404
- if (overwrite) {
2405
- return remove(dest, (err) => {
2406
- if (err)
2407
- return cb(err);
2408
- return rename(src, dest, overwrite, cb);
2409
- });
2410
- }
2411
- pathExists(dest, (err, destExists) => {
2412
- if (err)
2413
- return cb(err);
2414
- if (destExists)
2415
- return cb(new Error("dest already exists."));
2416
- return rename(src, dest, overwrite, cb);
2417
- });
2418
- }
2419
- function rename(src, dest, overwrite, cb) {
2420
- fs2.rename(src, dest, (err) => {
2421
- if (!err)
2422
- return cb();
2423
- if (err.code !== "EXDEV")
2424
- return cb(err);
2425
- return moveAcrossDevice(src, dest, overwrite, cb);
2426
- });
2427
- }
2428
- function moveAcrossDevice(src, dest, overwrite, cb) {
2429
- const opts = {
2430
- overwrite,
2431
- errorOnExist: true,
2432
- preserveTimestamps: true
2433
- };
2434
- copy(src, dest, opts, (err) => {
2435
- if (err)
2436
- return cb(err);
2437
- return remove(src, cb);
2438
- });
2439
- }
2440
- module.exports = move;
2441
- }
2442
- });
2443
-
2444
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/move-sync.js
2445
- var require_move_sync = __commonJS({
2446
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/move-sync.js"(exports, module) {
2447
- "use strict";
2448
- var fs2 = require_graceful_fs();
2449
- var path4 = __require("path");
2450
- var copySync = require_copy2().copySync;
2451
- var removeSync = require_remove().removeSync;
2452
- var mkdirpSync = require_mkdirs().mkdirpSync;
2453
- var stat = require_stat();
2454
- function moveSync(src, dest, opts) {
2455
- opts = opts || {};
2456
- const overwrite = opts.overwrite || opts.clobber || false;
2457
- const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
2458
- stat.checkParentPathsSync(src, srcStat, dest, "move");
2459
- if (!isParentRoot(dest))
2460
- mkdirpSync(path4.dirname(dest));
2461
- return doRename(src, dest, overwrite, isChangingCase);
2462
- }
2463
- function isParentRoot(dest) {
2464
- const parent = path4.dirname(dest);
2465
- const parsedPath = path4.parse(parent);
2466
- return parsedPath.root === parent;
2467
- }
2468
- function doRename(src, dest, overwrite, isChangingCase) {
2469
- if (isChangingCase)
2470
- return rename(src, dest, overwrite);
2471
- if (overwrite) {
2472
- removeSync(dest);
2473
- return rename(src, dest, overwrite);
2474
- }
2475
- if (fs2.existsSync(dest))
2476
- throw new Error("dest already exists.");
2477
- return rename(src, dest, overwrite);
2478
- }
2479
- function rename(src, dest, overwrite) {
2480
- try {
2481
- fs2.renameSync(src, dest);
2482
- } catch (err) {
2483
- if (err.code !== "EXDEV")
2484
- throw err;
2485
- return moveAcrossDevice(src, dest, overwrite);
2486
- }
2487
- }
2488
- function moveAcrossDevice(src, dest, overwrite) {
2489
- const opts = {
2490
- overwrite,
2491
- errorOnExist: true,
2492
- preserveTimestamps: true
2493
- };
2494
- copySync(src, dest, opts);
2495
- return removeSync(src);
2496
- }
2497
- module.exports = moveSync;
2498
- }
2499
- });
2500
-
2501
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/index.js
2502
- var require_move2 = __commonJS({
2503
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/index.js"(exports, module) {
2504
- "use strict";
2505
- var u = require_universalify().fromCallback;
2506
- module.exports = {
2507
- move: u(require_move()),
2508
- moveSync: require_move_sync()
2509
- };
2510
- }
2511
- });
2512
-
2513
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/index.js
2514
- var require_lib = __commonJS({
2515
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/index.js"(exports, module) {
2516
- "use strict";
2517
- module.exports = {
2518
- // Export promiseified graceful-fs:
2519
- ...require_fs(),
2520
- // Export extra methods:
2521
- ...require_copy2(),
2522
- ...require_empty(),
2523
- ...require_ensure(),
2524
- ...require_json(),
2525
- ...require_mkdirs(),
2526
- ...require_move2(),
2527
- ...require_output_file(),
2528
- ...require_path_exists(),
2529
- ...require_remove()
2530
- };
2531
- }
2532
- });
2533
-
2534
- // ../../node_modules/.pnpm/rspack-plugin-virtual-module@0.1.11/node_modules/rspack-plugin-virtual-module/dist/index.js
2535
- var require_dist = __commonJS({
2536
- "../../node_modules/.pnpm/rspack-plugin-virtual-module@0.1.11/node_modules/rspack-plugin-virtual-module/dist/index.js"(exports) {
2537
- "use strict";
2538
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
2539
- if (k2 === void 0)
2540
- k2 = k;
2541
- var desc = Object.getOwnPropertyDescriptor(m, k);
2542
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2543
- desc = {
2544
- enumerable: true,
2545
- get: function() {
2546
- return m[k];
2547
- }
2548
- };
2549
- }
2550
- Object.defineProperty(o, k2, desc);
2551
- } : function(o, m, k, k2) {
2552
- if (k2 === void 0)
2553
- k2 = k;
2554
- o[k2] = m[k];
2555
- });
2556
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
2557
- Object.defineProperty(o, "default", {
2558
- enumerable: true,
2559
- value: v
2560
- });
2561
- } : function(o, v) {
2562
- o["default"] = v;
2563
- });
2564
- var __importStar = exports && exports.__importStar || function(mod) {
2565
- if (mod && mod.__esModule)
2566
- return mod;
2567
- var result = {};
2568
- if (mod != null) {
2569
- for (var k in mod)
2570
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
2571
- __createBinding(result, mod, k);
2572
- }
2573
- __setModuleDefault(result, mod);
2574
- return result;
2575
- };
2576
- var __classPrivateFieldSet = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2577
- if (kind === "m")
2578
- throw new TypeError("Private method is not writable");
2579
- if (kind === "a" && !f)
2580
- throw new TypeError("Private accessor was defined without a setter");
2581
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2582
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
2583
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
2584
- };
2585
- var __classPrivateFieldGet = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
2586
- if (kind === "a" && !f)
2587
- throw new TypeError("Private accessor was defined without a getter");
2588
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2589
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
2590
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2591
- };
2592
- var __importDefault = exports && exports.__importDefault || function(mod) {
2593
- return mod && mod.__esModule ? mod : {
2594
- "default": mod
2595
- };
2596
- };
2597
- var _RspackVirtualModulePlugin_instances;
2598
- var _RspackVirtualModulePlugin_staticModules;
2599
- var _RspackVirtualModulePlugin_tempDir;
2600
- var _RspackVirtualModulePlugin_normalizePath;
2601
- Object.defineProperty(exports, "__esModule", {
2602
- value: true
2603
- });
2604
- exports.RspackVirtualModulePlugin = void 0;
2605
- var path_1 = __importStar(__require("path"));
2606
- var crypto_1 = __importDefault(__require("crypto"));
2607
- var fs_extra_1 = __importDefault(require_lib());
2608
- var RspackVirtualModulePlugin2 = class {
2609
- apply(compiler) {
2610
- Object.entries(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_staticModules, "f")).forEach(([path4, content]) => {
2611
- fs_extra_1.default.writeFileSync(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_instances, "m", _RspackVirtualModulePlugin_normalizePath).call(this, path4), content);
2612
- });
2613
- const originalResolveModulesDir = compiler.options.resolve.modules || [
2614
- "node_modules"
2615
- ];
2616
- compiler.options.resolve.modules = [
2617
- ...originalResolveModulesDir,
2618
- __classPrivateFieldGet(this, _RspackVirtualModulePlugin_tempDir, "f")
2619
- ];
2620
- compiler.options.resolve.alias = Object.assign(Object.assign({}, compiler.options.resolve.alias), Object.keys(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_staticModules, "f")).reduce((acc, p) => {
2621
- acc[p] = __classPrivateFieldGet(this, _RspackVirtualModulePlugin_instances, "m", _RspackVirtualModulePlugin_normalizePath).call(this, p);
2622
- return acc;
2623
- }, {}));
2624
- process.on("exit", this.clear.bind(this));
2625
- }
2626
- writeModule(path4, content) {
2627
- const normalizedPath = __classPrivateFieldGet(this, _RspackVirtualModulePlugin_instances, "m", _RspackVirtualModulePlugin_normalizePath).call(this, path4);
2628
- fs_extra_1.default.ensureDirSync((0, path_1.dirname)(normalizedPath));
2629
- fs_extra_1.default.writeFileSync(normalizedPath, content);
2630
- }
2631
- clear() {
2632
- fs_extra_1.default.removeSync(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_tempDir, "f"));
2633
- }
2634
- constructor(staticModules) {
2635
- _RspackVirtualModulePlugin_instances.add(this);
2636
- _RspackVirtualModulePlugin_staticModules.set(this, void 0);
2637
- _RspackVirtualModulePlugin_tempDir.set(this, void 0);
2638
- __classPrivateFieldSet(this, _RspackVirtualModulePlugin_staticModules, staticModules, "f");
2639
- const nodeModulesDir = (0, path_1.join)(process.cwd(), "node_modules");
2640
- if (!fs_extra_1.default.existsSync(nodeModulesDir)) {
2641
- fs_extra_1.default.mkdirSync(nodeModulesDir);
2642
- }
2643
- const hash = crypto_1.default.createHash("md5").update(JSON.stringify(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_staticModules, "f"))).digest("hex").slice(0, 8);
2644
- __classPrivateFieldSet(this, _RspackVirtualModulePlugin_tempDir, path_1.default.join(nodeModulesDir, `rspack-virtual-module-${hash}`), "f");
2645
- if (!fs_extra_1.default.existsSync(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_tempDir, "f"))) {
2646
- fs_extra_1.default.mkdirSync(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_tempDir, "f"));
2647
- }
2648
- }
2649
- };
2650
- exports.RspackVirtualModulePlugin = RspackVirtualModulePlugin2;
2651
- _RspackVirtualModulePlugin_staticModules = /* @__PURE__ */ new WeakMap(), _RspackVirtualModulePlugin_tempDir = /* @__PURE__ */ new WeakMap(), _RspackVirtualModulePlugin_instances = /* @__PURE__ */ new WeakSet(), _RspackVirtualModulePlugin_normalizePath = function _RspackVirtualModulePlugin_normalizePath2(p) {
2652
- const ext = (0, path_1.extname)(p);
2653
- return (0, path_1.join)(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_tempDir, "f"), ext ? p : `${p}.js`);
2654
- };
2655
- exports.default = RspackVirtualModulePlugin2;
2656
- }
2657
- });
3
+ var __esm = (fn, res) => function __init() {
4
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
5
+ };
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
2658
10
 
2659
11
  // ../../node_modules/.pnpm/unist-util-is@5.2.1/node_modules/unist-util-is/lib/index.js
2660
12
  function anyFactory(tests) {
@@ -2693,8 +45,10 @@ function typeFactory(check) {
2693
45
  function castFactory(check) {
2694
46
  return assertion;
2695
47
  function assertion(node, ...parameters) {
2696
- return Boolean(node && typeof node === "object" && "type" in node && // @ts-expect-error: fine.
2697
- Boolean(check.call(this, node, ...parameters)));
48
+ return Boolean(
49
+ node && typeof node === "object" && "type" in node && // @ts-expect-error: fine.
50
+ Boolean(check.call(this, node, ...parameters))
51
+ );
2698
52
  }
2699
53
  }
2700
54
  function ok() {
@@ -2703,16 +57,17 @@ function ok() {
2703
57
  var convert;
2704
58
  var init_lib = __esm({
2705
59
  "../../node_modules/.pnpm/unist-util-is@5.2.1/node_modules/unist-util-is/lib/index.js"() {
60
+ "use strict";
2706
61
  convert = /**
2707
- * @type {(
2708
- * (<Kind extends Node>(test: PredicateTest<Kind>) => AssertPredicate<Kind>) &
2709
- * ((test?: Test) => AssertAnything)
2710
- * )}
2711
- */
62
+ * @type {(
63
+ * (<Kind extends Node>(test: PredicateTest<Kind>) => AssertPredicate<Kind>) &
64
+ * ((test?: Test) => AssertAnything)
65
+ * )}
66
+ */
2712
67
  /**
2713
- * @param {Test} [test]
2714
- * @returns {AssertAnything}
2715
- */
68
+ * @param {Test} [test]
69
+ * @returns {AssertAnything}
70
+ */
2716
71
  function(test) {
2717
72
  if (test === void 0 || test === null) {
2718
73
  return ok;
@@ -2734,6 +89,7 @@ var init_lib = __esm({
2734
89
  // ../../node_modules/.pnpm/unist-util-is@5.2.1/node_modules/unist-util-is/index.js
2735
90
  var init_unist_util_is = __esm({
2736
91
  "../../node_modules/.pnpm/unist-util-is@5.2.1/node_modules/unist-util-is/index.js"() {
92
+ "use strict";
2737
93
  init_lib();
2738
94
  }
2739
95
  });
@@ -2744,6 +100,7 @@ function color(d) {
2744
100
  }
2745
101
  var init_color = __esm({
2746
102
  "../../node_modules/.pnpm/unist-util-visit-parents@5.1.3/node_modules/unist-util-visit-parents/lib/color.js"() {
103
+ "use strict";
2747
104
  }
2748
105
  });
2749
106
 
@@ -2753,36 +110,32 @@ function toResult(value) {
2753
110
  return value;
2754
111
  }
2755
112
  if (typeof value === "number") {
2756
- return [
2757
- CONTINUE,
2758
- value
2759
- ];
113
+ return [CONTINUE, value];
2760
114
  }
2761
- return [
2762
- value
2763
- ];
115
+ return [value];
2764
116
  }
2765
117
  var CONTINUE, EXIT, SKIP, visitParents;
2766
118
  var init_lib2 = __esm({
2767
119
  "../../node_modules/.pnpm/unist-util-visit-parents@5.1.3/node_modules/unist-util-visit-parents/lib/index.js"() {
120
+ "use strict";
2768
121
  init_unist_util_is();
2769
122
  init_color();
2770
123
  CONTINUE = true;
2771
124
  EXIT = false;
2772
125
  SKIP = "skip";
2773
126
  visitParents = /**
2774
- * @type {(
2775
- * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined) => void) &
2776
- * (<Tree extends Node>(tree: Tree, visitor: BuildVisitor<Tree>, reverse?: boolean | null | undefined) => void)
2777
- * )}
2778
- */
127
+ * @type {(
128
+ * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined) => void) &
129
+ * (<Tree extends Node>(tree: Tree, visitor: BuildVisitor<Tree>, reverse?: boolean | null | undefined) => void)
130
+ * )}
131
+ */
2779
132
  /**
2780
- * @param {Node} tree
2781
- * @param {Test} test
2782
- * @param {Visitor<Node>} visitor
2783
- * @param {boolean | null | undefined} [reverse]
2784
- * @returns {void}
2785
- */
133
+ * @param {Node} tree
134
+ * @param {Test} test
135
+ * @param {Visitor<Node>} visitor
136
+ * @param {boolean | null | undefined} [reverse]
137
+ * @returns {void}
138
+ */
2786
139
  function(tree, test, visitor, reverse) {
2787
140
  if (typeof test === "function" && typeof visitor !== "function") {
2788
141
  reverse = visitor;
@@ -2797,7 +150,10 @@ var init_lib2 = __esm({
2797
150
  if (typeof value.type === "string") {
2798
151
  const name = (
2799
152
  // `hast`
2800
- typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : void 0
153
+ typeof value.tagName === "string" ? value.tagName : (
154
+ // `xast`
155
+ typeof value.name === "string" ? value.name : void 0
156
+ )
2801
157
  );
2802
158
  Object.defineProperty(visit2, "name", {
2803
159
  value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")"
@@ -2836,6 +192,7 @@ var init_lib2 = __esm({
2836
192
  // ../../node_modules/.pnpm/unist-util-visit-parents@5.1.3/node_modules/unist-util-visit-parents/index.js
2837
193
  var init_unist_util_visit_parents = __esm({
2838
194
  "../../node_modules/.pnpm/unist-util-visit-parents@5.1.3/node_modules/unist-util-visit-parents/index.js"() {
195
+ "use strict";
2839
196
  init_lib2();
2840
197
  }
2841
198
  });
@@ -2851,20 +208,21 @@ __export(unist_util_visit_exports, {
2851
208
  var visit;
2852
209
  var init_unist_util_visit = __esm({
2853
210
  "../../node_modules/.pnpm/unist-util-visit@4.1.1/node_modules/unist-util-visit/index.js"() {
211
+ "use strict";
2854
212
  init_unist_util_visit_parents();
2855
213
  init_unist_util_visit_parents();
2856
214
  visit = /**
2857
- * @type {(
2858
- * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
2859
- * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
2860
- * )}
2861
- */
215
+ * @type {(
216
+ * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
217
+ * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
218
+ * )}
219
+ */
2862
220
  /**
2863
- * @param {Node} tree
2864
- * @param {Test} test
2865
- * @param {import('./complex-types.js').Visitor} visitor
2866
- * @param {boolean} [reverse]
2867
- */
221
+ * @param {Node} tree
222
+ * @param {Test} test
223
+ * @param {import('./complex-types.js').Visitor} visitor
224
+ * @param {boolean} [reverse]
225
+ */
2868
226
  function(tree, test, visitor, reverse) {
2869
227
  if (typeof test === "function" && typeof visitor !== "function") {
2870
228
  reverse = visitor;
@@ -2874,15 +232,19 @@ var init_unist_util_visit = __esm({
2874
232
  visitParents(tree, test, overload, reverse);
2875
233
  function overload(node, parents) {
2876
234
  const parent = parents[parents.length - 1];
2877
- return visitor(node, parent ? parent.children.indexOf(node) : null, parent);
235
+ return visitor(
236
+ node,
237
+ parent ? parent.children.indexOf(node) : null,
238
+ parent
239
+ );
2878
240
  }
2879
241
  };
2880
242
  }
2881
243
  });
2882
244
 
2883
245
  // src/cli/index.ts
2884
- var import_rspack_plugin_virtual_module = __toESM(require_dist());
2885
246
  import path3, { join as join2 } from "path";
247
+ import { RspackVirtualModulePlugin } from "rspack-plugin-virtual-module";
2886
248
 
2887
249
  // src/cli/constant.ts
2888
250
  import path from "path";
@@ -2905,14 +267,18 @@ var parseImports = (code, sourceExt) => {
2905
267
  return result;
2906
268
  };
2907
269
  var getNodeAttribute = (node, attrName) => {
2908
- return node.attributes.find((attr) => attr.name === attrName)?.value;
270
+ return node.attributes.find(
271
+ (attr) => attr.name === attrName
272
+ )?.value;
2909
273
  };
2910
274
  var getNodeMeta = (node, metaName) => {
2911
275
  if (!node.meta) {
2912
276
  return;
2913
277
  }
2914
278
  const meta = node.meta.split(" ");
2915
- const item = meta.find((x) => x.startsWith(metaName));
279
+ const item = meta.find(
280
+ (x) => x.startsWith(metaName)
281
+ );
2916
282
  if (item?.startsWith(`${metaName}=`)) {
2917
283
  return item.substring(metaName.length + 1);
2918
284
  }
@@ -2934,10 +300,16 @@ function createPlaygroundNode(currentNode, attrs) {
2934
300
  }))
2935
301
  });
2936
302
  }
2937
- var remarkPlugin = ({ getRouteMeta, defaultDirection, editorPosition }) => {
303
+ var remarkPlugin = ({
304
+ getRouteMeta,
305
+ defaultDirection,
306
+ editorPosition
307
+ }) => {
2938
308
  const routeMeta2 = getRouteMeta();
2939
309
  return (tree, vfile) => {
2940
- const route = routeMeta2.find((meta) => meta.absolutePath === (vfile.path || vfile.history[0]));
310
+ const route = routeMeta2.find(
311
+ (meta) => meta.absolutePath === (vfile.path || vfile.history[0])
312
+ );
2941
313
  if (!route) {
2942
314
  return;
2943
315
  }
@@ -2957,22 +329,10 @@ var remarkPlugin = ({ getRouteMeta, defaultDirection, editorPosition }) => {
2957
329
  });
2958
330
  const language = src.substr(src.lastIndexOf(".") + 1);
2959
331
  createPlaygroundNode(node, [
2960
- [
2961
- "code",
2962
- code
2963
- ],
2964
- [
2965
- "language",
2966
- language
2967
- ],
2968
- [
2969
- "direction",
2970
- direction
2971
- ],
2972
- [
2973
- "editorPosition",
2974
- editorPosition
2975
- ]
332
+ ["code", code],
333
+ ["language", language],
334
+ ["direction", direction],
335
+ ["editorPosition", editorPosition]
2976
336
  ]);
2977
337
  }
2978
338
  });
@@ -2984,22 +344,10 @@ var remarkPlugin = ({ getRouteMeta, defaultDirection, editorPosition }) => {
2984
344
  }
2985
345
  const direction = getNodeMeta(node, "direction") || defaultDirection;
2986
346
  createPlaygroundNode(node, [
2987
- [
2988
- "code",
2989
- node.value
2990
- ],
2991
- [
2992
- "language",
2993
- node.lang
2994
- ],
2995
- [
2996
- "direction",
2997
- direction
2998
- ],
2999
- [
3000
- "editorPosition",
3001
- editorPosition
3002
- ]
347
+ ["code", node.value],
348
+ ["language", node.lang],
349
+ ["direction", direction],
350
+ ["editorPosition", editorPosition]
3003
351
  ]);
3004
352
  }
3005
353
  });
@@ -3018,11 +366,21 @@ function normalizeUrl(u) {
3018
366
  // src/cli/index.ts
3019
367
  var routeMeta;
3020
368
  function pluginPlayground(options) {
3021
- const { render = "", include, defaultDirection = "horizontal", editorPosition = "left", babelUrl = "", monacoLoader = {}, monacoOptions = {} } = options || {};
3022
- const playgroundVirtualModule = new import_rspack_plugin_virtual_module.RspackVirtualModulePlugin({});
369
+ const {
370
+ render = "",
371
+ include,
372
+ defaultDirection = "horizontal",
373
+ editorPosition = "left",
374
+ babelUrl = "",
375
+ monacoLoader = {},
376
+ monacoOptions = {}
377
+ } = options || {};
378
+ const playgroundVirtualModule = new RspackVirtualModulePlugin({});
3023
379
  const getRouteMeta = () => routeMeta;
3024
380
  if (render && !/Playground\.(jsx?|tsx?)$/.test(render)) {
3025
- throw new Error("[Playground]: render should ends with Playground.(jsx?|tsx?)");
381
+ throw new Error(
382
+ "[Playground]: render should ends with Playground.(jsx?|tsx?)"
383
+ );
3026
384
  }
3027
385
  const preloads = [];
3028
386
  preloads.push(babelUrl || DEFAULT_BABEL_URL);
@@ -3031,69 +389,74 @@ function pluginPlayground(options) {
3031
389
  preloads.push(normalizeUrl(`${monacoPrefix}/editor/editor.main.js`));
3032
390
  return {
3033
391
  name: "@rspress/plugin-playground",
392
+ config(config) {
393
+ config.markdown = config.markdown || {};
394
+ config.markdown.mdxRs = false;
395
+ return config;
396
+ },
3034
397
  async routeGenerated(routes) {
3035
398
  const { default: fs2 } = await import("@modern-js/utils/fs-extra");
3036
399
  routeMeta = routes;
3037
400
  const files = routes.map((route) => route.absolutePath);
3038
401
  const imports = {};
3039
- await Promise.all(files.map(async (filepath, _index) => {
3040
- const isMdxFile = /\.mdx?$/.test(filepath);
3041
- if (!isMdxFile) {
3042
- return;
3043
- }
3044
- const { createProcessor } = await import("@mdx-js/mdx");
3045
- const { visit: visit2 } = await Promise.resolve().then(() => (init_unist_util_visit(), unist_util_visit_exports));
3046
- const { default: remarkGFM } = await import("remark-gfm");
3047
- try {
3048
- const processor = createProcessor({
3049
- format: path3.extname(filepath).slice(1),
3050
- remarkPlugins: [
3051
- remarkGFM
3052
- ]
3053
- });
3054
- const source = await fs2.readFile(filepath, "utf-8");
3055
- const ast = processor.parse(source);
3056
- visit2(ast, "mdxJsxFlowElement", (node) => {
3057
- if (node.name === "code") {
3058
- const src = getNodeAttribute(node, "src");
3059
- if (!src) {
3060
- return;
3061
- }
3062
- const demoPath = join2(path3.dirname(filepath), src);
3063
- if (!fs2.existsSync(demoPath)) {
3064
- return;
3065
- }
3066
- const code2 = fs2.readFileSync(demoPath, {
3067
- encoding: "utf8"
3068
- });
3069
- const thisImports = parseImports(code2, path3.extname(demoPath));
3070
- thisImports.forEach((x) => {
3071
- if (typeof imports[x] === "undefined") {
3072
- imports[x] = x;
402
+ await Promise.all(
403
+ files.map(async (filepath, _index) => {
404
+ const isMdxFile = /\.mdx?$/.test(filepath);
405
+ if (!isMdxFile) {
406
+ return;
407
+ }
408
+ const { createProcessor } = await import("@mdx-js/mdx");
409
+ const { visit: visit2 } = await Promise.resolve().then(() => (init_unist_util_visit(), unist_util_visit_exports));
410
+ const { default: remarkGFM } = await import("remark-gfm");
411
+ try {
412
+ const processor = createProcessor({
413
+ format: path3.extname(filepath).slice(1),
414
+ remarkPlugins: [remarkGFM]
415
+ });
416
+ const source = await fs2.readFile(filepath, "utf-8");
417
+ const ast = processor.parse(source);
418
+ visit2(ast, "mdxJsxFlowElement", (node) => {
419
+ if (node.name === "code") {
420
+ const src = getNodeAttribute(node, "src");
421
+ if (!src) {
422
+ return;
3073
423
  }
3074
- });
3075
- }
3076
- });
3077
- visit2(ast, "code", (node) => {
3078
- if (node.lang === "jsx" || node.lang === "tsx") {
3079
- const { value } = node;
3080
- const isPure = node?.meta?.includes("pure");
3081
- if (isPure) {
3082
- return;
424
+ const demoPath = join2(path3.dirname(filepath), src);
425
+ if (!fs2.existsSync(demoPath)) {
426
+ return;
427
+ }
428
+ const code2 = fs2.readFileSync(demoPath, {
429
+ encoding: "utf8"
430
+ });
431
+ const thisImports = parseImports(code2, path3.extname(demoPath));
432
+ thisImports.forEach((x) => {
433
+ if (typeof imports[x] === "undefined") {
434
+ imports[x] = x;
435
+ }
436
+ });
3083
437
  }
3084
- const thisImports = parseImports(value, node.lang);
3085
- thisImports.forEach((x) => {
3086
- if (typeof imports[x] === "undefined") {
3087
- imports[x] = x;
438
+ });
439
+ visit2(ast, "code", (node) => {
440
+ if (node.lang === "jsx" || node.lang === "tsx") {
441
+ const { value } = node;
442
+ const isPure = node?.meta?.includes("pure");
443
+ if (isPure) {
444
+ return;
3088
445
  }
3089
- });
3090
- }
3091
- });
3092
- } catch (e) {
3093
- console.error(e);
3094
- throw e;
3095
- }
3096
- }));
446
+ const thisImports = parseImports(value, node.lang);
447
+ thisImports.forEach((x) => {
448
+ if (typeof imports[x] === "undefined") {
449
+ imports[x] = x;
450
+ }
451
+ });
452
+ }
453
+ });
454
+ } catch (e) {
455
+ console.error(e);
456
+ throw e;
457
+ }
458
+ })
459
+ );
3097
460
  if (include) {
3098
461
  include.forEach((item) => {
3099
462
  if (typeof item === "string") {
@@ -3105,7 +468,9 @@ function pluginPlayground(options) {
3105
468
  }
3106
469
  const importKeys = Object.keys(imports);
3107
470
  const code = [
3108
- ...importKeys.map((x, index) => `import * as i_${index} from '${imports[x]}';`),
471
+ ...importKeys.map(
472
+ (x, index) => `import * as i_${index} from '${imports[x]}';`
473
+ ),
3109
474
  "const imports = new Map();",
3110
475
  ...importKeys.map((x, index) => `imports.set('${x}', i_${index});`),
3111
476
  "function getImport(name, getDefault) {",
@@ -3143,25 +508,16 @@ function pluginPlayground(options) {
3143
508
  }))
3144
509
  },
3145
510
  tools: {
511
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error
512
+ // @ts-ignore
3146
513
  rspack: {
3147
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error
3148
- // @ts-ignore
3149
- plugins: [
3150
- playgroundVirtualModule
3151
- ]
514
+ plugins: [playgroundVirtualModule]
3152
515
  }
3153
516
  }
3154
517
  },
3155
518
  markdown: {
3156
519
  remarkPlugins: [
3157
- [
3158
- remarkPlugin,
3159
- {
3160
- getRouteMeta,
3161
- defaultDirection,
3162
- editorPosition
3163
- }
3164
- ]
520
+ [remarkPlugin, { getRouteMeta, defaultDirection, editorPosition }]
3165
521
  ],
3166
522
  globalComponents: [
3167
523
  render ? render : path3.join(staticPath, "global-components", "Playground.tsx")