@rsbuild/core 1.3.21 → 1.4.0-beta.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.
Files changed (37) hide show
  1. package/README.md +2 -2
  2. package/compiled/css-loader/index.js +44 -44
  3. package/compiled/html-rspack-plugin/index.js +14 -14
  4. package/compiled/postcss/index.js +189 -144
  5. package/compiled/postcss/lib/input.d.ts +24 -3
  6. package/compiled/postcss/lib/node.d.ts +17 -2
  7. package/compiled/postcss/lib/stringifier.d.ts +2 -2
  8. package/compiled/postcss/package.json +1 -1
  9. package/compiled/postcss-load-config/index.js +10 -10
  10. package/compiled/postcss-loader/index.js +6 -6
  11. package/compiled/rsbuild-dev-middleware/index.js +115 -125
  12. package/compiled/rspack-chain/index.js +67 -67
  13. package/compiled/rspack-chain/package.json +1 -1
  14. package/compiled/rspack-chain/types/index.d.ts +1 -0
  15. package/compiled/rspack-manifest-plugin/index.js +4 -4
  16. package/compiled/sirv/index.js +12 -6
  17. package/compiled/style-loader/index.js +10 -10
  18. package/compiled/tinyglobby/index.d.ts +35 -16
  19. package/compiled/tinyglobby/index.js +517 -531
  20. package/compiled/tinyglobby/package.json +1 -1
  21. package/compiled/webpack-bundle-analyzer/index.js +62 -46
  22. package/dist/index.cjs +274 -236
  23. package/dist/index.js +233 -227
  24. package/dist-types/cli/commands.d.ts +1 -1
  25. package/dist-types/defaultConfig.d.ts +26 -0
  26. package/dist-types/index.d.ts +2 -2
  27. package/dist-types/{config.d.ts → loadConfig.d.ts} +9 -34
  28. package/dist-types/pluginHelper.d.ts +1 -1
  29. package/dist-types/plugins/minimize.d.ts +1 -1
  30. package/dist-types/server/cliShortcuts.d.ts +2 -2
  31. package/dist-types/server/helper.d.ts +2 -2
  32. package/dist-types/server/runner/asModule.d.ts +2 -2
  33. package/dist-types/types/config.d.ts +41 -20
  34. package/dist-types/types/hooks.d.ts +1 -1
  35. package/dist-types/types/plugin.d.ts +18 -18
  36. package/dist-types/types/rsbuild.d.ts +2 -2
  37. package/package.json +11 -10
@@ -1,10 +1,11 @@
1
1
  (() => {
2
- "use strict";
3
2
  var __webpack_modules__ = {
4
- 459: (__unused_webpack_module, exports, __nccwpck_require__) => {
3
+ 114: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ "use strict";
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.callback = exports.promise = void 0;
7
- const walker_1 = __nccwpck_require__(645);
6
+ exports.promise = promise;
7
+ exports.callback = callback;
8
+ const walker_1 = __nccwpck_require__(382);
8
9
  function promise(root, options) {
9
10
  return new Promise((resolve, reject) => {
10
11
  callback(root, options, (err, output) => {
@@ -13,14 +14,13 @@
13
14
  });
14
15
  });
15
16
  }
16
- exports.promise = promise;
17
17
  function callback(root, options, callback) {
18
18
  let walker = new walker_1.Walker(root, options, callback);
19
19
  walker.start();
20
20
  }
21
- exports.callback = callback;
22
21
  },
23
- 963: (__unused_webpack_module, exports) => {
22
+ 490: (__unused_webpack_module, exports) => {
23
+ "use strict";
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.Counter = void 0;
26
26
  class Counter {
@@ -44,19 +44,20 @@
44
44
  }
45
45
  exports.Counter = Counter;
46
46
  },
47
- 693: (__unused_webpack_module, exports) => {
47
+ 944: (__unused_webpack_module, exports) => {
48
+ "use strict";
48
49
  Object.defineProperty(exports, "__esModule", { value: true });
49
- exports.build = void 0;
50
+ exports.build = build;
50
51
  const getArray = (paths) => paths;
51
52
  const getArrayGroup = () => [""].slice(0, 0);
52
53
  function build(options) {
53
54
  return options.group ? getArrayGroup : getArray;
54
55
  }
55
- exports.build = build;
56
56
  },
57
- 140: (__unused_webpack_module, exports) => {
57
+ 753: (__unused_webpack_module, exports) => {
58
+ "use strict";
58
59
  Object.defineProperty(exports, "__esModule", { value: true });
59
- exports.build = void 0;
60
+ exports.build = build;
60
61
  const groupFiles = (groups, directory, files) => {
61
62
  groups.push({ directory, files, dir: directory });
62
63
  };
@@ -64,11 +65,11 @@
64
65
  function build(options) {
65
66
  return options.group ? groupFiles : empty;
66
67
  }
67
- exports.build = build;
68
68
  },
69
- 97: (__unused_webpack_module, exports) => {
69
+ 132: (__unused_webpack_module, exports) => {
70
+ "use strict";
70
71
  Object.defineProperty(exports, "__esModule", { value: true });
71
- exports.build = void 0;
72
+ exports.build = build;
72
73
  const onlyCountsSync = (state) => state.counts;
73
74
  const groupsSync = (state) => state.groups;
74
75
  const defaultSync = (state) => state.paths;
@@ -107,20 +108,18 @@
107
108
  return isSynchronous ? limitFilesSync : limitFilesAsync;
108
109
  else return isSynchronous ? defaultSync : defaultAsync;
109
110
  }
110
- exports.build = build;
111
111
  },
112
- 541: (__unused_webpack_module, exports, __nccwpck_require__) => {
112
+ 348: (__unused_webpack_module, exports, __nccwpck_require__) => {
113
+ "use strict";
113
114
  Object.defineProperty(exports, "__esModule", { value: true });
114
- exports.build =
115
- exports.joinDirectoryPath =
116
- exports.joinPathWithBasePath =
117
- void 0;
115
+ exports.joinPathWithBasePath = joinPathWithBasePath;
116
+ exports.joinDirectoryPath = joinDirectoryPath;
117
+ exports.build = build;
118
118
  const path_1 = __nccwpck_require__(928);
119
- const utils_1 = __nccwpck_require__(281);
119
+ const utils_1 = __nccwpck_require__(376);
120
120
  function joinPathWithBasePath(filename, directoryPath) {
121
121
  return directoryPath + filename;
122
122
  }
123
- exports.joinPathWithBasePath = joinPathWithBasePath;
124
123
  function joinPathWithRelativePath(root, options) {
125
124
  return function (filename, directoryPath) {
126
125
  const sameRoot = directoryPath.startsWith(root);
@@ -142,7 +141,6 @@
142
141
  function joinDirectoryPath(filename, directoryPath, separator) {
143
142
  return directoryPath + filename + separator;
144
143
  }
145
- exports.joinDirectoryPath = joinDirectoryPath;
146
144
  function build(root, options) {
147
145
  const { relativePaths, includeBasePath } = options;
148
146
  return relativePaths && root
@@ -151,11 +149,11 @@
151
149
  ? joinPathWithBasePath
152
150
  : joinPath;
153
151
  }
154
- exports.build = build;
155
152
  },
156
- 143: (__unused_webpack_module, exports) => {
153
+ 724: (__unused_webpack_module, exports) => {
154
+ "use strict";
157
155
  Object.defineProperty(exports, "__esModule", { value: true });
158
- exports.build = void 0;
156
+ exports.build = build;
159
157
  function pushDirectoryWithRelativePath(root) {
160
158
  return function (directoryPath, paths) {
161
159
  paths.push(directoryPath.substring(root.length) || ".");
@@ -188,11 +186,11 @@
188
186
  : pushDirectoryWithRelativePath(root);
189
187
  return filters && filters.length ? pushDirectoryFilter : pushDirectory;
190
188
  }
191
- exports.build = build;
192
189
  },
193
- 368: (__unused_webpack_module, exports) => {
190
+ 101: (__unused_webpack_module, exports) => {
191
+ "use strict";
194
192
  Object.defineProperty(exports, "__esModule", { value: true });
195
- exports.build = void 0;
193
+ exports.build = build;
196
194
  const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
197
195
  if (filters.every((filter) => filter(filename, false))) counts.files++;
198
196
  };
@@ -218,16 +216,16 @@
218
216
  return pushFile;
219
217
  }
220
218
  }
221
- exports.build = build;
222
219
  },
223
- 267: function (__unused_webpack_module, exports, __nccwpck_require__) {
220
+ 626: function (__unused_webpack_module, exports, __nccwpck_require__) {
221
+ "use strict";
224
222
  var __importDefault =
225
223
  (this && this.__importDefault) ||
226
224
  function (mod) {
227
225
  return mod && mod.__esModule ? mod : { default: mod };
228
226
  };
229
227
  Object.defineProperty(exports, "__esModule", { value: true });
230
- exports.build = void 0;
228
+ exports.build = build;
231
229
  const fs_1 = __importDefault(__nccwpck_require__(896));
232
230
  const path_1 = __nccwpck_require__(928);
233
231
  const resolveSymlinksAsync = function (path, state, callback) {
@@ -268,7 +266,6 @@
268
266
  if (!options.resolveSymlinks || options.excludeSymlinks) return null;
269
267
  return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
270
268
  }
271
- exports.build = build;
272
269
  function isRecursive(path, resolved, state) {
273
270
  if (state.options.useRealPaths)
274
271
  return isRecursiveUsingRealPaths(resolved, state);
@@ -291,14 +288,15 @@
291
288
  return state.visited.includes(resolved + state.options.pathSeparator);
292
289
  }
293
290
  },
294
- 642: function (__unused_webpack_module, exports, __nccwpck_require__) {
291
+ 373: function (__unused_webpack_module, exports, __nccwpck_require__) {
292
+ "use strict";
295
293
  var __importDefault =
296
294
  (this && this.__importDefault) ||
297
295
  function (mod) {
298
296
  return mod && mod.__esModule ? mod : { default: mod };
299
297
  };
300
298
  Object.defineProperty(exports, "__esModule", { value: true });
301
- exports.build = void 0;
299
+ exports.build = build;
302
300
  const fs_1 = __importDefault(__nccwpck_require__(896));
303
301
  const readdirOpts = { withFileTypes: true };
304
302
  const walkAsync = (
@@ -308,10 +306,10 @@
308
306
  currentDepth,
309
307
  callback,
310
308
  ) => {
311
- if (currentDepth < 0) return state.queue.dequeue(null, state);
309
+ state.queue.enqueue();
310
+ if (currentDepth <= 0) return state.queue.dequeue(null, state);
312
311
  state.visited.push(crawlPath);
313
312
  state.counts.directories++;
314
- state.queue.enqueue();
315
313
  fs_1.default.readdir(
316
314
  crawlPath || ".",
317
315
  readdirOpts,
@@ -331,7 +329,7 @@
331
329
  currentDepth,
332
330
  callback,
333
331
  ) => {
334
- if (currentDepth < 0) return;
332
+ if (currentDepth <= 0) return;
335
333
  state.visited.push(crawlPath);
336
334
  state.counts.directories++;
337
335
  let entries = [];
@@ -345,9 +343,9 @@
345
343
  function build(isSynchronous) {
346
344
  return isSynchronous ? walkSync : walkAsync;
347
345
  }
348
- exports.build = build;
349
346
  },
350
- 388: (__unused_webpack_module, exports) => {
347
+ 233: (__unused_webpack_module, exports) => {
348
+ "use strict";
351
349
  Object.defineProperty(exports, "__esModule", { value: true });
352
350
  exports.Queue = void 0;
353
351
  class Queue {
@@ -358,24 +356,32 @@
358
356
  }
359
357
  enqueue() {
360
358
  this.count++;
359
+ return this.count;
361
360
  }
362
361
  dequeue(error, output) {
363
- if (--this.count <= 0 || error) this.onQueueEmpty(error, output);
362
+ if (this.onQueueEmpty && (--this.count <= 0 || error)) {
363
+ this.onQueueEmpty(error, output);
364
+ if (error) {
365
+ output.controller.abort();
366
+ this.onQueueEmpty = undefined;
367
+ }
368
+ }
364
369
  }
365
370
  }
366
371
  exports.Queue = Queue;
367
372
  },
368
- 192: (__unused_webpack_module, exports, __nccwpck_require__) => {
373
+ 727: (__unused_webpack_module, exports, __nccwpck_require__) => {
374
+ "use strict";
369
375
  Object.defineProperty(exports, "__esModule", { value: true });
370
- exports.sync = void 0;
371
- const walker_1 = __nccwpck_require__(645);
376
+ exports.sync = sync;
377
+ const walker_1 = __nccwpck_require__(382);
372
378
  function sync(root, options) {
373
379
  const walker = new walker_1.Walker(root, options);
374
380
  return walker.start();
375
381
  }
376
- exports.sync = sync;
377
382
  },
378
- 645: function (__unused_webpack_module, exports, __nccwpck_require__) {
383
+ 382: function (__unused_webpack_module, exports, __nccwpck_require__) {
384
+ "use strict";
379
385
  var __createBinding =
380
386
  (this && this.__createBinding) ||
381
387
  (Object.create
@@ -415,33 +421,43 @@
415
421
  });
416
422
  var __importStar =
417
423
  (this && this.__importStar) ||
418
- function (mod) {
419
- if (mod && mod.__esModule) return mod;
420
- var result = {};
421
- if (mod != null)
422
- for (var k in mod)
423
- if (
424
- k !== "default" &&
425
- Object.prototype.hasOwnProperty.call(mod, k)
426
- )
427
- __createBinding(result, mod, k);
428
- __setModuleDefault(result, mod);
429
- return result;
430
- };
424
+ (function () {
425
+ var ownKeys = function (o) {
426
+ ownKeys =
427
+ Object.getOwnPropertyNames ||
428
+ function (o) {
429
+ var ar = [];
430
+ for (var k in o)
431
+ if (Object.prototype.hasOwnProperty.call(o, k))
432
+ ar[ar.length] = k;
433
+ return ar;
434
+ };
435
+ return ownKeys(o);
436
+ };
437
+ return function (mod) {
438
+ if (mod && mod.__esModule) return mod;
439
+ var result = {};
440
+ if (mod != null)
441
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
442
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
443
+ __setModuleDefault(result, mod);
444
+ return result;
445
+ };
446
+ })();
431
447
  Object.defineProperty(exports, "__esModule", { value: true });
432
448
  exports.Walker = void 0;
433
449
  const path_1 = __nccwpck_require__(928);
434
- const utils_1 = __nccwpck_require__(281);
435
- const joinPath = __importStar(__nccwpck_require__(541));
436
- const pushDirectory = __importStar(__nccwpck_require__(143));
437
- const pushFile = __importStar(__nccwpck_require__(368));
438
- const getArray = __importStar(__nccwpck_require__(693));
439
- const groupFiles = __importStar(__nccwpck_require__(140));
440
- const resolveSymlink = __importStar(__nccwpck_require__(267));
441
- const invokeCallback = __importStar(__nccwpck_require__(97));
442
- const walkDirectory = __importStar(__nccwpck_require__(642));
443
- const queue_1 = __nccwpck_require__(388);
444
- const counter_1 = __nccwpck_require__(963);
450
+ const utils_1 = __nccwpck_require__(376);
451
+ const joinPath = __importStar(__nccwpck_require__(348));
452
+ const pushDirectory = __importStar(__nccwpck_require__(724));
453
+ const pushFile = __importStar(__nccwpck_require__(101));
454
+ const getArray = __importStar(__nccwpck_require__(944));
455
+ const groupFiles = __importStar(__nccwpck_require__(753));
456
+ const resolveSymlink = __importStar(__nccwpck_require__(626));
457
+ const invokeCallback = __importStar(__nccwpck_require__(132));
458
+ const walkDirectory = __importStar(__nccwpck_require__(373));
459
+ const queue_1 = __nccwpck_require__(233);
460
+ const counter_1 = __nccwpck_require__(490);
445
461
  class Walker {
446
462
  root;
447
463
  isSynchronous;
@@ -474,6 +490,7 @@
474
490
  ),
475
491
  symlinks: new Map(),
476
492
  visited: [""].slice(0, 0),
493
+ controller: new AbortController(),
477
494
  };
478
495
  this.joinPath = joinPath.build(this.root, options);
479
496
  this.pushDirectory = pushDirectory.build(this.root, options);
@@ -487,6 +504,11 @@
487
504
  this.walkDirectory = walkDirectory.build(this.isSynchronous);
488
505
  }
489
506
  start() {
507
+ this.pushDirectory(
508
+ this.root,
509
+ this.state.paths,
510
+ this.state.options.filters,
511
+ );
490
512
  this.walkDirectory(
491
513
  this.state,
492
514
  this.root,
@@ -511,13 +533,14 @@
511
533
  useRealPaths,
512
534
  pathSeparator,
513
535
  },
536
+ controller,
514
537
  } = this.state;
515
538
  if (
539
+ controller.signal.aborted ||
516
540
  (signal && signal.aborted) ||
517
541
  (maxFiles && paths.length > maxFiles)
518
542
  )
519
543
  return;
520
- this.pushDirectory(directoryPath, paths, filters);
521
544
  const files = this.getArray(this.state.paths);
522
545
  for (let i = 0; i < entries.length; ++i) {
523
546
  const entry = entries[i];
@@ -534,8 +557,9 @@
534
557
  this.state.options.pathSeparator,
535
558
  );
536
559
  if (exclude && exclude(entry.name, path)) continue;
560
+ this.pushDirectory(path, paths, filters);
537
561
  this.walkDirectory(this.state, path, path, depth - 1, this.walk);
538
- } else if (entry.isSymbolicLink() && this.resolveSymlink) {
562
+ } else if (this.resolveSymlink && entry.isSymbolicLink()) {
539
563
  let path = joinPath.joinPathWithBasePath(
540
564
  entry.name,
541
565
  directoryPath,
@@ -584,11 +608,12 @@
584
608
  }
585
609
  exports.Walker = Walker;
586
610
  },
587
- 250: (__unused_webpack_module, exports, __nccwpck_require__) => {
611
+ 939: (__unused_webpack_module, exports, __nccwpck_require__) => {
612
+ "use strict";
588
613
  Object.defineProperty(exports, "__esModule", { value: true });
589
614
  exports.APIBuilder = void 0;
590
- const async_1 = __nccwpck_require__(459);
591
- const sync_1 = __nccwpck_require__(192);
615
+ const async_1 = __nccwpck_require__(114);
616
+ const sync_1 = __nccwpck_require__(727);
592
617
  class APIBuilder {
593
618
  root;
594
619
  options;
@@ -608,11 +633,12 @@
608
633
  }
609
634
  exports.APIBuilder = APIBuilder;
610
635
  },
611
- 256: (__unused_webpack_module, exports, __nccwpck_require__) => {
636
+ 129: (__unused_webpack_module, exports, __nccwpck_require__) => {
637
+ "use strict";
612
638
  Object.defineProperty(exports, "__esModule", { value: true });
613
639
  exports.Builder = void 0;
614
640
  const path_1 = __nccwpck_require__(928);
615
- const api_builder_1 = __nccwpck_require__(250);
641
+ const api_builder_1 = __nccwpck_require__(939);
616
642
  var pm = null;
617
643
  try {
618
644
  __nccwpck_require__.ab + "index1.js";
@@ -733,7 +759,8 @@
733
759
  }
734
760
  exports.Builder = Builder;
735
761
  },
736
- 648: function (__unused_webpack_module, exports, __nccwpck_require__) {
762
+ 725: function (__unused_webpack_module, exports, __nccwpck_require__) {
763
+ "use strict";
737
764
  var __createBinding =
738
765
  (this && this.__createBinding) ||
739
766
  (Object.create
@@ -771,25 +798,26 @@
771
798
  };
772
799
  Object.defineProperty(exports, "__esModule", { value: true });
773
800
  exports.fdir = void 0;
774
- const builder_1 = __nccwpck_require__(256);
801
+ const builder_1 = __nccwpck_require__(129);
775
802
  Object.defineProperty(exports, "fdir", {
776
803
  enumerable: true,
777
804
  get: function () {
778
805
  return builder_1.Builder;
779
806
  },
780
807
  });
781
- __exportStar(__nccwpck_require__(205), exports);
808
+ __exportStar(__nccwpck_require__(84), exports);
782
809
  },
783
- 205: (__unused_webpack_module, exports) => {
810
+ 84: (__unused_webpack_module, exports) => {
811
+ "use strict";
784
812
  Object.defineProperty(exports, "__esModule", { value: true });
785
813
  },
786
- 281: (__unused_webpack_module, exports, __nccwpck_require__) => {
814
+ 376: (__unused_webpack_module, exports, __nccwpck_require__) => {
815
+ "use strict";
787
816
  Object.defineProperty(exports, "__esModule", { value: true });
788
- exports.normalizePath =
789
- exports.isRootDirectory =
790
- exports.convertSlashes =
791
- exports.cleanPath =
792
- void 0;
817
+ exports.cleanPath = cleanPath;
818
+ exports.convertSlashes = convertSlashes;
819
+ exports.isRootDirectory = isRootDirectory;
820
+ exports.normalizePath = normalizePath;
793
821
  const path_1 = __nccwpck_require__(928);
794
822
  function cleanPath(path) {
795
823
  let normalized = (0, path_1.normalize)(path);
@@ -800,16 +828,14 @@
800
828
  normalized = normalized.substring(0, normalized.length - 1);
801
829
  return normalized;
802
830
  }
803
- exports.cleanPath = cleanPath;
804
831
  const SLASHES_REGEX = /[\\/]/g;
805
832
  function convertSlashes(path, separator) {
806
833
  return path.replace(SLASHES_REGEX, separator);
807
834
  }
808
- exports.convertSlashes = convertSlashes;
835
+ const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
809
836
  function isRootDirectory(path) {
810
- return path === "/" || /^[a-z]:\\$/i.test(path);
837
+ return path === "/" || WINDOWS_ROOT_DIR_REGEX.test(path);
811
838
  }
812
- exports.isRootDirectory = isRootDirectory;
813
839
  function normalizePath(path, options) {
814
840
  const { resolvePaths, normalizePath, pathSeparator } = options;
815
841
  const pathNeedsCleaning =
@@ -824,9 +850,9 @@
824
850
  pathSeparator,
825
851
  );
826
852
  }
827
- exports.normalizePath = normalizePath;
828
853
  },
829
854
  976: (module, __unused_webpack_exports, __nccwpck_require__) => {
855
+ "use strict";
830
856
  const pico = __nccwpck_require__(106);
831
857
  const utils = __nccwpck_require__(949);
832
858
  function picomatch(glob, options, returnState = false) {
@@ -842,6 +868,7 @@
842
868
  module.exports = picomatch;
843
869
  },
844
870
  425: (module) => {
871
+ "use strict";
845
872
  const WIN_SLASH = "\\\\/";
846
873
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
847
874
  const DOT_LITERAL = "\\.";
@@ -981,6 +1008,7 @@
981
1008
  };
982
1009
  },
983
1010
  775: (module, __unused_webpack_exports, __nccwpck_require__) => {
1011
+ "use strict";
984
1012
  const constants = __nccwpck_require__(425);
985
1013
  const utils = __nccwpck_require__(949);
986
1014
  const {
@@ -1850,6 +1878,7 @@
1850
1878
  module.exports = parse;
1851
1879
  },
1852
1880
  106: (module, __unused_webpack_exports, __nccwpck_require__) => {
1881
+ "use strict";
1853
1882
  const scan = __nccwpck_require__(75);
1854
1883
  const parse = __nccwpck_require__(775);
1855
1884
  const utils = __nccwpck_require__(949);
@@ -2025,6 +2054,7 @@
2025
2054
  module.exports = picomatch;
2026
2055
  },
2027
2056
  75: (module, __unused_webpack_exports, __nccwpck_require__) => {
2057
+ "use strict";
2028
2058
  const utils = __nccwpck_require__(949);
2029
2059
  const {
2030
2060
  CHAR_ASTERISK,
@@ -2347,6 +2377,7 @@
2347
2377
  module.exports = scan;
2348
2378
  },
2349
2379
  949: (__unused_webpack_module, exports, __nccwpck_require__) => {
2380
+ "use strict";
2350
2381
  const {
2351
2382
  REGEX_BACKSLASH,
2352
2383
  REGEX_REMOVE_BACKSLASH,
@@ -2408,447 +2439,12 @@
2408
2439
  return last;
2409
2440
  };
2410
2441
  },
2411
- 83: (module, __unused_webpack_exports, __nccwpck_require__) => {
2412
- var __create = Object.create;
2413
- var __defProp = Object.defineProperty;
2414
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2415
- var __getOwnPropNames = Object.getOwnPropertyNames;
2416
- var __getProtoOf = Object.getPrototypeOf;
2417
- var __hasOwnProp = Object.prototype.hasOwnProperty;
2418
- var __export = (target, all) => {
2419
- for (var name in all)
2420
- __defProp(target, name, { get: all[name], enumerable: true });
2421
- };
2422
- var __copyProps = (to, from, except, desc) => {
2423
- if ((from && typeof from === "object") || typeof from === "function") {
2424
- for (let key of __getOwnPropNames(from))
2425
- if (!__hasOwnProp.call(to, key) && key !== except)
2426
- __defProp(to, key, {
2427
- get: () => from[key],
2428
- enumerable:
2429
- !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
2430
- });
2431
- }
2432
- return to;
2433
- };
2434
- var __toESM = (mod, isNodeMode, target) => (
2435
- (target = mod != null ? __create(__getProtoOf(mod)) : {}),
2436
- __copyProps(
2437
- isNodeMode || !mod || !mod.__esModule
2438
- ? __defProp(target, "default", { value: mod, enumerable: true })
2439
- : target,
2440
- mod,
2441
- )
2442
- );
2443
- var __toCommonJS = (mod) =>
2444
- __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2445
- var index_exports = {};
2446
- __export(index_exports, {
2447
- convertPathToPattern: () => convertPathToPattern,
2448
- escapePath: () => escapePath,
2449
- glob: () => glob,
2450
- globSync: () => globSync,
2451
- isDynamicPattern: () => isDynamicPattern,
2452
- });
2453
- module.exports = __toCommonJS(index_exports);
2454
- var import_node_path = __toESM(__nccwpck_require__(928));
2455
- var import_fdir = __nccwpck_require__(648);
2456
- var import_picomatch2 = __toESM(__nccwpck_require__(976));
2457
- var import_picomatch = __toESM(__nccwpck_require__(976));
2458
- var ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
2459
- function getPartialMatcher(patterns, options) {
2460
- const patternsCount = patterns.length;
2461
- const patternsParts = Array(patternsCount);
2462
- const regexes = Array(patternsCount);
2463
- for (let i = 0; i < patternsCount; i++) {
2464
- const parts = splitPattern(patterns[i]);
2465
- patternsParts[i] = parts;
2466
- const partsCount = parts.length;
2467
- const partRegexes = Array(partsCount);
2468
- for (let j = 0; j < partsCount; j++) {
2469
- partRegexes[j] = import_picomatch.default.makeRe(parts[j], options);
2470
- }
2471
- regexes[i] = partRegexes;
2472
- }
2473
- return (input) => {
2474
- const inputParts = input.split("/");
2475
- if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) {
2476
- return true;
2477
- }
2478
- for (let i = 0; i < patterns.length; i++) {
2479
- const patternParts = patternsParts[i];
2480
- const regex = regexes[i];
2481
- const inputPatternCount = inputParts.length;
2482
- const minParts = Math.min(inputPatternCount, patternParts.length);
2483
- let j = 0;
2484
- while (j < minParts) {
2485
- const part = patternParts[j];
2486
- if (part.includes("/")) {
2487
- return true;
2488
- }
2489
- const match = regex[j].test(inputParts[j]);
2490
- if (!match) {
2491
- break;
2492
- }
2493
- if (part === "**") {
2494
- return true;
2495
- }
2496
- j++;
2497
- }
2498
- if (j === inputPatternCount) {
2499
- return true;
2500
- }
2501
- }
2502
- return false;
2503
- };
2504
- }
2505
- var splitPatternOptions = { parts: true };
2506
- function splitPattern(path2) {
2507
- var _a;
2508
- const result = import_picomatch.default.scan(
2509
- path2,
2510
- splitPatternOptions,
2511
- );
2512
- return ((_a = result.parts) == null ? void 0 : _a.length)
2513
- ? result.parts
2514
- : [path2];
2515
- }
2516
- var isWin = process.platform === "win32";
2517
- var ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
2518
- function convertPosixPathToPattern(path2) {
2519
- return escapePosixPath(path2);
2520
- }
2521
- function convertWin32PathToPattern(path2) {
2522
- return escapeWin32Path(path2).replace(ESCAPED_WIN32_BACKSLASHES, "/");
2523
- }
2524
- var convertPathToPattern = isWin
2525
- ? convertWin32PathToPattern
2526
- : convertPosixPathToPattern;
2527
- var POSIX_UNESCAPED_GLOB_SYMBOLS =
2528
- /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
2529
- var WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
2530
- var escapePosixPath = (path2) =>
2531
- path2.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2532
- var escapeWin32Path = (path2) =>
2533
- path2.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2534
- var escapePath = isWin ? escapeWin32Path : escapePosixPath;
2535
- function isDynamicPattern(pattern, options) {
2536
- if ((options == null ? void 0 : options.caseSensitiveMatch) === false) {
2537
- return true;
2538
- }
2539
- const scan = import_picomatch.default.scan(pattern);
2540
- return scan.isGlob || scan.negated;
2541
- }
2542
- function log(...tasks) {
2543
- console.log(
2544
- `[tinyglobby ${new Date().toLocaleTimeString("es")}]`,
2545
- ...tasks,
2546
- );
2547
- }
2548
- var PARENT_DIRECTORY = /^(\/?\.\.)+/;
2549
- var ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
2550
- var BACKSLASHES = /\\/g;
2551
- function normalizePattern(
2552
- pattern,
2553
- expandDirectories,
2554
- cwd,
2555
- props,
2556
- isIgnore,
2557
- ) {
2558
- var _a;
2559
- let result = pattern;
2560
- if (pattern.endsWith("/")) {
2561
- result = pattern.slice(0, -1);
2562
- }
2563
- if (!result.endsWith("*") && expandDirectories) {
2564
- result += "/**";
2565
- }
2566
- if (
2567
- import_node_path.default.isAbsolute(
2568
- result.replace(ESCAPING_BACKSLASHES, ""),
2569
- )
2570
- ) {
2571
- result = import_node_path.posix.relative(escapePath(cwd), result);
2572
- } else {
2573
- result = import_node_path.posix.normalize(result);
2574
- }
2575
- const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2576
- if (parentDirectoryMatch == null ? void 0 : parentDirectoryMatch[0]) {
2577
- const potentialRoot = import_node_path.posix.join(
2578
- cwd,
2579
- parentDirectoryMatch[0],
2580
- );
2581
- if (props.root.length > potentialRoot.length) {
2582
- props.root = potentialRoot;
2583
- props.depthOffset = -(parentDirectoryMatch[0].length + 1) / 3;
2584
- }
2585
- } else if (!isIgnore && props.depthOffset >= 0) {
2586
- const parts = splitPattern(result);
2587
- (_a = props.commonPath) != null ? _a : (props.commonPath = parts);
2588
- const newCommonPath = [];
2589
- const length = Math.min(props.commonPath.length, parts.length);
2590
- for (let i = 0; i < length; i++) {
2591
- const part = parts[i];
2592
- if (part === "**" && !parts[i + 1]) {
2593
- newCommonPath.pop();
2594
- break;
2595
- }
2596
- if (
2597
- part !== props.commonPath[i] ||
2598
- isDynamicPattern(part) ||
2599
- i === parts.length - 1
2600
- ) {
2601
- break;
2602
- }
2603
- newCommonPath.push(part);
2604
- }
2605
- props.depthOffset = newCommonPath.length;
2606
- props.commonPath = newCommonPath;
2607
- props.root =
2608
- newCommonPath.length > 0
2609
- ? import_node_path.default.posix.join(cwd, ...newCommonPath)
2610
- : cwd;
2611
- }
2612
- return result;
2613
- }
2614
- function processPatterns(
2615
- { patterns, ignore = [], expandDirectories = true },
2616
- cwd,
2617
- props,
2618
- ) {
2619
- if (typeof patterns === "string") {
2620
- patterns = [patterns];
2621
- } else if (!patterns) {
2622
- patterns = ["**/*"];
2623
- }
2624
- if (typeof ignore === "string") {
2625
- ignore = [ignore];
2626
- }
2627
- const matchPatterns = [];
2628
- const ignorePatterns = [];
2629
- for (const pattern of ignore) {
2630
- if (!pattern) {
2631
- continue;
2632
- }
2633
- if (pattern[0] !== "!" || pattern[1] === "(") {
2634
- ignorePatterns.push(
2635
- normalizePattern(pattern, expandDirectories, cwd, props, true),
2636
- );
2637
- }
2638
- }
2639
- for (const pattern of patterns) {
2640
- if (!pattern) {
2641
- continue;
2642
- }
2643
- if (pattern[0] !== "!" || pattern[1] === "(") {
2644
- matchPatterns.push(
2645
- normalizePattern(pattern, expandDirectories, cwd, props, false),
2646
- );
2647
- } else if (pattern[1] !== "!" || pattern[2] === "(") {
2648
- ignorePatterns.push(
2649
- normalizePattern(
2650
- pattern.slice(1),
2651
- expandDirectories,
2652
- cwd,
2653
- props,
2654
- true,
2655
- ),
2656
- );
2657
- }
2658
- }
2659
- return { match: matchPatterns, ignore: ignorePatterns };
2660
- }
2661
- function getRelativePath(path2, cwd, root) {
2662
- return import_node_path.posix.relative(cwd, `${root}/${path2}`) || ".";
2663
- }
2664
- function processPath(path2, cwd, root, isDirectory, absolute) {
2665
- const relativePath = absolute
2666
- ? path2.slice(root === "/" ? 1 : root.length + 1) || "."
2667
- : path2;
2668
- if (root === cwd) {
2669
- return isDirectory && relativePath !== "."
2670
- ? relativePath.slice(0, -1)
2671
- : relativePath;
2672
- }
2673
- return getRelativePath(relativePath, cwd, root);
2674
- }
2675
- function formatPaths(paths, cwd, root) {
2676
- for (let i = paths.length - 1; i >= 0; i--) {
2677
- const path2 = paths[i];
2678
- paths[i] =
2679
- getRelativePath(path2, cwd, root) +
2680
- (!path2 || path2.endsWith("/") ? "/" : "");
2681
- }
2682
- return paths;
2683
- }
2684
- function crawl(options, cwd, sync) {
2685
- if (process.env.TINYGLOBBY_DEBUG) {
2686
- options.debug = true;
2687
- }
2688
- if (options.debug) {
2689
- log("globbing with options:", options, "cwd:", cwd);
2690
- }
2691
- if (Array.isArray(options.patterns) && options.patterns.length === 0) {
2692
- return sync ? [] : Promise.resolve([]);
2693
- }
2694
- const props = { root: cwd, commonPath: null, depthOffset: 0 };
2695
- const processed = processPatterns(options, cwd, props);
2696
- const nocase = options.caseSensitiveMatch === false;
2697
- if (options.debug) {
2698
- log("internal processing patterns:", processed);
2699
- }
2700
- const matcher = (0, import_picomatch2.default)(processed.match, {
2701
- dot: options.dot,
2702
- nocase,
2703
- ignore: processed.ignore,
2704
- });
2705
- const ignore = (0, import_picomatch2.default)(processed.ignore, {
2706
- dot: options.dot,
2707
- nocase,
2708
- });
2709
- const partialMatcher = getPartialMatcher(processed.match, {
2710
- dot: options.dot,
2711
- nocase,
2712
- });
2713
- const fdirOptions = {
2714
- filters: [
2715
- options.debug
2716
- ? (p, isDirectory) => {
2717
- const path2 = processPath(
2718
- p,
2719
- cwd,
2720
- props.root,
2721
- isDirectory,
2722
- options.absolute,
2723
- );
2724
- const matches = matcher(path2);
2725
- if (matches) {
2726
- log(`matched ${path2}`);
2727
- }
2728
- return matches;
2729
- }
2730
- : (p, isDirectory) =>
2731
- matcher(
2732
- processPath(
2733
- p,
2734
- cwd,
2735
- props.root,
2736
- isDirectory,
2737
- options.absolute,
2738
- ),
2739
- ),
2740
- ],
2741
- exclude: options.debug
2742
- ? (_, p) => {
2743
- const relativePath = processPath(
2744
- p,
2745
- cwd,
2746
- props.root,
2747
- true,
2748
- true,
2749
- );
2750
- const skipped =
2751
- (relativePath !== "." && !partialMatcher(relativePath)) ||
2752
- ignore(relativePath);
2753
- if (skipped) {
2754
- log(`skipped ${p}`);
2755
- } else {
2756
- log(`crawling ${p}`);
2757
- }
2758
- return skipped;
2759
- }
2760
- : (_, p) => {
2761
- const relativePath = processPath(
2762
- p,
2763
- cwd,
2764
- props.root,
2765
- true,
2766
- true,
2767
- );
2768
- return (
2769
- (relativePath !== "." && !partialMatcher(relativePath)) ||
2770
- ignore(relativePath)
2771
- );
2772
- },
2773
- pathSeparator: "/",
2774
- relativePaths: true,
2775
- resolveSymlinks: true,
2776
- };
2777
- if (options.deep) {
2778
- fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
2779
- }
2780
- if (options.absolute) {
2781
- fdirOptions.relativePaths = false;
2782
- fdirOptions.resolvePaths = true;
2783
- fdirOptions.includeBasePath = true;
2784
- }
2785
- if (options.followSymbolicLinks === false) {
2786
- fdirOptions.resolveSymlinks = false;
2787
- fdirOptions.excludeSymlinks = true;
2788
- }
2789
- if (options.onlyDirectories) {
2790
- fdirOptions.excludeFiles = true;
2791
- fdirOptions.includeDirs = true;
2792
- } else if (options.onlyFiles === false) {
2793
- fdirOptions.includeDirs = true;
2794
- }
2795
- props.root = props.root.replace(BACKSLASHES, "");
2796
- const root = props.root;
2797
- if (options.debug) {
2798
- log("internal properties:", props);
2799
- }
2800
- const api = new import_fdir.fdir(fdirOptions).crawl(root);
2801
- if (cwd === root || options.absolute) {
2802
- return sync ? api.sync() : api.withPromise();
2803
- }
2804
- return sync
2805
- ? formatPaths(api.sync(), cwd, root)
2806
- : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
2807
- }
2808
- async function glob(patternsOrOptions, options) {
2809
- if (
2810
- patternsOrOptions &&
2811
- (options == null ? void 0 : options.patterns)
2812
- ) {
2813
- throw new Error(
2814
- "Cannot pass patterns as both an argument and an option",
2815
- );
2816
- }
2817
- const opts =
2818
- Array.isArray(patternsOrOptions) ||
2819
- typeof patternsOrOptions === "string"
2820
- ? { ...options, patterns: patternsOrOptions }
2821
- : patternsOrOptions;
2822
- const cwd = opts.cwd
2823
- ? import_node_path.default.resolve(opts.cwd).replace(BACKSLASHES, "/")
2824
- : process.cwd().replace(BACKSLASHES, "/");
2825
- return crawl(opts, cwd, false);
2826
- }
2827
- function globSync(patternsOrOptions, options) {
2828
- if (
2829
- patternsOrOptions &&
2830
- (options == null ? void 0 : options.patterns)
2831
- ) {
2832
- throw new Error(
2833
- "Cannot pass patterns as both an argument and an option",
2834
- );
2835
- }
2836
- const opts =
2837
- Array.isArray(patternsOrOptions) ||
2838
- typeof patternsOrOptions === "string"
2839
- ? { ...options, patterns: patternsOrOptions }
2840
- : patternsOrOptions;
2841
- const cwd = opts.cwd
2842
- ? import_node_path.default.resolve(opts.cwd).replace(BACKSLASHES, "/")
2843
- : process.cwd().replace(BACKSLASHES, "/");
2844
- return crawl(opts, cwd, true);
2845
- }
2846
- 0 && 0;
2847
- },
2848
2442
  896: (module) => {
2443
+ "use strict";
2849
2444
  module.exports = require("fs");
2850
2445
  },
2851
2446
  928: (module) => {
2447
+ "use strict";
2852
2448
  module.exports = require("path");
2853
2449
  },
2854
2450
  };
@@ -2875,6 +2471,396 @@
2875
2471
  }
2876
2472
  if (typeof __nccwpck_require__ !== "undefined")
2877
2473
  __nccwpck_require__.ab = __dirname + "/";
2878
- var __webpack_exports__ = __nccwpck_require__(83);
2474
+ var __webpack_exports__ = {};
2475
+ (() => {
2476
+ var exports = __webpack_exports__;
2477
+ var __create = Object.create;
2478
+ var __defProp = Object.defineProperty;
2479
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2480
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2481
+ var __getProtoOf = Object.getPrototypeOf;
2482
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
2483
+ var __copyProps = (to, from, except, desc) => {
2484
+ if ((from && typeof from === "object") || typeof from === "function")
2485
+ for (
2486
+ var keys = __getOwnPropNames(from), i = 0, n = keys.length, key;
2487
+ i < n;
2488
+ i++
2489
+ ) {
2490
+ key = keys[i];
2491
+ if (!__hasOwnProp.call(to, key) && key !== except)
2492
+ __defProp(to, key, {
2493
+ get: ((k) => from[k]).bind(null, key),
2494
+ enumerable:
2495
+ !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
2496
+ });
2497
+ }
2498
+ return to;
2499
+ };
2500
+ var __toESM = (mod, isNodeMode, target) => (
2501
+ (target = mod != null ? __create(__getProtoOf(mod)) : {}),
2502
+ __copyProps(
2503
+ isNodeMode || !mod || !mod.__esModule
2504
+ ? __defProp(target, "default", { value: mod, enumerable: true })
2505
+ : target,
2506
+ mod,
2507
+ )
2508
+ );
2509
+ const path = __toESM(__nccwpck_require__(928));
2510
+ const fdir = __toESM(__nccwpck_require__(725));
2511
+ const picomatch = __toESM(__nccwpck_require__(976));
2512
+ const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
2513
+ function getPartialMatcher(patterns, options) {
2514
+ const patternsCount = patterns.length;
2515
+ const patternsParts = Array(patternsCount);
2516
+ const regexes = Array(patternsCount);
2517
+ for (let i = 0; i < patternsCount; i++) {
2518
+ const parts = splitPattern(patterns[i]);
2519
+ patternsParts[i] = parts;
2520
+ const partsCount = parts.length;
2521
+ const partRegexes = Array(partsCount);
2522
+ for (let j = 0; j < partsCount; j++)
2523
+ partRegexes[j] = picomatch.default.makeRe(parts[j], options);
2524
+ regexes[i] = partRegexes;
2525
+ }
2526
+ return (input) => {
2527
+ const inputParts = input.split("/");
2528
+ if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input))
2529
+ return true;
2530
+ for (let i = 0; i < patterns.length; i++) {
2531
+ const patternParts = patternsParts[i];
2532
+ const regex = regexes[i];
2533
+ const inputPatternCount = inputParts.length;
2534
+ const minParts = Math.min(inputPatternCount, patternParts.length);
2535
+ let j = 0;
2536
+ while (j < minParts) {
2537
+ const part = patternParts[j];
2538
+ if (part.includes("/")) return true;
2539
+ const match = regex[j].test(inputParts[j]);
2540
+ if (!match) break;
2541
+ if (part === "**") return true;
2542
+ j++;
2543
+ }
2544
+ if (j === inputPatternCount) return true;
2545
+ }
2546
+ return false;
2547
+ };
2548
+ }
2549
+ const splitPatternOptions = { parts: true };
2550
+ function splitPattern(path$2) {
2551
+ var _result$parts;
2552
+ const result = picomatch.default.scan(path$2, splitPatternOptions);
2553
+ return (
2554
+ (_result$parts = result.parts) === null || _result$parts === void 0
2555
+ ? void 0
2556
+ : _result$parts.length
2557
+ )
2558
+ ? result.parts
2559
+ : [path$2];
2560
+ }
2561
+ const isWin = process.platform === "win32";
2562
+ const ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
2563
+ function convertPosixPathToPattern(path$2) {
2564
+ return escapePosixPath(path$2);
2565
+ }
2566
+ function convertWin32PathToPattern(path$2) {
2567
+ return escapeWin32Path(path$2).replace(ESCAPED_WIN32_BACKSLASHES, "/");
2568
+ }
2569
+ const convertPathToPattern = isWin
2570
+ ? convertWin32PathToPattern
2571
+ : convertPosixPathToPattern;
2572
+ const POSIX_UNESCAPED_GLOB_SYMBOLS =
2573
+ /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
2574
+ const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
2575
+ const escapePosixPath = (path$2) =>
2576
+ path$2.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2577
+ const escapeWin32Path = (path$2) =>
2578
+ path$2.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2579
+ const escapePath = isWin ? escapeWin32Path : escapePosixPath;
2580
+ function isDynamicPattern(pattern, options) {
2581
+ if (
2582
+ (options === null || options === void 0
2583
+ ? void 0
2584
+ : options.caseSensitiveMatch) === false
2585
+ )
2586
+ return true;
2587
+ const scan = picomatch.default.scan(pattern);
2588
+ return scan.isGlob || scan.negated;
2589
+ }
2590
+ function log(...tasks) {
2591
+ console.log(
2592
+ `[tinyglobby ${new Date().toLocaleTimeString("es")}]`,
2593
+ ...tasks,
2594
+ );
2595
+ }
2596
+ const PARENT_DIRECTORY = /^(\/?\.\.)+/;
2597
+ const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
2598
+ const BACKSLASHES = /\\/g;
2599
+ function normalizePattern(
2600
+ pattern,
2601
+ expandDirectories,
2602
+ cwd,
2603
+ props,
2604
+ isIgnore,
2605
+ ) {
2606
+ let result = pattern;
2607
+ if (pattern.endsWith("/")) result = pattern.slice(0, -1);
2608
+ if (!result.endsWith("*") && expandDirectories) result += "/**";
2609
+ const escapedCwd = escapePath(cwd);
2610
+ if (path.default.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")))
2611
+ result = path.posix.relative(escapedCwd, result);
2612
+ else result = path.posix.normalize(result);
2613
+ const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2614
+ const parts = splitPattern(result);
2615
+ if (
2616
+ parentDirectoryMatch === null || parentDirectoryMatch === void 0
2617
+ ? void 0
2618
+ : parentDirectoryMatch[0]
2619
+ ) {
2620
+ const n = (parentDirectoryMatch[0].length + 1) / 3;
2621
+ let i = 0;
2622
+ const cwdParts = escapedCwd.split("/");
2623
+ while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
2624
+ result =
2625
+ result.slice(0, (n - i - 1) * 3) +
2626
+ result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
2627
+ i++;
2628
+ }
2629
+ const potentialRoot = path.posix.join(
2630
+ cwd,
2631
+ parentDirectoryMatch[0].slice(i * 3),
2632
+ );
2633
+ if (
2634
+ !potentialRoot.startsWith(".") &&
2635
+ props.root.length > potentialRoot.length
2636
+ ) {
2637
+ props.root = potentialRoot;
2638
+ props.depthOffset = -n + i;
2639
+ }
2640
+ }
2641
+ if (!isIgnore && props.depthOffset >= 0) {
2642
+ var _props$commonPath;
2643
+ ((_props$commonPath = props.commonPath) !== null &&
2644
+ _props$commonPath !== void 0) ||
2645
+ (props.commonPath = parts);
2646
+ const newCommonPath = [];
2647
+ const length = Math.min(props.commonPath.length, parts.length);
2648
+ for (let i = 0; i < length; i++) {
2649
+ const part = parts[i];
2650
+ if (part === "**" && !parts[i + 1]) {
2651
+ newCommonPath.pop();
2652
+ break;
2653
+ }
2654
+ if (
2655
+ part !== props.commonPath[i] ||
2656
+ isDynamicPattern(part) ||
2657
+ i === parts.length - 1
2658
+ )
2659
+ break;
2660
+ newCommonPath.push(part);
2661
+ }
2662
+ props.depthOffset = newCommonPath.length;
2663
+ props.commonPath = newCommonPath;
2664
+ props.root =
2665
+ newCommonPath.length > 0
2666
+ ? path.default.posix.join(cwd, ...newCommonPath)
2667
+ : cwd;
2668
+ }
2669
+ return result;
2670
+ }
2671
+ function processPatterns(
2672
+ { patterns, ignore = [], expandDirectories = true },
2673
+ cwd,
2674
+ props,
2675
+ ) {
2676
+ if (typeof patterns === "string") patterns = [patterns];
2677
+ else if (!patterns) patterns = ["**/*"];
2678
+ if (typeof ignore === "string") ignore = [ignore];
2679
+ const matchPatterns = [];
2680
+ const ignorePatterns = [];
2681
+ for (const pattern of ignore) {
2682
+ if (!pattern) continue;
2683
+ if (pattern[0] !== "!" || pattern[1] === "(")
2684
+ ignorePatterns.push(
2685
+ normalizePattern(pattern, expandDirectories, cwd, props, true),
2686
+ );
2687
+ }
2688
+ for (const pattern of patterns) {
2689
+ if (!pattern) continue;
2690
+ if (pattern[0] !== "!" || pattern[1] === "(")
2691
+ matchPatterns.push(
2692
+ normalizePattern(pattern, expandDirectories, cwd, props, false),
2693
+ );
2694
+ else if (pattern[1] !== "!" || pattern[2] === "(")
2695
+ ignorePatterns.push(
2696
+ normalizePattern(
2697
+ pattern.slice(1),
2698
+ expandDirectories,
2699
+ cwd,
2700
+ props,
2701
+ true,
2702
+ ),
2703
+ );
2704
+ }
2705
+ return { match: matchPatterns, ignore: ignorePatterns };
2706
+ }
2707
+ function getRelativePath(path$2, cwd, root) {
2708
+ return path.posix.relative(cwd, `${root}/${path$2}`) || ".";
2709
+ }
2710
+ function processPath(path$2, cwd, root, isDirectory, absolute) {
2711
+ const relativePath = absolute
2712
+ ? path$2.slice(root === "/" ? 1 : root.length + 1) || "."
2713
+ : path$2;
2714
+ if (root === cwd)
2715
+ return isDirectory && relativePath !== "."
2716
+ ? relativePath.slice(0, -1)
2717
+ : relativePath;
2718
+ return getRelativePath(relativePath, cwd, root);
2719
+ }
2720
+ function formatPaths(paths, cwd, root) {
2721
+ for (let i = paths.length - 1; i >= 0; i--) {
2722
+ const path$2 = paths[i];
2723
+ paths[i] =
2724
+ getRelativePath(path$2, cwd, root) +
2725
+ (!path$2 || path$2.endsWith("/") ? "/" : "");
2726
+ }
2727
+ return paths;
2728
+ }
2729
+ function crawl(options, cwd, sync) {
2730
+ if (process.env.TINYGLOBBY_DEBUG) options.debug = true;
2731
+ if (options.debug) log("globbing with options:", options, "cwd:", cwd);
2732
+ if (Array.isArray(options.patterns) && options.patterns.length === 0)
2733
+ return sync ? [] : Promise.resolve([]);
2734
+ const props = { root: cwd, commonPath: null, depthOffset: 0 };
2735
+ const processed = processPatterns(options, cwd, props);
2736
+ const nocase = options.caseSensitiveMatch === false;
2737
+ if (options.debug) log("internal processing patterns:", processed);
2738
+ const matcher = (0, picomatch.default)(processed.match, {
2739
+ dot: options.dot,
2740
+ nocase,
2741
+ ignore: processed.ignore,
2742
+ });
2743
+ const ignore = (0, picomatch.default)(processed.ignore, {
2744
+ dot: options.dot,
2745
+ nocase,
2746
+ });
2747
+ const partialMatcher = getPartialMatcher(processed.match, {
2748
+ dot: options.dot,
2749
+ nocase,
2750
+ });
2751
+ const fdirOptions = {
2752
+ filters: [
2753
+ options.debug
2754
+ ? (p, isDirectory) => {
2755
+ const path$2 = processPath(
2756
+ p,
2757
+ cwd,
2758
+ props.root,
2759
+ isDirectory,
2760
+ options.absolute,
2761
+ );
2762
+ const matches = matcher(path$2);
2763
+ if (matches) log(`matched ${path$2}`);
2764
+ return matches;
2765
+ }
2766
+ : (p, isDirectory) =>
2767
+ matcher(
2768
+ processPath(
2769
+ p,
2770
+ cwd,
2771
+ props.root,
2772
+ isDirectory,
2773
+ options.absolute,
2774
+ ),
2775
+ ),
2776
+ ],
2777
+ exclude: options.debug
2778
+ ? (_, p) => {
2779
+ const relativePath = processPath(p, cwd, props.root, true, true);
2780
+ const skipped =
2781
+ (relativePath !== "." && !partialMatcher(relativePath)) ||
2782
+ ignore(relativePath);
2783
+ if (skipped) log(`skipped ${p}`);
2784
+ else log(`crawling ${p}`);
2785
+ return skipped;
2786
+ }
2787
+ : (_, p) => {
2788
+ const relativePath = processPath(p, cwd, props.root, true, true);
2789
+ return (
2790
+ (relativePath !== "." && !partialMatcher(relativePath)) ||
2791
+ ignore(relativePath)
2792
+ );
2793
+ },
2794
+ pathSeparator: "/",
2795
+ relativePaths: true,
2796
+ resolveSymlinks: true,
2797
+ };
2798
+ if (options.deep !== void 0)
2799
+ fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
2800
+ if (options.absolute) {
2801
+ fdirOptions.relativePaths = false;
2802
+ fdirOptions.resolvePaths = true;
2803
+ fdirOptions.includeBasePath = true;
2804
+ }
2805
+ if (options.followSymbolicLinks === false) {
2806
+ fdirOptions.resolveSymlinks = false;
2807
+ fdirOptions.excludeSymlinks = true;
2808
+ }
2809
+ if (options.onlyDirectories) {
2810
+ fdirOptions.excludeFiles = true;
2811
+ fdirOptions.includeDirs = true;
2812
+ } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
2813
+ props.root = props.root.replace(BACKSLASHES, "");
2814
+ const root = props.root;
2815
+ if (options.debug) log("internal properties:", props);
2816
+ const api = new fdir.fdir(fdirOptions).crawl(root);
2817
+ if (cwd === root || options.absolute)
2818
+ return sync ? api.sync() : api.withPromise();
2819
+ return sync
2820
+ ? formatPaths(api.sync(), cwd, root)
2821
+ : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
2822
+ }
2823
+ async function glob(patternsOrOptions, options) {
2824
+ if (
2825
+ patternsOrOptions &&
2826
+ (options === null || options === void 0 ? void 0 : options.patterns)
2827
+ )
2828
+ throw new Error(
2829
+ "Cannot pass patterns as both an argument and an option",
2830
+ );
2831
+ const opts =
2832
+ Array.isArray(patternsOrOptions) ||
2833
+ typeof patternsOrOptions === "string"
2834
+ ? { ...options, patterns: patternsOrOptions }
2835
+ : patternsOrOptions;
2836
+ const cwd = opts.cwd
2837
+ ? path.default.resolve(opts.cwd).replace(BACKSLASHES, "/")
2838
+ : process.cwd().replace(BACKSLASHES, "/");
2839
+ return crawl(opts, cwd, false);
2840
+ }
2841
+ function globSync(patternsOrOptions, options) {
2842
+ if (
2843
+ patternsOrOptions &&
2844
+ (options === null || options === void 0 ? void 0 : options.patterns)
2845
+ )
2846
+ throw new Error(
2847
+ "Cannot pass patterns as both an argument and an option",
2848
+ );
2849
+ const opts =
2850
+ Array.isArray(patternsOrOptions) ||
2851
+ typeof patternsOrOptions === "string"
2852
+ ? { ...options, patterns: patternsOrOptions }
2853
+ : patternsOrOptions;
2854
+ const cwd = opts.cwd
2855
+ ? path.default.resolve(opts.cwd).replace(BACKSLASHES, "/")
2856
+ : process.cwd().replace(BACKSLASHES, "/");
2857
+ return crawl(opts, cwd, true);
2858
+ }
2859
+ exports.convertPathToPattern = convertPathToPattern;
2860
+ exports.escapePath = escapePath;
2861
+ exports.glob = glob;
2862
+ exports.globSync = globSync;
2863
+ exports.isDynamicPattern = isDynamicPattern;
2864
+ })();
2879
2865
  module.exports = __webpack_exports__;
2880
2866
  })();