@rsbuild/core 1.3.21 → 1.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  (() => {
2
- "use strict";
3
2
  var __webpack_modules__ = {
4
3
  459: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ "use strict";
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.callback = exports.promise = void 0;
7
7
  const walker_1 = __nccwpck_require__(645);
@@ -21,6 +21,7 @@
21
21
  exports.callback = callback;
22
22
  },
23
23
  963: (__unused_webpack_module, exports) => {
24
+ "use strict";
24
25
  Object.defineProperty(exports, "__esModule", { value: true });
25
26
  exports.Counter = void 0;
26
27
  class Counter {
@@ -45,6 +46,7 @@
45
46
  exports.Counter = Counter;
46
47
  },
47
48
  693: (__unused_webpack_module, exports) => {
49
+ "use strict";
48
50
  Object.defineProperty(exports, "__esModule", { value: true });
49
51
  exports.build = void 0;
50
52
  const getArray = (paths) => paths;
@@ -55,6 +57,7 @@
55
57
  exports.build = build;
56
58
  },
57
59
  140: (__unused_webpack_module, exports) => {
60
+ "use strict";
58
61
  Object.defineProperty(exports, "__esModule", { value: true });
59
62
  exports.build = void 0;
60
63
  const groupFiles = (groups, directory, files) => {
@@ -67,6 +70,7 @@
67
70
  exports.build = build;
68
71
  },
69
72
  97: (__unused_webpack_module, exports) => {
73
+ "use strict";
70
74
  Object.defineProperty(exports, "__esModule", { value: true });
71
75
  exports.build = void 0;
72
76
  const onlyCountsSync = (state) => state.counts;
@@ -110,6 +114,7 @@
110
114
  exports.build = build;
111
115
  },
112
116
  541: (__unused_webpack_module, exports, __nccwpck_require__) => {
117
+ "use strict";
113
118
  Object.defineProperty(exports, "__esModule", { value: true });
114
119
  exports.build =
115
120
  exports.joinDirectoryPath =
@@ -154,6 +159,7 @@
154
159
  exports.build = build;
155
160
  },
156
161
  143: (__unused_webpack_module, exports) => {
162
+ "use strict";
157
163
  Object.defineProperty(exports, "__esModule", { value: true });
158
164
  exports.build = void 0;
159
165
  function pushDirectoryWithRelativePath(root) {
@@ -191,6 +197,7 @@
191
197
  exports.build = build;
192
198
  },
193
199
  368: (__unused_webpack_module, exports) => {
200
+ "use strict";
194
201
  Object.defineProperty(exports, "__esModule", { value: true });
195
202
  exports.build = void 0;
196
203
  const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
@@ -221,6 +228,7 @@
221
228
  exports.build = build;
222
229
  },
223
230
  267: function (__unused_webpack_module, exports, __nccwpck_require__) {
231
+ "use strict";
224
232
  var __importDefault =
225
233
  (this && this.__importDefault) ||
226
234
  function (mod) {
@@ -292,6 +300,7 @@
292
300
  }
293
301
  },
294
302
  642: function (__unused_webpack_module, exports, __nccwpck_require__) {
303
+ "use strict";
295
304
  var __importDefault =
296
305
  (this && this.__importDefault) ||
297
306
  function (mod) {
@@ -348,6 +357,7 @@
348
357
  exports.build = build;
349
358
  },
350
359
  388: (__unused_webpack_module, exports) => {
360
+ "use strict";
351
361
  Object.defineProperty(exports, "__esModule", { value: true });
352
362
  exports.Queue = void 0;
353
363
  class Queue {
@@ -366,6 +376,7 @@
366
376
  exports.Queue = Queue;
367
377
  },
368
378
  192: (__unused_webpack_module, exports, __nccwpck_require__) => {
379
+ "use strict";
369
380
  Object.defineProperty(exports, "__esModule", { value: true });
370
381
  exports.sync = void 0;
371
382
  const walker_1 = __nccwpck_require__(645);
@@ -376,6 +387,7 @@
376
387
  exports.sync = sync;
377
388
  },
378
389
  645: function (__unused_webpack_module, exports, __nccwpck_require__) {
390
+ "use strict";
379
391
  var __createBinding =
380
392
  (this && this.__createBinding) ||
381
393
  (Object.create
@@ -585,6 +597,7 @@
585
597
  exports.Walker = Walker;
586
598
  },
587
599
  250: (__unused_webpack_module, exports, __nccwpck_require__) => {
600
+ "use strict";
588
601
  Object.defineProperty(exports, "__esModule", { value: true });
589
602
  exports.APIBuilder = void 0;
590
603
  const async_1 = __nccwpck_require__(459);
@@ -609,6 +622,7 @@
609
622
  exports.APIBuilder = APIBuilder;
610
623
  },
611
624
  256: (__unused_webpack_module, exports, __nccwpck_require__) => {
625
+ "use strict";
612
626
  Object.defineProperty(exports, "__esModule", { value: true });
613
627
  exports.Builder = void 0;
614
628
  const path_1 = __nccwpck_require__(928);
@@ -734,6 +748,7 @@
734
748
  exports.Builder = Builder;
735
749
  },
736
750
  648: function (__unused_webpack_module, exports, __nccwpck_require__) {
751
+ "use strict";
737
752
  var __createBinding =
738
753
  (this && this.__createBinding) ||
739
754
  (Object.create
@@ -781,9 +796,11 @@
781
796
  __exportStar(__nccwpck_require__(205), exports);
782
797
  },
783
798
  205: (__unused_webpack_module, exports) => {
799
+ "use strict";
784
800
  Object.defineProperty(exports, "__esModule", { value: true });
785
801
  },
786
802
  281: (__unused_webpack_module, exports, __nccwpck_require__) => {
803
+ "use strict";
787
804
  Object.defineProperty(exports, "__esModule", { value: true });
788
805
  exports.normalizePath =
789
806
  exports.isRootDirectory =
@@ -827,6 +844,7 @@
827
844
  exports.normalizePath = normalizePath;
828
845
  },
829
846
  976: (module, __unused_webpack_exports, __nccwpck_require__) => {
847
+ "use strict";
830
848
  const pico = __nccwpck_require__(106);
831
849
  const utils = __nccwpck_require__(949);
832
850
  function picomatch(glob, options, returnState = false) {
@@ -842,6 +860,7 @@
842
860
  module.exports = picomatch;
843
861
  },
844
862
  425: (module) => {
863
+ "use strict";
845
864
  const WIN_SLASH = "\\\\/";
846
865
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
847
866
  const DOT_LITERAL = "\\.";
@@ -981,6 +1000,7 @@
981
1000
  };
982
1001
  },
983
1002
  775: (module, __unused_webpack_exports, __nccwpck_require__) => {
1003
+ "use strict";
984
1004
  const constants = __nccwpck_require__(425);
985
1005
  const utils = __nccwpck_require__(949);
986
1006
  const {
@@ -1850,6 +1870,7 @@
1850
1870
  module.exports = parse;
1851
1871
  },
1852
1872
  106: (module, __unused_webpack_exports, __nccwpck_require__) => {
1873
+ "use strict";
1853
1874
  const scan = __nccwpck_require__(75);
1854
1875
  const parse = __nccwpck_require__(775);
1855
1876
  const utils = __nccwpck_require__(949);
@@ -2025,6 +2046,7 @@
2025
2046
  module.exports = picomatch;
2026
2047
  },
2027
2048
  75: (module, __unused_webpack_exports, __nccwpck_require__) => {
2049
+ "use strict";
2028
2050
  const utils = __nccwpck_require__(949);
2029
2051
  const {
2030
2052
  CHAR_ASTERISK,
@@ -2347,6 +2369,7 @@
2347
2369
  module.exports = scan;
2348
2370
  },
2349
2371
  949: (__unused_webpack_module, exports, __nccwpck_require__) => {
2372
+ "use strict";
2350
2373
  const {
2351
2374
  REGEX_BACKSLASH,
2352
2375
  REGEX_REMOVE_BACKSLASH,
@@ -2408,447 +2431,12 @@
2408
2431
  return last;
2409
2432
  };
2410
2433
  },
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
2434
  896: (module) => {
2435
+ "use strict";
2849
2436
  module.exports = require("fs");
2850
2437
  },
2851
2438
  928: (module) => {
2439
+ "use strict";
2852
2440
  module.exports = require("path");
2853
2441
  },
2854
2442
  };
@@ -2875,6 +2463,396 @@
2875
2463
  }
2876
2464
  if (typeof __nccwpck_require__ !== "undefined")
2877
2465
  __nccwpck_require__.ab = __dirname + "/";
2878
- var __webpack_exports__ = __nccwpck_require__(83);
2466
+ var __webpack_exports__ = {};
2467
+ (() => {
2468
+ var exports = __webpack_exports__;
2469
+ var __create = Object.create;
2470
+ var __defProp = Object.defineProperty;
2471
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2472
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2473
+ var __getProtoOf = Object.getPrototypeOf;
2474
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
2475
+ var __copyProps = (to, from, except, desc) => {
2476
+ if ((from && typeof from === "object") || typeof from === "function")
2477
+ for (
2478
+ var keys = __getOwnPropNames(from), i = 0, n = keys.length, key;
2479
+ i < n;
2480
+ i++
2481
+ ) {
2482
+ key = keys[i];
2483
+ if (!__hasOwnProp.call(to, key) && key !== except)
2484
+ __defProp(to, key, {
2485
+ get: ((k) => from[k]).bind(null, key),
2486
+ enumerable:
2487
+ !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
2488
+ });
2489
+ }
2490
+ return to;
2491
+ };
2492
+ var __toESM = (mod, isNodeMode, target) => (
2493
+ (target = mod != null ? __create(__getProtoOf(mod)) : {}),
2494
+ __copyProps(
2495
+ isNodeMode || !mod || !mod.__esModule
2496
+ ? __defProp(target, "default", { value: mod, enumerable: true })
2497
+ : target,
2498
+ mod,
2499
+ )
2500
+ );
2501
+ const path = __toESM(__nccwpck_require__(928));
2502
+ const fdir = __toESM(__nccwpck_require__(648));
2503
+ const picomatch = __toESM(__nccwpck_require__(976));
2504
+ const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
2505
+ function getPartialMatcher(patterns, options) {
2506
+ const patternsCount = patterns.length;
2507
+ const patternsParts = Array(patternsCount);
2508
+ const regexes = Array(patternsCount);
2509
+ for (let i = 0; i < patternsCount; i++) {
2510
+ const parts = splitPattern(patterns[i]);
2511
+ patternsParts[i] = parts;
2512
+ const partsCount = parts.length;
2513
+ const partRegexes = Array(partsCount);
2514
+ for (let j = 0; j < partsCount; j++)
2515
+ partRegexes[j] = picomatch.default.makeRe(parts[j], options);
2516
+ regexes[i] = partRegexes;
2517
+ }
2518
+ return (input) => {
2519
+ const inputParts = input.split("/");
2520
+ if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input))
2521
+ return true;
2522
+ for (let i = 0; i < patterns.length; i++) {
2523
+ const patternParts = patternsParts[i];
2524
+ const regex = regexes[i];
2525
+ const inputPatternCount = inputParts.length;
2526
+ const minParts = Math.min(inputPatternCount, patternParts.length);
2527
+ let j = 0;
2528
+ while (j < minParts) {
2529
+ const part = patternParts[j];
2530
+ if (part.includes("/")) return true;
2531
+ const match = regex[j].test(inputParts[j]);
2532
+ if (!match) break;
2533
+ if (part === "**") return true;
2534
+ j++;
2535
+ }
2536
+ if (j === inputPatternCount) return true;
2537
+ }
2538
+ return false;
2539
+ };
2540
+ }
2541
+ const splitPatternOptions = { parts: true };
2542
+ function splitPattern(path$2) {
2543
+ var _result$parts;
2544
+ const result = picomatch.default.scan(path$2, splitPatternOptions);
2545
+ return (
2546
+ (_result$parts = result.parts) === null || _result$parts === void 0
2547
+ ? void 0
2548
+ : _result$parts.length
2549
+ )
2550
+ ? result.parts
2551
+ : [path$2];
2552
+ }
2553
+ const isWin = process.platform === "win32";
2554
+ const ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
2555
+ function convertPosixPathToPattern(path$2) {
2556
+ return escapePosixPath(path$2);
2557
+ }
2558
+ function convertWin32PathToPattern(path$2) {
2559
+ return escapeWin32Path(path$2).replace(ESCAPED_WIN32_BACKSLASHES, "/");
2560
+ }
2561
+ const convertPathToPattern = isWin
2562
+ ? convertWin32PathToPattern
2563
+ : convertPosixPathToPattern;
2564
+ const POSIX_UNESCAPED_GLOB_SYMBOLS =
2565
+ /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
2566
+ const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
2567
+ const escapePosixPath = (path$2) =>
2568
+ path$2.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2569
+ const escapeWin32Path = (path$2) =>
2570
+ path$2.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2571
+ const escapePath = isWin ? escapeWin32Path : escapePosixPath;
2572
+ function isDynamicPattern(pattern, options) {
2573
+ if (
2574
+ (options === null || options === void 0
2575
+ ? void 0
2576
+ : options.caseSensitiveMatch) === false
2577
+ )
2578
+ return true;
2579
+ const scan = picomatch.default.scan(pattern);
2580
+ return scan.isGlob || scan.negated;
2581
+ }
2582
+ function log(...tasks) {
2583
+ console.log(
2584
+ `[tinyglobby ${new Date().toLocaleTimeString("es")}]`,
2585
+ ...tasks,
2586
+ );
2587
+ }
2588
+ const PARENT_DIRECTORY = /^(\/?\.\.)+/;
2589
+ const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
2590
+ const BACKSLASHES = /\\/g;
2591
+ function normalizePattern(
2592
+ pattern,
2593
+ expandDirectories,
2594
+ cwd,
2595
+ props,
2596
+ isIgnore,
2597
+ ) {
2598
+ let result = pattern;
2599
+ if (pattern.endsWith("/")) result = pattern.slice(0, -1);
2600
+ if (!result.endsWith("*") && expandDirectories) result += "/**";
2601
+ const escapedCwd = escapePath(cwd);
2602
+ if (path.default.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")))
2603
+ result = path.posix.relative(escapedCwd, result);
2604
+ else result = path.posix.normalize(result);
2605
+ const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2606
+ const parts = splitPattern(result);
2607
+ if (
2608
+ parentDirectoryMatch === null || parentDirectoryMatch === void 0
2609
+ ? void 0
2610
+ : parentDirectoryMatch[0]
2611
+ ) {
2612
+ const n = (parentDirectoryMatch[0].length + 1) / 3;
2613
+ let i = 0;
2614
+ const cwdParts = escapedCwd.split("/");
2615
+ while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
2616
+ result =
2617
+ result.slice(0, (n - i - 1) * 3) +
2618
+ result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
2619
+ i++;
2620
+ }
2621
+ const potentialRoot = path.posix.join(
2622
+ cwd,
2623
+ parentDirectoryMatch[0].slice(i * 3),
2624
+ );
2625
+ if (
2626
+ !potentialRoot.startsWith(".") &&
2627
+ props.root.length > potentialRoot.length
2628
+ ) {
2629
+ props.root = potentialRoot;
2630
+ props.depthOffset = -n + i;
2631
+ }
2632
+ }
2633
+ if (!isIgnore && props.depthOffset >= 0) {
2634
+ var _props$commonPath;
2635
+ ((_props$commonPath = props.commonPath) !== null &&
2636
+ _props$commonPath !== void 0) ||
2637
+ (props.commonPath = parts);
2638
+ const newCommonPath = [];
2639
+ const length = Math.min(props.commonPath.length, parts.length);
2640
+ for (let i = 0; i < length; i++) {
2641
+ const part = parts[i];
2642
+ if (part === "**" && !parts[i + 1]) {
2643
+ newCommonPath.pop();
2644
+ break;
2645
+ }
2646
+ if (
2647
+ part !== props.commonPath[i] ||
2648
+ isDynamicPattern(part) ||
2649
+ i === parts.length - 1
2650
+ )
2651
+ break;
2652
+ newCommonPath.push(part);
2653
+ }
2654
+ props.depthOffset = newCommonPath.length;
2655
+ props.commonPath = newCommonPath;
2656
+ props.root =
2657
+ newCommonPath.length > 0
2658
+ ? path.default.posix.join(cwd, ...newCommonPath)
2659
+ : cwd;
2660
+ }
2661
+ return result;
2662
+ }
2663
+ function processPatterns(
2664
+ { patterns, ignore = [], expandDirectories = true },
2665
+ cwd,
2666
+ props,
2667
+ ) {
2668
+ if (typeof patterns === "string") patterns = [patterns];
2669
+ else if (!patterns) patterns = ["**/*"];
2670
+ if (typeof ignore === "string") ignore = [ignore];
2671
+ const matchPatterns = [];
2672
+ const ignorePatterns = [];
2673
+ for (const pattern of ignore) {
2674
+ if (!pattern) continue;
2675
+ if (pattern[0] !== "!" || pattern[1] === "(")
2676
+ ignorePatterns.push(
2677
+ normalizePattern(pattern, expandDirectories, cwd, props, true),
2678
+ );
2679
+ }
2680
+ for (const pattern of patterns) {
2681
+ if (!pattern) continue;
2682
+ if (pattern[0] !== "!" || pattern[1] === "(")
2683
+ matchPatterns.push(
2684
+ normalizePattern(pattern, expandDirectories, cwd, props, false),
2685
+ );
2686
+ else if (pattern[1] !== "!" || pattern[2] === "(")
2687
+ ignorePatterns.push(
2688
+ normalizePattern(
2689
+ pattern.slice(1),
2690
+ expandDirectories,
2691
+ cwd,
2692
+ props,
2693
+ true,
2694
+ ),
2695
+ );
2696
+ }
2697
+ return { match: matchPatterns, ignore: ignorePatterns };
2698
+ }
2699
+ function getRelativePath(path$2, cwd, root) {
2700
+ return path.posix.relative(cwd, `${root}/${path$2}`) || ".";
2701
+ }
2702
+ function processPath(path$2, cwd, root, isDirectory, absolute) {
2703
+ const relativePath = absolute
2704
+ ? path$2.slice(root === "/" ? 1 : root.length + 1) || "."
2705
+ : path$2;
2706
+ if (root === cwd)
2707
+ return isDirectory && relativePath !== "."
2708
+ ? relativePath.slice(0, -1)
2709
+ : relativePath;
2710
+ return getRelativePath(relativePath, cwd, root);
2711
+ }
2712
+ function formatPaths(paths, cwd, root) {
2713
+ for (let i = paths.length - 1; i >= 0; i--) {
2714
+ const path$2 = paths[i];
2715
+ paths[i] =
2716
+ getRelativePath(path$2, cwd, root) +
2717
+ (!path$2 || path$2.endsWith("/") ? "/" : "");
2718
+ }
2719
+ return paths;
2720
+ }
2721
+ function crawl(options, cwd, sync) {
2722
+ if (process.env.TINYGLOBBY_DEBUG) options.debug = true;
2723
+ if (options.debug) log("globbing with options:", options, "cwd:", cwd);
2724
+ if (Array.isArray(options.patterns) && options.patterns.length === 0)
2725
+ return sync ? [] : Promise.resolve([]);
2726
+ const props = { root: cwd, commonPath: null, depthOffset: 0 };
2727
+ const processed = processPatterns(options, cwd, props);
2728
+ const nocase = options.caseSensitiveMatch === false;
2729
+ if (options.debug) log("internal processing patterns:", processed);
2730
+ const matcher = (0, picomatch.default)(processed.match, {
2731
+ dot: options.dot,
2732
+ nocase,
2733
+ ignore: processed.ignore,
2734
+ });
2735
+ const ignore = (0, picomatch.default)(processed.ignore, {
2736
+ dot: options.dot,
2737
+ nocase,
2738
+ });
2739
+ const partialMatcher = getPartialMatcher(processed.match, {
2740
+ dot: options.dot,
2741
+ nocase,
2742
+ });
2743
+ const fdirOptions = {
2744
+ filters: [
2745
+ options.debug
2746
+ ? (p, isDirectory) => {
2747
+ const path$2 = processPath(
2748
+ p,
2749
+ cwd,
2750
+ props.root,
2751
+ isDirectory,
2752
+ options.absolute,
2753
+ );
2754
+ const matches = matcher(path$2);
2755
+ if (matches) log(`matched ${path$2}`);
2756
+ return matches;
2757
+ }
2758
+ : (p, isDirectory) =>
2759
+ matcher(
2760
+ processPath(
2761
+ p,
2762
+ cwd,
2763
+ props.root,
2764
+ isDirectory,
2765
+ options.absolute,
2766
+ ),
2767
+ ),
2768
+ ],
2769
+ exclude: options.debug
2770
+ ? (_, p) => {
2771
+ const relativePath = processPath(p, cwd, props.root, true, true);
2772
+ const skipped =
2773
+ (relativePath !== "." && !partialMatcher(relativePath)) ||
2774
+ ignore(relativePath);
2775
+ if (skipped) log(`skipped ${p}`);
2776
+ else log(`crawling ${p}`);
2777
+ return skipped;
2778
+ }
2779
+ : (_, p) => {
2780
+ const relativePath = processPath(p, cwd, props.root, true, true);
2781
+ return (
2782
+ (relativePath !== "." && !partialMatcher(relativePath)) ||
2783
+ ignore(relativePath)
2784
+ );
2785
+ },
2786
+ pathSeparator: "/",
2787
+ relativePaths: true,
2788
+ resolveSymlinks: true,
2789
+ };
2790
+ if (options.deep !== void 0)
2791
+ fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
2792
+ if (options.absolute) {
2793
+ fdirOptions.relativePaths = false;
2794
+ fdirOptions.resolvePaths = true;
2795
+ fdirOptions.includeBasePath = true;
2796
+ }
2797
+ if (options.followSymbolicLinks === false) {
2798
+ fdirOptions.resolveSymlinks = false;
2799
+ fdirOptions.excludeSymlinks = true;
2800
+ }
2801
+ if (options.onlyDirectories) {
2802
+ fdirOptions.excludeFiles = true;
2803
+ fdirOptions.includeDirs = true;
2804
+ } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
2805
+ props.root = props.root.replace(BACKSLASHES, "");
2806
+ const root = props.root;
2807
+ if (options.debug) log("internal properties:", props);
2808
+ const api = new fdir.fdir(fdirOptions).crawl(root);
2809
+ if (cwd === root || options.absolute)
2810
+ return sync ? api.sync() : api.withPromise();
2811
+ return sync
2812
+ ? formatPaths(api.sync(), cwd, root)
2813
+ : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
2814
+ }
2815
+ async function glob(patternsOrOptions, options) {
2816
+ if (
2817
+ patternsOrOptions &&
2818
+ (options === null || options === void 0 ? void 0 : options.patterns)
2819
+ )
2820
+ throw new Error(
2821
+ "Cannot pass patterns as both an argument and an option",
2822
+ );
2823
+ const opts =
2824
+ Array.isArray(patternsOrOptions) ||
2825
+ typeof patternsOrOptions === "string"
2826
+ ? { ...options, patterns: patternsOrOptions }
2827
+ : patternsOrOptions;
2828
+ const cwd = opts.cwd
2829
+ ? path.default.resolve(opts.cwd).replace(BACKSLASHES, "/")
2830
+ : process.cwd().replace(BACKSLASHES, "/");
2831
+ return crawl(opts, cwd, false);
2832
+ }
2833
+ function globSync(patternsOrOptions, options) {
2834
+ if (
2835
+ patternsOrOptions &&
2836
+ (options === null || options === void 0 ? void 0 : options.patterns)
2837
+ )
2838
+ throw new Error(
2839
+ "Cannot pass patterns as both an argument and an option",
2840
+ );
2841
+ const opts =
2842
+ Array.isArray(patternsOrOptions) ||
2843
+ typeof patternsOrOptions === "string"
2844
+ ? { ...options, patterns: patternsOrOptions }
2845
+ : patternsOrOptions;
2846
+ const cwd = opts.cwd
2847
+ ? path.default.resolve(opts.cwd).replace(BACKSLASHES, "/")
2848
+ : process.cwd().replace(BACKSLASHES, "/");
2849
+ return crawl(opts, cwd, true);
2850
+ }
2851
+ exports.convertPathToPattern = convertPathToPattern;
2852
+ exports.escapePath = escapePath;
2853
+ exports.glob = glob;
2854
+ exports.globSync = globSync;
2855
+ exports.isDynamicPattern = isDynamicPattern;
2856
+ })();
2879
2857
  module.exports = __webpack_exports__;
2880
2858
  })();