react-router-hono-server 2.17.0-next.1 → 2.17.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.
package/dist/dev.js CHANGED
@@ -1,1804 +1,9 @@
1
- import {
2
- getRequestListener
3
- } from "./chunk-OKB2FS67.js";
4
- import {
5
- __commonJS,
6
- __toESM
7
- } from "./chunk-JSBRDJBE.js";
8
-
9
- // node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
10
- var require_balanced_match = __commonJS({
11
- "node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module) {
12
- "use strict";
13
- module.exports = balanced;
14
- function balanced(a, b, str) {
15
- if (a instanceof RegExp) a = maybeMatch(a, str);
16
- if (b instanceof RegExp) b = maybeMatch(b, str);
17
- var r = range(a, b, str);
18
- return r && {
19
- start: r[0],
20
- end: r[1],
21
- pre: str.slice(0, r[0]),
22
- body: str.slice(r[0] + a.length, r[1]),
23
- post: str.slice(r[1] + b.length)
24
- };
25
- }
26
- function maybeMatch(reg, str) {
27
- var m = str.match(reg);
28
- return m ? m[0] : null;
29
- }
30
- balanced.range = range;
31
- function range(a, b, str) {
32
- var begs, beg, left, right, result;
33
- var ai = str.indexOf(a);
34
- var bi = str.indexOf(b, ai + 1);
35
- var i = ai;
36
- if (ai >= 0 && bi > 0) {
37
- if (a === b) {
38
- return [ai, bi];
39
- }
40
- begs = [];
41
- left = str.length;
42
- while (i >= 0 && !result) {
43
- if (i == ai) {
44
- begs.push(i);
45
- ai = str.indexOf(a, i + 1);
46
- } else if (begs.length == 1) {
47
- result = [begs.pop(), bi];
48
- } else {
49
- beg = begs.pop();
50
- if (beg < left) {
51
- left = beg;
52
- right = bi;
53
- }
54
- bi = str.indexOf(b, i + 1);
55
- }
56
- i = ai < bi && ai >= 0 ? ai : bi;
57
- }
58
- if (begs.length) {
59
- result = [left, right];
60
- }
61
- }
62
- return result;
63
- }
64
- }
65
- });
66
-
67
- // node_modules/.pnpm/brace-expansion@2.0.2/node_modules/brace-expansion/index.js
68
- var require_brace_expansion = __commonJS({
69
- "node_modules/.pnpm/brace-expansion@2.0.2/node_modules/brace-expansion/index.js"(exports, module) {
70
- "use strict";
71
- var balanced = require_balanced_match();
72
- module.exports = expandTop;
73
- var escSlash = "\0SLASH" + Math.random() + "\0";
74
- var escOpen = "\0OPEN" + Math.random() + "\0";
75
- var escClose = "\0CLOSE" + Math.random() + "\0";
76
- var escComma = "\0COMMA" + Math.random() + "\0";
77
- var escPeriod = "\0PERIOD" + Math.random() + "\0";
78
- function numeric(str) {
79
- return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
80
- }
81
- function escapeBraces(str) {
82
- return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
83
- }
84
- function unescapeBraces(str) {
85
- return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
86
- }
87
- function parseCommaParts(str) {
88
- if (!str)
89
- return [""];
90
- var parts = [];
91
- var m = balanced("{", "}", str);
92
- if (!m)
93
- return str.split(",");
94
- var pre = m.pre;
95
- var body = m.body;
96
- var post = m.post;
97
- var p = pre.split(",");
98
- p[p.length - 1] += "{" + body + "}";
99
- var postParts = parseCommaParts(post);
100
- if (post.length) {
101
- p[p.length - 1] += postParts.shift();
102
- p.push.apply(p, postParts);
103
- }
104
- parts.push.apply(parts, p);
105
- return parts;
106
- }
107
- function expandTop(str) {
108
- if (!str)
109
- return [];
110
- if (str.substr(0, 2) === "{}") {
111
- str = "\\{\\}" + str.substr(2);
112
- }
113
- return expand2(escapeBraces(str), true).map(unescapeBraces);
114
- }
115
- function embrace(str) {
116
- return "{" + str + "}";
117
- }
118
- function isPadded(el) {
119
- return /^-?0\d/.test(el);
120
- }
121
- function lte(i, y) {
122
- return i <= y;
123
- }
124
- function gte(i, y) {
125
- return i >= y;
126
- }
127
- function expand2(str, isTop) {
128
- var expansions = [];
129
- var m = balanced("{", "}", str);
130
- if (!m) return [str];
131
- var pre = m.pre;
132
- var post = m.post.length ? expand2(m.post, false) : [""];
133
- if (/\$$/.test(m.pre)) {
134
- for (var k = 0; k < post.length; k++) {
135
- var expansion = pre + "{" + m.body + "}" + post[k];
136
- expansions.push(expansion);
137
- }
138
- } else {
139
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
140
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
141
- var isSequence = isNumericSequence || isAlphaSequence;
142
- var isOptions = m.body.indexOf(",") >= 0;
143
- if (!isSequence && !isOptions) {
144
- if (m.post.match(/,(?!,).*\}/)) {
145
- str = m.pre + "{" + m.body + escClose + m.post;
146
- return expand2(str);
147
- }
148
- return [str];
149
- }
150
- var n;
151
- if (isSequence) {
152
- n = m.body.split(/\.\./);
153
- } else {
154
- n = parseCommaParts(m.body);
155
- if (n.length === 1) {
156
- n = expand2(n[0], false).map(embrace);
157
- if (n.length === 1) {
158
- return post.map(function(p) {
159
- return m.pre + n[0] + p;
160
- });
161
- }
162
- }
163
- }
164
- var N;
165
- if (isSequence) {
166
- var x = numeric(n[0]);
167
- var y = numeric(n[1]);
168
- var width = Math.max(n[0].length, n[1].length);
169
- var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
170
- var test = lte;
171
- var reverse = y < x;
172
- if (reverse) {
173
- incr *= -1;
174
- test = gte;
175
- }
176
- var pad = n.some(isPadded);
177
- N = [];
178
- for (var i = x; test(i, y); i += incr) {
179
- var c;
180
- if (isAlphaSequence) {
181
- c = String.fromCharCode(i);
182
- if (c === "\\")
183
- c = "";
184
- } else {
185
- c = String(i);
186
- if (pad) {
187
- var need = width - c.length;
188
- if (need > 0) {
189
- var z = new Array(need + 1).join("0");
190
- if (i < 0)
191
- c = "-" + z + c.slice(1);
192
- else
193
- c = z + c;
194
- }
195
- }
196
- }
197
- N.push(c);
198
- }
199
- } else {
200
- N = [];
201
- for (var j = 0; j < n.length; j++) {
202
- N.push.apply(N, expand2(n[j], false));
203
- }
204
- }
205
- for (var j = 0; j < N.length; j++) {
206
- for (var k = 0; k < post.length; k++) {
207
- var expansion = pre + N[j] + post[k];
208
- if (!isTop || isSequence || expansion)
209
- expansions.push(expansion);
210
- }
211
- }
212
- }
213
- return expansions;
214
- }
215
- }
216
- });
217
-
218
1
  // src/dev.ts
219
- import fs2 from "fs";
220
- import path3 from "path";
221
-
222
- // node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/index.js
223
- var import_brace_expansion = __toESM(require_brace_expansion(), 1);
224
-
225
- // node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/assert-valid-pattern.js
226
- var MAX_PATTERN_LENGTH = 1024 * 64;
227
- var assertValidPattern = (pattern) => {
228
- if (typeof pattern !== "string") {
229
- throw new TypeError("invalid pattern");
230
- }
231
- if (pattern.length > MAX_PATTERN_LENGTH) {
232
- throw new TypeError("pattern is too long");
233
- }
234
- };
235
-
236
- // node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/brace-expressions.js
237
- var posixClasses = {
238
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
239
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
240
- "[:ascii:]": ["\\x00-\\x7f", false],
241
- "[:blank:]": ["\\p{Zs}\\t", true],
242
- "[:cntrl:]": ["\\p{Cc}", true],
243
- "[:digit:]": ["\\p{Nd}", true],
244
- "[:graph:]": ["\\p{Z}\\p{C}", true, true],
245
- "[:lower:]": ["\\p{Ll}", true],
246
- "[:print:]": ["\\p{C}", true],
247
- "[:punct:]": ["\\p{P}", true],
248
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
249
- "[:upper:]": ["\\p{Lu}", true],
250
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
251
- "[:xdigit:]": ["A-Fa-f0-9", false]
252
- };
253
- var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
254
- var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
255
- var rangesToString = (ranges) => ranges.join("");
256
- var parseClass = (glob, position) => {
257
- const pos = position;
258
- if (glob.charAt(pos) !== "[") {
259
- throw new Error("not in a brace expression");
260
- }
261
- const ranges = [];
262
- const negs = [];
263
- let i = pos + 1;
264
- let sawStart = false;
265
- let uflag = false;
266
- let escaping = false;
267
- let negate = false;
268
- let endPos = pos;
269
- let rangeStart = "";
270
- WHILE: while (i < glob.length) {
271
- const c = glob.charAt(i);
272
- if ((c === "!" || c === "^") && i === pos + 1) {
273
- negate = true;
274
- i++;
275
- continue;
276
- }
277
- if (c === "]" && sawStart && !escaping) {
278
- endPos = i + 1;
279
- break;
280
- }
281
- sawStart = true;
282
- if (c === "\\") {
283
- if (!escaping) {
284
- escaping = true;
285
- i++;
286
- continue;
287
- }
288
- }
289
- if (c === "[" && !escaping) {
290
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
291
- if (glob.startsWith(cls, i)) {
292
- if (rangeStart) {
293
- return ["$.", false, glob.length - pos, true];
294
- }
295
- i += cls.length;
296
- if (neg)
297
- negs.push(unip);
298
- else
299
- ranges.push(unip);
300
- uflag = uflag || u;
301
- continue WHILE;
302
- }
303
- }
304
- }
305
- escaping = false;
306
- if (rangeStart) {
307
- if (c > rangeStart) {
308
- ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
309
- } else if (c === rangeStart) {
310
- ranges.push(braceEscape(c));
311
- }
312
- rangeStart = "";
313
- i++;
314
- continue;
315
- }
316
- if (glob.startsWith("-]", i + 1)) {
317
- ranges.push(braceEscape(c + "-"));
318
- i += 2;
319
- continue;
320
- }
321
- if (glob.startsWith("-", i + 1)) {
322
- rangeStart = c;
323
- i += 2;
324
- continue;
325
- }
326
- ranges.push(braceEscape(c));
327
- i++;
328
- }
329
- if (endPos < i) {
330
- return ["", false, 0, false];
331
- }
332
- if (!ranges.length && !negs.length) {
333
- return ["$.", false, glob.length - pos, true];
334
- }
335
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
336
- const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
337
- return [regexpEscape(r), false, endPos - pos, false];
338
- }
339
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
340
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
341
- const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
342
- return [comb, uflag, endPos - pos, true];
343
- };
344
-
345
- // node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/unescape.js
346
- var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
347
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
348
- };
349
-
350
- // node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/ast.js
351
- var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
352
- var isExtglobType = (c) => types.has(c);
353
- var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
354
- var startNoDot = "(?!\\.)";
355
- var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
356
- var justDots = /* @__PURE__ */ new Set(["..", "."]);
357
- var reSpecials = new Set("().*{}+?[]^$\\!");
358
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
359
- var qmark = "[^/]";
360
- var star = qmark + "*?";
361
- var starNoEmpty = qmark + "+?";
362
- var AST = class _AST {
363
- type;
364
- #root;
365
- #hasMagic;
366
- #uflag = false;
367
- #parts = [];
368
- #parent;
369
- #parentIndex;
370
- #negs;
371
- #filledNegs = false;
372
- #options;
373
- #toString;
374
- // set to true if it's an extglob with no children
375
- // (which really means one child of '')
376
- #emptyExt = false;
377
- constructor(type, parent, options = {}) {
378
- this.type = type;
379
- if (type)
380
- this.#hasMagic = true;
381
- this.#parent = parent;
382
- this.#root = this.#parent ? this.#parent.#root : this;
383
- this.#options = this.#root === this ? options : this.#root.#options;
384
- this.#negs = this.#root === this ? [] : this.#root.#negs;
385
- if (type === "!" && !this.#root.#filledNegs)
386
- this.#negs.push(this);
387
- this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
388
- }
389
- get hasMagic() {
390
- if (this.#hasMagic !== void 0)
391
- return this.#hasMagic;
392
- for (const p of this.#parts) {
393
- if (typeof p === "string")
394
- continue;
395
- if (p.type || p.hasMagic)
396
- return this.#hasMagic = true;
397
- }
398
- return this.#hasMagic;
399
- }
400
- // reconstructs the pattern
401
- toString() {
402
- if (this.#toString !== void 0)
403
- return this.#toString;
404
- if (!this.type) {
405
- return this.#toString = this.#parts.map((p) => String(p)).join("");
406
- } else {
407
- return this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
408
- }
409
- }
410
- #fillNegs() {
411
- if (this !== this.#root)
412
- throw new Error("should only call on root");
413
- if (this.#filledNegs)
414
- return this;
415
- this.toString();
416
- this.#filledNegs = true;
417
- let n;
418
- while (n = this.#negs.pop()) {
419
- if (n.type !== "!")
420
- continue;
421
- let p = n;
422
- let pp = p.#parent;
423
- while (pp) {
424
- for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
425
- for (const part of n.#parts) {
426
- if (typeof part === "string") {
427
- throw new Error("string part in extglob AST??");
428
- }
429
- part.copyIn(pp.#parts[i]);
430
- }
431
- }
432
- p = pp;
433
- pp = p.#parent;
434
- }
435
- }
436
- return this;
437
- }
438
- push(...parts) {
439
- for (const p of parts) {
440
- if (p === "")
441
- continue;
442
- if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
443
- throw new Error("invalid part: " + p);
444
- }
445
- this.#parts.push(p);
446
- }
447
- }
448
- toJSON() {
449
- const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
450
- if (this.isStart() && !this.type)
451
- ret.unshift([]);
452
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) {
453
- ret.push({});
454
- }
455
- return ret;
456
- }
457
- isStart() {
458
- if (this.#root === this)
459
- return true;
460
- if (!this.#parent?.isStart())
461
- return false;
462
- if (this.#parentIndex === 0)
463
- return true;
464
- const p = this.#parent;
465
- for (let i = 0; i < this.#parentIndex; i++) {
466
- const pp = p.#parts[i];
467
- if (!(pp instanceof _AST && pp.type === "!")) {
468
- return false;
469
- }
470
- }
471
- return true;
472
- }
473
- isEnd() {
474
- if (this.#root === this)
475
- return true;
476
- if (this.#parent?.type === "!")
477
- return true;
478
- if (!this.#parent?.isEnd())
479
- return false;
480
- if (!this.type)
481
- return this.#parent?.isEnd();
482
- const pl = this.#parent ? this.#parent.#parts.length : 0;
483
- return this.#parentIndex === pl - 1;
484
- }
485
- copyIn(part) {
486
- if (typeof part === "string")
487
- this.push(part);
488
- else
489
- this.push(part.clone(this));
490
- }
491
- clone(parent) {
492
- const c = new _AST(this.type, parent);
493
- for (const p of this.#parts) {
494
- c.copyIn(p);
495
- }
496
- return c;
497
- }
498
- static #parseAST(str, ast, pos, opt) {
499
- let escaping = false;
500
- let inBrace = false;
501
- let braceStart = -1;
502
- let braceNeg = false;
503
- if (ast.type === null) {
504
- let i2 = pos;
505
- let acc2 = "";
506
- while (i2 < str.length) {
507
- const c = str.charAt(i2++);
508
- if (escaping || c === "\\") {
509
- escaping = !escaping;
510
- acc2 += c;
511
- continue;
512
- }
513
- if (inBrace) {
514
- if (i2 === braceStart + 1) {
515
- if (c === "^" || c === "!") {
516
- braceNeg = true;
517
- }
518
- } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
519
- inBrace = false;
520
- }
521
- acc2 += c;
522
- continue;
523
- } else if (c === "[") {
524
- inBrace = true;
525
- braceStart = i2;
526
- braceNeg = false;
527
- acc2 += c;
528
- continue;
529
- }
530
- if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
531
- ast.push(acc2);
532
- acc2 = "";
533
- const ext2 = new _AST(c, ast);
534
- i2 = _AST.#parseAST(str, ext2, i2, opt);
535
- ast.push(ext2);
536
- continue;
537
- }
538
- acc2 += c;
539
- }
540
- ast.push(acc2);
541
- return i2;
542
- }
543
- let i = pos + 1;
544
- let part = new _AST(null, ast);
545
- const parts = [];
546
- let acc = "";
547
- while (i < str.length) {
548
- const c = str.charAt(i++);
549
- if (escaping || c === "\\") {
550
- escaping = !escaping;
551
- acc += c;
552
- continue;
553
- }
554
- if (inBrace) {
555
- if (i === braceStart + 1) {
556
- if (c === "^" || c === "!") {
557
- braceNeg = true;
558
- }
559
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
560
- inBrace = false;
561
- }
562
- acc += c;
563
- continue;
564
- } else if (c === "[") {
565
- inBrace = true;
566
- braceStart = i;
567
- braceNeg = false;
568
- acc += c;
569
- continue;
570
- }
571
- if (isExtglobType(c) && str.charAt(i) === "(") {
572
- part.push(acc);
573
- acc = "";
574
- const ext2 = new _AST(c, part);
575
- part.push(ext2);
576
- i = _AST.#parseAST(str, ext2, i, opt);
577
- continue;
578
- }
579
- if (c === "|") {
580
- part.push(acc);
581
- acc = "";
582
- parts.push(part);
583
- part = new _AST(null, ast);
584
- continue;
585
- }
586
- if (c === ")") {
587
- if (acc === "" && ast.#parts.length === 0) {
588
- ast.#emptyExt = true;
589
- }
590
- part.push(acc);
591
- acc = "";
592
- ast.push(...parts, part);
593
- return i;
594
- }
595
- acc += c;
596
- }
597
- ast.type = null;
598
- ast.#hasMagic = void 0;
599
- ast.#parts = [str.substring(pos - 1)];
600
- return i;
601
- }
602
- static fromGlob(pattern, options = {}) {
603
- const ast = new _AST(null, void 0, options);
604
- _AST.#parseAST(pattern, ast, 0, options);
605
- return ast;
606
- }
607
- // returns the regular expression if there's magic, or the unescaped
608
- // string if not.
609
- toMMPattern() {
610
- if (this !== this.#root)
611
- return this.#root.toMMPattern();
612
- const glob = this.toString();
613
- const [re, body, hasMagic, uflag] = this.toRegExpSource();
614
- const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
615
- if (!anyMagic) {
616
- return body;
617
- }
618
- const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
619
- return Object.assign(new RegExp(`^${re}$`, flags), {
620
- _src: re,
621
- _glob: glob
622
- });
623
- }
624
- get options() {
625
- return this.#options;
626
- }
627
- // returns the string match, the regexp source, whether there's magic
628
- // in the regexp (so a regular expression is required) and whether or
629
- // not the uflag is needed for the regular expression (for posix classes)
630
- // TODO: instead of injecting the start/end at this point, just return
631
- // the BODY of the regexp, along with the start/end portions suitable
632
- // for binding the start/end in either a joined full-path makeRe context
633
- // (where we bind to (^|/), or a standalone matchPart context (where
634
- // we bind to ^, and not /). Otherwise slashes get duped!
635
- //
636
- // In part-matching mode, the start is:
637
- // - if not isStart: nothing
638
- // - if traversal possible, but not allowed: ^(?!\.\.?$)
639
- // - if dots allowed or not possible: ^
640
- // - if dots possible and not allowed: ^(?!\.)
641
- // end is:
642
- // - if not isEnd(): nothing
643
- // - else: $
644
- //
645
- // In full-path matching mode, we put the slash at the START of the
646
- // pattern, so start is:
647
- // - if first pattern: same as part-matching mode
648
- // - if not isStart(): nothing
649
- // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
650
- // - if dots allowed or not possible: /
651
- // - if dots possible and not allowed: /(?!\.)
652
- // end is:
653
- // - if last pattern, same as part-matching mode
654
- // - else nothing
655
- //
656
- // Always put the (?:$|/) on negated tails, though, because that has to be
657
- // there to bind the end of the negated pattern portion, and it's easier to
658
- // just stick it in now rather than try to inject it later in the middle of
659
- // the pattern.
660
- //
661
- // We can just always return the same end, and leave it up to the caller
662
- // to know whether it's going to be used joined or in parts.
663
- // And, if the start is adjusted slightly, can do the same there:
664
- // - if not isStart: nothing
665
- // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
666
- // - if dots allowed or not possible: (?:/|^)
667
- // - if dots possible and not allowed: (?:/|^)(?!\.)
668
- //
669
- // But it's better to have a simpler binding without a conditional, for
670
- // performance, so probably better to return both start options.
671
- //
672
- // Then the caller just ignores the end if it's not the first pattern,
673
- // and the start always gets applied.
674
- //
675
- // But that's always going to be $ if it's the ending pattern, or nothing,
676
- // so the caller can just attach $ at the end of the pattern when building.
677
- //
678
- // So the todo is:
679
- // - better detect what kind of start is needed
680
- // - return both flavors of starting pattern
681
- // - attach $ at the end of the pattern when creating the actual RegExp
682
- //
683
- // Ah, but wait, no, that all only applies to the root when the first pattern
684
- // is not an extglob. If the first pattern IS an extglob, then we need all
685
- // that dot prevention biz to live in the extglob portions, because eg
686
- // +(*|.x*) can match .xy but not .yx.
687
- //
688
- // So, return the two flavors if it's #root and the first child is not an
689
- // AST, otherwise leave it to the child AST to handle it, and there,
690
- // use the (?:^|/) style of start binding.
691
- //
692
- // Even simplified further:
693
- // - Since the start for a join is eg /(?!\.) and the start for a part
694
- // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
695
- // or start or whatever) and prepend ^ or / at the Regexp construction.
696
- toRegExpSource(allowDot) {
697
- const dot = allowDot ?? !!this.#options.dot;
698
- if (this.#root === this)
699
- this.#fillNegs();
700
- if (!this.type) {
701
- const noEmpty = this.isStart() && this.isEnd();
702
- const src = this.#parts.map((p) => {
703
- const [re, _, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
704
- this.#hasMagic = this.#hasMagic || hasMagic;
705
- this.#uflag = this.#uflag || uflag;
706
- return re;
707
- }).join("");
708
- let start2 = "";
709
- if (this.isStart()) {
710
- if (typeof this.#parts[0] === "string") {
711
- const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
712
- if (!dotTravAllowed) {
713
- const aps = addPatternStart;
714
- const needNoTrav = (
715
- // dots are allowed, and the pattern starts with [ or .
716
- dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
717
- src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
718
- src.startsWith("\\.\\.") && aps.has(src.charAt(4))
719
- );
720
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
721
- start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
722
- }
723
- }
724
- }
725
- let end = "";
726
- if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") {
727
- end = "(?:$|\\/)";
728
- }
729
- const final2 = start2 + src + end;
730
- return [
731
- final2,
732
- unescape(src),
733
- this.#hasMagic = !!this.#hasMagic,
734
- this.#uflag
735
- ];
736
- }
737
- const repeated = this.type === "*" || this.type === "+";
738
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
739
- let body = this.#partsToRegExp(dot);
740
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
741
- const s = this.toString();
742
- this.#parts = [s];
743
- this.type = null;
744
- this.#hasMagic = void 0;
745
- return [s, unescape(this.toString()), false, false];
746
- }
747
- let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
748
- if (bodyDotAllowed === body) {
749
- bodyDotAllowed = "";
750
- }
751
- if (bodyDotAllowed) {
752
- body = `(?:${body})(?:${bodyDotAllowed})*?`;
753
- }
754
- let final = "";
755
- if (this.type === "!" && this.#emptyExt) {
756
- final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
757
- } else {
758
- const close = this.type === "!" ? (
759
- // !() must match something,but !(x) can match ''
760
- "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
761
- ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
762
- final = start + body + close;
763
- }
764
- return [
765
- final,
766
- unescape(body),
767
- this.#hasMagic = !!this.#hasMagic,
768
- this.#uflag
769
- ];
770
- }
771
- #partsToRegExp(dot) {
772
- return this.#parts.map((p) => {
773
- if (typeof p === "string") {
774
- throw new Error("string type in extglob ast??");
775
- }
776
- const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
777
- this.#uflag = this.#uflag || uflag;
778
- return re;
779
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
780
- }
781
- static #parseGlob(glob, hasMagic, noEmpty = false) {
782
- let escaping = false;
783
- let re = "";
784
- let uflag = false;
785
- for (let i = 0; i < glob.length; i++) {
786
- const c = glob.charAt(i);
787
- if (escaping) {
788
- escaping = false;
789
- re += (reSpecials.has(c) ? "\\" : "") + c;
790
- continue;
791
- }
792
- if (c === "\\") {
793
- if (i === glob.length - 1) {
794
- re += "\\\\";
795
- } else {
796
- escaping = true;
797
- }
798
- continue;
799
- }
800
- if (c === "[") {
801
- const [src, needUflag, consumed, magic] = parseClass(glob, i);
802
- if (consumed) {
803
- re += src;
804
- uflag = uflag || needUflag;
805
- i += consumed - 1;
806
- hasMagic = hasMagic || magic;
807
- continue;
808
- }
809
- }
810
- if (c === "*") {
811
- if (noEmpty && glob === "*")
812
- re += starNoEmpty;
813
- else
814
- re += star;
815
- hasMagic = true;
816
- continue;
817
- }
818
- if (c === "?") {
819
- re += qmark;
820
- hasMagic = true;
821
- continue;
822
- }
823
- re += regExpEscape(c);
824
- }
825
- return [re, unescape(glob), !!hasMagic, uflag];
826
- }
827
- };
828
-
829
- // node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/escape.js
830
- var escape = (s, { windowsPathsNoEscape = false } = {}) => {
831
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
832
- };
833
-
834
- // node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/index.js
835
- var minimatch = (p, pattern, options = {}) => {
836
- assertValidPattern(pattern);
837
- if (!options.nocomment && pattern.charAt(0) === "#") {
838
- return false;
839
- }
840
- return new Minimatch(pattern, options).match(p);
841
- };
842
- var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
843
- var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
844
- var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
845
- var starDotExtTestNocase = (ext2) => {
846
- ext2 = ext2.toLowerCase();
847
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
848
- };
849
- var starDotExtTestNocaseDot = (ext2) => {
850
- ext2 = ext2.toLowerCase();
851
- return (f) => f.toLowerCase().endsWith(ext2);
852
- };
853
- var starDotStarRE = /^\*+\.\*+$/;
854
- var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
855
- var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
856
- var dotStarRE = /^\.\*+$/;
857
- var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
858
- var starRE = /^\*+$/;
859
- var starTest = (f) => f.length !== 0 && !f.startsWith(".");
860
- var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
861
- var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
862
- var qmarksTestNocase = ([$0, ext2 = ""]) => {
863
- const noext = qmarksTestNoExt([$0]);
864
- if (!ext2)
865
- return noext;
866
- ext2 = ext2.toLowerCase();
867
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
868
- };
869
- var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
870
- const noext = qmarksTestNoExtDot([$0]);
871
- if (!ext2)
872
- return noext;
873
- ext2 = ext2.toLowerCase();
874
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
875
- };
876
- var qmarksTestDot = ([$0, ext2 = ""]) => {
877
- const noext = qmarksTestNoExtDot([$0]);
878
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
879
- };
880
- var qmarksTest = ([$0, ext2 = ""]) => {
881
- const noext = qmarksTestNoExt([$0]);
882
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
883
- };
884
- var qmarksTestNoExt = ([$0]) => {
885
- const len = $0.length;
886
- return (f) => f.length === len && !f.startsWith(".");
887
- };
888
- var qmarksTestNoExtDot = ([$0]) => {
889
- const len = $0.length;
890
- return (f) => f.length === len && f !== "." && f !== "..";
891
- };
892
- var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
893
- var path = {
894
- win32: { sep: "\\" },
895
- posix: { sep: "/" }
896
- };
897
- var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
898
- minimatch.sep = sep;
899
- var GLOBSTAR = Symbol("globstar **");
900
- minimatch.GLOBSTAR = GLOBSTAR;
901
- var qmark2 = "[^/]";
902
- var star2 = qmark2 + "*?";
903
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
904
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
905
- var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
906
- minimatch.filter = filter;
907
- var ext = (a, b = {}) => Object.assign({}, a, b);
908
- var defaults = (def) => {
909
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
910
- return minimatch;
911
- }
912
- const orig = minimatch;
913
- const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
914
- return Object.assign(m, {
915
- Minimatch: class Minimatch extends orig.Minimatch {
916
- constructor(pattern, options = {}) {
917
- super(pattern, ext(def, options));
918
- }
919
- static defaults(options) {
920
- return orig.defaults(ext(def, options)).Minimatch;
921
- }
922
- },
923
- AST: class AST extends orig.AST {
924
- /* c8 ignore start */
925
- constructor(type, parent, options = {}) {
926
- super(type, parent, ext(def, options));
927
- }
928
- /* c8 ignore stop */
929
- static fromGlob(pattern, options = {}) {
930
- return orig.AST.fromGlob(pattern, ext(def, options));
931
- }
932
- },
933
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
934
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
935
- filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
936
- defaults: (options) => orig.defaults(ext(def, options)),
937
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
938
- braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
939
- match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
940
- sep: orig.sep,
941
- GLOBSTAR
942
- });
943
- };
944
- minimatch.defaults = defaults;
945
- var braceExpand = (pattern, options = {}) => {
946
- assertValidPattern(pattern);
947
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
948
- return [pattern];
949
- }
950
- return (0, import_brace_expansion.default)(pattern);
951
- };
952
- minimatch.braceExpand = braceExpand;
953
- var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
954
- minimatch.makeRe = makeRe;
955
- var match = (list, pattern, options = {}) => {
956
- const mm = new Minimatch(pattern, options);
957
- list = list.filter((f) => mm.match(f));
958
- if (mm.options.nonull && !list.length) {
959
- list.push(pattern);
960
- }
961
- return list;
962
- };
963
- minimatch.match = match;
964
- var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
965
- var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
966
- var Minimatch = class {
967
- options;
968
- set;
969
- pattern;
970
- windowsPathsNoEscape;
971
- nonegate;
972
- negate;
973
- comment;
974
- empty;
975
- preserveMultipleSlashes;
976
- partial;
977
- globSet;
978
- globParts;
979
- nocase;
980
- isWindows;
981
- platform;
982
- windowsNoMagicRoot;
983
- regexp;
984
- constructor(pattern, options = {}) {
985
- assertValidPattern(pattern);
986
- options = options || {};
987
- this.options = options;
988
- this.pattern = pattern;
989
- this.platform = options.platform || defaultPlatform;
990
- this.isWindows = this.platform === "win32";
991
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
992
- if (this.windowsPathsNoEscape) {
993
- this.pattern = this.pattern.replace(/\\/g, "/");
994
- }
995
- this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
996
- this.regexp = null;
997
- this.negate = false;
998
- this.nonegate = !!options.nonegate;
999
- this.comment = false;
1000
- this.empty = false;
1001
- this.partial = !!options.partial;
1002
- this.nocase = !!this.options.nocase;
1003
- this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
1004
- this.globSet = [];
1005
- this.globParts = [];
1006
- this.set = [];
1007
- this.make();
1008
- }
1009
- hasMagic() {
1010
- if (this.options.magicalBraces && this.set.length > 1) {
1011
- return true;
1012
- }
1013
- for (const pattern of this.set) {
1014
- for (const part of pattern) {
1015
- if (typeof part !== "string")
1016
- return true;
1017
- }
1018
- }
1019
- return false;
1020
- }
1021
- debug(..._) {
1022
- }
1023
- make() {
1024
- const pattern = this.pattern;
1025
- const options = this.options;
1026
- if (!options.nocomment && pattern.charAt(0) === "#") {
1027
- this.comment = true;
1028
- return;
1029
- }
1030
- if (!pattern) {
1031
- this.empty = true;
1032
- return;
1033
- }
1034
- this.parseNegate();
1035
- this.globSet = [...new Set(this.braceExpand())];
1036
- if (options.debug) {
1037
- this.debug = (...args) => console.error(...args);
1038
- }
1039
- this.debug(this.pattern, this.globSet);
1040
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
1041
- this.globParts = this.preprocess(rawGlobParts);
1042
- this.debug(this.pattern, this.globParts);
1043
- let set = this.globParts.map((s, _, __) => {
1044
- if (this.isWindows && this.windowsNoMagicRoot) {
1045
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
1046
- const isDrive = /^[a-z]:/i.test(s[0]);
1047
- if (isUNC) {
1048
- return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
1049
- } else if (isDrive) {
1050
- return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
1051
- }
1052
- }
1053
- return s.map((ss) => this.parse(ss));
1054
- });
1055
- this.debug(this.pattern, set);
1056
- this.set = set.filter((s) => s.indexOf(false) === -1);
1057
- if (this.isWindows) {
1058
- for (let i = 0; i < this.set.length; i++) {
1059
- const p = this.set[i];
1060
- if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
1061
- p[2] = "?";
1062
- }
1063
- }
1064
- }
1065
- this.debug(this.pattern, this.set);
1066
- }
1067
- // various transforms to equivalent pattern sets that are
1068
- // faster to process in a filesystem walk. The goal is to
1069
- // eliminate what we can, and push all ** patterns as far
1070
- // to the right as possible, even if it increases the number
1071
- // of patterns that we have to process.
1072
- preprocess(globParts) {
1073
- if (this.options.noglobstar) {
1074
- for (let i = 0; i < globParts.length; i++) {
1075
- for (let j = 0; j < globParts[i].length; j++) {
1076
- if (globParts[i][j] === "**") {
1077
- globParts[i][j] = "*";
1078
- }
1079
- }
1080
- }
1081
- }
1082
- const { optimizationLevel = 1 } = this.options;
1083
- if (optimizationLevel >= 2) {
1084
- globParts = this.firstPhasePreProcess(globParts);
1085
- globParts = this.secondPhasePreProcess(globParts);
1086
- } else if (optimizationLevel >= 1) {
1087
- globParts = this.levelOneOptimize(globParts);
1088
- } else {
1089
- globParts = this.adjascentGlobstarOptimize(globParts);
1090
- }
1091
- return globParts;
1092
- }
1093
- // just get rid of adjascent ** portions
1094
- adjascentGlobstarOptimize(globParts) {
1095
- return globParts.map((parts) => {
1096
- let gs = -1;
1097
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1098
- let i = gs;
1099
- while (parts[i + 1] === "**") {
1100
- i++;
1101
- }
1102
- if (i !== gs) {
1103
- parts.splice(gs, i - gs);
1104
- }
1105
- }
1106
- return parts;
1107
- });
1108
- }
1109
- // get rid of adjascent ** and resolve .. portions
1110
- levelOneOptimize(globParts) {
1111
- return globParts.map((parts) => {
1112
- parts = parts.reduce((set, part) => {
1113
- const prev = set[set.length - 1];
1114
- if (part === "**" && prev === "**") {
1115
- return set;
1116
- }
1117
- if (part === "..") {
1118
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
1119
- set.pop();
1120
- return set;
1121
- }
1122
- }
1123
- set.push(part);
1124
- return set;
1125
- }, []);
1126
- return parts.length === 0 ? [""] : parts;
1127
- });
1128
- }
1129
- levelTwoFileOptimize(parts) {
1130
- if (!Array.isArray(parts)) {
1131
- parts = this.slashSplit(parts);
1132
- }
1133
- let didSomething = false;
1134
- do {
1135
- didSomething = false;
1136
- if (!this.preserveMultipleSlashes) {
1137
- for (let i = 1; i < parts.length - 1; i++) {
1138
- const p = parts[i];
1139
- if (i === 1 && p === "" && parts[0] === "")
1140
- continue;
1141
- if (p === "." || p === "") {
1142
- didSomething = true;
1143
- parts.splice(i, 1);
1144
- i--;
1145
- }
1146
- }
1147
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1148
- didSomething = true;
1149
- parts.pop();
1150
- }
1151
- }
1152
- let dd = 0;
1153
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1154
- const p = parts[dd - 1];
1155
- if (p && p !== "." && p !== ".." && p !== "**") {
1156
- didSomething = true;
1157
- parts.splice(dd - 1, 2);
1158
- dd -= 2;
1159
- }
1160
- }
1161
- } while (didSomething);
1162
- return parts.length === 0 ? [""] : parts;
1163
- }
1164
- // First phase: single-pattern processing
1165
- // <pre> is 1 or more portions
1166
- // <rest> is 1 or more portions
1167
- // <p> is any portion other than ., .., '', or **
1168
- // <e> is . or ''
1169
- //
1170
- // **/.. is *brutal* for filesystem walking performance, because
1171
- // it effectively resets the recursive walk each time it occurs,
1172
- // and ** cannot be reduced out by a .. pattern part like a regexp
1173
- // or most strings (other than .., ., and '') can be.
1174
- //
1175
- // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
1176
- // <pre>/<e>/<rest> -> <pre>/<rest>
1177
- // <pre>/<p>/../<rest> -> <pre>/<rest>
1178
- // **/**/<rest> -> **/<rest>
1179
- //
1180
- // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
1181
- // this WOULD be allowed if ** did follow symlinks, or * didn't
1182
- firstPhasePreProcess(globParts) {
1183
- let didSomething = false;
1184
- do {
1185
- didSomething = false;
1186
- for (let parts of globParts) {
1187
- let gs = -1;
1188
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1189
- let gss = gs;
1190
- while (parts[gss + 1] === "**") {
1191
- gss++;
1192
- }
1193
- if (gss > gs) {
1194
- parts.splice(gs + 1, gss - gs);
1195
- }
1196
- let next = parts[gs + 1];
1197
- const p = parts[gs + 2];
1198
- const p2 = parts[gs + 3];
1199
- if (next !== "..")
1200
- continue;
1201
- if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
1202
- continue;
1203
- }
1204
- didSomething = true;
1205
- parts.splice(gs, 1);
1206
- const other = parts.slice(0);
1207
- other[gs] = "**";
1208
- globParts.push(other);
1209
- gs--;
1210
- }
1211
- if (!this.preserveMultipleSlashes) {
1212
- for (let i = 1; i < parts.length - 1; i++) {
1213
- const p = parts[i];
1214
- if (i === 1 && p === "" && parts[0] === "")
1215
- continue;
1216
- if (p === "." || p === "") {
1217
- didSomething = true;
1218
- parts.splice(i, 1);
1219
- i--;
1220
- }
1221
- }
1222
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1223
- didSomething = true;
1224
- parts.pop();
1225
- }
1226
- }
1227
- let dd = 0;
1228
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1229
- const p = parts[dd - 1];
1230
- if (p && p !== "." && p !== ".." && p !== "**") {
1231
- didSomething = true;
1232
- const needDot = dd === 1 && parts[dd + 1] === "**";
1233
- const splin = needDot ? ["."] : [];
1234
- parts.splice(dd - 1, 2, ...splin);
1235
- if (parts.length === 0)
1236
- parts.push("");
1237
- dd -= 2;
1238
- }
1239
- }
1240
- }
1241
- } while (didSomething);
1242
- return globParts;
1243
- }
1244
- // second phase: multi-pattern dedupes
1245
- // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
1246
- // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
1247
- // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
1248
- //
1249
- // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
1250
- // ^-- not valid because ** doens't follow symlinks
1251
- secondPhasePreProcess(globParts) {
1252
- for (let i = 0; i < globParts.length - 1; i++) {
1253
- for (let j = i + 1; j < globParts.length; j++) {
1254
- const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
1255
- if (matched) {
1256
- globParts[i] = [];
1257
- globParts[j] = matched;
1258
- break;
1259
- }
1260
- }
1261
- }
1262
- return globParts.filter((gs) => gs.length);
1263
- }
1264
- partsMatch(a, b, emptyGSMatch = false) {
1265
- let ai = 0;
1266
- let bi = 0;
1267
- let result = [];
1268
- let which = "";
1269
- while (ai < a.length && bi < b.length) {
1270
- if (a[ai] === b[bi]) {
1271
- result.push(which === "b" ? b[bi] : a[ai]);
1272
- ai++;
1273
- bi++;
1274
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
1275
- result.push(a[ai]);
1276
- ai++;
1277
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
1278
- result.push(b[bi]);
1279
- bi++;
1280
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
1281
- if (which === "b")
1282
- return false;
1283
- which = "a";
1284
- result.push(a[ai]);
1285
- ai++;
1286
- bi++;
1287
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
1288
- if (which === "a")
1289
- return false;
1290
- which = "b";
1291
- result.push(b[bi]);
1292
- ai++;
1293
- bi++;
1294
- } else {
1295
- return false;
1296
- }
1297
- }
1298
- return a.length === b.length && result;
1299
- }
1300
- parseNegate() {
1301
- if (this.nonegate)
1302
- return;
1303
- const pattern = this.pattern;
1304
- let negate = false;
1305
- let negateOffset = 0;
1306
- for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
1307
- negate = !negate;
1308
- negateOffset++;
1309
- }
1310
- if (negateOffset)
1311
- this.pattern = pattern.slice(negateOffset);
1312
- this.negate = negate;
1313
- }
1314
- // set partial to true to test if, for example,
1315
- // "/a/b" matches the start of "/*/b/*/d"
1316
- // Partial means, if you run out of file before you run
1317
- // out of pattern, then that's fine, as long as all
1318
- // the parts match.
1319
- matchOne(file, pattern, partial = false) {
1320
- const options = this.options;
1321
- if (this.isWindows) {
1322
- const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
1323
- const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
1324
- const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
1325
- const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
1326
- const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
1327
- const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
1328
- if (typeof fdi === "number" && typeof pdi === "number") {
1329
- const [fd, pd] = [file[fdi], pattern[pdi]];
1330
- if (fd.toLowerCase() === pd.toLowerCase()) {
1331
- pattern[pdi] = fd;
1332
- if (pdi > fdi) {
1333
- pattern = pattern.slice(pdi);
1334
- } else if (fdi > pdi) {
1335
- file = file.slice(fdi);
1336
- }
1337
- }
1338
- }
1339
- }
1340
- const { optimizationLevel = 1 } = this.options;
1341
- if (optimizationLevel >= 2) {
1342
- file = this.levelTwoFileOptimize(file);
1343
- }
1344
- this.debug("matchOne", this, { file, pattern });
1345
- this.debug("matchOne", file.length, pattern.length);
1346
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
1347
- this.debug("matchOne loop");
1348
- var p = pattern[pi];
1349
- var f = file[fi];
1350
- this.debug(pattern, p, f);
1351
- if (p === false) {
1352
- return false;
1353
- }
1354
- if (p === GLOBSTAR) {
1355
- this.debug("GLOBSTAR", [pattern, p, f]);
1356
- var fr = fi;
1357
- var pr = pi + 1;
1358
- if (pr === pl) {
1359
- this.debug("** at the end");
1360
- for (; fi < fl; fi++) {
1361
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
1362
- return false;
1363
- }
1364
- return true;
1365
- }
1366
- while (fr < fl) {
1367
- var swallowee = file[fr];
1368
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
1369
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
1370
- this.debug("globstar found match!", fr, fl, swallowee);
1371
- return true;
1372
- } else {
1373
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
1374
- this.debug("dot detected!", file, fr, pattern, pr);
1375
- break;
1376
- }
1377
- this.debug("globstar swallow a segment, and continue");
1378
- fr++;
1379
- }
1380
- }
1381
- if (partial) {
1382
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
1383
- if (fr === fl) {
1384
- return true;
1385
- }
1386
- }
1387
- return false;
1388
- }
1389
- let hit;
1390
- if (typeof p === "string") {
1391
- hit = f === p;
1392
- this.debug("string match", p, f, hit);
1393
- } else {
1394
- hit = p.test(f);
1395
- this.debug("pattern match", p, f, hit);
1396
- }
1397
- if (!hit)
1398
- return false;
1399
- }
1400
- if (fi === fl && pi === pl) {
1401
- return true;
1402
- } else if (fi === fl) {
1403
- return partial;
1404
- } else if (pi === pl) {
1405
- return fi === fl - 1 && file[fi] === "";
1406
- } else {
1407
- throw new Error("wtf?");
1408
- }
1409
- }
1410
- braceExpand() {
1411
- return braceExpand(this.pattern, this.options);
1412
- }
1413
- parse(pattern) {
1414
- assertValidPattern(pattern);
1415
- const options = this.options;
1416
- if (pattern === "**")
1417
- return GLOBSTAR;
1418
- if (pattern === "")
1419
- return "";
1420
- let m;
1421
- let fastTest = null;
1422
- if (m = pattern.match(starRE)) {
1423
- fastTest = options.dot ? starTestDot : starTest;
1424
- } else if (m = pattern.match(starDotExtRE)) {
1425
- fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
1426
- } else if (m = pattern.match(qmarksRE)) {
1427
- fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
1428
- } else if (m = pattern.match(starDotStarRE)) {
1429
- fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
1430
- } else if (m = pattern.match(dotStarRE)) {
1431
- fastTest = dotStarTest;
1432
- }
1433
- const re = AST.fromGlob(pattern, this.options).toMMPattern();
1434
- if (fastTest && typeof re === "object") {
1435
- Reflect.defineProperty(re, "test", { value: fastTest });
1436
- }
1437
- return re;
1438
- }
1439
- makeRe() {
1440
- if (this.regexp || this.regexp === false)
1441
- return this.regexp;
1442
- const set = this.set;
1443
- if (!set.length) {
1444
- this.regexp = false;
1445
- return this.regexp;
1446
- }
1447
- const options = this.options;
1448
- const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
1449
- const flags = new Set(options.nocase ? ["i"] : []);
1450
- let re = set.map((pattern) => {
1451
- const pp = pattern.map((p) => {
1452
- if (p instanceof RegExp) {
1453
- for (const f of p.flags.split(""))
1454
- flags.add(f);
1455
- }
1456
- return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
1457
- });
1458
- pp.forEach((p, i) => {
1459
- const next = pp[i + 1];
1460
- const prev = pp[i - 1];
1461
- if (p !== GLOBSTAR || prev === GLOBSTAR) {
1462
- return;
1463
- }
1464
- if (prev === void 0) {
1465
- if (next !== void 0 && next !== GLOBSTAR) {
1466
- pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
1467
- } else {
1468
- pp[i] = twoStar;
1469
- }
1470
- } else if (next === void 0) {
1471
- pp[i - 1] = prev + "(?:\\/|" + twoStar + ")?";
1472
- } else if (next !== GLOBSTAR) {
1473
- pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
1474
- pp[i + 1] = GLOBSTAR;
1475
- }
1476
- });
1477
- return pp.filter((p) => p !== GLOBSTAR).join("/");
1478
- }).join("|");
1479
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
1480
- re = "^" + open + re + close + "$";
1481
- if (this.negate)
1482
- re = "^(?!" + re + ").+$";
1483
- try {
1484
- this.regexp = new RegExp(re, [...flags].join(""));
1485
- } catch (ex) {
1486
- this.regexp = false;
1487
- }
1488
- return this.regexp;
1489
- }
1490
- slashSplit(p) {
1491
- if (this.preserveMultipleSlashes) {
1492
- return p.split("/");
1493
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
1494
- return ["", ...p.split(/\/+/)];
1495
- } else {
1496
- return p.split(/\/+/);
1497
- }
1498
- }
1499
- match(f, partial = this.partial) {
1500
- this.debug("match", f, this.pattern);
1501
- if (this.comment) {
1502
- return false;
1503
- }
1504
- if (this.empty) {
1505
- return f === "";
1506
- }
1507
- if (f === "/" && partial) {
1508
- return true;
1509
- }
1510
- const options = this.options;
1511
- if (this.isWindows) {
1512
- f = f.split("\\").join("/");
1513
- }
1514
- const ff = this.slashSplit(f);
1515
- this.debug(this.pattern, "split", ff);
1516
- const set = this.set;
1517
- this.debug(this.pattern, "set", set);
1518
- let filename = ff[ff.length - 1];
1519
- if (!filename) {
1520
- for (let i = ff.length - 2; !filename && i >= 0; i--) {
1521
- filename = ff[i];
1522
- }
1523
- }
1524
- for (let i = 0; i < set.length; i++) {
1525
- const pattern = set[i];
1526
- let file = ff;
1527
- if (options.matchBase && pattern.length === 1) {
1528
- file = [filename];
1529
- }
1530
- const hit = this.matchOne(file, pattern, partial);
1531
- if (hit) {
1532
- if (options.flipNegate) {
1533
- return true;
1534
- }
1535
- return !this.negate;
1536
- }
1537
- }
1538
- if (options.flipNegate) {
1539
- return false;
1540
- }
1541
- return this.negate;
1542
- }
1543
- static defaults(def) {
1544
- return minimatch.defaults(def).Minimatch;
1545
- }
1546
- };
1547
- minimatch.AST = AST;
1548
- minimatch.Minimatch = Minimatch;
1549
- minimatch.escape = escape;
1550
- minimatch.unescape = unescape;
1551
-
1552
- // node_modules/.pnpm/@hono+vite-dev-server@0.20.0_hono@4.8.5_miniflare@3.20250408.2_wrangler@4.26.0_@cloudflare+workers-types@4.20250724.0_/node_modules/@hono/vite-dev-server/dist/dev-server.js
1553
2
  import fs from "fs";
1554
- import path2 from "path";
1555
- var defaultOptions = {
1556
- entry: "./src/index.ts",
1557
- export: "default",
1558
- injectClientScript: true,
1559
- exclude: [
1560
- /.*\.css$/,
1561
- /.*\.ts$/,
1562
- /.*\.tsx$/,
1563
- /^\/@.+$/,
1564
- /\?t\=\d+$/,
1565
- /^\/favicon\.ico$/,
1566
- /^\/static\/.+/,
1567
- /^\/node_modules\/.*/
1568
- ],
1569
- ignoreWatching: [/\.wrangler/, /\.mf/],
1570
- handleHotUpdate: ({ server, modules }) => {
1571
- const isSSR = modules.some((mod) => mod._ssrModule);
1572
- if (isSSR) {
1573
- server.hot.send({ type: "full-reload" });
1574
- return [];
1575
- }
1576
- }
1577
- };
1578
- function devServer(options) {
1579
- let publicDirPath = "";
1580
- const entry = options?.entry ?? defaultOptions.entry;
1581
- const plugin = {
1582
- name: "@hono/vite-dev-server",
1583
- configResolved(config) {
1584
- publicDirPath = config.publicDir;
1585
- },
1586
- configureServer: async (server) => {
1587
- async function createMiddleware(server2) {
1588
- return async function(req, res, next) {
1589
- if (req.url) {
1590
- const filePath = path2.join(publicDirPath, req.url);
1591
- try {
1592
- if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {
1593
- return next();
1594
- }
1595
- } catch {
1596
- }
1597
- }
1598
- const exclude = options?.exclude ?? defaultOptions.exclude;
1599
- for (const pattern of exclude) {
1600
- if (req.url) {
1601
- if (pattern instanceof RegExp) {
1602
- if (pattern.test(req.url)) {
1603
- return next();
1604
- }
1605
- } else if (minimatch(req.url?.toString(), pattern)) {
1606
- return next();
1607
- }
1608
- }
1609
- }
1610
- let loadModule;
1611
- if (options?.loadModule) {
1612
- loadModule = options.loadModule;
1613
- } else {
1614
- loadModule = async (server3, entry2) => {
1615
- let appModule;
1616
- try {
1617
- appModule = await server3.ssrLoadModule(entry2);
1618
- } catch (e) {
1619
- if (e instanceof Error) {
1620
- server3.ssrFixStacktrace(e);
1621
- }
1622
- throw e;
1623
- }
1624
- const exportName = options?.export ?? defaultOptions.export;
1625
- const app2 = appModule[exportName];
1626
- if (!app2) {
1627
- throw new Error(`Failed to find a named export "${exportName}" from ${entry2}`);
1628
- }
1629
- return app2;
1630
- };
1631
- }
1632
- let app;
1633
- try {
1634
- app = await loadModule(server2, entry);
1635
- } catch (e) {
1636
- return next(e);
1637
- }
1638
- getRequestListener(
1639
- async (request) => {
1640
- let env = {
1641
- incoming: req,
1642
- outgoing: res
1643
- };
1644
- if (options?.env) {
1645
- if (typeof options.env === "function") {
1646
- env = { ...env, ...await options.env() };
1647
- } else {
1648
- env = { ...env, ...options.env };
1649
- }
1650
- }
1651
- const adapter = await getAdapterFromOptions(options);
1652
- if (adapter?.env) {
1653
- env = { ...env, ...adapter.env };
1654
- }
1655
- const executionContext = adapter?.executionContext ?? {
1656
- waitUntil: async (fn) => fn,
1657
- passThroughOnException: () => {
1658
- throw new Error("`passThroughOnException` is not supported");
1659
- }
1660
- };
1661
- const response = await app.fetch(request, env, executionContext);
1662
- if (!(response instanceof Response)) {
1663
- throw response;
1664
- }
1665
- if (options?.injectClientScript !== false && response.headers.get("content-type")?.match(/^text\/html/)) {
1666
- const nonce = response.headers.get("content-security-policy")?.match(/'nonce-([^']+)'/)?.[1];
1667
- const script = `<script${nonce ? ` nonce="${nonce}"` : ""}>import("/@vite/client")</script>`;
1668
- return injectStringToResponse(response, script) ?? response;
1669
- }
1670
- return response;
1671
- },
1672
- {
1673
- overrideGlobalObjects: false,
1674
- errorHandler: (e) => {
1675
- let err;
1676
- if (e instanceof Error) {
1677
- err = e;
1678
- server2.ssrFixStacktrace(err);
1679
- } else if (typeof e === "string") {
1680
- err = new Error(`The response is not an instance of "Response", but: ${e}`);
1681
- } else {
1682
- err = new Error(`Unknown error: ${e}`);
1683
- }
1684
- next(err);
1685
- }
1686
- }
1687
- )(req, res);
1688
- };
1689
- }
1690
- server.middlewares.use(await createMiddleware(server));
1691
- server.httpServer?.on("close", async () => {
1692
- const adapter = await getAdapterFromOptions(options);
1693
- if (adapter?.onServerClose) {
1694
- await adapter.onServerClose();
1695
- }
1696
- });
1697
- },
1698
- handleHotUpdate: options?.handleHotUpdate ?? defaultOptions.handleHotUpdate,
1699
- config: () => {
1700
- return {
1701
- server: {
1702
- watch: {
1703
- ignored: options?.ignoreWatching ?? defaultOptions.ignoreWatching
1704
- }
1705
- }
1706
- };
1707
- }
1708
- };
1709
- return plugin;
1710
- }
1711
- var getAdapterFromOptions = async (options) => {
1712
- let adapter = options?.adapter;
1713
- if (typeof adapter === "function") {
1714
- adapter = adapter();
1715
- }
1716
- if (adapter instanceof Promise) {
1717
- adapter = await adapter;
1718
- }
1719
- return adapter;
1720
- };
1721
- function injectStringToResponse(response, content) {
1722
- const stream = response.body;
1723
- const newContent = new TextEncoder().encode(content);
1724
- if (!stream) {
1725
- return null;
1726
- }
1727
- const reader = stream.getReader();
1728
- const newContentReader = new ReadableStream({
1729
- start(controller) {
1730
- controller.enqueue(newContent);
1731
- controller.close();
1732
- }
1733
- }).getReader();
1734
- const combinedStream = new ReadableStream({
1735
- async start(controller) {
1736
- for (; ; ) {
1737
- const [existingResult, newContentResult] = await Promise.all([
1738
- reader.read(),
1739
- newContentReader.read()
1740
- ]);
1741
- if (existingResult.done && newContentResult.done) {
1742
- controller.close();
1743
- break;
1744
- }
1745
- if (!existingResult.done) {
1746
- controller.enqueue(existingResult.value);
1747
- }
1748
- if (!newContentResult.done) {
1749
- controller.enqueue(newContentResult.value);
1750
- }
1751
- }
1752
- }
1753
- });
1754
- const headers = new Headers(response.headers);
1755
- headers.delete("content-length");
1756
- return new Response(combinedStream, {
1757
- headers,
1758
- status: response.status
1759
- });
1760
- }
1761
-
1762
- // node_modules/.pnpm/@hono+vite-dev-server@0.20.0_hono@4.8.5_miniflare@3.20250408.2_wrangler@4.26.0_@cloudflare+workers-types@4.20250724.0_/node_modules/@hono/vite-dev-server/dist/index.js
1763
- var src_default = devServer;
1764
-
1765
- // node_modules/.pnpm/@hono+vite-dev-server@0.20.0_hono@4.8.5_miniflare@3.20250408.2_wrangler@4.26.0_@cloudflare+workers-types@4.20250724.0_/node_modules/@hono/vite-dev-server/dist/adapter/bun.js
1766
- var bunAdapter = () => {
1767
- if (typeof globalThis.navigator === "undefined") {
1768
- globalThis.navigator = {
1769
- userAgent: "Bun"
1770
- };
1771
- } else {
1772
- Object.defineProperty(globalThis.navigator, "userAgent", {
1773
- value: "Bun",
1774
- writable: false
1775
- });
1776
- }
1777
- return {
1778
- env: process.env
1779
- };
1780
- };
1781
- var bun_default = bunAdapter;
1782
-
1783
- // node_modules/.pnpm/@hono+vite-dev-server@0.20.0_hono@4.8.5_miniflare@3.20250408.2_wrangler@4.26.0_@cloudflare+workers-types@4.20250724.0_/node_modules/@hono/vite-dev-server/dist/adapter/node.js
1784
- var nodeAdapter = () => {
1785
- if (typeof globalThis.navigator === "undefined") {
1786
- globalThis.navigator = {
1787
- userAgent: "Node.js"
1788
- };
1789
- } else {
1790
- Object.defineProperty(globalThis.navigator, "userAgent", {
1791
- value: "Node.js",
1792
- writable: false
1793
- });
1794
- }
1795
- return {
1796
- env: process.env
1797
- };
1798
- };
1799
- var node_default = nodeAdapter;
1800
-
1801
- // src/dev.ts
3
+ import path from "path";
4
+ import honoDevServer from "@hono/vite-dev-server";
5
+ import bunAdapter from "@hono/vite-dev-server/bun";
6
+ import nodeAdapter from "@hono/vite-dev-server/node";
1802
7
  var REACT_ROUTER_VIRTUAL_MODULE_ID = "\0virtual:react-router/server-build";
1803
8
  var VIRTUAL_MODULE_ID = "\0virtual:react-router-hono-server/server";
1804
9
  var REACT_ROUTER_EXPORT = "export { serverManifest as assets, assetsBuildDirectory, basename, entry, future, isSpaMode, prerender, publicPath, routes, ssr, routeDiscovery };";
@@ -1876,9 +81,6 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
1876
81
  alias
1877
82
  },
1878
83
  build: {
1879
- // https://vite.dev/config/build-options#build-target
1880
- cssTarget: ["es2020", "edge88", "firefox78", "chrome87", "safari14"],
1881
- target: "esnext",
1882
84
  rollupOptions: {
1883
85
  input: pluginConfig.serverEntryPoint,
1884
86
  output: {
@@ -1923,8 +125,8 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
1923
125
  return;
1924
126
  }
1925
127
  console.log("Cleaning up server exports...");
1926
- const buildPath = path3.join(pluginConfig.rootDirectory, pluginConfig.buildDirectory, "server", "index.js");
1927
- let serverFile = await fs2.promises.readFile(buildPath, "utf-8").catch((e) => {
128
+ const buildPath = path.join(pluginConfig.rootDirectory, pluginConfig.buildDirectory, "server", "index.js");
129
+ let serverFile = await fs.promises.readFile(buildPath, "utf-8").catch((e) => {
1928
130
  if (e.code === "ENOENT") {
1929
131
  console.error("\x1B[31m\nThe server was not built\x1B[0m");
1930
132
  if (pluginConfig?.flag?.force_react_19) {
@@ -1942,7 +144,7 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
1942
144
  if (await getReactVersion(pluginConfig) >= 19) {
1943
145
  serverFile = serverFile.replace(/react-dom\/server\.browser/g, "react-dom/server.edge");
1944
146
  }
1945
- await fs2.promises.writeFile(buildPath, serverFile);
147
+ await fs.promises.writeFile(buildPath, serverFile);
1946
148
  console.log("\x1B[32mAll done!\x1B[0m");
1947
149
  },
1948
150
  async configureServer(server) {
@@ -1953,15 +155,15 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
1953
155
  if (devServerPlugin) {
1954
156
  return;
1955
157
  }
1956
- let adapter = node_default;
158
+ let adapter = nodeAdapter;
1957
159
  if (runtime === "bun") {
1958
- adapter = bun_default;
160
+ adapter = bunAdapter;
1959
161
  }
1960
162
  if (runtime === "cloudflare") {
1961
- const { cloudflareAdapter } = await import("./cloudflare-SMC4F7QZ.js");
163
+ const { cloudflareAdapter } = await import("@hono/vite-dev-server/cloudflare");
1962
164
  adapter = cloudflareAdapter;
1963
165
  }
1964
- devServerPlugin = src_default({
166
+ devServerPlugin = honoDevServer({
1965
167
  adapter,
1966
168
  injectClientScript: false,
1967
169
  entry: pluginConfig.serverEntryPoint,
@@ -2001,8 +203,8 @@ function resolvePluginConfig(config, options) {
2001
203
  return null;
2002
204
  }
2003
205
  const { reactRouterConfig, environmentBuildContext, rootDirectory } = config.__reactRouterPluginContext;
2004
- const buildDirectory = path3.relative(rootDirectory, reactRouterConfig.buildDirectory);
2005
- const appDirectory = path3.relative(rootDirectory, reactRouterConfig.appDirectory);
206
+ const buildDirectory = path.relative(rootDirectory, reactRouterConfig.buildDirectory);
207
+ const appDirectory = path.relative(rootDirectory, reactRouterConfig.appDirectory);
2006
208
  const isSsrBuild = environmentBuildContext?.name === "ssr";
2007
209
  const assetsDir = config.build?.assetsDir || "assets";
2008
210
  const serverEntryPoint = options.serverEntryPoint || findDefaultServerEntry(appDirectory);
@@ -2027,10 +229,10 @@ var warned = false;
2027
229
  function findDefaultServerEntry(appDirectory) {
2028
230
  const fileWay = `${appDirectory}/server.ts`;
2029
231
  const folderWay = `${appDirectory}/server/index.ts`;
2030
- if (fs2.existsSync(fileWay)) {
232
+ if (fs.existsSync(fileWay)) {
2031
233
  return fileWay;
2032
234
  }
2033
- if (fs2.existsSync(folderWay)) {
235
+ if (fs.existsSync(folderWay)) {
2034
236
  return folderWay;
2035
237
  }
2036
238
  if (!warned) {