@voidzero-dev/vite-plus-core 0.1.17-alpha.3 → 0.1.17-alpha.5

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,8 +1,8 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "./chunk-CSNpwdVU.js";
2
- import { C as promiseWithResolvers, D as toArray, E as slash, S as pkgExists, T as resolveRegex, _ as yellow, a as createLogger, b as matchPattern, c as globalLogger, d as bold, f as dim, g as underline, h as red, i as LogLevels, l as prettyFormat, n as z, o as generateColor, p as green, r as version, s as getNameLabel, t as R, u as blue, v as debounce, w as resolveComma, x as noop, y as importWithError } from "./main-CSVR9Fv3.js";
2
+ import { C as promiseWithResolvers, D as toArray, E as slash, S as pkgExists, T as resolveRegex, _ as yellow, a as createLogger, b as matchPattern, c as globalLogger, d as bold, f as dim, g as underline, h as red, i as LogLevels, l as prettyFormat, n as W, o as generateColor, p as green, r as version, s as getNameLabel, t as U, u as blue, v as debounce, w as resolveComma, x as noop, y as importWithError } from "./main-Ccx2FDJq.js";
3
3
  import { t as createDebug } from "./node-B3Gdtau1.js";
4
4
  import { d as filename_js_to_dts, i as RE_JS, n as RE_DTS, o as RE_NODE_MODULES$1, t as RE_CSS } from "./filename-DQnUJlio-DHPB7cQg.js";
5
- import "./dist-CxeZzY9B.js";
5
+ import "./dist-CbhZqEsp.js";
6
6
  import module$1, { builtinModules, createRequire, isBuiltin } from "node:module";
7
7
  import process$1, { env } from "node:process";
8
8
  import readline from "node:readline";
@@ -11,10 +11,10 @@ import path, { dirname, isAbsolute, join, parse, resolve } from "node:path";
11
11
  import { VERSION, build, watch } from "@voidzero-dev/vite-plus-core/rolldown";
12
12
  import { access, chmod, cp, mkdir, mkdtemp, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
13
13
  import { and, id, importerId, include } from "@voidzero-dev/vite-plus-core/rolldown/filter";
14
- import re, { existsSync, readFileSync, writeFileSync } from "node:fs";
15
- import * as nativeFs$1 from "fs";
16
- import nativeFs from "fs";
17
- import path$1, { basename, dirname as dirname$1, normalize as normalize$1, posix, relative, resolve as resolve$1, sep } from "path";
14
+ import fs$1, { existsSync, readFileSync, writeFileSync } from "node:fs";
15
+ import * as nativeFs from "fs";
16
+ import { readdir as readdir$1, readdirSync, realpath, realpathSync, stat as stat$1, statSync } from "fs";
17
+ import { basename, dirname as dirname$1, isAbsolute as isAbsolute$1, normalize as normalize$1, posix, relative, resolve as resolve$1, sep } from "path";
18
18
  import { fileURLToPath } from "url";
19
19
  import { createRequire as createRequire$1 } from "module";
20
20
  import { tmpdir } from "node:os";
@@ -22,7 +22,7 @@ import { pathToFileURL } from "node:url";
22
22
  import { Buffer } from "node:buffer";
23
23
  import { brotliCompress, gzip } from "node:zlib";
24
24
  import { importGlobPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
25
- //#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_40fa21a6dd0aac837d14f6503ecc360a/node_modules/tsdown/dist/fs-Dd6Htx2P.mjs
25
+ //#region ../../node_modules/.pnpm/tsdown@0.21.8_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.8_@tsdown+exe@0.21.8_@type_bf863151738d83584e36df49913526fa/node_modules/tsdown/dist/fs-Dd6Htx2P.mjs
26
26
  function fsExists(path) {
27
27
  return access(path).then(() => true, () => false);
28
28
  }
@@ -65,7 +65,7 @@ function stripExtname(filePath) {
65
65
  return filePath.slice(0, -ext.length);
66
66
  }
67
67
  //#endregion
68
- //#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_40fa21a6dd0aac837d14f6503ecc360a/node_modules/tsdown/dist/format-_3CEX8E7.mjs
68
+ //#region ../../node_modules/.pnpm/tsdown@0.21.8_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.8_@tsdown+exe@0.21.8_@type_bf863151738d83584e36df49913526fa/node_modules/tsdown/dist/format-a5Q6w07o.mjs
69
69
  const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
70
70
  function getShimsInject(format, platform) {
71
71
  if (format === "es" && platform === "node") return {
@@ -155,6 +155,7 @@ function DepsPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBund
155
155
  for (const chunk of Object.values(bundle)) {
156
156
  if (chunk.type === "asset") continue;
157
157
  for (const id of chunk.moduleIds) {
158
+ if (id === shimFile) continue;
158
159
  const parsed = await readBundledDepInfo(id);
159
160
  if (!parsed) continue;
160
161
  deps.add(parsed.name);
@@ -276,8 +277,39 @@ function detectIndentation(jsonText) {
276
277
  }
277
278
  return 2;
278
279
  }
280
+ const minVersion = createRequire(import.meta.url)("./npm_entry_semver_ranges_min-version.cjs");
281
+ const BASELINE_WIDELY_AVAILABLE_TARGET = [
282
+ "chrome111",
283
+ "edge111",
284
+ "firefox114",
285
+ "safari16.4",
286
+ "ios16.4"
287
+ ];
288
+ function expandBaselineTarget(targets) {
289
+ return targets.flatMap((t) => t === "baseline-widely-available" ? BASELINE_WIDELY_AVAILABLE_TARGET : t);
290
+ }
291
+ function resolveTarget(logger, target, color, pkg, nameLabel) {
292
+ if (target === false) return;
293
+ if (target == null) {
294
+ const pkgTarget = resolvePackageTarget(pkg);
295
+ if (pkgTarget) target = pkgTarget;
296
+ else return;
297
+ }
298
+ if (typeof target === "number") throw new TypeError(`Invalid target: ${target}`);
299
+ const targets = expandBaselineTarget(resolveComma(toArray(target)));
300
+ if (targets.length) logger.info(nameLabel, `target${targets.length > 1 ? "s" : ""}: ${color(targets.join(", "))}`);
301
+ return targets;
302
+ }
303
+ function resolvePackageTarget(pkg) {
304
+ const nodeVersion = pkg?.engines?.node;
305
+ if (!nodeVersion) return;
306
+ const nodeMinVersion = minVersion(nodeVersion);
307
+ if (!nodeMinVersion) return;
308
+ if (nodeMinVersion.version === "0.0.0") return;
309
+ return `node${nodeMinVersion.version}`;
310
+ }
279
311
  //#endregion
280
- //#region ../../node_modules/.pnpm/defu@6.1.6/node_modules/defu/dist/defu.mjs
312
+ //#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
281
313
  function isPlainObject(value) {
282
314
  if (value === null || typeof value !== "object") return false;
283
315
  const prototype = Object.getPrototypeOf(value);
@@ -618,7 +650,7 @@ var Walker = class {
618
650
  symlinks: /* @__PURE__ */ new Map(),
619
651
  visited: [""].slice(0, 0),
620
652
  controller: new Aborter(),
621
- fs: options.fs || nativeFs$1
653
+ fs: options.fs || nativeFs
622
654
  };
623
655
  this.joinPath = build$7(this.root, options);
624
656
  this.pushDirectory = build$6(this.root, options);
@@ -2678,7 +2710,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2678
2710
  module.exports = picomatch;
2679
2711
  }));
2680
2712
  //#endregion
2681
- //#region ../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs
2713
+ //#region ../../node_modules/.pnpm/tinyglobby@0.2.16/node_modules/tinyglobby/dist/index.mjs
2682
2714
  var import_picomatch = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
2683
2715
  const pico = require_picomatch$1();
2684
2716
  const utils = require_utils();
@@ -2693,35 +2725,36 @@ var import_picomatch = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
2693
2725
  module.exports = picomatch;
2694
2726
  })))(), 1);
2695
2727
  const isReadonlyArray = Array.isArray;
2728
+ const BACKSLASHES = /\\/g;
2696
2729
  const isWin = process.platform === "win32";
2697
2730
  const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
2698
2731
  function getPartialMatcher(patterns, options = {}) {
2699
2732
  const patternsCount = patterns.length;
2700
2733
  const patternsParts = Array(patternsCount);
2701
2734
  const matchers = Array(patternsCount);
2702
- const globstarEnabled = !options.noglobstar;
2703
- for (let i = 0; i < patternsCount; i++) {
2735
+ let i, j;
2736
+ for (i = 0; i < patternsCount; i++) {
2704
2737
  const parts = splitPattern(patterns[i]);
2705
2738
  patternsParts[i] = parts;
2706
2739
  const partsCount = parts.length;
2707
2740
  const partMatchers = Array(partsCount);
2708
- for (let j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
2741
+ for (j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
2709
2742
  matchers[i] = partMatchers;
2710
2743
  }
2711
2744
  return (input) => {
2712
2745
  const inputParts = input.split("/");
2713
2746
  if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
2714
- for (let i = 0; i < patterns.length; i++) {
2747
+ for (i = 0; i < patternsCount; i++) {
2715
2748
  const patternParts = patternsParts[i];
2716
2749
  const matcher = matchers[i];
2717
2750
  const inputPatternCount = inputParts.length;
2718
2751
  const minParts = Math.min(inputPatternCount, patternParts.length);
2719
- let j = 0;
2752
+ j = 0;
2720
2753
  while (j < minParts) {
2721
2754
  const part = patternParts[j];
2722
2755
  if (part.includes("/")) return true;
2723
2756
  if (!matcher[j](inputParts[j])) break;
2724
- if (globstarEnabled && part === "**") return true;
2757
+ if (!options.noglobstar && part === "**") return true;
2725
2758
  j++;
2726
2759
  }
2727
2760
  if (j === inputPatternCount) return true;
@@ -2735,7 +2768,7 @@ const isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === "/";
2735
2768
  function buildFormat(cwd, root, absolute) {
2736
2769
  if (cwd === root || root.startsWith(`${cwd}/`)) {
2737
2770
  if (absolute) {
2738
- const start = isRoot(cwd) ? cwd.length : cwd.length + 1;
2771
+ const start = cwd.length + +!isRoot(cwd);
2739
2772
  return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
2740
2773
  }
2741
2774
  const prefix = root.slice(cwd.length + 1);
@@ -2756,20 +2789,19 @@ function buildRelative(cwd, root) {
2756
2789
  }
2757
2790
  return (p) => {
2758
2791
  const result = posix.relative(cwd, `${root}/${p}`);
2759
- if (p.endsWith("/") && result !== "") return `${result}/`;
2760
- return result || ".";
2792
+ return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
2761
2793
  };
2762
2794
  }
2763
2795
  const splitPatternOptions = { parts: true };
2764
- function splitPattern(path$1) {
2796
+ function splitPattern(path) {
2765
2797
  var _result$parts;
2766
- const result = import_picomatch.default.scan(path$1, splitPatternOptions);
2767
- return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
2798
+ const result = import_picomatch.default.scan(path, splitPatternOptions);
2799
+ return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path];
2768
2800
  }
2769
2801
  const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
2770
2802
  const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
2771
- const escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2772
- const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2803
+ const escapePosixPath = (path) => path.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2804
+ const escapeWin32Path = (path) => path.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2773
2805
  /**
2774
2806
  * Escapes a path's special characters depending on the platform.
2775
2807
  * @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
@@ -2796,28 +2828,31 @@ function isDynamicPattern(pattern, options) {
2796
2828
  function log(...tasks) {
2797
2829
  console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
2798
2830
  }
2831
+ function ensureStringArray(value) {
2832
+ return typeof value === "string" ? [value] : value !== null && value !== void 0 ? value : [];
2833
+ }
2799
2834
  const PARENT_DIRECTORY = /^(\/?\.\.)+/;
2800
2835
  const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
2801
- const BACKSLASHES = /\\/g;
2802
- function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2836
+ function normalizePattern(pattern, opts, props, isIgnore) {
2837
+ var _PARENT_DIRECTORY$exe;
2838
+ const cwd = opts.cwd;
2803
2839
  let result = pattern;
2804
- if (pattern.endsWith("/")) result = pattern.slice(0, -1);
2805
- if (!result.endsWith("*") && expandDirectories) result += "/**";
2840
+ if (pattern[pattern.length - 1] === "/") result = pattern.slice(0, -1);
2841
+ if (result[result.length - 1] !== "*" && opts.expandDirectories) result += "/**";
2806
2842
  const escapedCwd = escapePath(cwd);
2807
- if (path$1.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
2808
- else result = posix.normalize(result);
2809
- const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2843
+ result = isAbsolute$1(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
2844
+ const parentDir = (_PARENT_DIRECTORY$exe = PARENT_DIRECTORY.exec(result)) === null || _PARENT_DIRECTORY$exe === void 0 ? void 0 : _PARENT_DIRECTORY$exe[0];
2810
2845
  const parts = splitPattern(result);
2811
- if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
2812
- const n = (parentDirectoryMatch[0].length + 1) / 3;
2846
+ if (parentDir) {
2847
+ const n = (parentDir.length + 1) / 3;
2813
2848
  let i = 0;
2814
2849
  const cwdParts = escapedCwd.split("/");
2815
2850
  while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
2816
2851
  result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
2817
2852
  i++;
2818
2853
  }
2819
- const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i * 3));
2820
- if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
2854
+ const potentialRoot = posix.join(cwd, parentDir.slice(i * 3));
2855
+ if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
2821
2856
  props.root = potentialRoot;
2822
2857
  props.depthOffset = -n + i;
2823
2858
  }
@@ -2833,7 +2868,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2833
2868
  newCommonPath.pop();
2834
2869
  break;
2835
2870
  }
2836
- if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
2871
+ if (i === parts.length - 1 || part !== props.commonPath[i] || isDynamicPattern(part)) break;
2837
2872
  newCommonPath.push(part);
2838
2873
  }
2839
2874
  props.depthOffset = newCommonPath.length;
@@ -2842,135 +2877,126 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2842
2877
  }
2843
2878
  return result;
2844
2879
  }
2845
- function processPatterns({ patterns = ["**/*"], ignore = [], expandDirectories = true }, cwd, props) {
2846
- if (typeof patterns === "string") patterns = [patterns];
2847
- if (typeof ignore === "string") ignore = [ignore];
2880
+ function processPatterns(options, patterns, props) {
2848
2881
  const matchPatterns = [];
2849
2882
  const ignorePatterns = [];
2850
- for (const pattern of ignore) {
2883
+ for (const pattern of options.ignore) {
2851
2884
  if (!pattern) continue;
2852
- if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
2885
+ if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, options, props, true));
2853
2886
  }
2854
2887
  for (const pattern of patterns) {
2855
2888
  if (!pattern) continue;
2856
- if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
2857
- else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
2889
+ if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, options, props, false));
2890
+ else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), options, props, true));
2858
2891
  }
2859
2892
  return {
2860
2893
  match: matchPatterns,
2861
2894
  ignore: ignorePatterns
2862
2895
  };
2863
2896
  }
2864
- function formatPaths(paths, relative) {
2865
- for (let i = paths.length - 1; i >= 0; i--) {
2866
- const path$1 = paths[i];
2867
- paths[i] = relative(path$1);
2868
- }
2869
- return paths;
2870
- }
2871
- function normalizeCwd(cwd) {
2872
- if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
2873
- if (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, "/");
2874
- return path$1.resolve(cwd).replace(BACKSLASHES, "/");
2875
- }
2876
- function getCrawler(patterns, inputOptions = {}) {
2877
- const options = process.env.TINYGLOBBY_DEBUG ? {
2878
- ...inputOptions,
2879
- debug: true
2880
- } : inputOptions;
2881
- const cwd = normalizeCwd(options.cwd);
2882
- if (options.debug) log("globbing with:", {
2883
- patterns,
2884
- options,
2885
- cwd
2886
- });
2887
- if (Array.isArray(patterns) && patterns.length === 0) return [{
2888
- sync: () => [],
2889
- withPromise: async () => []
2890
- }, false];
2897
+ function buildCrawler(options, patterns) {
2898
+ const cwd = options.cwd;
2891
2899
  const props = {
2892
2900
  root: cwd,
2893
- commonPath: null,
2894
2901
  depthOffset: 0
2895
2902
  };
2896
- const processed = processPatterns({
2897
- ...options,
2898
- patterns
2899
- }, cwd, props);
2903
+ const processed = processPatterns(options, patterns, props);
2900
2904
  if (options.debug) log("internal processing patterns:", processed);
2905
+ const { absolute, caseSensitiveMatch, debug, dot, followSymbolicLinks, onlyDirectories } = options;
2906
+ const root = props.root.replace(BACKSLASHES, "");
2901
2907
  const matchOptions = {
2902
- dot: options.dot,
2908
+ dot,
2903
2909
  nobrace: options.braceExpansion === false,
2904
- nocase: options.caseSensitiveMatch === false,
2910
+ nocase: !caseSensitiveMatch,
2905
2911
  noextglob: options.extglob === false,
2906
2912
  noglobstar: options.globstar === false,
2907
2913
  posix: true
2908
2914
  };
2909
- const matcher = (0, import_picomatch.default)(processed.match, {
2910
- ...matchOptions,
2911
- ignore: processed.ignore
2912
- });
2915
+ const matcher = (0, import_picomatch.default)(processed.match, matchOptions);
2913
2916
  const ignore = (0, import_picomatch.default)(processed.ignore, matchOptions);
2914
2917
  const partialMatcher = getPartialMatcher(processed.match, matchOptions);
2915
- const format = buildFormat(cwd, props.root, options.absolute);
2916
- const formatExclude = options.absolute ? format : buildFormat(cwd, props.root, true);
2917
- const fdirOptions = {
2918
- filters: [options.debug ? (p, isDirectory) => {
2919
- const path$1 = format(p, isDirectory);
2920
- const matches = matcher(path$1);
2921
- if (matches) log(`matched ${path$1}`);
2918
+ const format = buildFormat(cwd, root, absolute);
2919
+ const excludeFormatter = absolute ? format : buildFormat(cwd, root, true);
2920
+ const excludePredicate = (_, p) => {
2921
+ const relativePath = excludeFormatter(p, true);
2922
+ return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2923
+ };
2924
+ let maxDepth;
2925
+ if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
2926
+ const crawler = new Builder({
2927
+ filters: [debug ? (p, isDirectory) => {
2928
+ const path = format(p, isDirectory);
2929
+ const matches = matcher(path) && !ignore(path);
2930
+ if (matches) log(`matched ${path}`);
2922
2931
  return matches;
2923
- } : (p, isDirectory) => matcher(format(p, isDirectory))],
2924
- exclude: options.debug ? (_, p) => {
2925
- const relativePath = formatExclude(p, true);
2926
- const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2927
- if (skipped) log(`skipped ${p}`);
2928
- else log(`crawling ${p}`);
2932
+ } : (p, isDirectory) => {
2933
+ const path = format(p, isDirectory);
2934
+ return matcher(path) && !ignore(path);
2935
+ }],
2936
+ exclude: debug ? (_, p) => {
2937
+ const skipped = excludePredicate(_, p);
2938
+ log(`${skipped ? "skipped" : "crawling"} ${p}`);
2929
2939
  return skipped;
2930
- } : (_, p) => {
2931
- const relativePath = formatExclude(p, true);
2932
- return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2933
- },
2934
- fs: options.fs ? {
2935
- readdir: options.fs.readdir || nativeFs.readdir,
2936
- readdirSync: options.fs.readdirSync || nativeFs.readdirSync,
2937
- realpath: options.fs.realpath || nativeFs.realpath,
2938
- realpathSync: options.fs.realpathSync || nativeFs.realpathSync,
2939
- stat: options.fs.stat || nativeFs.stat,
2940
- statSync: options.fs.statSync || nativeFs.statSync
2941
- } : void 0,
2940
+ } : excludePredicate,
2941
+ fs: options.fs,
2942
2942
  pathSeparator: "/",
2943
- relativePaths: true,
2944
- resolveSymlinks: true,
2943
+ relativePaths: !absolute,
2944
+ resolvePaths: absolute,
2945
+ includeBasePath: absolute,
2946
+ resolveSymlinks: followSymbolicLinks,
2947
+ excludeSymlinks: !followSymbolicLinks,
2948
+ excludeFiles: onlyDirectories,
2949
+ includeDirs: onlyDirectories || !options.onlyFiles,
2950
+ maxDepth,
2945
2951
  signal: options.signal
2952
+ }).crawl(root);
2953
+ if (options.debug) log("internal properties:", {
2954
+ ...props,
2955
+ root
2956
+ });
2957
+ return [crawler, cwd !== root && !absolute && buildRelative(cwd, root)];
2958
+ }
2959
+ function formatPaths(paths, mapper) {
2960
+ if (mapper) for (let i = paths.length - 1; i >= 0; i--) paths[i] = mapper(paths[i]);
2961
+ return paths;
2962
+ }
2963
+ const defaultOptions$1 = {
2964
+ caseSensitiveMatch: true,
2965
+ cwd: process.cwd(),
2966
+ debug: !!process.env.TINYGLOBBY_DEBUG,
2967
+ expandDirectories: true,
2968
+ followSymbolicLinks: true,
2969
+ onlyFiles: true
2970
+ };
2971
+ function getOptions(options) {
2972
+ const opts = {
2973
+ ...defaultOptions$1,
2974
+ ...options
2946
2975
  };
2947
- if (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
2948
- if (options.absolute) {
2949
- fdirOptions.relativePaths = false;
2950
- fdirOptions.resolvePaths = true;
2951
- fdirOptions.includeBasePath = true;
2952
- }
2953
- if (options.followSymbolicLinks === false) {
2954
- fdirOptions.resolveSymlinks = false;
2955
- fdirOptions.excludeSymlinks = true;
2956
- }
2957
- if (options.onlyDirectories) {
2958
- fdirOptions.excludeFiles = true;
2959
- fdirOptions.includeDirs = true;
2960
- } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
2961
- props.root = props.root.replace(BACKSLASHES, "");
2962
- const root = props.root;
2963
- if (options.debug) log("internal properties:", props);
2964
- const relative = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
2965
- return [new Builder(fdirOptions).crawl(root), relative];
2966
- }
2967
- async function glob(patternsOrOptions, options) {
2968
- if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
2969
- const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
2970
- const opts = isModern ? options : patternsOrOptions;
2971
- const [crawler, relative] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
2972
- if (!relative) return crawler.withPromise();
2973
- return formatPaths(await crawler.withPromise(), relative);
2976
+ opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve$1(opts.cwd)).replace(BACKSLASHES, "/");
2977
+ opts.ignore = ensureStringArray(opts.ignore);
2978
+ opts.fs && (opts.fs = {
2979
+ readdir: opts.fs.readdir || readdir$1,
2980
+ readdirSync: opts.fs.readdirSync || readdirSync,
2981
+ realpath: opts.fs.realpath || realpath,
2982
+ realpathSync: opts.fs.realpathSync || realpathSync,
2983
+ stat: opts.fs.stat || stat$1,
2984
+ statSync: opts.fs.statSync || statSync
2985
+ });
2986
+ if (opts.debug) log("globbing with options:", opts);
2987
+ return opts;
2988
+ }
2989
+ function getCrawler(globInput, inputOptions = {}) {
2990
+ var _ref;
2991
+ if (globInput && (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
2992
+ const isModern = isReadonlyArray(globInput) || typeof globInput === "string";
2993
+ const patterns = ensureStringArray((_ref = isModern ? globInput : globInput.patterns) !== null && _ref !== void 0 ? _ref : "**/*");
2994
+ const options = getOptions(isModern ? inputOptions : globInput);
2995
+ return patterns.length > 0 ? buildCrawler(options, patterns) : [];
2996
+ }
2997
+ async function glob(globInput, options) {
2998
+ const [crawler, relative] = getCrawler(globInput, options);
2999
+ return crawler ? formatPaths(await crawler.withPromise(), relative) : [];
2974
3000
  }
2975
3001
  //#endregion
2976
3002
  //#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/resolve.mjs
@@ -3182,93 +3208,93 @@ quansync$1({
3182
3208
  */
3183
3209
  const quansync = quansync$1;
3184
3210
  quansync$1({
3185
- sync: re.readFileSync,
3186
- async: re.promises.readFile
3211
+ sync: fs$1.readFileSync,
3212
+ async: fs$1.promises.readFile
3187
3213
  });
3188
3214
  quansync$1({
3189
- sync: re.writeFileSync,
3190
- async: re.promises.writeFile
3215
+ sync: fs$1.writeFileSync,
3216
+ async: fs$1.promises.writeFile
3191
3217
  });
3192
3218
  quansync$1({
3193
- sync: re.unlinkSync,
3194
- async: re.promises.unlink
3219
+ sync: fs$1.unlinkSync,
3220
+ async: fs$1.promises.unlink
3195
3221
  });
3196
3222
  quansync$1({
3197
- sync: re.accessSync,
3198
- async: re.promises.access
3223
+ sync: fs$1.accessSync,
3224
+ async: fs$1.promises.access
3199
3225
  });
3200
3226
  /**
3201
3227
  * @link https://nodejs.org/api/fs.html#fspromisesstatpath-options
3202
3228
  */
3203
- const stat$1 = quansync$1({
3204
- sync: re.statSync,
3205
- async: re.promises.stat
3229
+ const stat$2 = quansync$1({
3230
+ sync: fs$1.statSync,
3231
+ async: fs$1.promises.stat
3206
3232
  });
3207
3233
  const lstat = quansync$1({
3208
- sync: re.lstatSync,
3209
- async: re.promises.lstat
3234
+ sync: fs$1.lstatSync,
3235
+ async: fs$1.promises.lstat
3210
3236
  });
3211
3237
  quansync$1({
3212
- sync: re.copyFileSync,
3213
- async: re.promises.copyFile
3238
+ sync: fs$1.copyFileSync,
3239
+ async: fs$1.promises.copyFile
3214
3240
  });
3215
3241
  quansync$1({
3216
- sync: re.rmSync,
3217
- async: re.promises.rm
3242
+ sync: fs$1.rmSync,
3243
+ async: fs$1.promises.rm
3218
3244
  });
3219
3245
  quansync$1({
3220
- sync: re.mkdirSync,
3221
- async: re.promises.mkdir
3246
+ sync: fs$1.mkdirSync,
3247
+ async: fs$1.promises.mkdir
3222
3248
  });
3223
3249
  quansync$1({
3224
- sync: re.renameSync,
3225
- async: re.promises.rename
3250
+ sync: fs$1.renameSync,
3251
+ async: fs$1.promises.rename
3226
3252
  });
3227
3253
  quansync$1({
3228
- sync: re.readdirSync,
3229
- async: re.promises.readdir
3254
+ sync: fs$1.readdirSync,
3255
+ async: fs$1.promises.readdir
3230
3256
  });
3231
3257
  quansync$1({
3232
- sync: re.realpathSync,
3233
- async: re.promises.realpath
3258
+ sync: fs$1.realpathSync,
3259
+ async: fs$1.promises.realpath
3234
3260
  });
3235
3261
  quansync$1({
3236
- sync: re.readlinkSync,
3237
- async: re.promises.readlink
3262
+ sync: fs$1.readlinkSync,
3263
+ async: fs$1.promises.readlink
3238
3264
  });
3239
3265
  quansync$1({
3240
- sync: re.symlinkSync,
3241
- async: re.promises.symlink
3266
+ sync: fs$1.symlinkSync,
3267
+ async: fs$1.promises.symlink
3242
3268
  });
3243
3269
  quansync$1({
3244
- sync: re.chownSync,
3245
- async: re.promises.chown
3270
+ sync: fs$1.chownSync,
3271
+ async: fs$1.promises.chown
3246
3272
  });
3247
3273
  quansync$1({
3248
- sync: re.lchownSync,
3249
- async: re.promises.lchown
3274
+ sync: fs$1.lchownSync,
3275
+ async: fs$1.promises.lchown
3250
3276
  });
3251
3277
  quansync$1({
3252
- sync: re.chmodSync,
3253
- async: re.promises.chmod
3278
+ sync: fs$1.chmodSync,
3279
+ async: fs$1.promises.chmod
3254
3280
  });
3255
3281
  quansync$1({
3256
- sync: re.utimesSync,
3257
- async: re.promises.utimes
3282
+ sync: fs$1.utimesSync,
3283
+ async: fs$1.promises.utimes
3258
3284
  });
3259
3285
  quansync$1({
3260
- sync: re.lutimesSync,
3261
- async: re.promises.lutimes
3286
+ sync: fs$1.lutimesSync,
3287
+ async: fs$1.promises.lutimes
3262
3288
  });
3263
3289
  quansync$1({
3264
- sync: re.mkdtempSync,
3265
- async: re.promises.mkdtemp
3290
+ sync: fs$1.mkdtempSync,
3291
+ async: fs$1.promises.mkdtemp
3266
3292
  });
3267
3293
  //#endregion
3268
3294
  //#region ../../node_modules/.pnpm/unconfig-core@7.5.0/node_modules/unconfig-core/dist/index.mjs
3269
3295
  const isFile = quansync(function* (path, allowSymlinks) {
3270
3296
  try {
3271
- return (yield (allowSymlinks ? stat$1 : lstat)(path)).isFile();
3297
+ return (yield (allowSymlinks ? stat$2 : lstat)(path)).isFile();
3272
3298
  } catch {
3273
3299
  return false;
3274
3300
  }
@@ -3341,11 +3367,10 @@ function createConfigCoreLoader(options) {
3341
3367
  };
3342
3368
  }
3343
3369
  //#endregion
3344
- //#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_40fa21a6dd0aac837d14f6503ecc360a/node_modules/tsdown/dist/options-j2tUAf6W.mjs
3370
+ //#region ../../node_modules/.pnpm/tsdown@0.21.8_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.8_@tsdown+exe@0.21.8_@type_bf863151738d83584e36df49913526fa/node_modules/tsdown/dist/options-CAjSicbD.mjs
3345
3371
  const __cjs_require$1 = createRequire(import.meta.url);
3346
3372
  const picomatch = __cjs_require$1("./npm_entry_picomatch.cjs");
3347
3373
  const satisfies$1 = __cjs_require$1("./npm_entry_semver_functions_satisfies.cjs");
3348
- const minVersion = __cjs_require$1("./npm_entry_semver_ranges_min-version.cjs");
3349
3374
  const check = (key) => key in env && env[key] !== "0" && env[key] !== "false";
3350
3375
  const isInCi = check("CI") || check("CONTINUOUS_INTEGRATION");
3351
3376
  const debug$4$2 = createDebug("tsdown:clean");
@@ -3515,7 +3540,7 @@ async function buildSingleExe(config, bundledFile, outputFile, executable, targe
3515
3540
  await writeFile(seaConfigPath, JSON.stringify(seaConfig));
3516
3541
  debug$3$2("Wrote sea-config.json: %O -> %s", seaConfig, seaConfigPath);
3517
3542
  debug$3$2("Running: %s --build-sea %s", process$1.execPath, seaConfigPath);
3518
- await R(process$1.execPath, ["--build-sea", seaConfigPath], {
3543
+ await U(process$1.execPath, ["--build-sea", seaConfigPath], {
3519
3544
  nodeOptions: { stdio: [
3520
3545
  "ignore",
3521
3546
  "ignore",
@@ -3528,7 +3553,7 @@ async function buildSingleExe(config, bundledFile, outputFile, executable, targe
3528
3553
  else await fsRemove(tempDir);
3529
3554
  }
3530
3555
  if ((target?.platform || process$1.platform) === "darwin") try {
3531
- await R("codesign", [
3556
+ await U("codesign", [
3532
3557
  "--sign",
3533
3558
  "-",
3534
3559
  outputPath
@@ -3570,7 +3595,7 @@ function shouldExclude(fileName, exclude) {
3570
3595
  return matchPattern(fileName, exclude);
3571
3596
  }
3572
3597
  async function generateExports(pkg, chunks, options, inlinedDeps) {
3573
- let { exports: { devExports, all, packageJson = true, exclude, customExports, legacy, inlinedDependencies: emitInlinedDeps = true, bin }, css, logger, cwd } = options;
3598
+ let { exports: { devExports, all, packageJson = true, exclude, customExports, legacy, extensions, inlinedDependencies: emitInlinedDeps = true, bin }, css, logger, cwd } = options;
3574
3599
  const pkgRoot = path.dirname(pkg.packageJsonPath);
3575
3600
  let main, module, cjsTypes, esmTypes;
3576
3601
  const exportsMap = /* @__PURE__ */ new Map();
@@ -3602,6 +3627,7 @@ async function generateExports(pkg, chunks, options, inlinedDeps) {
3602
3627
  else module = distFile;
3603
3628
  } else if (name.endsWith("/index")) name = `./${name.slice(0, -6)}`;
3604
3629
  else name = `./${name}`;
3630
+ if (extensions && name !== ".") name = `${name}.js`;
3605
3631
  let subExport = exportsMap.get(name);
3606
3632
  if (!subExport) {
3607
3633
  subExport = {};
@@ -3760,26 +3786,6 @@ function join$1(pkgRoot, outDir, fileName) {
3760
3786
  const outDirRelative = slash(path.relative(pkgRoot, outDir));
3761
3787
  return `${outDirRelative ? `./${outDirRelative}` : "."}/${fileName}`;
3762
3788
  }
3763
- function resolveTarget(logger, target, color, pkg, nameLabel) {
3764
- if (target === false) return;
3765
- if (target == null) {
3766
- const pkgTarget = resolvePackageTarget(pkg);
3767
- if (pkgTarget) target = pkgTarget;
3768
- else return;
3769
- }
3770
- if (typeof target === "number") throw new TypeError(`Invalid target: ${target}`);
3771
- const targets = resolveComma(toArray(target));
3772
- if (targets.length) logger.info(nameLabel, `target${targets.length > 1 ? "s" : ""}: ${color(targets.join(", "))}`);
3773
- return targets;
3774
- }
3775
- function resolvePackageTarget(pkg) {
3776
- const nodeVersion = pkg?.engines?.node;
3777
- if (!nodeVersion) return;
3778
- const nodeMinVersion = minVersion(nodeVersion);
3779
- if (!nodeMinVersion) return;
3780
- if (nodeMinVersion.version === "0.0.0") return;
3781
- return `node${nodeMinVersion.version}`;
3782
- }
3783
3789
  function findTsconfig(cwd, name = "tsconfig.json") {
3784
3790
  return up$1(name, { cwd }) || false;
3785
3791
  }
@@ -3964,7 +3970,7 @@ async function nativeImport(id) {
3964
3970
  return mod.default || mod;
3965
3971
  }
3966
3972
  async function unrunImport(id) {
3967
- const { unrun } = await import("./dist-Cqme3mtE.js");
3973
+ const { unrun } = await import("./dist-_IXstuie.js");
3968
3974
  const { module } = await unrun({ path: pathToFileURL(id).href });
3969
3975
  return module;
3970
3976
  }
@@ -4157,7 +4163,7 @@ function filterConfig(filter, configCwd, name) {
4157
4163
  return toArray(filter).some((value) => name && name === value || cwd === value);
4158
4164
  }
4159
4165
  //#endregion
4160
- //#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_40fa21a6dd0aac837d14f6503ecc360a/node_modules/tsdown/dist/watch-ZJbRq-K8.mjs
4166
+ //#region ../../node_modules/.pnpm/tsdown@0.21.8_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.8_@tsdown+exe@0.21.8_@type_bf863151738d83584e36df49913526fa/node_modules/tsdown/dist/watch-C9ZHIctp.mjs
4161
4167
  async function copy(options) {
4162
4168
  if (!options.copy) return;
4163
4169
  const resolved = await resolveCopyEntries(options);
@@ -4537,7 +4543,7 @@ var Hookable = class {
4537
4543
  }
4538
4544
  };
4539
4545
  //#endregion
4540
- //#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_40fa21a6dd0aac837d14f6503ecc360a/node_modules/tsdown/dist/build-DU-BFLB1.mjs
4546
+ //#region ../../node_modules/.pnpm/tsdown@0.21.8_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.8_@tsdown+exe@0.21.8_@type_bf863151738d83584e36df49913526fa/node_modules/tsdown/dist/build-y6nUUkVJ.mjs
4541
4547
  const __cjs_require = createRequire(import.meta.url);
4542
4548
  const satisfies = __cjs_require("./npm_entry_semver_functions_satisfies.cjs");
4543
4549
  const coerce = __cjs_require("./npm_entry_semver_functions_coerce.cjs");
@@ -4632,6 +4638,23 @@ function warnLegacyCJS(config) {
4632
4638
  return version && satisfies(version, "^20.19.0 || >=22.12.0");
4633
4639
  })) config.logger.warnOnce("We recommend using the ESM format instead of CommonJS.\nThe ESM format is compatible with modern platforms and runtimes, and most new libraries are now distributed only in ESM format.\nLearn more at https://nodejs.org/en/learn/modules/publishing-a-package#how-did-we-get-here");
4634
4640
  }
4641
+ function CjsDtsReexportPlugin() {
4642
+ return {
4643
+ name: "tsdown:cjs-dts-reexport",
4644
+ generateBundle(_options, bundle) {
4645
+ for (const chunk of Object.values(bundle)) {
4646
+ if (chunk.type !== "chunk" || !chunk.isEntry) continue;
4647
+ if (!chunk.fileName.endsWith(".cjs") && !chunk.fileName.endsWith(".js")) continue;
4648
+ const content = `export type * from './${path.basename(chunk.fileName.replace(RE_JS, ".d.mts"))}'\n`;
4649
+ this.emitFile({
4650
+ type: "prebuilt-chunk",
4651
+ fileName: filename_js_to_dts(chunk.fileName),
4652
+ code: content
4653
+ });
4654
+ }
4655
+ }
4656
+ };
4657
+ }
4635
4658
  async function startDevtoolsUI(config) {
4636
4659
  const { start } = await importWithError("@vitejs/devtools/cli-commands");
4637
4660
  await start({
@@ -4656,7 +4679,7 @@ function executeOnSuccess(config) {
4656
4679
  if (!config.onSuccess) return;
4657
4680
  const ab = new AbortController();
4658
4681
  if (typeof config.onSuccess === "string") {
4659
- const p = z(config.onSuccess, [], { nodeOptions: {
4682
+ const p = W(config.onSuccess, [], { nodeOptions: {
4660
4683
  shell: true,
4661
4684
  stdio: "inherit",
4662
4685
  cwd: config.cwd
@@ -4834,7 +4857,7 @@ async function bundleDone(bundleByPkg, bundle) {
4834
4857
  async function packTarball(packageJsonPath) {
4835
4858
  const pkgDir = path.dirname(packageJsonPath);
4836
4859
  const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
4837
- const { detect } = await import("./detect-h8ZFBH96-CQo7h2I_.js");
4860
+ const { detect } = await import("./detect-DN3DXXYt-DDr6LAmT.js");
4838
4861
  try {
4839
4862
  const detected = await detect({ cwd: pkgDir });
4840
4863
  if (detected?.name === "deno") throw new Error(`Cannot pack tarball for Deno projects at ${pkgDir}`);
@@ -4901,7 +4924,7 @@ async function pack(dir, pm, destination, ignoreScripts) {
4901
4924
  args.push("--ignore-scripts");
4902
4925
  break;
4903
4926
  }
4904
- const output = await R(command, args, { nodeOptions: { cwd: dir } });
4927
+ const output = await U(command, args, { nodeOptions: { cwd: dir } });
4905
4928
  const tarballFile = await readdir(destination).then((files) => files.find((file) => file.endsWith(".tgz")));
4906
4929
  if (!tarballFile) throw new Error(`Failed to find packed tarball file in ${destination}. Command output:\n${JSON.stringify(output, null, 2)}`);
4907
4930
  return path.join(destination, tarballFile);
@@ -4970,7 +4993,7 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
4970
4993
  if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
4971
4994
  if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepsPlugin(config, bundle));
4972
4995
  if (dts) {
4973
- const { dts: dtsPlugin } = await import("./dist-CtsD24R6.js");
4996
+ const { dts: dtsPlugin } = await import("./dist-C4l5avio.js");
4974
4997
  const { cjsReexport: _, ...dtsPluginOptions } = dts;
4975
4998
  const options = {
4976
4999
  tsconfig,
@@ -5095,23 +5118,6 @@ function handlePluginInspect(plugins) {
5095
5118
  else return `"rolldown plugin: ${plugins.name}"`;
5096
5119
  };
5097
5120
  }
5098
- function CjsDtsReexportPlugin() {
5099
- return {
5100
- name: "tsdown:cjs-dts-reexport",
5101
- generateBundle(_options, bundle) {
5102
- for (const chunk of Object.values(bundle)) {
5103
- if (chunk.type !== "chunk") continue;
5104
- if (!chunk.fileName.endsWith(".cjs") && !chunk.fileName.endsWith(".js")) continue;
5105
- const content = `export * from './${path.basename(chunk.fileName.replace(RE_JS, ".d.mts"))}'\n`;
5106
- this.emitFile({
5107
- type: "prebuilt-chunk",
5108
- fileName: filename_js_to_dts(chunk.fileName),
5109
- code: content
5110
- });
5111
- }
5112
- }
5113
- };
5114
- }
5115
5121
  function CssGuardPlugin() {
5116
5122
  return {
5117
5123
  name: "tsdown:css-guard",