@vixt/react 0.10.1 → 0.11.0

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,1958 +1,12 @@
1
- import { builtinModules, createRequire } from "node:module";
2
- import { VixtClientAutoImports, createVixtPlugin, defineVixtModule, resolveLayersDirs } from "@vixt/core";
3
- import fs, { realpathSync, statSync } from "node:fs";
1
+ import { builtinModules } from "node:module";
2
+ import fs, { promises, realpathSync, statSync } from "node:fs";
4
3
  import { fileURLToPath, pathToFileURL } from "node:url";
5
4
  import assert from "node:assert";
6
- import process$1, { cwd } from "node:process";
5
+ import process$1 from "node:process";
7
6
  import path from "node:path";
8
7
  import v8 from "node:v8";
9
8
  import { format, inspect } from "node:util";
10
- import React from "@vitejs/plugin-react";
11
- import UnoCSS from "unocss/vite";
12
- import AutoImport from "unplugin-auto-import/vite";
13
- import Pages from "vite-plugin-pages";
14
- import Layouts from "vite-plugin-vue-layouts";
15
- import fg from "fast-glob";
16
- import { pascalCase } from "unplugin-vue-components";
17
- import extractComments from "extract-comments";
18
- import { parse } from "yaml";
19
- import { parseAst } from "vite";
20
- //#region \0rolldown/runtime.js
21
- var __create = Object.create;
22
- var __defProp = Object.defineProperty;
23
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
24
- var __getOwnPropNames = Object.getOwnPropertyNames;
25
- var __getProtoOf = Object.getPrototypeOf;
26
- var __hasOwnProp = Object.prototype.hasOwnProperty;
27
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
28
- var __copyProps = (to, from, except, desc) => {
29
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
30
- key = keys[i];
31
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
32
- get: ((k) => from[k]).bind(null, key),
33
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
34
- });
35
- }
36
- return to;
37
- };
38
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
39
- value: mod,
40
- enumerable: true
41
- }) : target, mod));
42
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
43
- //#endregion
44
- //#region ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
45
- var require_universalify = /* @__PURE__ */ __commonJSMin(((exports) => {
46
- exports.fromCallback = function(fn) {
47
- return Object.defineProperty(function(...args) {
48
- if (typeof args[args.length - 1] === "function") fn.apply(this, args);
49
- else return new Promise((resolve, reject) => {
50
- args.push((err, res) => err != null ? reject(err) : resolve(res));
51
- fn.apply(this, args);
52
- });
53
- }, "name", { value: fn.name });
54
- };
55
- exports.fromPromise = function(fn) {
56
- return Object.defineProperty(function(...args) {
57
- const cb = args[args.length - 1];
58
- if (typeof cb !== "function") return fn.apply(this, args);
59
- else {
60
- args.pop();
61
- fn.apply(this, args).then((r) => cb(null, r), cb);
62
- }
63
- }, "name", { value: fn.name });
64
- };
65
- }));
66
- //#endregion
67
- //#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
68
- var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69
- var constants = __require("constants");
70
- var origCwd = process.cwd;
71
- var cwd = null;
72
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
73
- process.cwd = function() {
74
- if (!cwd) cwd = origCwd.call(process);
75
- return cwd;
76
- };
77
- try {
78
- process.cwd();
79
- } catch (er) {}
80
- if (typeof process.chdir === "function") {
81
- var chdir = process.chdir;
82
- process.chdir = function(d) {
83
- cwd = null;
84
- chdir.call(process, d);
85
- };
86
- if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
87
- }
88
- module.exports = patch;
89
- function patch(fs) {
90
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
91
- if (!fs.lutimes) patchLutimes(fs);
92
- fs.chown = chownFix(fs.chown);
93
- fs.fchown = chownFix(fs.fchown);
94
- fs.lchown = chownFix(fs.lchown);
95
- fs.chmod = chmodFix(fs.chmod);
96
- fs.fchmod = chmodFix(fs.fchmod);
97
- fs.lchmod = chmodFix(fs.lchmod);
98
- fs.chownSync = chownFixSync(fs.chownSync);
99
- fs.fchownSync = chownFixSync(fs.fchownSync);
100
- fs.lchownSync = chownFixSync(fs.lchownSync);
101
- fs.chmodSync = chmodFixSync(fs.chmodSync);
102
- fs.fchmodSync = chmodFixSync(fs.fchmodSync);
103
- fs.lchmodSync = chmodFixSync(fs.lchmodSync);
104
- fs.stat = statFix(fs.stat);
105
- fs.fstat = statFix(fs.fstat);
106
- fs.lstat = statFix(fs.lstat);
107
- fs.statSync = statFixSync(fs.statSync);
108
- fs.fstatSync = statFixSync(fs.fstatSync);
109
- fs.lstatSync = statFixSync(fs.lstatSync);
110
- if (fs.chmod && !fs.lchmod) {
111
- fs.lchmod = function(path, mode, cb) {
112
- if (cb) process.nextTick(cb);
113
- };
114
- fs.lchmodSync = function() {};
115
- }
116
- if (fs.chown && !fs.lchown) {
117
- fs.lchown = function(path, uid, gid, cb) {
118
- if (cb) process.nextTick(cb);
119
- };
120
- fs.lchownSync = function() {};
121
- }
122
- if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
123
- function rename(from, to, cb) {
124
- var start = Date.now();
125
- var backoff = 0;
126
- fs$rename(from, to, function CB(er) {
127
- if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
128
- setTimeout(function() {
129
- fs.stat(to, function(stater, st) {
130
- if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
131
- else cb(er);
132
- });
133
- }, backoff);
134
- if (backoff < 100) backoff += 10;
135
- return;
136
- }
137
- if (cb) cb(er);
138
- });
139
- }
140
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
141
- return rename;
142
- })(fs.rename);
143
- fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
144
- function read(fd, buffer, offset, length, position, callback_) {
145
- var callback;
146
- if (callback_ && typeof callback_ === "function") {
147
- var eagCounter = 0;
148
- callback = function(er, _, __) {
149
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
150
- eagCounter++;
151
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
152
- }
153
- callback_.apply(this, arguments);
154
- };
155
- }
156
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
157
- }
158
- if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
159
- return read;
160
- })(fs.read);
161
- fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
162
- return function(fd, buffer, offset, length, position) {
163
- var eagCounter = 0;
164
- while (true) try {
165
- return fs$readSync.call(fs, fd, buffer, offset, length, position);
166
- } catch (er) {
167
- if (er.code === "EAGAIN" && eagCounter < 10) {
168
- eagCounter++;
169
- continue;
170
- }
171
- throw er;
172
- }
173
- };
174
- })(fs.readSync);
175
- function patchLchmod(fs) {
176
- fs.lchmod = function(path, mode, callback) {
177
- fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
178
- if (err) {
179
- if (callback) callback(err);
180
- return;
181
- }
182
- fs.fchmod(fd, mode, function(err) {
183
- fs.close(fd, function(err2) {
184
- if (callback) callback(err || err2);
185
- });
186
- });
187
- });
188
- };
189
- fs.lchmodSync = function(path, mode) {
190
- var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
191
- var threw = true;
192
- var ret;
193
- try {
194
- ret = fs.fchmodSync(fd, mode);
195
- threw = false;
196
- } finally {
197
- if (threw) try {
198
- fs.closeSync(fd);
199
- } catch (er) {}
200
- else fs.closeSync(fd);
201
- }
202
- return ret;
203
- };
204
- }
205
- function patchLutimes(fs) {
206
- if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
207
- fs.lutimes = function(path, at, mt, cb) {
208
- fs.open(path, constants.O_SYMLINK, function(er, fd) {
209
- if (er) {
210
- if (cb) cb(er);
211
- return;
212
- }
213
- fs.futimes(fd, at, mt, function(er) {
214
- fs.close(fd, function(er2) {
215
- if (cb) cb(er || er2);
216
- });
217
- });
218
- });
219
- };
220
- fs.lutimesSync = function(path, at, mt) {
221
- var fd = fs.openSync(path, constants.O_SYMLINK);
222
- var ret;
223
- var threw = true;
224
- try {
225
- ret = fs.futimesSync(fd, at, mt);
226
- threw = false;
227
- } finally {
228
- if (threw) try {
229
- fs.closeSync(fd);
230
- } catch (er) {}
231
- else fs.closeSync(fd);
232
- }
233
- return ret;
234
- };
235
- } else if (fs.futimes) {
236
- fs.lutimes = function(_a, _b, _c, cb) {
237
- if (cb) process.nextTick(cb);
238
- };
239
- fs.lutimesSync = function() {};
240
- }
241
- }
242
- function chmodFix(orig) {
243
- if (!orig) return orig;
244
- return function(target, mode, cb) {
245
- return orig.call(fs, target, mode, function(er) {
246
- if (chownErOk(er)) er = null;
247
- if (cb) cb.apply(this, arguments);
248
- });
249
- };
250
- }
251
- function chmodFixSync(orig) {
252
- if (!orig) return orig;
253
- return function(target, mode) {
254
- try {
255
- return orig.call(fs, target, mode);
256
- } catch (er) {
257
- if (!chownErOk(er)) throw er;
258
- }
259
- };
260
- }
261
- function chownFix(orig) {
262
- if (!orig) return orig;
263
- return function(target, uid, gid, cb) {
264
- return orig.call(fs, target, uid, gid, function(er) {
265
- if (chownErOk(er)) er = null;
266
- if (cb) cb.apply(this, arguments);
267
- });
268
- };
269
- }
270
- function chownFixSync(orig) {
271
- if (!orig) return orig;
272
- return function(target, uid, gid) {
273
- try {
274
- return orig.call(fs, target, uid, gid);
275
- } catch (er) {
276
- if (!chownErOk(er)) throw er;
277
- }
278
- };
279
- }
280
- function statFix(orig) {
281
- if (!orig) return orig;
282
- return function(target, options, cb) {
283
- if (typeof options === "function") {
284
- cb = options;
285
- options = null;
286
- }
287
- function callback(er, stats) {
288
- if (stats) {
289
- if (stats.uid < 0) stats.uid += 4294967296;
290
- if (stats.gid < 0) stats.gid += 4294967296;
291
- }
292
- if (cb) cb.apply(this, arguments);
293
- }
294
- return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
295
- };
296
- }
297
- function statFixSync(orig) {
298
- if (!orig) return orig;
299
- return function(target, options) {
300
- var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
301
- if (stats) {
302
- if (stats.uid < 0) stats.uid += 4294967296;
303
- if (stats.gid < 0) stats.gid += 4294967296;
304
- }
305
- return stats;
306
- };
307
- }
308
- function chownErOk(er) {
309
- if (!er) return true;
310
- if (er.code === "ENOSYS") return true;
311
- if (!process.getuid || process.getuid() !== 0) {
312
- if (er.code === "EINVAL" || er.code === "EPERM") return true;
313
- }
314
- return false;
315
- }
316
- }
317
- }));
318
- //#endregion
319
- //#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
320
- var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
321
- var Stream = __require("stream").Stream;
322
- module.exports = legacy;
323
- function legacy(fs) {
324
- return {
325
- ReadStream,
326
- WriteStream
327
- };
328
- function ReadStream(path, options) {
329
- if (!(this instanceof ReadStream)) return new ReadStream(path, options);
330
- Stream.call(this);
331
- var self = this;
332
- this.path = path;
333
- this.fd = null;
334
- this.readable = true;
335
- this.paused = false;
336
- this.flags = "r";
337
- this.mode = 438;
338
- this.bufferSize = 64 * 1024;
339
- options = options || {};
340
- var keys = Object.keys(options);
341
- for (var index = 0, length = keys.length; index < length; index++) {
342
- var key = keys[index];
343
- this[key] = options[key];
344
- }
345
- if (this.encoding) this.setEncoding(this.encoding);
346
- if (this.start !== void 0) {
347
- if ("number" !== typeof this.start) throw TypeError("start must be a Number");
348
- if (this.end === void 0) this.end = Infinity;
349
- else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
350
- if (this.start > this.end) throw new Error("start must be <= end");
351
- this.pos = this.start;
352
- }
353
- if (this.fd !== null) {
354
- process.nextTick(function() {
355
- self._read();
356
- });
357
- return;
358
- }
359
- fs.open(this.path, this.flags, this.mode, function(err, fd) {
360
- if (err) {
361
- self.emit("error", err);
362
- self.readable = false;
363
- return;
364
- }
365
- self.fd = fd;
366
- self.emit("open", fd);
367
- self._read();
368
- });
369
- }
370
- function WriteStream(path, options) {
371
- if (!(this instanceof WriteStream)) return new WriteStream(path, options);
372
- Stream.call(this);
373
- this.path = path;
374
- this.fd = null;
375
- this.writable = true;
376
- this.flags = "w";
377
- this.encoding = "binary";
378
- this.mode = 438;
379
- this.bytesWritten = 0;
380
- options = options || {};
381
- var keys = Object.keys(options);
382
- for (var index = 0, length = keys.length; index < length; index++) {
383
- var key = keys[index];
384
- this[key] = options[key];
385
- }
386
- if (this.start !== void 0) {
387
- if ("number" !== typeof this.start) throw TypeError("start must be a Number");
388
- if (this.start < 0) throw new Error("start must be >= zero");
389
- this.pos = this.start;
390
- }
391
- this.busy = false;
392
- this._queue = [];
393
- if (this.fd === null) {
394
- this._open = fs.open;
395
- this._queue.push([
396
- this._open,
397
- this.path,
398
- this.flags,
399
- this.mode,
400
- void 0
401
- ]);
402
- this.flush();
403
- }
404
- }
405
- }
406
- }));
407
- //#endregion
408
- //#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
409
- var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
410
- module.exports = clone;
411
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
412
- return obj.__proto__;
413
- };
414
- function clone(obj) {
415
- if (obj === null || typeof obj !== "object") return obj;
416
- if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
417
- else var copy = Object.create(null);
418
- Object.getOwnPropertyNames(obj).forEach(function(key) {
419
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
420
- });
421
- return copy;
422
- }
423
- }));
424
- //#endregion
425
- //#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
426
- var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
427
- var fs$4 = __require("fs");
428
- var polyfills = require_polyfills();
429
- var legacy = require_legacy_streams();
430
- var clone = require_clone();
431
- var util = __require("util");
432
- /* istanbul ignore next - node 0.x polyfill */
433
- var gracefulQueue;
434
- var previousSymbol;
435
- /* istanbul ignore else - node 0.x polyfill */
436
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
437
- gracefulQueue = Symbol.for("graceful-fs.queue");
438
- previousSymbol = Symbol.for("graceful-fs.previous");
439
- } else {
440
- gracefulQueue = "___graceful-fs.queue";
441
- previousSymbol = "___graceful-fs.previous";
442
- }
443
- function noop() {}
444
- function publishQueue(context, queue) {
445
- Object.defineProperty(context, gracefulQueue, { get: function() {
446
- return queue;
447
- } });
448
- }
449
- var debug = noop;
450
- if (util.debuglog) debug = util.debuglog("gfs4");
451
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
452
- var m = util.format.apply(util, arguments);
453
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
454
- console.error(m);
455
- };
456
- if (!fs$4[gracefulQueue]) {
457
- publishQueue(fs$4, global[gracefulQueue] || []);
458
- fs$4.close = (function(fs$close) {
459
- function close(fd, cb) {
460
- return fs$close.call(fs$4, fd, function(err) {
461
- if (!err) resetQueue();
462
- if (typeof cb === "function") cb.apply(this, arguments);
463
- });
464
- }
465
- Object.defineProperty(close, previousSymbol, { value: fs$close });
466
- return close;
467
- })(fs$4.close);
468
- fs$4.closeSync = (function(fs$closeSync) {
469
- function closeSync(fd) {
470
- fs$closeSync.apply(fs$4, arguments);
471
- resetQueue();
472
- }
473
- Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
474
- return closeSync;
475
- })(fs$4.closeSync);
476
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
477
- debug(fs$4[gracefulQueue]);
478
- __require("assert").equal(fs$4[gracefulQueue].length, 0);
479
- });
480
- }
481
- if (!global[gracefulQueue]) publishQueue(global, fs$4[gracefulQueue]);
482
- module.exports = patch(clone(fs$4));
483
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$4.__patched) {
484
- module.exports = patch(fs$4);
485
- fs$4.__patched = true;
486
- }
487
- function patch(fs) {
488
- polyfills(fs);
489
- fs.gracefulify = patch;
490
- fs.createReadStream = createReadStream;
491
- fs.createWriteStream = createWriteStream;
492
- var fs$readFile = fs.readFile;
493
- fs.readFile = readFile;
494
- function readFile(path, options, cb) {
495
- if (typeof options === "function") cb = options, options = null;
496
- return go$readFile(path, options, cb);
497
- function go$readFile(path, options, cb, startTime) {
498
- return fs$readFile(path, options, function(err) {
499
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
500
- go$readFile,
501
- [
502
- path,
503
- options,
504
- cb
505
- ],
506
- err,
507
- startTime || Date.now(),
508
- Date.now()
509
- ]);
510
- else if (typeof cb === "function") cb.apply(this, arguments);
511
- });
512
- }
513
- }
514
- var fs$writeFile = fs.writeFile;
515
- fs.writeFile = writeFile;
516
- function writeFile(path, data, options, cb) {
517
- if (typeof options === "function") cb = options, options = null;
518
- return go$writeFile(path, data, options, cb);
519
- function go$writeFile(path, data, options, cb, startTime) {
520
- return fs$writeFile(path, data, options, function(err) {
521
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
522
- go$writeFile,
523
- [
524
- path,
525
- data,
526
- options,
527
- cb
528
- ],
529
- err,
530
- startTime || Date.now(),
531
- Date.now()
532
- ]);
533
- else if (typeof cb === "function") cb.apply(this, arguments);
534
- });
535
- }
536
- }
537
- var fs$appendFile = fs.appendFile;
538
- if (fs$appendFile) fs.appendFile = appendFile;
539
- function appendFile(path, data, options, cb) {
540
- if (typeof options === "function") cb = options, options = null;
541
- return go$appendFile(path, data, options, cb);
542
- function go$appendFile(path, data, options, cb, startTime) {
543
- return fs$appendFile(path, data, options, function(err) {
544
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
545
- go$appendFile,
546
- [
547
- path,
548
- data,
549
- options,
550
- cb
551
- ],
552
- err,
553
- startTime || Date.now(),
554
- Date.now()
555
- ]);
556
- else if (typeof cb === "function") cb.apply(this, arguments);
557
- });
558
- }
559
- }
560
- var fs$copyFile = fs.copyFile;
561
- if (fs$copyFile) fs.copyFile = copyFile;
562
- function copyFile(src, dest, flags, cb) {
563
- if (typeof flags === "function") {
564
- cb = flags;
565
- flags = 0;
566
- }
567
- return go$copyFile(src, dest, flags, cb);
568
- function go$copyFile(src, dest, flags, cb, startTime) {
569
- return fs$copyFile(src, dest, flags, function(err) {
570
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
571
- go$copyFile,
572
- [
573
- src,
574
- dest,
575
- flags,
576
- cb
577
- ],
578
- err,
579
- startTime || Date.now(),
580
- Date.now()
581
- ]);
582
- else if (typeof cb === "function") cb.apply(this, arguments);
583
- });
584
- }
585
- }
586
- var fs$readdir = fs.readdir;
587
- fs.readdir = readdir;
588
- var noReaddirOptionVersions = /^v[0-5]\./;
589
- function readdir(path, options, cb) {
590
- if (typeof options === "function") cb = options, options = null;
591
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
592
- return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
593
- } : function go$readdir(path, options, cb, startTime) {
594
- return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
595
- };
596
- return go$readdir(path, options, cb);
597
- function fs$readdirCallback(path, options, cb, startTime) {
598
- return function(err, files) {
599
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
600
- go$readdir,
601
- [
602
- path,
603
- options,
604
- cb
605
- ],
606
- err,
607
- startTime || Date.now(),
608
- Date.now()
609
- ]);
610
- else {
611
- if (files && files.sort) files.sort();
612
- if (typeof cb === "function") cb.call(this, err, files);
613
- }
614
- };
615
- }
616
- }
617
- if (process.version.substr(0, 4) === "v0.8") {
618
- var legStreams = legacy(fs);
619
- ReadStream = legStreams.ReadStream;
620
- WriteStream = legStreams.WriteStream;
621
- }
622
- var fs$ReadStream = fs.ReadStream;
623
- if (fs$ReadStream) {
624
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
625
- ReadStream.prototype.open = ReadStream$open;
626
- }
627
- var fs$WriteStream = fs.WriteStream;
628
- if (fs$WriteStream) {
629
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
630
- WriteStream.prototype.open = WriteStream$open;
631
- }
632
- Object.defineProperty(fs, "ReadStream", {
633
- get: function() {
634
- return ReadStream;
635
- },
636
- set: function(val) {
637
- ReadStream = val;
638
- },
639
- enumerable: true,
640
- configurable: true
641
- });
642
- Object.defineProperty(fs, "WriteStream", {
643
- get: function() {
644
- return WriteStream;
645
- },
646
- set: function(val) {
647
- WriteStream = val;
648
- },
649
- enumerable: true,
650
- configurable: true
651
- });
652
- var FileReadStream = ReadStream;
653
- Object.defineProperty(fs, "FileReadStream", {
654
- get: function() {
655
- return FileReadStream;
656
- },
657
- set: function(val) {
658
- FileReadStream = val;
659
- },
660
- enumerable: true,
661
- configurable: true
662
- });
663
- var FileWriteStream = WriteStream;
664
- Object.defineProperty(fs, "FileWriteStream", {
665
- get: function() {
666
- return FileWriteStream;
667
- },
668
- set: function(val) {
669
- FileWriteStream = val;
670
- },
671
- enumerable: true,
672
- configurable: true
673
- });
674
- function ReadStream(path, options) {
675
- if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
676
- else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
677
- }
678
- function ReadStream$open() {
679
- var that = this;
680
- open(that.path, that.flags, that.mode, function(err, fd) {
681
- if (err) {
682
- if (that.autoClose) that.destroy();
683
- that.emit("error", err);
684
- } else {
685
- that.fd = fd;
686
- that.emit("open", fd);
687
- that.read();
688
- }
689
- });
690
- }
691
- function WriteStream(path, options) {
692
- if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
693
- else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
694
- }
695
- function WriteStream$open() {
696
- var that = this;
697
- open(that.path, that.flags, that.mode, function(err, fd) {
698
- if (err) {
699
- that.destroy();
700
- that.emit("error", err);
701
- } else {
702
- that.fd = fd;
703
- that.emit("open", fd);
704
- }
705
- });
706
- }
707
- function createReadStream(path, options) {
708
- return new fs.ReadStream(path, options);
709
- }
710
- function createWriteStream(path, options) {
711
- return new fs.WriteStream(path, options);
712
- }
713
- var fs$open = fs.open;
714
- fs.open = open;
715
- function open(path, flags, mode, cb) {
716
- if (typeof mode === "function") cb = mode, mode = null;
717
- return go$open(path, flags, mode, cb);
718
- function go$open(path, flags, mode, cb, startTime) {
719
- return fs$open(path, flags, mode, function(err, fd) {
720
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
721
- go$open,
722
- [
723
- path,
724
- flags,
725
- mode,
726
- cb
727
- ],
728
- err,
729
- startTime || Date.now(),
730
- Date.now()
731
- ]);
732
- else if (typeof cb === "function") cb.apply(this, arguments);
733
- });
734
- }
735
- }
736
- return fs;
737
- }
738
- function enqueue(elem) {
739
- debug("ENQUEUE", elem[0].name, elem[1]);
740
- fs$4[gracefulQueue].push(elem);
741
- retry();
742
- }
743
- var retryTimer;
744
- function resetQueue() {
745
- var now = Date.now();
746
- for (var i = 0; i < fs$4[gracefulQueue].length; ++i) if (fs$4[gracefulQueue][i].length > 2) {
747
- fs$4[gracefulQueue][i][3] = now;
748
- fs$4[gracefulQueue][i][4] = now;
749
- }
750
- retry();
751
- }
752
- function retry() {
753
- clearTimeout(retryTimer);
754
- retryTimer = void 0;
755
- if (fs$4[gracefulQueue].length === 0) return;
756
- var elem = fs$4[gracefulQueue].shift();
757
- var fn = elem[0];
758
- var args = elem[1];
759
- var err = elem[2];
760
- var startTime = elem[3];
761
- var lastTime = elem[4];
762
- if (startTime === void 0) {
763
- debug("RETRY", fn.name, args);
764
- fn.apply(null, args);
765
- } else if (Date.now() - startTime >= 6e4) {
766
- debug("TIMEOUT", fn.name, args);
767
- var cb = args.pop();
768
- if (typeof cb === "function") cb.call(null, err);
769
- } else {
770
- var sinceAttempt = Date.now() - lastTime;
771
- var sinceStart = Math.max(lastTime - startTime, 1);
772
- if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
773
- debug("RETRY", fn.name, args);
774
- fn.apply(null, args.concat([startTime]));
775
- } else fs$4[gracefulQueue].push(elem);
776
- }
777
- if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
778
- }
779
- }));
780
- //#endregion
781
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js
782
- var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
783
- const u = require_universalify().fromCallback;
784
- const fs = require_graceful_fs();
785
- const api = [
786
- "access",
787
- "appendFile",
788
- "chmod",
789
- "chown",
790
- "close",
791
- "copyFile",
792
- "cp",
793
- "fchmod",
794
- "fchown",
795
- "fdatasync",
796
- "fstat",
797
- "fsync",
798
- "ftruncate",
799
- "futimes",
800
- "glob",
801
- "lchmod",
802
- "lchown",
803
- "lutimes",
804
- "link",
805
- "lstat",
806
- "mkdir",
807
- "mkdtemp",
808
- "open",
809
- "opendir",
810
- "readdir",
811
- "readFile",
812
- "readlink",
813
- "realpath",
814
- "rename",
815
- "rm",
816
- "rmdir",
817
- "stat",
818
- "statfs",
819
- "symlink",
820
- "truncate",
821
- "unlink",
822
- "utimes",
823
- "writeFile"
824
- ].filter((key) => {
825
- return typeof fs[key] === "function";
826
- });
827
- Object.assign(exports, fs);
828
- api.forEach((method) => {
829
- exports[method] = u(fs[method]);
830
- });
831
- exports.exists = function(filename, callback) {
832
- if (typeof callback === "function") return fs.exists(filename, callback);
833
- return new Promise((resolve) => {
834
- return fs.exists(filename, resolve);
835
- });
836
- };
837
- exports.read = function(fd, buffer, offset, length, position, callback) {
838
- if (typeof callback === "function") return fs.read(fd, buffer, offset, length, position, callback);
839
- return new Promise((resolve, reject) => {
840
- fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
841
- if (err) return reject(err);
842
- resolve({
843
- bytesRead,
844
- buffer
845
- });
846
- });
847
- });
848
- };
849
- exports.write = function(fd, buffer, ...args) {
850
- if (typeof args[args.length - 1] === "function") return fs.write(fd, buffer, ...args);
851
- return new Promise((resolve, reject) => {
852
- fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
853
- if (err) return reject(err);
854
- resolve({
855
- bytesWritten,
856
- buffer
857
- });
858
- });
859
- });
860
- };
861
- exports.readv = function(fd, buffers, ...args) {
862
- if (typeof args[args.length - 1] === "function") return fs.readv(fd, buffers, ...args);
863
- return new Promise((resolve, reject) => {
864
- fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
865
- if (err) return reject(err);
866
- resolve({
867
- bytesRead,
868
- buffers
869
- });
870
- });
871
- });
872
- };
873
- exports.writev = function(fd, buffers, ...args) {
874
- if (typeof args[args.length - 1] === "function") return fs.writev(fd, buffers, ...args);
875
- return new Promise((resolve, reject) => {
876
- fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
877
- if (err) return reject(err);
878
- resolve({
879
- bytesWritten,
880
- buffers
881
- });
882
- });
883
- });
884
- };
885
- if (typeof fs.realpath.native === "function") exports.realpath.native = u(fs.realpath.native);
886
- else process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003");
887
- }));
888
- //#endregion
889
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/utils.js
890
- var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
891
- const path$12 = __require("path");
892
- module.exports.checkPath = function checkPath(pth) {
893
- if (process.platform === "win32") {
894
- if (/[<>:"|?*]/.test(pth.replace(path$12.parse(pth).root, ""))) {
895
- const error = /* @__PURE__ */ new Error(`Path contains invalid characters: ${pth}`);
896
- error.code = "EINVAL";
897
- throw error;
898
- }
899
- }
900
- };
901
- }));
902
- //#endregion
903
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/make-dir.js
904
- var require_make_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
905
- const fs = require_fs();
906
- const { checkPath } = require_utils$1();
907
- const getMode = (options) => {
908
- const defaults = { mode: 511 };
909
- if (typeof options === "number") return options;
910
- return {
911
- ...defaults,
912
- ...options
913
- }.mode;
914
- };
915
- module.exports.makeDir = async (dir, options) => {
916
- checkPath(dir);
917
- return fs.mkdir(dir, {
918
- mode: getMode(options),
919
- recursive: true
920
- });
921
- };
922
- module.exports.makeDirSync = (dir, options) => {
923
- checkPath(dir);
924
- return fs.mkdirSync(dir, {
925
- mode: getMode(options),
926
- recursive: true
927
- });
928
- };
929
- }));
930
- //#endregion
931
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js
932
- var require_mkdirs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
933
- const u = require_universalify().fromPromise;
934
- const { makeDir: _makeDir, makeDirSync } = require_make_dir();
935
- const makeDir = u(_makeDir);
936
- module.exports = {
937
- mkdirs: makeDir,
938
- mkdirsSync: makeDirSync,
939
- mkdirp: makeDir,
940
- mkdirpSync: makeDirSync,
941
- ensureDir: makeDir,
942
- ensureDirSync: makeDirSync
943
- };
944
- }));
945
- //#endregion
946
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js
947
- var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
948
- const u = require_universalify().fromPromise;
949
- const fs = require_fs();
950
- function pathExists(path) {
951
- return fs.access(path).then(() => true).catch(() => false);
952
- }
953
- module.exports = {
954
- pathExists: u(pathExists),
955
- pathExistsSync: fs.existsSync
956
- };
957
- }));
958
- //#endregion
959
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/utimes.js
960
- var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
961
- const fs = require_fs();
962
- const u = require_universalify().fromPromise;
963
- async function utimesMillis(path, atime, mtime) {
964
- const fd = await fs.open(path, "r+");
965
- let closeErr = null;
966
- try {
967
- await fs.futimes(fd, atime, mtime);
968
- } finally {
969
- try {
970
- await fs.close(fd);
971
- } catch (e) {
972
- closeErr = e;
973
- }
974
- }
975
- if (closeErr) throw closeErr;
976
- }
977
- function utimesMillisSync(path, atime, mtime) {
978
- const fd = fs.openSync(path, "r+");
979
- fs.futimesSync(fd, atime, mtime);
980
- return fs.closeSync(fd);
981
- }
982
- module.exports = {
983
- utimesMillis: u(utimesMillis),
984
- utimesMillisSync
985
- };
986
- }));
987
- //#endregion
988
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js
989
- var require_stat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
990
- const fs = require_fs();
991
- const path$11 = __require("path");
992
- const u = require_universalify().fromPromise;
993
- function getStats(src, dest, opts) {
994
- const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true });
995
- return Promise.all([statFunc(src), statFunc(dest).catch((err) => {
996
- if (err.code === "ENOENT") return null;
997
- throw err;
998
- })]).then(([srcStat, destStat]) => ({
999
- srcStat,
1000
- destStat
1001
- }));
1002
- }
1003
- function getStatsSync(src, dest, opts) {
1004
- let destStat;
1005
- const statFunc = opts.dereference ? (file) => fs.statSync(file, { bigint: true }) : (file) => fs.lstatSync(file, { bigint: true });
1006
- const srcStat = statFunc(src);
1007
- try {
1008
- destStat = statFunc(dest);
1009
- } catch (err) {
1010
- if (err.code === "ENOENT") return {
1011
- srcStat,
1012
- destStat: null
1013
- };
1014
- throw err;
1015
- }
1016
- return {
1017
- srcStat,
1018
- destStat
1019
- };
1020
- }
1021
- async function checkPaths(src, dest, funcName, opts) {
1022
- const { srcStat, destStat } = await getStats(src, dest, opts);
1023
- if (destStat) {
1024
- if (areIdentical(srcStat, destStat)) {
1025
- const srcBaseName = path$11.basename(src);
1026
- const destBaseName = path$11.basename(dest);
1027
- if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) return {
1028
- srcStat,
1029
- destStat,
1030
- isChangingCase: true
1031
- };
1032
- throw new Error("Source and destination must not be the same.");
1033
- }
1034
- if (srcStat.isDirectory() && !destStat.isDirectory()) throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1035
- if (!srcStat.isDirectory() && destStat.isDirectory()) throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1036
- }
1037
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) throw new Error(errMsg(src, dest, funcName));
1038
- return {
1039
- srcStat,
1040
- destStat
1041
- };
1042
- }
1043
- function checkPathsSync(src, dest, funcName, opts) {
1044
- const { srcStat, destStat } = getStatsSync(src, dest, opts);
1045
- if (destStat) {
1046
- if (areIdentical(srcStat, destStat)) {
1047
- const srcBaseName = path$11.basename(src);
1048
- const destBaseName = path$11.basename(dest);
1049
- if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) return {
1050
- srcStat,
1051
- destStat,
1052
- isChangingCase: true
1053
- };
1054
- throw new Error("Source and destination must not be the same.");
1055
- }
1056
- if (srcStat.isDirectory() && !destStat.isDirectory()) throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1057
- if (!srcStat.isDirectory() && destStat.isDirectory()) throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1058
- }
1059
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) throw new Error(errMsg(src, dest, funcName));
1060
- return {
1061
- srcStat,
1062
- destStat
1063
- };
1064
- }
1065
- async function checkParentPaths(src, srcStat, dest, funcName) {
1066
- const srcParent = path$11.resolve(path$11.dirname(src));
1067
- const destParent = path$11.resolve(path$11.dirname(dest));
1068
- if (destParent === srcParent || destParent === path$11.parse(destParent).root) return;
1069
- let destStat;
1070
- try {
1071
- destStat = await fs.stat(destParent, { bigint: true });
1072
- } catch (err) {
1073
- if (err.code === "ENOENT") return;
1074
- throw err;
1075
- }
1076
- if (areIdentical(srcStat, destStat)) throw new Error(errMsg(src, dest, funcName));
1077
- return checkParentPaths(src, srcStat, destParent, funcName);
1078
- }
1079
- function checkParentPathsSync(src, srcStat, dest, funcName) {
1080
- const srcParent = path$11.resolve(path$11.dirname(src));
1081
- const destParent = path$11.resolve(path$11.dirname(dest));
1082
- if (destParent === srcParent || destParent === path$11.parse(destParent).root) return;
1083
- let destStat;
1084
- try {
1085
- destStat = fs.statSync(destParent, { bigint: true });
1086
- } catch (err) {
1087
- if (err.code === "ENOENT") return;
1088
- throw err;
1089
- }
1090
- if (areIdentical(srcStat, destStat)) throw new Error(errMsg(src, dest, funcName));
1091
- return checkParentPathsSync(src, srcStat, destParent, funcName);
1092
- }
1093
- function areIdentical(srcStat, destStat) {
1094
- return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
1095
- }
1096
- function isSrcSubdir(src, dest) {
1097
- const srcArr = path$11.resolve(src).split(path$11.sep).filter((i) => i);
1098
- const destArr = path$11.resolve(dest).split(path$11.sep).filter((i) => i);
1099
- return srcArr.every((cur, i) => destArr[i] === cur);
1100
- }
1101
- function errMsg(src, dest, funcName) {
1102
- return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
1103
- }
1104
- module.exports = {
1105
- checkPaths: u(checkPaths),
1106
- checkPathsSync,
1107
- checkParentPaths: u(checkParentPaths),
1108
- checkParentPathsSync,
1109
- isSrcSubdir,
1110
- areIdentical
1111
- };
1112
- }));
1113
- //#endregion
1114
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/async.js
1115
- var require_async = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1116
- async function asyncIteratorConcurrentProcess(iterator, fn) {
1117
- const promises = [];
1118
- for await (const item of iterator) promises.push(fn(item).then(() => null, (err) => err ?? /* @__PURE__ */ new Error("unknown error")));
1119
- await Promise.all(promises.map((promise) => promise.then((possibleErr) => {
1120
- if (possibleErr !== null) throw possibleErr;
1121
- })));
1122
- }
1123
- module.exports = { asyncIteratorConcurrentProcess };
1124
- }));
1125
- //#endregion
1126
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy.js
1127
- var require_copy$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1128
- const fs = require_fs();
1129
- const path$10 = __require("path");
1130
- const { mkdirs } = require_mkdirs();
1131
- const { pathExists } = require_path_exists();
1132
- const { utimesMillis } = require_utimes();
1133
- const stat = require_stat();
1134
- const { asyncIteratorConcurrentProcess } = require_async();
1135
- async function copy(src, dest, opts = {}) {
1136
- if (typeof opts === "function") opts = { filter: opts };
1137
- opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1138
- opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1139
- if (opts.preserveTimestamps && process.arch === "ia32") process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0001");
1140
- const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
1141
- await stat.checkParentPaths(src, srcStat, dest, "copy");
1142
- if (!await runFilter(src, dest, opts)) return;
1143
- const destParent = path$10.dirname(dest);
1144
- if (!await pathExists(destParent)) await mkdirs(destParent);
1145
- await getStatsAndPerformCopy(destStat, src, dest, opts);
1146
- }
1147
- async function runFilter(src, dest, opts) {
1148
- if (!opts.filter) return true;
1149
- return opts.filter(src, dest);
1150
- }
1151
- async function getStatsAndPerformCopy(destStat, src, dest, opts) {
1152
- const srcStat = await (opts.dereference ? fs.stat : fs.lstat)(src);
1153
- if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
1154
- if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
1155
- if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
1156
- if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
1157
- if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
1158
- throw new Error(`Unknown file: ${src}`);
1159
- }
1160
- async function onFile(srcStat, destStat, src, dest, opts) {
1161
- if (!destStat) return copyFile(srcStat, src, dest, opts);
1162
- if (opts.overwrite) {
1163
- await fs.unlink(dest);
1164
- return copyFile(srcStat, src, dest, opts);
1165
- }
1166
- if (opts.errorOnExist) throw new Error(`'${dest}' already exists`);
1167
- }
1168
- async function copyFile(srcStat, src, dest, opts) {
1169
- await fs.copyFile(src, dest);
1170
- if (opts.preserveTimestamps) {
1171
- if (fileIsNotWritable(srcStat.mode)) await makeFileWritable(dest, srcStat.mode);
1172
- const updatedSrcStat = await fs.stat(src);
1173
- await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1174
- }
1175
- return fs.chmod(dest, srcStat.mode);
1176
- }
1177
- function fileIsNotWritable(srcMode) {
1178
- return (srcMode & 128) === 0;
1179
- }
1180
- function makeFileWritable(dest, srcMode) {
1181
- return fs.chmod(dest, srcMode | 128);
1182
- }
1183
- async function onDir(srcStat, destStat, src, dest, opts) {
1184
- if (!destStat) await fs.mkdir(dest);
1185
- await asyncIteratorConcurrentProcess(await fs.opendir(src), async (item) => {
1186
- const srcItem = path$10.join(src, item.name);
1187
- const destItem = path$10.join(dest, item.name);
1188
- if (await runFilter(srcItem, destItem, opts)) {
1189
- const { destStat } = await stat.checkPaths(srcItem, destItem, "copy", opts);
1190
- await getStatsAndPerformCopy(destStat, srcItem, destItem, opts);
1191
- }
1192
- });
1193
- if (!destStat) await fs.chmod(dest, srcStat.mode);
1194
- }
1195
- async function onLink(destStat, src, dest, opts) {
1196
- let resolvedSrc = await fs.readlink(src);
1197
- if (opts.dereference) resolvedSrc = path$10.resolve(process.cwd(), resolvedSrc);
1198
- if (!destStat) return fs.symlink(resolvedSrc, dest);
1199
- let resolvedDest = null;
1200
- try {
1201
- resolvedDest = await fs.readlink(dest);
1202
- } catch (e) {
1203
- if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs.symlink(resolvedSrc, dest);
1204
- throw e;
1205
- }
1206
- if (opts.dereference) resolvedDest = path$10.resolve(process.cwd(), resolvedDest);
1207
- if (resolvedSrc !== resolvedDest) {
1208
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
1209
- if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
1210
- }
1211
- await fs.unlink(dest);
1212
- return fs.symlink(resolvedSrc, dest);
1213
- }
1214
- module.exports = copy;
1215
- }));
1216
- //#endregion
1217
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy-sync.js
1218
- var require_copy_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1219
- const fs = require_graceful_fs();
1220
- const path$9 = __require("path");
1221
- const mkdirsSync = require_mkdirs().mkdirsSync;
1222
- const utimesMillisSync = require_utimes().utimesMillisSync;
1223
- const stat = require_stat();
1224
- function copySync(src, dest, opts) {
1225
- if (typeof opts === "function") opts = { filter: opts };
1226
- opts = opts || {};
1227
- opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1228
- opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1229
- if (opts.preserveTimestamps && process.arch === "ia32") process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0002");
1230
- const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
1231
- stat.checkParentPathsSync(src, srcStat, dest, "copy");
1232
- if (opts.filter && !opts.filter(src, dest)) return;
1233
- const destParent = path$9.dirname(dest);
1234
- if (!fs.existsSync(destParent)) mkdirsSync(destParent);
1235
- return getStats(destStat, src, dest, opts);
1236
- }
1237
- function getStats(destStat, src, dest, opts) {
1238
- const srcStat = (opts.dereference ? fs.statSync : fs.lstatSync)(src);
1239
- if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
1240
- else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
1241
- else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
1242
- else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
1243
- else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
1244
- throw new Error(`Unknown file: ${src}`);
1245
- }
1246
- function onFile(srcStat, destStat, src, dest, opts) {
1247
- if (!destStat) return copyFile(srcStat, src, dest, opts);
1248
- return mayCopyFile(srcStat, src, dest, opts);
1249
- }
1250
- function mayCopyFile(srcStat, src, dest, opts) {
1251
- if (opts.overwrite) {
1252
- fs.unlinkSync(dest);
1253
- return copyFile(srcStat, src, dest, opts);
1254
- } else if (opts.errorOnExist) throw new Error(`'${dest}' already exists`);
1255
- }
1256
- function copyFile(srcStat, src, dest, opts) {
1257
- fs.copyFileSync(src, dest);
1258
- if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
1259
- return setDestMode(dest, srcStat.mode);
1260
- }
1261
- function handleTimestamps(srcMode, src, dest) {
1262
- if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
1263
- return setDestTimestamps(src, dest);
1264
- }
1265
- function fileIsNotWritable(srcMode) {
1266
- return (srcMode & 128) === 0;
1267
- }
1268
- function makeFileWritable(dest, srcMode) {
1269
- return setDestMode(dest, srcMode | 128);
1270
- }
1271
- function setDestMode(dest, srcMode) {
1272
- return fs.chmodSync(dest, srcMode);
1273
- }
1274
- function setDestTimestamps(src, dest) {
1275
- const updatedSrcStat = fs.statSync(src);
1276
- return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1277
- }
1278
- function onDir(srcStat, destStat, src, dest, opts) {
1279
- if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
1280
- return copyDir(src, dest, opts);
1281
- }
1282
- function mkDirAndCopy(srcMode, src, dest, opts) {
1283
- fs.mkdirSync(dest);
1284
- copyDir(src, dest, opts);
1285
- return setDestMode(dest, srcMode);
1286
- }
1287
- function copyDir(src, dest, opts) {
1288
- const dir = fs.opendirSync(src);
1289
- try {
1290
- let dirent;
1291
- while ((dirent = dir.readSync()) !== null) copyDirItem(dirent.name, src, dest, opts);
1292
- } finally {
1293
- dir.closeSync();
1294
- }
1295
- }
1296
- function copyDirItem(item, src, dest, opts) {
1297
- const srcItem = path$9.join(src, item);
1298
- const destItem = path$9.join(dest, item);
1299
- if (opts.filter && !opts.filter(srcItem, destItem)) return;
1300
- const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
1301
- return getStats(destStat, srcItem, destItem, opts);
1302
- }
1303
- function onLink(destStat, src, dest, opts) {
1304
- let resolvedSrc = fs.readlinkSync(src);
1305
- if (opts.dereference) resolvedSrc = path$9.resolve(process.cwd(), resolvedSrc);
1306
- if (!destStat) return fs.symlinkSync(resolvedSrc, dest);
1307
- else {
1308
- let resolvedDest;
1309
- try {
1310
- resolvedDest = fs.readlinkSync(dest);
1311
- } catch (err) {
1312
- if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs.symlinkSync(resolvedSrc, dest);
1313
- throw err;
1314
- }
1315
- if (opts.dereference) resolvedDest = path$9.resolve(process.cwd(), resolvedDest);
1316
- if (resolvedSrc !== resolvedDest) {
1317
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
1318
- if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
1319
- }
1320
- return copyLink(resolvedSrc, dest);
1321
- }
1322
- }
1323
- function copyLink(resolvedSrc, dest) {
1324
- fs.unlinkSync(dest);
1325
- return fs.symlinkSync(resolvedSrc, dest);
1326
- }
1327
- module.exports = copySync;
1328
- }));
1329
- //#endregion
1330
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/index.js
1331
- var require_copy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1332
- const u = require_universalify().fromPromise;
1333
- module.exports = {
1334
- copy: u(require_copy$1()),
1335
- copySync: require_copy_sync()
1336
- };
1337
- }));
1338
- //#endregion
1339
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js
1340
- var require_remove = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1341
- const fs = require_graceful_fs();
1342
- const u = require_universalify().fromCallback;
1343
- function remove(path, callback) {
1344
- fs.rm(path, {
1345
- recursive: true,
1346
- force: true
1347
- }, callback);
1348
- }
1349
- function removeSync(path) {
1350
- fs.rmSync(path, {
1351
- recursive: true,
1352
- force: true
1353
- });
1354
- }
1355
- module.exports = {
1356
- remove: u(remove),
1357
- removeSync
1358
- };
1359
- }));
1360
- //#endregion
1361
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/empty/index.js
1362
- var require_empty = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1363
- const u = require_universalify().fromPromise;
1364
- const fs = require_fs();
1365
- const path$8 = __require("path");
1366
- const mkdir = require_mkdirs();
1367
- const remove = require_remove();
1368
- const emptyDir = u(async function emptyDir(dir) {
1369
- let items;
1370
- try {
1371
- items = await fs.readdir(dir);
1372
- } catch {
1373
- return mkdir.mkdirs(dir);
1374
- }
1375
- return Promise.all(items.map((item) => remove.remove(path$8.join(dir, item))));
1376
- });
1377
- function emptyDirSync(dir) {
1378
- let items;
1379
- try {
1380
- items = fs.readdirSync(dir);
1381
- } catch {
1382
- return mkdir.mkdirsSync(dir);
1383
- }
1384
- items.forEach((item) => {
1385
- item = path$8.join(dir, item);
1386
- remove.removeSync(item);
1387
- });
1388
- }
1389
- module.exports = {
1390
- emptyDirSync,
1391
- emptydirSync: emptyDirSync,
1392
- emptyDir,
1393
- emptydir: emptyDir
1394
- };
1395
- }));
1396
- //#endregion
1397
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/file.js
1398
- var require_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1399
- const u = require_universalify().fromPromise;
1400
- const path$7 = __require("path");
1401
- const fs = require_fs();
1402
- const mkdir = require_mkdirs();
1403
- async function createFile(file) {
1404
- let stats;
1405
- try {
1406
- stats = await fs.stat(file);
1407
- } catch {}
1408
- if (stats && stats.isFile()) return;
1409
- const dir = path$7.dirname(file);
1410
- let dirStats = null;
1411
- try {
1412
- dirStats = await fs.stat(dir);
1413
- } catch (err) {
1414
- if (err.code === "ENOENT") {
1415
- await mkdir.mkdirs(dir);
1416
- await fs.writeFile(file, "");
1417
- return;
1418
- } else throw err;
1419
- }
1420
- if (dirStats.isDirectory()) await fs.writeFile(file, "");
1421
- else await fs.readdir(dir);
1422
- }
1423
- function createFileSync(file) {
1424
- let stats;
1425
- try {
1426
- stats = fs.statSync(file);
1427
- } catch {}
1428
- if (stats && stats.isFile()) return;
1429
- const dir = path$7.dirname(file);
1430
- try {
1431
- if (!fs.statSync(dir).isDirectory()) fs.readdirSync(dir);
1432
- } catch (err) {
1433
- if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
1434
- else throw err;
1435
- }
1436
- fs.writeFileSync(file, "");
1437
- }
1438
- module.exports = {
1439
- createFile: u(createFile),
1440
- createFileSync
1441
- };
1442
- }));
1443
- //#endregion
1444
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/link.js
1445
- var require_link = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1446
- const u = require_universalify().fromPromise;
1447
- const path$6 = __require("path");
1448
- const fs = require_fs();
1449
- const mkdir = require_mkdirs();
1450
- const { pathExists } = require_path_exists();
1451
- const { areIdentical } = require_stat();
1452
- async function createLink(srcpath, dstpath) {
1453
- let dstStat;
1454
- try {
1455
- dstStat = await fs.lstat(dstpath);
1456
- } catch {}
1457
- let srcStat;
1458
- try {
1459
- srcStat = await fs.lstat(srcpath);
1460
- } catch (err) {
1461
- err.message = err.message.replace("lstat", "ensureLink");
1462
- throw err;
1463
- }
1464
- if (dstStat && areIdentical(srcStat, dstStat)) return;
1465
- const dir = path$6.dirname(dstpath);
1466
- if (!await pathExists(dir)) await mkdir.mkdirs(dir);
1467
- await fs.link(srcpath, dstpath);
1468
- }
1469
- function createLinkSync(srcpath, dstpath) {
1470
- let dstStat;
1471
- try {
1472
- dstStat = fs.lstatSync(dstpath);
1473
- } catch {}
1474
- try {
1475
- const srcStat = fs.lstatSync(srcpath);
1476
- if (dstStat && areIdentical(srcStat, dstStat)) return;
1477
- } catch (err) {
1478
- err.message = err.message.replace("lstat", "ensureLink");
1479
- throw err;
1480
- }
1481
- const dir = path$6.dirname(dstpath);
1482
- if (fs.existsSync(dir)) return fs.linkSync(srcpath, dstpath);
1483
- mkdir.mkdirsSync(dir);
1484
- return fs.linkSync(srcpath, dstpath);
1485
- }
1486
- module.exports = {
1487
- createLink: u(createLink),
1488
- createLinkSync
1489
- };
1490
- }));
1491
- //#endregion
1492
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-paths.js
1493
- var require_symlink_paths = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1494
- const path$5 = __require("path");
1495
- const fs = require_fs();
1496
- const { pathExists } = require_path_exists();
1497
- const u = require_universalify().fromPromise;
1498
- /**
1499
- * Function that returns two types of paths, one relative to symlink, and one
1500
- * relative to the current working directory. Checks if path is absolute or
1501
- * relative. If the path is relative, this function checks if the path is
1502
- * relative to symlink or relative to current working directory. This is an
1503
- * initiative to find a smarter `srcpath` to supply when building symlinks.
1504
- * This allows you to determine which path to use out of one of three possible
1505
- * types of source paths. The first is an absolute path. This is detected by
1506
- * `path.isAbsolute()`. When an absolute path is provided, it is checked to
1507
- * see if it exists. If it does it's used, if not an error is returned
1508
- * (callback)/ thrown (sync). The other two options for `srcpath` are a
1509
- * relative url. By default Node's `fs.symlink` works by creating a symlink
1510
- * using `dstpath` and expects the `srcpath` to be relative to the newly
1511
- * created symlink. If you provide a `srcpath` that does not exist on the file
1512
- * system it results in a broken symlink. To minimize this, the function
1513
- * checks to see if the 'relative to symlink' source file exists, and if it
1514
- * does it will use it. If it does not, it checks if there's a file that
1515
- * exists that is relative to the current working directory, if does its used.
1516
- * This preserves the expectations of the original fs.symlink spec and adds
1517
- * the ability to pass in `relative to current working direcotry` paths.
1518
- */
1519
- async function symlinkPaths(srcpath, dstpath) {
1520
- if (path$5.isAbsolute(srcpath)) {
1521
- try {
1522
- await fs.lstat(srcpath);
1523
- } catch (err) {
1524
- err.message = err.message.replace("lstat", "ensureSymlink");
1525
- throw err;
1526
- }
1527
- return {
1528
- toCwd: srcpath,
1529
- toDst: srcpath
1530
- };
1531
- }
1532
- const dstdir = path$5.dirname(dstpath);
1533
- const relativeToDst = path$5.join(dstdir, srcpath);
1534
- if (await pathExists(relativeToDst)) return {
1535
- toCwd: relativeToDst,
1536
- toDst: srcpath
1537
- };
1538
- try {
1539
- await fs.lstat(srcpath);
1540
- } catch (err) {
1541
- err.message = err.message.replace("lstat", "ensureSymlink");
1542
- throw err;
1543
- }
1544
- return {
1545
- toCwd: srcpath,
1546
- toDst: path$5.relative(dstdir, srcpath)
1547
- };
1548
- }
1549
- function symlinkPathsSync(srcpath, dstpath) {
1550
- if (path$5.isAbsolute(srcpath)) {
1551
- if (!fs.existsSync(srcpath)) throw new Error("absolute srcpath does not exist");
1552
- return {
1553
- toCwd: srcpath,
1554
- toDst: srcpath
1555
- };
1556
- }
1557
- const dstdir = path$5.dirname(dstpath);
1558
- const relativeToDst = path$5.join(dstdir, srcpath);
1559
- if (fs.existsSync(relativeToDst)) return {
1560
- toCwd: relativeToDst,
1561
- toDst: srcpath
1562
- };
1563
- if (!fs.existsSync(srcpath)) throw new Error("relative srcpath does not exist");
1564
- return {
1565
- toCwd: srcpath,
1566
- toDst: path$5.relative(dstdir, srcpath)
1567
- };
1568
- }
1569
- module.exports = {
1570
- symlinkPaths: u(symlinkPaths),
1571
- symlinkPathsSync
1572
- };
1573
- }));
1574
- //#endregion
1575
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-type.js
1576
- var require_symlink_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1577
- const fs = require_fs();
1578
- const u = require_universalify().fromPromise;
1579
- async function symlinkType(srcpath, type) {
1580
- if (type) return type;
1581
- let stats;
1582
- try {
1583
- stats = await fs.lstat(srcpath);
1584
- } catch {
1585
- return "file";
1586
- }
1587
- return stats && stats.isDirectory() ? "dir" : "file";
1588
- }
1589
- function symlinkTypeSync(srcpath, type) {
1590
- if (type) return type;
1591
- let stats;
1592
- try {
1593
- stats = fs.lstatSync(srcpath);
1594
- } catch {
1595
- return "file";
1596
- }
1597
- return stats && stats.isDirectory() ? "dir" : "file";
1598
- }
1599
- module.exports = {
1600
- symlinkType: u(symlinkType),
1601
- symlinkTypeSync
1602
- };
1603
- }));
1604
- //#endregion
1605
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink.js
1606
- var require_symlink = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1607
- const u = require_universalify().fromPromise;
1608
- const path$4 = __require("path");
1609
- const fs = require_fs();
1610
- const { mkdirs, mkdirsSync } = require_mkdirs();
1611
- const { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
1612
- const { symlinkType, symlinkTypeSync } = require_symlink_type();
1613
- const { pathExists } = require_path_exists();
1614
- const { areIdentical } = require_stat();
1615
- async function createSymlink(srcpath, dstpath, type) {
1616
- let stats;
1617
- try {
1618
- stats = await fs.lstat(dstpath);
1619
- } catch {}
1620
- if (stats && stats.isSymbolicLink()) {
1621
- let srcStat;
1622
- if (path$4.isAbsolute(srcpath)) srcStat = await fs.stat(srcpath);
1623
- else {
1624
- const dstdir = path$4.dirname(dstpath);
1625
- const relativeToDst = path$4.join(dstdir, srcpath);
1626
- try {
1627
- srcStat = await fs.stat(relativeToDst);
1628
- } catch {
1629
- srcStat = await fs.stat(srcpath);
1630
- }
1631
- }
1632
- const dstStat = await fs.stat(dstpath);
1633
- if (areIdentical(srcStat, dstStat)) return;
1634
- }
1635
- const relative = await symlinkPaths(srcpath, dstpath);
1636
- srcpath = relative.toDst;
1637
- const toType = await symlinkType(relative.toCwd, type);
1638
- const dir = path$4.dirname(dstpath);
1639
- if (!await pathExists(dir)) await mkdirs(dir);
1640
- return fs.symlink(srcpath, dstpath, toType);
1641
- }
1642
- function createSymlinkSync(srcpath, dstpath, type) {
1643
- let stats;
1644
- try {
1645
- stats = fs.lstatSync(dstpath);
1646
- } catch {}
1647
- if (stats && stats.isSymbolicLink()) {
1648
- let srcStat;
1649
- if (path$4.isAbsolute(srcpath)) srcStat = fs.statSync(srcpath);
1650
- else {
1651
- const dstdir = path$4.dirname(dstpath);
1652
- const relativeToDst = path$4.join(dstdir, srcpath);
1653
- try {
1654
- srcStat = fs.statSync(relativeToDst);
1655
- } catch {
1656
- srcStat = fs.statSync(srcpath);
1657
- }
1658
- }
1659
- const dstStat = fs.statSync(dstpath);
1660
- if (areIdentical(srcStat, dstStat)) return;
1661
- }
1662
- const relative = symlinkPathsSync(srcpath, dstpath);
1663
- srcpath = relative.toDst;
1664
- type = symlinkTypeSync(relative.toCwd, type);
1665
- const dir = path$4.dirname(dstpath);
1666
- if (fs.existsSync(dir)) return fs.symlinkSync(srcpath, dstpath, type);
1667
- mkdirsSync(dir);
1668
- return fs.symlinkSync(srcpath, dstpath, type);
1669
- }
1670
- module.exports = {
1671
- createSymlink: u(createSymlink),
1672
- createSymlinkSync
1673
- };
1674
- }));
1675
- //#endregion
1676
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/index.js
1677
- var require_ensure = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1678
- const { createFile, createFileSync } = require_file();
1679
- const { createLink, createLinkSync } = require_link();
1680
- const { createSymlink, createSymlinkSync } = require_symlink();
1681
- module.exports = {
1682
- createFile,
1683
- createFileSync,
1684
- ensureFile: createFile,
1685
- ensureFileSync: createFileSync,
1686
- createLink,
1687
- createLinkSync,
1688
- ensureLink: createLink,
1689
- ensureLinkSync: createLinkSync,
1690
- createSymlink,
1691
- createSymlinkSync,
1692
- ensureSymlink: createSymlink,
1693
- ensureSymlinkSync: createSymlinkSync
1694
- };
1695
- }));
1696
- //#endregion
1697
- //#region ../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js
1698
- var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1699
- function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
1700
- const EOF = finalEOL ? EOL : "";
1701
- return JSON.stringify(obj, replacer, spaces).replace(/\n/g, EOL) + EOF;
1702
- }
1703
- function stripBom(content) {
1704
- if (Buffer.isBuffer(content)) content = content.toString("utf8");
1705
- return content.replace(/^\uFEFF/, "");
1706
- }
1707
- module.exports = {
1708
- stringify,
1709
- stripBom
1710
- };
1711
- }));
1712
- //#endregion
1713
- //#region ../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/index.js
1714
- var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1715
- let _fs;
1716
- try {
1717
- _fs = require_graceful_fs();
1718
- } catch (_) {
1719
- _fs = __require("fs");
1720
- }
1721
- const universalify = require_universalify();
1722
- const { stringify, stripBom } = require_utils();
1723
- async function _readFile(file, options = {}) {
1724
- if (typeof options === "string") options = { encoding: options };
1725
- const fs = options.fs || _fs;
1726
- const shouldThrow = "throws" in options ? options.throws : true;
1727
- let data = await universalify.fromCallback(fs.readFile)(file, options);
1728
- data = stripBom(data);
1729
- let obj;
1730
- try {
1731
- obj = JSON.parse(data, options ? options.reviver : null);
1732
- } catch (err) {
1733
- if (shouldThrow) {
1734
- err.message = `${file}: ${err.message}`;
1735
- throw err;
1736
- } else return null;
1737
- }
1738
- return obj;
1739
- }
1740
- const readFile = universalify.fromPromise(_readFile);
1741
- function readFileSync(file, options = {}) {
1742
- if (typeof options === "string") options = { encoding: options };
1743
- const fs = options.fs || _fs;
1744
- const shouldThrow = "throws" in options ? options.throws : true;
1745
- try {
1746
- let content = fs.readFileSync(file, options);
1747
- content = stripBom(content);
1748
- return JSON.parse(content, options.reviver);
1749
- } catch (err) {
1750
- if (shouldThrow) {
1751
- err.message = `${file}: ${err.message}`;
1752
- throw err;
1753
- } else return null;
1754
- }
1755
- }
1756
- async function _writeFile(file, obj, options = {}) {
1757
- const fs = options.fs || _fs;
1758
- const str = stringify(obj, options);
1759
- await universalify.fromCallback(fs.writeFile)(file, str, options);
1760
- }
1761
- const writeFile = universalify.fromPromise(_writeFile);
1762
- function writeFileSync(file, obj, options = {}) {
1763
- const fs = options.fs || _fs;
1764
- const str = stringify(obj, options);
1765
- return fs.writeFileSync(file, str, options);
1766
- }
1767
- module.exports = {
1768
- readFile,
1769
- readFileSync,
1770
- writeFile,
1771
- writeFileSync
1772
- };
1773
- }));
1774
- //#endregion
1775
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/jsonfile.js
1776
- var require_jsonfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1777
- const jsonFile = require_jsonfile$1();
1778
- module.exports = {
1779
- readJson: jsonFile.readFile,
1780
- readJsonSync: jsonFile.readFileSync,
1781
- writeJson: jsonFile.writeFile,
1782
- writeJsonSync: jsonFile.writeFileSync
1783
- };
1784
- }));
1785
- //#endregion
1786
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/output-file/index.js
1787
- var require_output_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1788
- const u = require_universalify().fromPromise;
1789
- const fs = require_fs();
1790
- const path$3 = __require("path");
1791
- const mkdir = require_mkdirs();
1792
- const pathExists = require_path_exists().pathExists;
1793
- async function outputFile(file, data, encoding = "utf-8") {
1794
- const dir = path$3.dirname(file);
1795
- if (!await pathExists(dir)) await mkdir.mkdirs(dir);
1796
- return fs.writeFile(file, data, encoding);
1797
- }
1798
- function outputFileSync(file, ...args) {
1799
- const dir = path$3.dirname(file);
1800
- if (!fs.existsSync(dir)) mkdir.mkdirsSync(dir);
1801
- fs.writeFileSync(file, ...args);
1802
- }
1803
- module.exports = {
1804
- outputFile: u(outputFile),
1805
- outputFileSync
1806
- };
1807
- }));
1808
- //#endregion
1809
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json.js
1810
- var require_output_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1811
- const { stringify } = require_utils();
1812
- const { outputFile } = require_output_file();
1813
- async function outputJson(file, data, options = {}) {
1814
- await outputFile(file, stringify(data, options), options);
1815
- }
1816
- module.exports = outputJson;
1817
- }));
1818
- //#endregion
1819
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json-sync.js
1820
- var require_output_json_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1821
- const { stringify } = require_utils();
1822
- const { outputFileSync } = require_output_file();
1823
- function outputJsonSync(file, data, options) {
1824
- outputFileSync(file, stringify(data, options), options);
1825
- }
1826
- module.exports = outputJsonSync;
1827
- }));
1828
- //#endregion
1829
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/index.js
1830
- var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1831
- const u = require_universalify().fromPromise;
1832
- const jsonFile = require_jsonfile();
1833
- jsonFile.outputJson = u(require_output_json());
1834
- jsonFile.outputJsonSync = require_output_json_sync();
1835
- jsonFile.outputJSON = jsonFile.outputJson;
1836
- jsonFile.outputJSONSync = jsonFile.outputJsonSync;
1837
- jsonFile.writeJSON = jsonFile.writeJson;
1838
- jsonFile.writeJSONSync = jsonFile.writeJsonSync;
1839
- jsonFile.readJSON = jsonFile.readJson;
1840
- jsonFile.readJSONSync = jsonFile.readJsonSync;
1841
- module.exports = jsonFile;
1842
- }));
1843
- //#endregion
1844
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move.js
1845
- var require_move$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1846
- const fs = require_fs();
1847
- const path$2 = __require("path");
1848
- const { copy } = require_copy();
1849
- const { remove } = require_remove();
1850
- const { mkdirp } = require_mkdirs();
1851
- const { pathExists } = require_path_exists();
1852
- const stat = require_stat();
1853
- async function move(src, dest, opts = {}) {
1854
- const overwrite = opts.overwrite || opts.clobber || false;
1855
- const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
1856
- await stat.checkParentPaths(src, srcStat, dest, "move");
1857
- const destParent = path$2.dirname(dest);
1858
- if (path$2.parse(destParent).root !== destParent) await mkdirp(destParent);
1859
- return doRename(src, dest, overwrite, isChangingCase);
1860
- }
1861
- async function doRename(src, dest, overwrite, isChangingCase) {
1862
- if (!isChangingCase) {
1863
- if (overwrite) await remove(dest);
1864
- else if (await pathExists(dest)) throw new Error("dest already exists.");
1865
- }
1866
- try {
1867
- await fs.rename(src, dest);
1868
- } catch (err) {
1869
- if (err.code !== "EXDEV") throw err;
1870
- await moveAcrossDevice(src, dest, overwrite);
1871
- }
1872
- }
1873
- async function moveAcrossDevice(src, dest, overwrite) {
1874
- await copy(src, dest, {
1875
- overwrite,
1876
- errorOnExist: true,
1877
- preserveTimestamps: true
1878
- });
1879
- return remove(src);
1880
- }
1881
- module.exports = move;
1882
- }));
1883
- //#endregion
1884
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move-sync.js
1885
- var require_move_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1886
- const fs = require_graceful_fs();
1887
- const path$1 = __require("path");
1888
- const copySync = require_copy().copySync;
1889
- const removeSync = require_remove().removeSync;
1890
- const mkdirpSync = require_mkdirs().mkdirpSync;
1891
- const stat = require_stat();
1892
- function moveSync(src, dest, opts) {
1893
- opts = opts || {};
1894
- const overwrite = opts.overwrite || opts.clobber || false;
1895
- const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
1896
- stat.checkParentPathsSync(src, srcStat, dest, "move");
1897
- if (!isParentRoot(dest)) mkdirpSync(path$1.dirname(dest));
1898
- return doRename(src, dest, overwrite, isChangingCase);
1899
- }
1900
- function isParentRoot(dest) {
1901
- const parent = path$1.dirname(dest);
1902
- return path$1.parse(parent).root === parent;
1903
- }
1904
- function doRename(src, dest, overwrite, isChangingCase) {
1905
- if (isChangingCase) return rename(src, dest, overwrite);
1906
- if (overwrite) {
1907
- removeSync(dest);
1908
- return rename(src, dest, overwrite);
1909
- }
1910
- if (fs.existsSync(dest)) throw new Error("dest already exists.");
1911
- return rename(src, dest, overwrite);
1912
- }
1913
- function rename(src, dest, overwrite) {
1914
- try {
1915
- fs.renameSync(src, dest);
1916
- } catch (err) {
1917
- if (err.code !== "EXDEV") throw err;
1918
- return moveAcrossDevice(src, dest, overwrite);
1919
- }
1920
- }
1921
- function moveAcrossDevice(src, dest, overwrite) {
1922
- copySync(src, dest, {
1923
- overwrite,
1924
- errorOnExist: true,
1925
- preserveTimestamps: true
1926
- });
1927
- return removeSync(src);
1928
- }
1929
- module.exports = moveSync;
1930
- }));
1931
- //#endregion
1932
- //#region ../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/index.js
1933
- var require_move = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1934
- const u = require_universalify().fromPromise;
1935
- module.exports = {
1936
- move: u(require_move$1()),
1937
- moveSync: require_move_sync()
1938
- };
1939
- }));
1940
- //#endregion
1941
9
  //#region ../../node_modules/.pnpm/acorn@8.16.0/node_modules/acorn/dist/acorn.mjs
1942
- var import_lib = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
1943
- module.exports = {
1944
- ...require_fs(),
1945
- ...require_copy(),
1946
- ...require_empty(),
1947
- ...require_ensure(),
1948
- ...require_json(),
1949
- ...require_mkdirs(),
1950
- ...require_move(),
1951
- ...require_output_file(),
1952
- ...require_path_exists(),
1953
- ...require_remove()
1954
- };
1955
- })))(), 1);
1956
10
  var astralIdentifierCodes = [
1957
11
  509,
1958
12
  0,
@@ -5460,23 +3514,21 @@ var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
5460
3514
  var ecma11BinaryProperties = ecma10BinaryProperties;
5461
3515
  var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
5462
3516
  var ecma13BinaryProperties = ecma12BinaryProperties;
5463
- var ecma14BinaryProperties = ecma13BinaryProperties;
5464
3517
  var unicodeBinaryProperties = {
5465
3518
  9: ecma9BinaryProperties,
5466
3519
  10: ecma10BinaryProperties,
5467
3520
  11: ecma11BinaryProperties,
5468
3521
  12: ecma12BinaryProperties,
5469
3522
  13: ecma13BinaryProperties,
5470
- 14: ecma14BinaryProperties
3523
+ 14: ecma13BinaryProperties
5471
3524
  };
5472
- var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
5473
3525
  var unicodeBinaryPropertiesOfStrings = {
5474
3526
  9: "",
5475
3527
  10: "",
5476
3528
  11: "",
5477
3529
  12: "",
5478
3530
  13: "",
5479
- 14: ecma14BinaryPropertiesOfStrings
3531
+ 14: "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"
5480
3532
  };
5481
3533
  var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
5482
3534
  var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
@@ -5484,14 +3536,13 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
5484
3536
  var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
5485
3537
  var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
5486
3538
  var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
5487
- var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode;
5488
3539
  var unicodeScriptValues = {
5489
3540
  9: ecma9ScriptValues,
5490
3541
  10: ecma10ScriptValues,
5491
3542
  11: ecma11ScriptValues,
5492
3543
  12: ecma12ScriptValues,
5493
3544
  13: ecma13ScriptValues,
5494
- 14: ecma14ScriptValues
3545
+ 14: ecma13ScriptValues + " " + scriptValuesAddedInUnicode
5495
3546
  };
5496
3547
  var data = {};
5497
3548
  function buildUnicodeData(ecmaVersion) {
@@ -7033,6 +5084,12 @@ Parser.acorn = {
7033
5084
  lineBreakG,
7034
5085
  nonASCIIwhitespace
7035
5086
  };
5087
+ function parse$2(input, options) {
5088
+ return Parser.parse(input, options);
5089
+ }
5090
+ function tokenizer(input, options) {
5091
+ return Parser.tokenizer(input, options);
5092
+ }
7036
5093
  String.fromCharCode;
7037
5094
  const TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
7038
5095
  const JOIN_LEADING_SLASH_RE = /^\.?\//;
@@ -7313,11 +5370,11 @@ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
7313
5370
  const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
7314
5371
  const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
7315
5372
  const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
7316
- const normalize = function(path) {
5373
+ const normalize$1 = function(path) {
7317
5374
  if (path.length === 0) return ".";
7318
5375
  path = normalizeWindowsPath(path);
7319
5376
  const isUNCPath = path.match(_UNC_REGEX);
7320
- const isPathAbsolute = isAbsolute(path);
5377
+ const isPathAbsolute = isAbsolute$1(path);
7321
5378
  const trailingSeparator = path[path.length - 1] === "/";
7322
5379
  path = normalizeString(path, !isPathAbsolute);
7323
5380
  if (path.length === 0) {
@@ -7330,9 +5387,9 @@ const normalize = function(path) {
7330
5387
  if (!isPathAbsolute) return `//./${path}`;
7331
5388
  return `//${path}`;
7332
5389
  }
7333
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
5390
+ return isPathAbsolute && !isAbsolute$1(path) ? `/${path}` : path;
7334
5391
  };
7335
- const join = function(...segments) {
5392
+ const join$1 = function(...segments) {
7336
5393
  let path = "";
7337
5394
  for (const seg of segments) {
7338
5395
  if (!seg) continue;
@@ -7343,13 +5400,13 @@ const join = function(...segments) {
7343
5400
  else path += pathTrailing || segLeading ? seg : `/${seg}`;
7344
5401
  } else path += seg;
7345
5402
  }
7346
- return normalize(path);
5403
+ return normalize$1(path);
7347
5404
  };
7348
5405
  function cwd$1() {
7349
5406
  if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
7350
5407
  return "/";
7351
5408
  }
7352
- const resolve = function(...arguments_) {
5409
+ const resolve$2 = function(...arguments_) {
7353
5410
  arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
7354
5411
  let resolvedPath = "";
7355
5412
  let resolvedAbsolute = false;
@@ -7357,10 +5414,10 @@ const resolve = function(...arguments_) {
7357
5414
  const path = index >= 0 ? arguments_[index] : cwd$1();
7358
5415
  if (!path || path.length === 0) continue;
7359
5416
  resolvedPath = `${path}/${resolvedPath}`;
7360
- resolvedAbsolute = isAbsolute(path);
5417
+ resolvedAbsolute = isAbsolute$1(path);
7361
5418
  }
7362
5419
  resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
7363
- if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
5420
+ if (resolvedAbsolute && !isAbsolute$1(resolvedPath)) return `/${resolvedPath}`;
7364
5421
  return resolvedPath.length > 0 ? resolvedPath : ".";
7365
5422
  };
7366
5423
  function normalizeString(path, allowAboveRoot) {
@@ -7413,20 +5470,20 @@ function normalizeString(path, allowAboveRoot) {
7413
5470
  }
7414
5471
  return res;
7415
5472
  }
7416
- const isAbsolute = function(p) {
5473
+ const isAbsolute$1 = function(p) {
7417
5474
  return _IS_ABSOLUTE_RE.test(p);
7418
5475
  };
7419
5476
  const toNamespacedPath = function(p) {
7420
5477
  return normalizeWindowsPath(p);
7421
5478
  };
7422
- const extname$1 = function(p) {
5479
+ const extname$2 = function(p) {
7423
5480
  if (p === "..") return "";
7424
5481
  const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
7425
5482
  return match && match[1] || "";
7426
5483
  };
7427
- const relative = function(from, to) {
7428
- const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
7429
- const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
5484
+ const relative$1 = function(from, to) {
5485
+ const _from = resolve$2(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
5486
+ const _to = resolve$2(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
7430
5487
  if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
7431
5488
  const _fromCopy = [..._from];
7432
5489
  for (const segment of _fromCopy) {
@@ -7436,10 +5493,10 @@ const relative = function(from, to) {
7436
5493
  }
7437
5494
  return [..._from.map(() => ".."), ..._to].join("/");
7438
5495
  };
7439
- const dirname = function(p) {
5496
+ const dirname$1 = function(p) {
7440
5497
  const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
7441
5498
  if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
7442
- return segments.join("/") || (isAbsolute(p) ? "/" : ".");
5499
+ return segments.join("/") || (isAbsolute$1(p) ? "/" : ".");
7443
5500
  };
7444
5501
  const format$1 = function(p) {
7445
5502
  const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
@@ -7448,9 +5505,9 @@ const format$1 = function(p) {
7448
5505
  p.dir,
7449
5506
  p.base ?? (p.name ?? "") + ext
7450
5507
  ].filter(Boolean);
7451
- return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
5508
+ return normalizeWindowsPath(p.root ? resolve$2(...segments) : segments.join("/"));
7452
5509
  };
7453
- const basename = function(p, extension) {
5510
+ const basename$1 = function(p, extension) {
7454
5511
  const segments = normalizeWindowsPath(p).split("/");
7455
5512
  let lastSegment = "";
7456
5513
  for (let i = segments.length - 1; i >= 0; i--) {
@@ -7464,33 +5521,33 @@ const basename = function(p, extension) {
7464
5521
  };
7465
5522
  const parse$1 = function(p) {
7466
5523
  const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
7467
- const base = basename(p);
7468
- const extension = extname$1(base);
5524
+ const base = basename$1(p);
5525
+ const extension = extname$2(base);
7469
5526
  return {
7470
5527
  root,
7471
- dir: dirname(p),
5528
+ dir: dirname$1(p),
7472
5529
  base,
7473
5530
  ext: extension,
7474
5531
  name: base.slice(0, base.length - extension.length)
7475
5532
  };
7476
5533
  };
7477
5534
  const matchesGlob = (path, pattern) => {
7478
- return zeptomatch(pattern, normalize(path));
5535
+ return zeptomatch(pattern, normalize$1(path));
7479
5536
  };
7480
5537
  const _path = {
7481
5538
  __proto__: null,
7482
- basename,
7483
- dirname,
7484
- extname: extname$1,
5539
+ basename: basename$1,
5540
+ dirname: dirname$1,
5541
+ extname: extname$2,
7485
5542
  format: format$1,
7486
- isAbsolute,
7487
- join,
5543
+ isAbsolute: isAbsolute$1,
5544
+ join: join$1,
7488
5545
  matchesGlob,
7489
- normalize,
5546
+ normalize: normalize$1,
7490
5547
  normalizeString,
7491
5548
  parse: parse$1,
7492
- relative,
7493
- resolve,
5549
+ relative: relative$1,
5550
+ resolve: resolve$2,
7494
5551
  sep: "/",
7495
5552
  toNamespacedPath
7496
5553
  };
@@ -7505,18 +5562,39 @@ const mix = (del = delimiter) => {
7505
5562
  return new Proxy(_path, { get(_, prop) {
7506
5563
  if (prop === "delimiter") return del;
7507
5564
  if (prop === "posix") return posix;
7508
- if (prop === "win32") return win32;
5565
+ if (prop === "win32") return win32$1;
7509
5566
  return _platforms[prop] || _path[prop];
7510
5567
  } });
7511
5568
  };
7512
5569
  const posix = /* @__PURE__ */ mix(":");
7513
- const win32 = /* @__PURE__ */ mix(";");
5570
+ const win32$1 = /* @__PURE__ */ mix(";");
7514
5571
  //#endregion
7515
5572
  //#region ../../node_modules/.pnpm/mlly@1.8.2/node_modules/mlly/dist/index.mjs
7516
5573
  const BUILTIN_MODULES = new Set(builtinModules);
7517
5574
  function normalizeSlash(path) {
7518
5575
  return path.replace(/\\/g, "/");
7519
5576
  }
5577
+ function matchAll(regex, string, addition) {
5578
+ const matches = [];
5579
+ for (const match of string.matchAll(regex)) matches.push({
5580
+ ...addition,
5581
+ ...match.groups,
5582
+ code: match[0],
5583
+ start: match.index,
5584
+ end: (match.index || 0) + match[0].length
5585
+ });
5586
+ return matches;
5587
+ }
5588
+ function clearImports(imports) {
5589
+ return (imports || "").replace(/\/\/[^\n]*\n|\/\*.*\*\//g, "").replace(/\s+/g, " ");
5590
+ }
5591
+ function getImportNames(cleanedImports) {
5592
+ const topLevelImports = cleanedImports.replace(/{[^}]*}/, "");
5593
+ return {
5594
+ namespacedImport: topLevelImports.match(/\* as \s*(\S*)/)?.[1],
5595
+ defaultImport: topLevelImports.split(",").find((index) => !/[*{}]/.test(index))?.trim() || void 0
5596
+ };
5597
+ }
7520
5598
  /**
7521
5599
  * @typedef ErrnoExceptionFields
7522
5600
  * @property {number | undefined} [errnode]
@@ -7760,6 +5838,7 @@ function makeNodeErrorWithCode(Base, key) {
7760
5838
  configurable: true
7761
5839
  },
7762
5840
  toString: {
5841
+ /** @this {Error} */
7763
5842
  value() {
7764
5843
  return `${this.name} [${key}]: ${this.message}`;
7765
5844
  },
@@ -7987,7 +6066,7 @@ function getDataProtocolModuleFormat(parsed) {
7987
6066
  * @param {URL} url
7988
6067
  * @returns {string}
7989
6068
  */
7990
- function extname(url) {
6069
+ function extname$1(url) {
7991
6070
  const pathname = url.pathname;
7992
6071
  let index = pathname.length;
7993
6072
  while (index--) {
@@ -8001,7 +6080,7 @@ function extname(url) {
8001
6080
  * @type {ProtocolHandler}
8002
6081
  */
8003
6082
  function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
8004
- const value = extname(url);
6083
+ const value = extname$1(url);
8005
6084
  if (value === ".js") {
8006
6085
  const packageType = getPackageType(url);
8007
6086
  if (packageType !== "none") return packageType;
@@ -8625,6 +6704,9 @@ function normalizeid(id) {
8625
6704
  if (BUILTIN_MODULES.has(id)) return "node:" + id;
8626
6705
  return "file://" + encodeURI(normalizeSlash(id));
8627
6706
  }
6707
+ async function loadURL(url) {
6708
+ return await promises.readFile(fileURLToPath$1(url), "utf8");
6709
+ }
8628
6710
  const DEFAULT_CONDITIONS_SET = /* @__PURE__ */ new Set(["node", "import"]);
8629
6711
  const DEFAULT_EXTENSIONS = [
8630
6712
  ".mjs",
@@ -8651,7 +6733,7 @@ function _resolve(id, options = {}) {
8651
6733
  if (/(?:node|data|http|https):/.test(id)) return id;
8652
6734
  if (BUILTIN_MODULES.has(id)) return "node:" + id;
8653
6735
  if (id.startsWith("file://")) id = fileURLToPath$1(id);
8654
- if (isAbsolute(id)) try {
6736
+ if (isAbsolute$1(id)) try {
8655
6737
  if (statSync(id).isFile()) return pathToFileURL$1(id);
8656
6738
  } catch (error) {
8657
6739
  if (error?.code !== "ENOENT") throw error;
@@ -8684,247 +6766,234 @@ function _resolve(id, options = {}) {
8684
6766
  function resolveSync(id, options) {
8685
6767
  return _resolve(id, options);
8686
6768
  }
6769
+ function resolve$1(id, options) {
6770
+ try {
6771
+ return Promise.resolve(resolveSync(id, options));
6772
+ } catch (error) {
6773
+ return Promise.reject(error);
6774
+ }
6775
+ }
8687
6776
  function resolvePathSync(id, options) {
8688
6777
  return fileURLToPath$1(resolveSync(id, options));
8689
6778
  }
8690
- //#endregion
8691
- //#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
8692
- function isPlainObject(value) {
8693
- if (value === null || typeof value !== "object") return false;
8694
- const prototype = Object.getPrototypeOf(value);
8695
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
8696
- if (Symbol.iterator in value) return false;
8697
- if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
8698
- return true;
6779
+ function resolvePath(id, options) {
6780
+ try {
6781
+ return Promise.resolve(resolvePathSync(id, options));
6782
+ } catch (error) {
6783
+ return Promise.reject(error);
6784
+ }
8699
6785
  }
8700
- function _defu(baseObject, defaults, namespace = ".", merger) {
8701
- if (!isPlainObject(defaults)) return _defu(baseObject, {}, namespace, merger);
8702
- const object = { ...defaults };
8703
- for (const key of Object.keys(baseObject)) {
8704
- if (key === "__proto__" || key === "constructor") continue;
8705
- const value = baseObject[key];
8706
- if (value === null || value === void 0) continue;
8707
- if (merger && merger(object, key, value, namespace)) continue;
8708
- if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
8709
- else if (isPlainObject(value) && isPlainObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
8710
- else object[key] = value;
8711
- }
8712
- return object;
6786
+ const ESM_STATIC_IMPORT_RE = /(?<=\s|^|;|\})import\s*(?:[\s"']*(?<imports>[\p{L}\p{M}\w\t\n\r $*,/{}@.]+)from\s*)?["']\s*(?<specifier>(?<="\s*)[^"]*[^\s"](?=\s*")|(?<='\s*)[^']*[^\s'](?=\s*'))\s*["'][\s;]*/gmu;
6787
+ const EXPORT_DECAL_RE = /\bexport\s+(?<declaration>(?:async function\s*\*?|function\s*\*?|let|const enum|const|enum|var|class))\s+\*?(?<name>[\w$]+)(?<extraNames>.*,\s*[\s\w:[\]{}]*[\w$\]}]+)*/g;
6788
+ const EXPORT_DECAL_TYPE_RE = /\bexport\s+(?<declaration>(?:interface|type|declare (?:async function|function|let|const enum|const|enum|var|class)))\s+(?<name>[\w$]+)/g;
6789
+ const EXPORT_NAMED_RE = /\bexport\s*{(?<exports>[^}]+?)[\s,]*}(?:\s*from\s*["']\s*(?<specifier>(?<="\s*)[^"]*[^\s"](?=\s*")|(?<='\s*)[^']*[^\s'](?=\s*'))\s*["'][^\n;]*)?/g;
6790
+ const EXPORT_NAMED_TYPE_RE = /\bexport\s+type\s*{(?<exports>[^}]+?)[\s,]*}(?:\s*from\s*["']\s*(?<specifier>(?<="\s*)[^"]*[^\s"](?=\s*")|(?<='\s*)[^']*[^\s'](?=\s*'))\s*["'][^\n;]*)?/g;
6791
+ const EXPORT_NAMED_DESTRUCT = /\bexport\s+(?:let|var|const)\s+(?:{(?<exports1>[^}]+?)[\s,]*}|\[(?<exports2>[^\]]+?)[\s,]*])\s+=/gm;
6792
+ const EXPORT_STAR_RE = /\bexport\s*\*(?:\s*as\s+(?<name>[\w$]+)\s+)?\s*(?:\s*from\s*["']\s*(?<specifier>(?<="\s*)[^"]*[^\s"](?=\s*")|(?<='\s*)[^']*[^\s'](?=\s*'))\s*["'][^\n;]*)?/g;
6793
+ const EXPORT_DEFAULT_RE = /\bexport\s+default\s+(async function|function|class|true|false|\W|\d)|\bexport\s+default\s+(?<defaultName>.*)/g;
6794
+ const EXPORT_DEFAULT_CLASS_RE = /\bexport\s+default\s+(?<declaration>class)\s+(?<name>[\w$]+)/g;
6795
+ const TYPE_RE = /^\s*?type\s/;
6796
+ function findStaticImports(code) {
6797
+ return _filterStatement(_tryGetLocations(code, "import"), matchAll(ESM_STATIC_IMPORT_RE, code, { type: "static" }));
8713
6798
  }
8714
- function createDefu(merger) {
8715
- return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
6799
+ function parseStaticImport(matched) {
6800
+ const cleanedImports = clearImports(matched.imports);
6801
+ const namedImports = {};
6802
+ const _matches = cleanedImports.match(/{([^}]*)}/)?.[1]?.split(",") || [];
6803
+ for (const namedImport of _matches) {
6804
+ const _match = namedImport.match(/^\s*(\S*) as (\S*)\s*$/);
6805
+ const source = _match?.[1] || namedImport.trim();
6806
+ const importName = _match?.[2] || source;
6807
+ if (source && !TYPE_RE.test(source)) namedImports[source] = importName;
6808
+ }
6809
+ const { namespacedImport, defaultImport } = getImportNames(cleanedImports);
6810
+ return {
6811
+ ...matched,
6812
+ defaultImport,
6813
+ namespacedImport,
6814
+ namedImports
6815
+ };
8716
6816
  }
8717
- const defu = createDefu();
8718
- createDefu((object, key, currentValue) => {
8719
- if (object[key] !== void 0 && typeof currentValue === "function") {
8720
- object[key] = currentValue(object[key]);
8721
- return true;
8722
- }
8723
- });
8724
- createDefu((object, key, currentValue) => {
8725
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
8726
- object[key] = currentValue(object[key]);
8727
- return true;
6817
+ function _extractExtraNames(extraNamesStr) {
6818
+ const names = [];
6819
+ let depth = 0;
6820
+ let angleDepth = 0;
6821
+ let inString = false;
6822
+ let inTypeAnnotation = false;
6823
+ for (let i = 0; i < extraNamesStr.length; i++) {
6824
+ const char = extraNamesStr[i];
6825
+ if (inString) {
6826
+ if (char === inString) {
6827
+ let backslashCount = 0;
6828
+ for (let j = i - 1; j >= 0 && extraNamesStr[j] === "\\"; j--) backslashCount++;
6829
+ if (backslashCount % 2 === 0) inString = false;
6830
+ }
6831
+ continue;
6832
+ }
6833
+ if (char === "\"" || char === "'" || char === "`") {
6834
+ inString = char;
6835
+ continue;
6836
+ }
6837
+ if (char === ":" && depth === 0 && angleDepth === 0) {
6838
+ inTypeAnnotation = true;
6839
+ continue;
6840
+ }
6841
+ if (char === "=" && extraNamesStr[i + 1] !== ">" && depth === 0 && angleDepth === 0) inTypeAnnotation = false;
6842
+ if (inTypeAnnotation && char === "<") {
6843
+ angleDepth++;
6844
+ continue;
6845
+ }
6846
+ if (!inTypeAnnotation && char === "<" && depth === 0 && i > 0 && _isIdentifierBeforeAngleBracket(extraNamesStr, i)) {
6847
+ angleDepth++;
6848
+ continue;
6849
+ }
6850
+ if (char === ">" && angleDepth > 0 && extraNamesStr[i - 1] !== "=") {
6851
+ angleDepth--;
6852
+ continue;
6853
+ }
6854
+ if (char === "(" || char === "[" || char === "{") depth++;
6855
+ else if (char === ")" || char === "]" || char === "}") depth--;
6856
+ if (char === "," && depth === 0 && angleDepth === 0) {
6857
+ const match = extraNamesStr.slice(i + 1).match(/^\s*([\w$]+)/);
6858
+ if (match) names.push(match[1]);
6859
+ }
8728
6860
  }
8729
- });
8730
- //#endregion
8731
- //#region src/modules/components.ts
8732
- function componentsResolver(options = {}) {
8733
- const { dirs = ["src/components"] } = options;
8734
- const files = fg.sync(dirs.map((c) => `${c}/**/*.(t|j)sx`), {
8735
- ignore: ["node_modules"],
8736
- onlyFiles: true,
8737
- cwd: cwd(),
8738
- absolute: true
6861
+ return names;
6862
+ }
6863
+ function findExports(code) {
6864
+ const declaredExports = matchAll(EXPORT_DECAL_RE, code, { type: "declaration" });
6865
+ for (const declaredExport of declaredExports) {
6866
+ if (/^export\s+(?:async\s+)?function/.test(declaredExport.code)) continue;
6867
+ const extraNamesStr = declaredExport.extraNames;
6868
+ if (extraNamesStr) {
6869
+ const extraNames = _extractExtraNames(extraNamesStr);
6870
+ if (extraNames.length > 0) declaredExport.names = [declaredExport.name, ...extraNames];
6871
+ }
6872
+ delete declaredExport.extraNames;
6873
+ }
6874
+ const namedExports = normalizeNamedExports(matchAll(EXPORT_NAMED_RE, code, { type: "named" }));
6875
+ const destructuredExports = matchAll(EXPORT_NAMED_DESTRUCT, code, { type: "named" });
6876
+ for (const namedExport of destructuredExports) {
6877
+ namedExport.exports = namedExport.exports1 || namedExport.exports2;
6878
+ namedExport.names = namedExport.exports.replace(/^\r?\n?/, "").split(/\s*,\s*/g).filter((name) => !TYPE_RE.test(name)).map((name) => name.replace(/^.*?\s*:\s*/, "").replace(/\s*=\s*.*$/, "").trim());
6879
+ }
6880
+ const defaultExport = matchAll(EXPORT_DEFAULT_RE, code, {
6881
+ type: "default",
6882
+ name: "default"
8739
6883
  });
8740
- const imports = {};
8741
- files.forEach((componentPath) => {
8742
- let componentName = componentPath.replace(/\/index\.(t|j)sx$/, "").replace(/\.(t|j)sx$/, "");
8743
- for (const dir of dirs) componentName = componentName.replace(dir, "");
8744
- componentName = pascalCase(componentName.replace(/\//g, "-"));
8745
- imports[componentPath] = [["default", componentName]];
6884
+ const defaultClassExports = matchAll(EXPORT_DEFAULT_CLASS_RE, code, { type: "declaration" });
6885
+ const starExports = matchAll(EXPORT_STAR_RE, code, { type: "star" });
6886
+ const exports$1 = normalizeExports([
6887
+ ...declaredExports,
6888
+ ...namedExports,
6889
+ ...destructuredExports,
6890
+ ...defaultExport,
6891
+ ...defaultClassExports,
6892
+ ...starExports
6893
+ ]);
6894
+ if (exports$1.length === 0) return [];
6895
+ const exportLocations = _tryGetLocations(code, "export");
6896
+ if (exportLocations && exportLocations.length === 0) return [];
6897
+ return _filterStatement(exportLocations, exports$1).filter((exp, index, exports2) => {
6898
+ const nextExport = exports2[index + 1];
6899
+ return !nextExport || exp.type !== nextExport.type || !exp.name || exp.name !== nextExport.name;
8746
6900
  });
8747
- return imports;
8748
6901
  }
8749
- //#endregion
8750
- //#region src/modules/route-block.ts
8751
- const routeJSXReg = /^\s+(route)\s+/gm;
8752
- function parseJSX(code) {
8753
- return extractComments(code).slice(0, 1).filter((comment) => routeJSXReg.test(comment.value) && comment.value.includes(":") && comment.loc.start.line === 1);
6902
+ function findTypeExports(code) {
6903
+ const declaredExports = matchAll(EXPORT_DECAL_TYPE_RE, code, { type: "declaration" });
6904
+ const namedExports = normalizeNamedExports(matchAll(EXPORT_NAMED_TYPE_RE, code, { type: "named" }));
6905
+ const exports$1 = normalizeExports([...declaredExports, ...namedExports]);
6906
+ if (exports$1.length === 0) return [];
6907
+ const exportLocations = _tryGetLocations(code, "export");
6908
+ if (exportLocations && exportLocations.length === 0) return [];
6909
+ return _filterStatement(exportLocations, exports$1).filter((exp, index, exports2) => {
6910
+ const nextExport = exports2[index + 1];
6911
+ return !nextExport || exp.type !== nextExport.type || !exp.name || exp.name !== nextExport.name;
6912
+ });
8754
6913
  }
8755
- function parseYamlComment(code, path) {
8756
- return code.reduce((memo, item) => {
8757
- const { value } = item;
8758
- const v = value.replace(routeJSXReg, "");
8759
- try {
8760
- const yamlResult = parse(v);
8761
- return {
8762
- ...memo,
8763
- ...yamlResult
8764
- };
8765
- } catch (err) {
8766
- throw new Error(`Invalid YAML format of comment in ${path}\n${err.message}`);
6914
+ function normalizeExports(exports$1) {
6915
+ for (const exp of exports$1) {
6916
+ if (!exp.name && exp.names && exp.names.length === 1) exp.name = exp.names[0];
6917
+ if (exp.name === "default" && exp.type !== "default") {
6918
+ exp._type = exp.type;
6919
+ exp.type = "default";
8767
6920
  }
8768
- }, {});
8769
- }
8770
- function getRouteBlock(path) {
8771
- return parseYamlComment(parseJSX(import_lib.default.readFileSync(path, "utf-8")), path);
6921
+ if (!exp.names && exp.name) exp.names = [exp.name];
6922
+ if (exp.type === "declaration" && exp.declaration) exp.declarationType = exp.declaration.replace(/^declare\s*/, "");
6923
+ }
6924
+ return exports$1;
8772
6925
  }
8773
- function extendRoute(route) {
8774
- if (!route.element) return;
8775
- const block = getRouteBlock(route.element.startsWith("/") ? route.element.slice(1) : route.element);
8776
- return {
8777
- ...route,
8778
- ...block
8779
- };
6926
+ function normalizeNamedExports(namedExports) {
6927
+ for (const namedExport of namedExports) namedExport.names = namedExport.exports.replace(/^\r?\n?/, "").split(/\s*,\s*/g).filter((name) => !TYPE_RE.test(name)).map((name) => name.replace(/^.*?\sas\s/, "").trim());
6928
+ return namedExports;
8780
6929
  }
8781
- var preset_react_default = defineVixtModule({
8782
- meta: { name: "vixt:preset-react" },
8783
- setup(_, vixt) {
8784
- const { components = [], constants = [], hooks = [], layouts = [], pages = [], stores = [], utils = [] } = resolveLayersDirs([...vixt._layers].reverse());
8785
- const { buildTypesDir } = vixt.options;
8786
- const defaultOptions = {
8787
- react: {},
8788
- pages: {
8789
- dirs: pages,
8790
- extendRoute
8791
- },
8792
- layouts: {
8793
- layoutsDirs: layouts,
8794
- pagesDirs: pages,
8795
- extensions: ["jsx", "tsx"],
8796
- importMode: () => "sync"
8797
- },
8798
- imports: {
8799
- imports: [
8800
- "react",
8801
- "react-router",
8802
- "ahooks",
8803
- componentsResolver({ dirs: components }),
8804
- VixtClientAutoImports
8805
- ],
8806
- dts: `${buildTypesDir}/auto-imports.d.ts`,
8807
- dirs: [
8808
- constants,
8809
- hooks,
8810
- stores,
8811
- utils
8812
- ].flat()
8813
- },
8814
- unocss: {}
8815
- };
8816
- const options = vixt.options = defu(vixt.options, defaultOptions);
8817
- return [
8818
- UnoCSS(options.unocss),
8819
- React(options.react),
8820
- Pages(options.pages),
8821
- Layouts(options.layouts),
8822
- AutoImport(options.imports)
8823
- ];
8824
- }
8825
- });
8826
- //#endregion
8827
- //#region src/modules/virtual-root-component.ts
8828
- function resolveRootComponent(vixt) {
8829
- for (const layer of vixt._layers) {
8830
- const layerRootComponentPath = posix.resolve(layer.config.srcDir, "App.tsx");
8831
- const layerRootComponentCode = import_lib.default.existsSync(layerRootComponentPath) && import_lib.default.readFileSync(layerRootComponentPath, "utf-8") || "";
8832
- if (!isEmptyCode(layerRootComponentCode)) return {
8833
- path: layerRootComponentPath,
8834
- code: layerRootComponentCode
8835
- };
6930
+ async function resolveModuleExportNames(id, options) {
6931
+ const url = await resolvePath(id, options);
6932
+ const exports$1 = findExports(await loadURL(url));
6933
+ const exportNames = new Set(exports$1.flatMap((exp) => exp.names).filter(Boolean));
6934
+ for (const exp of exports$1) {
6935
+ if (exp.type !== "star" || !exp.specifier) continue;
6936
+ const subExports = await resolveModuleExportNames(exp.specifier, {
6937
+ ...options,
6938
+ url
6939
+ });
6940
+ for (const subExport of subExports) exportNames.add(subExport);
8836
6941
  }
8837
- const defaultRootComponentPath = resolvePathSync("@vixt/react/client/App");
8838
- return {
8839
- path: defaultRootComponentPath,
8840
- code: import_lib.default.readFileSync(defaultRootComponentPath, "utf-8")
8841
- };
6942
+ return [...exportNames];
6943
+ }
6944
+ function _filterStatement(locations, statements) {
6945
+ return statements.filter((exp) => {
6946
+ return !locations || locations.some((location) => {
6947
+ return exp.start <= location.start && exp.end >= location.end;
6948
+ });
6949
+ });
8842
6950
  }
8843
- function isEmptyCode(code) {
8844
- if (!code) return true;
6951
+ function _tryGetLocations(code, label) {
8845
6952
  try {
8846
- return !parseAst(code, { jsx: true }).body.length;
8847
- } catch {
8848
- return false;
8849
- }
6953
+ return _getLocations(code, label);
6954
+ } catch {}
6955
+ }
6956
+ function _getLocations(code, label) {
6957
+ const tokens = tokenizer(code, {
6958
+ ecmaVersion: "latest",
6959
+ sourceType: "module",
6960
+ allowHashBang: true,
6961
+ allowAwaitOutsideFunction: true,
6962
+ allowImportExportEverywhere: true
6963
+ });
6964
+ const locations = [];
6965
+ for (const token of tokens) if (token.type.label === label) locations.push({
6966
+ start: token.start,
6967
+ end: token.end
6968
+ });
6969
+ return locations;
6970
+ }
6971
+ function _isIdentifierBeforeAngleBracket(str, i) {
6972
+ let j = i - 1;
6973
+ while (j >= 0 && /[A-Za-z0-9_$]/.test(str[j])) j--;
6974
+ const wordStart = j + 1;
6975
+ return wordStart < i && /[A-Za-z_$]/.test(str[wordStart]);
6976
+ }
6977
+ const ESM_RE = /(?:[\s;]|^)(?:import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m;
6978
+ const CJS_RE = /(?:[\s;]|^)(?:module\.exports\b|exports\.\w|require\s*\(|global\.\w)/m;
6979
+ const COMMENT_RE = /\/\*.+?\*\/|\/\/.*(?=[nr])/g;
6980
+ function hasESMSyntax(code, opts = {}) {
6981
+ if (opts.stripComments) code = code.replace(COMMENT_RE, "");
6982
+ return ESM_RE.test(code);
6983
+ }
6984
+ function hasCJSSyntax(code, opts = {}) {
6985
+ if (opts.stripComments) code = code.replace(COMMENT_RE, "");
6986
+ return CJS_RE.test(code);
6987
+ }
6988
+ function detectSyntax(code, opts = {}) {
6989
+ if (opts.stripComments) code = code.replace(COMMENT_RE, "");
6990
+ const hasESM = hasESMSyntax(code, {});
6991
+ const hasCJS = hasCJSSyntax(code, {});
6992
+ return {
6993
+ hasESM,
6994
+ hasCJS,
6995
+ isMixed: hasESM && hasCJS
6996
+ };
8850
6997
  }
8851
- const name$1 = "virtual:vixt:root-component.tsx";
8852
- var virtual_root_component_default = defineVixtModule({
8853
- meta: { name: name$1 },
8854
- setup(_, vixt) {
8855
- return {
8856
- name: name$1,
8857
- resolveId(id) {
8858
- if (id === name$1) return name$1;
8859
- },
8860
- load(id) {
8861
- if (id === name$1) {
8862
- const { path, code } = resolveRootComponent(vixt);
8863
- this.addWatchFile(path);
8864
- return code;
8865
- }
8866
- }
8867
- };
8868
- }
8869
- });
8870
- //#endregion
8871
- //#region src/modules/virtual-setup-layouts.ts
8872
- const name = "virtual:vixt:setup-layouts";
8873
- const virtualModuleId = name;
8874
- const resolvedVirtualModuleId = `\0${virtualModuleId}`;
8875
- //#endregion
8876
- //#region src/index.ts
8877
- var src_default = createVixtPlugin({ defaults: {
8878
- modules: [
8879
- preset_react_default,
8880
- virtual_root_component_default,
8881
- defineVixtModule({
8882
- meta: { name },
8883
- setup(_, vixt) {
8884
- return {
8885
- name,
8886
- resolveId(id) {
8887
- if (id === virtualModuleId) return resolvedVirtualModuleId;
8888
- },
8889
- load(id) {
8890
- if (id === resolvedVirtualModuleId) {
8891
- const { defaultLayout = "default" } = vixt.options.layouts ?? {};
8892
- return `import { createElement } from 'react'
8893
- import { layouts } from 'virtual:generated-layouts'
8894
-
8895
- export function setupLayouts(routes) {
8896
- return routes.map(route => {
8897
- if (route.children?.length > 0) {
8898
- route.children = setupLayouts(route.children)
8899
- }
8900
- if(route.element && route.meta?.layout !== false) {
8901
- return {
8902
- path: route.path,
8903
- element: createElement(layouts[route.meta?.layout ?? '${defaultLayout}']),
8904
- children: [{ ...route, path: '' }]
8905
- }
8906
- }
8907
- return route
8908
- });
8909
- }`;
8910
- }
8911
- }
8912
- };
8913
- }
8914
- })
8915
- ],
8916
- app: {
8917
- entryFile: "main.tsx",
8918
- entryCode: import_lib.default.readFileSync(resolvePathSync("@vixt/react/client/entry"), "utf-8"),
8919
- head: { meta: [{ charset: "utf-8" }, {
8920
- name: "viewport",
8921
- content: "width=device-width, initial-scale=1.0"
8922
- }] }
8923
- },
8924
- typescript: { tsConfig: { compilerOptions: {
8925
- jsxImportSource: "react",
8926
- types: ["@vixt/react/types", "vite-plugin-pages/client-react"]
8927
- } } }
8928
- } });
8929
6998
  //#endregion
8930
- export { src_default as default };
6999
+ export { resolve$2 as _, parseStaticImport as a, resolvePathSync as c, dirname$1 as d, isAbsolute$1 as f, relative$1 as g, parse$1 as h, findTypeExports as i, posix as l, normalize$1 as m, findExports as n, resolve$1 as o, join$1 as p, findStaticImports as r, resolveModuleExportNames as s, detectSyntax as t, basename$1 as u, Parser as v, parse$2 as y };