vite-plugin-dts 0.8.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1601,6 +1601,747 @@ var require_source = __commonJS({
1601
1601
  }
1602
1602
  });
1603
1603
 
1604
+ // node_modules/ms/index.js
1605
+ var require_ms = __commonJS({
1606
+ "node_modules/ms/index.js"(exports, module2) {
1607
+ init_cjs_shims();
1608
+ var s = 1e3;
1609
+ var m = s * 60;
1610
+ var h = m * 60;
1611
+ var d = h * 24;
1612
+ var w = d * 7;
1613
+ var y = d * 365.25;
1614
+ module2.exports = function(val, options) {
1615
+ options = options || {};
1616
+ var type = typeof val;
1617
+ if (type === "string" && val.length > 0) {
1618
+ return parse(val);
1619
+ } else if (type === "number" && isFinite(val)) {
1620
+ return options.long ? fmtLong(val) : fmtShort(val);
1621
+ }
1622
+ throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
1623
+ };
1624
+ function parse(str) {
1625
+ str = String(str);
1626
+ if (str.length > 100) {
1627
+ return;
1628
+ }
1629
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
1630
+ if (!match) {
1631
+ return;
1632
+ }
1633
+ var n = parseFloat(match[1]);
1634
+ var type = (match[2] || "ms").toLowerCase();
1635
+ switch (type) {
1636
+ case "years":
1637
+ case "year":
1638
+ case "yrs":
1639
+ case "yr":
1640
+ case "y":
1641
+ return n * y;
1642
+ case "weeks":
1643
+ case "week":
1644
+ case "w":
1645
+ return n * w;
1646
+ case "days":
1647
+ case "day":
1648
+ case "d":
1649
+ return n * d;
1650
+ case "hours":
1651
+ case "hour":
1652
+ case "hrs":
1653
+ case "hr":
1654
+ case "h":
1655
+ return n * h;
1656
+ case "minutes":
1657
+ case "minute":
1658
+ case "mins":
1659
+ case "min":
1660
+ case "m":
1661
+ return n * m;
1662
+ case "seconds":
1663
+ case "second":
1664
+ case "secs":
1665
+ case "sec":
1666
+ case "s":
1667
+ return n * s;
1668
+ case "milliseconds":
1669
+ case "millisecond":
1670
+ case "msecs":
1671
+ case "msec":
1672
+ case "ms":
1673
+ return n;
1674
+ default:
1675
+ return void 0;
1676
+ }
1677
+ }
1678
+ function fmtShort(ms) {
1679
+ var msAbs = Math.abs(ms);
1680
+ if (msAbs >= d) {
1681
+ return Math.round(ms / d) + "d";
1682
+ }
1683
+ if (msAbs >= h) {
1684
+ return Math.round(ms / h) + "h";
1685
+ }
1686
+ if (msAbs >= m) {
1687
+ return Math.round(ms / m) + "m";
1688
+ }
1689
+ if (msAbs >= s) {
1690
+ return Math.round(ms / s) + "s";
1691
+ }
1692
+ return ms + "ms";
1693
+ }
1694
+ function fmtLong(ms) {
1695
+ var msAbs = Math.abs(ms);
1696
+ if (msAbs >= d) {
1697
+ return plural(ms, msAbs, d, "day");
1698
+ }
1699
+ if (msAbs >= h) {
1700
+ return plural(ms, msAbs, h, "hour");
1701
+ }
1702
+ if (msAbs >= m) {
1703
+ return plural(ms, msAbs, m, "minute");
1704
+ }
1705
+ if (msAbs >= s) {
1706
+ return plural(ms, msAbs, s, "second");
1707
+ }
1708
+ return ms + " ms";
1709
+ }
1710
+ function plural(ms, msAbs, n, name) {
1711
+ var isPlural = msAbs >= n * 1.5;
1712
+ return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
1713
+ }
1714
+ }
1715
+ });
1716
+
1717
+ // node_modules/debug/src/common.js
1718
+ var require_common = __commonJS({
1719
+ "node_modules/debug/src/common.js"(exports, module2) {
1720
+ init_cjs_shims();
1721
+ function setup(env) {
1722
+ createDebug.debug = createDebug;
1723
+ createDebug.default = createDebug;
1724
+ createDebug.coerce = coerce;
1725
+ createDebug.disable = disable;
1726
+ createDebug.enable = enable;
1727
+ createDebug.enabled = enabled;
1728
+ createDebug.humanize = require_ms();
1729
+ createDebug.destroy = destroy;
1730
+ Object.keys(env).forEach((key) => {
1731
+ createDebug[key] = env[key];
1732
+ });
1733
+ createDebug.names = [];
1734
+ createDebug.skips = [];
1735
+ createDebug.formatters = {};
1736
+ function selectColor(namespace) {
1737
+ let hash = 0;
1738
+ for (let i = 0; i < namespace.length; i++) {
1739
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
1740
+ hash |= 0;
1741
+ }
1742
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
1743
+ }
1744
+ createDebug.selectColor = selectColor;
1745
+ function createDebug(namespace) {
1746
+ let prevTime;
1747
+ let enableOverride = null;
1748
+ let namespacesCache;
1749
+ let enabledCache;
1750
+ function debug2(...args) {
1751
+ if (!debug2.enabled) {
1752
+ return;
1753
+ }
1754
+ const self = debug2;
1755
+ const curr = Number(new Date());
1756
+ const ms = curr - (prevTime || curr);
1757
+ self.diff = ms;
1758
+ self.prev = prevTime;
1759
+ self.curr = curr;
1760
+ prevTime = curr;
1761
+ args[0] = createDebug.coerce(args[0]);
1762
+ if (typeof args[0] !== "string") {
1763
+ args.unshift("%O");
1764
+ }
1765
+ let index2 = 0;
1766
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
1767
+ if (match === "%%") {
1768
+ return "%";
1769
+ }
1770
+ index2++;
1771
+ const formatter = createDebug.formatters[format];
1772
+ if (typeof formatter === "function") {
1773
+ const val = args[index2];
1774
+ match = formatter.call(self, val);
1775
+ args.splice(index2, 1);
1776
+ index2--;
1777
+ }
1778
+ return match;
1779
+ });
1780
+ createDebug.formatArgs.call(self, args);
1781
+ const logFn = self.log || createDebug.log;
1782
+ logFn.apply(self, args);
1783
+ }
1784
+ debug2.namespace = namespace;
1785
+ debug2.useColors = createDebug.useColors();
1786
+ debug2.color = createDebug.selectColor(namespace);
1787
+ debug2.extend = extend;
1788
+ debug2.destroy = createDebug.destroy;
1789
+ Object.defineProperty(debug2, "enabled", {
1790
+ enumerable: true,
1791
+ configurable: false,
1792
+ get: () => {
1793
+ if (enableOverride !== null) {
1794
+ return enableOverride;
1795
+ }
1796
+ if (namespacesCache !== createDebug.namespaces) {
1797
+ namespacesCache = createDebug.namespaces;
1798
+ enabledCache = createDebug.enabled(namespace);
1799
+ }
1800
+ return enabledCache;
1801
+ },
1802
+ set: (v) => {
1803
+ enableOverride = v;
1804
+ }
1805
+ });
1806
+ if (typeof createDebug.init === "function") {
1807
+ createDebug.init(debug2);
1808
+ }
1809
+ return debug2;
1810
+ }
1811
+ function extend(namespace, delimiter) {
1812
+ const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
1813
+ newDebug.log = this.log;
1814
+ return newDebug;
1815
+ }
1816
+ function enable(namespaces) {
1817
+ createDebug.save(namespaces);
1818
+ createDebug.namespaces = namespaces;
1819
+ createDebug.names = [];
1820
+ createDebug.skips = [];
1821
+ let i;
1822
+ const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
1823
+ const len = split.length;
1824
+ for (i = 0; i < len; i++) {
1825
+ if (!split[i]) {
1826
+ continue;
1827
+ }
1828
+ namespaces = split[i].replace(/\*/g, ".*?");
1829
+ if (namespaces[0] === "-") {
1830
+ createDebug.skips.push(new RegExp("^" + namespaces.substr(1) + "$"));
1831
+ } else {
1832
+ createDebug.names.push(new RegExp("^" + namespaces + "$"));
1833
+ }
1834
+ }
1835
+ }
1836
+ function disable() {
1837
+ const namespaces = [
1838
+ ...createDebug.names.map(toNamespace),
1839
+ ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
1840
+ ].join(",");
1841
+ createDebug.enable("");
1842
+ return namespaces;
1843
+ }
1844
+ function enabled(name) {
1845
+ if (name[name.length - 1] === "*") {
1846
+ return true;
1847
+ }
1848
+ let i;
1849
+ let len;
1850
+ for (i = 0, len = createDebug.skips.length; i < len; i++) {
1851
+ if (createDebug.skips[i].test(name)) {
1852
+ return false;
1853
+ }
1854
+ }
1855
+ for (i = 0, len = createDebug.names.length; i < len; i++) {
1856
+ if (createDebug.names[i].test(name)) {
1857
+ return true;
1858
+ }
1859
+ }
1860
+ return false;
1861
+ }
1862
+ function toNamespace(regexp) {
1863
+ return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
1864
+ }
1865
+ function coerce(val) {
1866
+ if (val instanceof Error) {
1867
+ return val.stack || val.message;
1868
+ }
1869
+ return val;
1870
+ }
1871
+ function destroy() {
1872
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
1873
+ }
1874
+ createDebug.enable(createDebug.load());
1875
+ return createDebug;
1876
+ }
1877
+ module2.exports = setup;
1878
+ }
1879
+ });
1880
+
1881
+ // node_modules/debug/src/browser.js
1882
+ var require_browser = __commonJS({
1883
+ "node_modules/debug/src/browser.js"(exports, module2) {
1884
+ init_cjs_shims();
1885
+ exports.formatArgs = formatArgs;
1886
+ exports.save = save;
1887
+ exports.load = load;
1888
+ exports.useColors = useColors;
1889
+ exports.storage = localstorage();
1890
+ exports.destroy = (() => {
1891
+ let warned = false;
1892
+ return () => {
1893
+ if (!warned) {
1894
+ warned = true;
1895
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
1896
+ }
1897
+ };
1898
+ })();
1899
+ exports.colors = [
1900
+ "#0000CC",
1901
+ "#0000FF",
1902
+ "#0033CC",
1903
+ "#0033FF",
1904
+ "#0066CC",
1905
+ "#0066FF",
1906
+ "#0099CC",
1907
+ "#0099FF",
1908
+ "#00CC00",
1909
+ "#00CC33",
1910
+ "#00CC66",
1911
+ "#00CC99",
1912
+ "#00CCCC",
1913
+ "#00CCFF",
1914
+ "#3300CC",
1915
+ "#3300FF",
1916
+ "#3333CC",
1917
+ "#3333FF",
1918
+ "#3366CC",
1919
+ "#3366FF",
1920
+ "#3399CC",
1921
+ "#3399FF",
1922
+ "#33CC00",
1923
+ "#33CC33",
1924
+ "#33CC66",
1925
+ "#33CC99",
1926
+ "#33CCCC",
1927
+ "#33CCFF",
1928
+ "#6600CC",
1929
+ "#6600FF",
1930
+ "#6633CC",
1931
+ "#6633FF",
1932
+ "#66CC00",
1933
+ "#66CC33",
1934
+ "#9900CC",
1935
+ "#9900FF",
1936
+ "#9933CC",
1937
+ "#9933FF",
1938
+ "#99CC00",
1939
+ "#99CC33",
1940
+ "#CC0000",
1941
+ "#CC0033",
1942
+ "#CC0066",
1943
+ "#CC0099",
1944
+ "#CC00CC",
1945
+ "#CC00FF",
1946
+ "#CC3300",
1947
+ "#CC3333",
1948
+ "#CC3366",
1949
+ "#CC3399",
1950
+ "#CC33CC",
1951
+ "#CC33FF",
1952
+ "#CC6600",
1953
+ "#CC6633",
1954
+ "#CC9900",
1955
+ "#CC9933",
1956
+ "#CCCC00",
1957
+ "#CCCC33",
1958
+ "#FF0000",
1959
+ "#FF0033",
1960
+ "#FF0066",
1961
+ "#FF0099",
1962
+ "#FF00CC",
1963
+ "#FF00FF",
1964
+ "#FF3300",
1965
+ "#FF3333",
1966
+ "#FF3366",
1967
+ "#FF3399",
1968
+ "#FF33CC",
1969
+ "#FF33FF",
1970
+ "#FF6600",
1971
+ "#FF6633",
1972
+ "#FF9900",
1973
+ "#FF9933",
1974
+ "#FFCC00",
1975
+ "#FFCC33"
1976
+ ];
1977
+ function useColors() {
1978
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
1979
+ return true;
1980
+ }
1981
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
1982
+ return false;
1983
+ }
1984
+ return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
1985
+ }
1986
+ function formatArgs(args) {
1987
+ args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff);
1988
+ if (!this.useColors) {
1989
+ return;
1990
+ }
1991
+ const c = "color: " + this.color;
1992
+ args.splice(1, 0, c, "color: inherit");
1993
+ let index2 = 0;
1994
+ let lastC = 0;
1995
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
1996
+ if (match === "%%") {
1997
+ return;
1998
+ }
1999
+ index2++;
2000
+ if (match === "%c") {
2001
+ lastC = index2;
2002
+ }
2003
+ });
2004
+ args.splice(lastC, 0, c);
2005
+ }
2006
+ exports.log = console.debug || console.log || (() => {
2007
+ });
2008
+ function save(namespaces) {
2009
+ try {
2010
+ if (namespaces) {
2011
+ exports.storage.setItem("debug", namespaces);
2012
+ } else {
2013
+ exports.storage.removeItem("debug");
2014
+ }
2015
+ } catch (error) {
2016
+ }
2017
+ }
2018
+ function load() {
2019
+ let r;
2020
+ try {
2021
+ r = exports.storage.getItem("debug");
2022
+ } catch (error) {
2023
+ }
2024
+ if (!r && typeof process !== "undefined" && "env" in process) {
2025
+ r = process.env.DEBUG;
2026
+ }
2027
+ return r;
2028
+ }
2029
+ function localstorage() {
2030
+ try {
2031
+ return localStorage;
2032
+ } catch (error) {
2033
+ }
2034
+ }
2035
+ module2.exports = require_common()(exports);
2036
+ var { formatters } = module2.exports;
2037
+ formatters.j = function(v) {
2038
+ try {
2039
+ return JSON.stringify(v);
2040
+ } catch (error) {
2041
+ return "[UnexpectedJSONParseError]: " + error.message;
2042
+ }
2043
+ };
2044
+ }
2045
+ });
2046
+
2047
+ // node_modules/supports-color/index.js
2048
+ var require_supports_color2 = __commonJS({
2049
+ "node_modules/supports-color/index.js"(exports, module2) {
2050
+ init_cjs_shims();
2051
+ "use strict";
2052
+ var os2 = require("os");
2053
+ var tty = require("tty");
2054
+ var hasFlag = require_has_flag();
2055
+ var { env } = process;
2056
+ var flagForceColor;
2057
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
2058
+ flagForceColor = 0;
2059
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
2060
+ flagForceColor = 1;
2061
+ }
2062
+ function envForceColor() {
2063
+ if ("FORCE_COLOR" in env) {
2064
+ if (env.FORCE_COLOR === "true") {
2065
+ return 1;
2066
+ }
2067
+ if (env.FORCE_COLOR === "false") {
2068
+ return 0;
2069
+ }
2070
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
2071
+ }
2072
+ }
2073
+ function translateLevel(level) {
2074
+ if (level === 0) {
2075
+ return false;
2076
+ }
2077
+ return {
2078
+ level,
2079
+ hasBasic: true,
2080
+ has256: level >= 2,
2081
+ has16m: level >= 3
2082
+ };
2083
+ }
2084
+ function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
2085
+ const noFlagForceColor = envForceColor();
2086
+ if (noFlagForceColor !== void 0) {
2087
+ flagForceColor = noFlagForceColor;
2088
+ }
2089
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
2090
+ if (forceColor === 0) {
2091
+ return 0;
2092
+ }
2093
+ if (sniffFlags) {
2094
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
2095
+ return 3;
2096
+ }
2097
+ if (hasFlag("color=256")) {
2098
+ return 2;
2099
+ }
2100
+ }
2101
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
2102
+ return 0;
2103
+ }
2104
+ const min = forceColor || 0;
2105
+ if (env.TERM === "dumb") {
2106
+ return min;
2107
+ }
2108
+ if (process.platform === "win32") {
2109
+ const osRelease = os2.release().split(".");
2110
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
2111
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
2112
+ }
2113
+ return 1;
2114
+ }
2115
+ if ("CI" in env) {
2116
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
2117
+ return 1;
2118
+ }
2119
+ return min;
2120
+ }
2121
+ if ("TEAMCITY_VERSION" in env) {
2122
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2123
+ }
2124
+ if (env.COLORTERM === "truecolor") {
2125
+ return 3;
2126
+ }
2127
+ if ("TERM_PROGRAM" in env) {
2128
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
2129
+ switch (env.TERM_PROGRAM) {
2130
+ case "iTerm.app":
2131
+ return version >= 3 ? 3 : 2;
2132
+ case "Apple_Terminal":
2133
+ return 2;
2134
+ }
2135
+ }
2136
+ if (/-256(color)?$/i.test(env.TERM)) {
2137
+ return 2;
2138
+ }
2139
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
2140
+ return 1;
2141
+ }
2142
+ if ("COLORTERM" in env) {
2143
+ return 1;
2144
+ }
2145
+ return min;
2146
+ }
2147
+ function getSupportLevel(stream, options = {}) {
2148
+ const level = supportsColor(stream, __spreadValues({
2149
+ streamIsTTY: stream && stream.isTTY
2150
+ }, options));
2151
+ return translateLevel(level);
2152
+ }
2153
+ module2.exports = {
2154
+ supportsColor: getSupportLevel,
2155
+ stdout: getSupportLevel({ isTTY: tty.isatty(1) }),
2156
+ stderr: getSupportLevel({ isTTY: tty.isatty(2) })
2157
+ };
2158
+ }
2159
+ });
2160
+
2161
+ // node_modules/debug/src/node.js
2162
+ var require_node = __commonJS({
2163
+ "node_modules/debug/src/node.js"(exports, module2) {
2164
+ init_cjs_shims();
2165
+ var tty = require("tty");
2166
+ var util = require("util");
2167
+ exports.init = init;
2168
+ exports.log = log;
2169
+ exports.formatArgs = formatArgs;
2170
+ exports.save = save;
2171
+ exports.load = load;
2172
+ exports.useColors = useColors;
2173
+ exports.destroy = util.deprecate(() => {
2174
+ }, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
2175
+ exports.colors = [6, 2, 3, 4, 5, 1];
2176
+ try {
2177
+ const supportsColor = require_supports_color2();
2178
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
2179
+ exports.colors = [
2180
+ 20,
2181
+ 21,
2182
+ 26,
2183
+ 27,
2184
+ 32,
2185
+ 33,
2186
+ 38,
2187
+ 39,
2188
+ 40,
2189
+ 41,
2190
+ 42,
2191
+ 43,
2192
+ 44,
2193
+ 45,
2194
+ 56,
2195
+ 57,
2196
+ 62,
2197
+ 63,
2198
+ 68,
2199
+ 69,
2200
+ 74,
2201
+ 75,
2202
+ 76,
2203
+ 77,
2204
+ 78,
2205
+ 79,
2206
+ 80,
2207
+ 81,
2208
+ 92,
2209
+ 93,
2210
+ 98,
2211
+ 99,
2212
+ 112,
2213
+ 113,
2214
+ 128,
2215
+ 129,
2216
+ 134,
2217
+ 135,
2218
+ 148,
2219
+ 149,
2220
+ 160,
2221
+ 161,
2222
+ 162,
2223
+ 163,
2224
+ 164,
2225
+ 165,
2226
+ 166,
2227
+ 167,
2228
+ 168,
2229
+ 169,
2230
+ 170,
2231
+ 171,
2232
+ 172,
2233
+ 173,
2234
+ 178,
2235
+ 179,
2236
+ 184,
2237
+ 185,
2238
+ 196,
2239
+ 197,
2240
+ 198,
2241
+ 199,
2242
+ 200,
2243
+ 201,
2244
+ 202,
2245
+ 203,
2246
+ 204,
2247
+ 205,
2248
+ 206,
2249
+ 207,
2250
+ 208,
2251
+ 209,
2252
+ 214,
2253
+ 215,
2254
+ 220,
2255
+ 221
2256
+ ];
2257
+ }
2258
+ } catch (error) {
2259
+ }
2260
+ exports.inspectOpts = Object.keys(process.env).filter((key) => {
2261
+ return /^debug_/i.test(key);
2262
+ }).reduce((obj, key) => {
2263
+ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
2264
+ return k.toUpperCase();
2265
+ });
2266
+ let val = process.env[key];
2267
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
2268
+ val = true;
2269
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
2270
+ val = false;
2271
+ } else if (val === "null") {
2272
+ val = null;
2273
+ } else {
2274
+ val = Number(val);
2275
+ }
2276
+ obj[prop] = val;
2277
+ return obj;
2278
+ }, {});
2279
+ function useColors() {
2280
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
2281
+ }
2282
+ function formatArgs(args) {
2283
+ const { namespace: name, useColors: useColors2 } = this;
2284
+ if (useColors2) {
2285
+ const c = this.color;
2286
+ const colorCode = "[3" + (c < 8 ? c : "8;5;" + c);
2287
+ const prefix = ` ${colorCode};1m${name} `;
2288
+ args[0] = prefix + args[0].split("\n").join("\n" + prefix);
2289
+ args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "");
2290
+ } else {
2291
+ args[0] = getDate() + name + " " + args[0];
2292
+ }
2293
+ }
2294
+ function getDate() {
2295
+ if (exports.inspectOpts.hideDate) {
2296
+ return "";
2297
+ }
2298
+ return new Date().toISOString() + " ";
2299
+ }
2300
+ function log(...args) {
2301
+ return process.stderr.write(util.format(...args) + "\n");
2302
+ }
2303
+ function save(namespaces) {
2304
+ if (namespaces) {
2305
+ process.env.DEBUG = namespaces;
2306
+ } else {
2307
+ delete process.env.DEBUG;
2308
+ }
2309
+ }
2310
+ function load() {
2311
+ return process.env.DEBUG;
2312
+ }
2313
+ function init(debug2) {
2314
+ debug2.inspectOpts = {};
2315
+ const keys = Object.keys(exports.inspectOpts);
2316
+ for (let i = 0; i < keys.length; i++) {
2317
+ debug2.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
2318
+ }
2319
+ }
2320
+ module2.exports = require_common()(exports);
2321
+ var { formatters } = module2.exports;
2322
+ formatters.o = function(v) {
2323
+ this.inspectOpts.colors = this.useColors;
2324
+ return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
2325
+ };
2326
+ formatters.O = function(v) {
2327
+ this.inspectOpts.colors = this.useColors;
2328
+ return util.inspect(v, this.inspectOpts);
2329
+ };
2330
+ }
2331
+ });
2332
+
2333
+ // node_modules/debug/src/index.js
2334
+ var require_src = __commonJS({
2335
+ "node_modules/debug/src/index.js"(exports, module2) {
2336
+ init_cjs_shims();
2337
+ if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
2338
+ module2.exports = require_browser();
2339
+ } else {
2340
+ module2.exports = require_node();
2341
+ }
2342
+ }
2343
+ });
2344
+
1604
2345
  // node_modules/source-map/lib/base64.js
1605
2346
  var require_base64 = __commonJS({
1606
2347
  "node_modules/source-map/lib/base64.js"(exports) {
@@ -137775,6 +138516,7 @@ var import_fs_extra = __toModule(require("fs-extra"));
137775
138516
  var import_os = __toModule(require("os"));
137776
138517
  var import_chalk = __toModule(require_source());
137777
138518
  var import_fast_glob = __toModule(require("fast-glob"));
138519
+ var import_debug = __toModule(require_src());
137778
138520
  var import_ts_morph = __toModule(require("ts-morph"));
137779
138521
  var import_vite2 = __toModule(require("vite"));
137780
138522
  var import_typescript = __toModule(require_typescript());
@@ -137936,6 +138678,7 @@ function transferSetupPosition(content) {
137936
138678
 
137937
138679
  // src/compile.ts
137938
138680
  init_cjs_shims();
138681
+ var exportDefaultRE = /export\s+default/;
137939
138682
  var exportDefaultClassRE = /(?:(?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/;
137940
138683
  var index = 1;
137941
138684
  var compiler;
@@ -137965,7 +138708,7 @@ function compileVueCode(code) {
137965
138708
  content = compiled.content.replace(exportDefaultClassRE, `
137966
138709
  class $1`) + `
137967
138710
  const _sfc_main = ${classMatch[1]}`;
137968
- if (/export\s+default/.test(content)) {
138711
+ if (exportDefaultRE.test(content)) {
137969
138712
  content = rewriteDefault(compiled.content, `_sfc_main`);
137970
138713
  }
137971
138714
  } else {
@@ -137984,9 +138727,17 @@ const _sfc_main = ${classMatch[1]}`;
137984
138727
 
137985
138728
  // src/index.ts
137986
138729
  var noneExport = "export {};\n";
138730
+ var vueRE = /\.vue$/;
138731
+ var tsRE = /\.tsx?$/;
138732
+ var jsRE = /\.jsx?$/;
138733
+ var dtsRE = /\.d\.tsx?$/;
138734
+ var tjsRE = /\.(t|j)sx?$/;
138735
+ var watchExtensionRE = /\.(vue|(t|j)sx?)$/;
137987
138736
  var noop = () => {
137988
138737
  };
138738
+ var bundleDebug = (0, import_debug.debug)("vite-plugin-dts:bundle");
137989
138739
  function dtsPlugin(options = {}) {
138740
+ var _a;
137990
138741
  const {
137991
138742
  tsConfigFilePath = "tsconfig.json",
137992
138743
  cleanVueFileName = false,
@@ -137994,11 +138745,12 @@ function dtsPlugin(options = {}) {
137994
138745
  clearPureImport = true,
137995
138746
  insertTypesEntry = false,
137996
138747
  noEmitOnError = false,
138748
+ skipDiagnostics = true,
137997
138749
  logDiagnostics = false,
137998
138750
  afterDiagnostic = noop,
137999
138751
  beforeWriteFile = noop
138000
138752
  } = options;
138001
- const compilerOptions = options.compilerOptions || {};
138753
+ const compilerOptions = (_a = options.compilerOptions) != null ? _a : {};
138002
138754
  let root;
138003
138755
  let aliases;
138004
138756
  let entries;
@@ -138015,9 +138767,10 @@ function dtsPlugin(options = {}) {
138015
138767
  apply: "build",
138016
138768
  enforce: "pre",
138017
138769
  config(config) {
138770
+ var _a2;
138018
138771
  if (isBundle)
138019
138772
  return;
138020
- const aliasOptions = config.resolve && config.resolve.alias || [];
138773
+ const aliasOptions = (_a2 = config.resolve && config.resolve.alias) != null ? _a2 : [];
138021
138774
  if (isNativeObj(aliasOptions)) {
138022
138775
  aliases = Object.entries(aliasOptions).map(([key, value]) => {
138023
138776
  return { find: key, replacement: value };
@@ -138027,7 +138780,7 @@ function dtsPlugin(options = {}) {
138027
138780
  }
138028
138781
  },
138029
138782
  configResolved(config) {
138030
- var _a;
138783
+ var _a2, _b;
138031
138784
  if (isBundle)
138032
138785
  return;
138033
138786
  logger = config.logger;
@@ -138036,7 +138789,7 @@ function dtsPlugin(options = {}) {
138036
138789
  ${import_chalk.default.cyan("[vite:dts]")} You building not a library that may not need to generate declaration files.
138037
138790
  `));
138038
138791
  }
138039
- root = ensureAbsolute(options.root || "", config.root);
138792
+ root = ensureAbsolute((_a2 = options.root) != null ? _a2 : "", config.root);
138040
138793
  tsConfigPath = ensureAbsolute(tsConfigFilePath, root);
138041
138794
  outputDir = options.outputDir ? ensureAbsolute(options.outputDir, root) : ensureAbsolute(config.build.outDir, root);
138042
138795
  if (!outputDir) {
@@ -138045,9 +138798,9 @@ ${import_chalk.default.cyan("[vite:dts]")} Can not resolve declaration directory
138045
138798
  `));
138046
138799
  return;
138047
138800
  }
138048
- compilerOptions.rootDir = compilerOptions.rootDir || root;
138801
+ compilerOptions.rootDir || (compilerOptions.rootDir = root);
138049
138802
  project = new import_ts_morph.Project({
138050
- compilerOptions: mergeObjects(compilerOptions || {}, {
138803
+ compilerOptions: mergeObjects(compilerOptions, {
138051
138804
  noEmitOnError,
138052
138805
  outDir: ".",
138053
138806
  declarationDir: null,
@@ -138058,49 +138811,59 @@ ${import_chalk.default.cyan("[vite:dts]")} Can not resolve declaration directory
138058
138811
  tsConfigFilePath: tsConfigPath,
138059
138812
  skipAddingFilesFromTsConfig: true
138060
138813
  });
138061
- allowJs = (_a = project.getCompilerOptions().allowJs) != null ? _a : false;
138814
+ allowJs = (_b = project.getCompilerOptions().allowJs) != null ? _b : false;
138062
138815
  },
138063
138816
  buildStart(inputOptions) {
138064
- entries = Array.isArray(inputOptions.input) ? inputOptions.input : Object.values(inputOptions.input);
138817
+ if (insertTypesEntry) {
138818
+ entries = Array.isArray(inputOptions.input) ? inputOptions.input : Object.values(inputOptions.input);
138819
+ }
138065
138820
  },
138066
138821
  transform(code, id) {
138067
- if (/\.vue$/.test(id)) {
138822
+ if (vueRE.test(id)) {
138068
138823
  const { content, ext } = compileVueCode(code);
138069
138824
  if (content) {
138070
138825
  if (ext === "js" || ext === "jsx")
138071
138826
  hasJsVue = true;
138072
138827
  project.createSourceFile(`${id}.${ext || "js"}`, content, { overwrite: true });
138073
138828
  }
138074
- } else if (!id.includes(".vue?vue") && (/\.tsx?$/.test(id) || allowJs && /\.jsx?$/.test(id))) {
138829
+ } else if (!id.includes(".vue?vue") && (tsRE.test(id) || allowJs && jsRE.test(id))) {
138075
138830
  project.addSourceFileAtPath(id);
138076
138831
  }
138077
138832
  return null;
138078
138833
  },
138079
138834
  watchChange(id) {
138080
- if (/\.(vue|(t|j)sx?)$/.test(id)) {
138835
+ if (watchExtensionRE.test(id)) {
138081
138836
  isBundle = false;
138837
+ if (project) {
138838
+ const sourceFile = project.getSourceFile((0, import_vite2.normalizePath)(id));
138839
+ sourceFile && project.removeSourceFile(sourceFile);
138840
+ }
138082
138841
  }
138083
138842
  },
138084
138843
  async closeBundle() {
138844
+ var _a2, _b, _c;
138085
138845
  if (!outputDir || !project || isBundle)
138086
138846
  return;
138087
138847
  logger.info(import_chalk.default.green(`
138088
- ${import_chalk.default.cyan("[vite:dts]")} Compiling source files...`));
138848
+ ${import_chalk.default.cyan("[vite:dts]")} Start generate declaration files...`));
138849
+ bundleDebug("start");
138089
138850
  isBundle = true;
138090
138851
  sourceDtsFiles.clear();
138091
- const tsConfig = (0, import_typescript.readConfigFile)(tsConfigPath, project.getFileSystem().readFileSync).config || {};
138092
- const include = options.include || tsConfig.include;
138093
- const exclude = options.exclude || tsConfig.exclude;
138852
+ const startTime = Date.now();
138853
+ const tsConfig = (_a2 = (0, import_typescript.readConfigFile)(tsConfigPath, project.getFileSystem().readFileSync).config) != null ? _a2 : {};
138854
+ const include = (_b = options.include) != null ? _b : tsConfig.include;
138855
+ const exclude = (_c = options.exclude) != null ? _c : tsConfig.exclude;
138856
+ bundleDebug("read config");
138094
138857
  const includedFileSet = new Set();
138095
138858
  if (include && include.length) {
138096
138859
  const files = await (0, import_fast_glob.default)(ensureArray(include).map(normalizeGlob), {
138097
138860
  cwd: root,
138098
138861
  absolute: true,
138099
- ignore: ensureArray(exclude || ["node_modules/**"]).map(normalizeGlob)
138862
+ ignore: ensureArray(exclude != null ? exclude : ["node_modules/**"]).map(normalizeGlob)
138100
138863
  });
138101
138864
  files.forEach((file) => {
138102
- includedFileSet.add(/\.d\.tsx?$/.test(file) ? file : `${/\.(t|j)sx?$/.test(file) ? file.replace(/\.(t|j)sx?$/, "") : file}.d.ts`);
138103
- if (/\.d\.tsx?$/.test(file)) {
138865
+ includedFileSet.add(dtsRE.test(file) ? file : `${tjsRE.test(file) ? file.replace(tjsRE, "") : file}.d.ts`);
138866
+ if (dtsRE.test(file)) {
138104
138867
  sourceDtsFiles.add(file);
138105
138868
  }
138106
138869
  });
@@ -138110,19 +138873,29 @@ ${import_chalk.default.cyan("[vite:dts]")} Compiling source files...`));
138110
138873
  }
138111
138874
  project.compilerOptions.set({ allowJs: true });
138112
138875
  }
138876
+ bundleDebug("collect files");
138113
138877
  }
138114
138878
  project.resolveSourceFileDependencies();
138115
- const diagnostics = project.getPreEmitDiagnostics();
138116
- if ((diagnostics == null ? void 0 : diagnostics.length) && logDiagnostics) {
138117
- logger.warn(project.formatDiagnosticsWithColorAndContext(diagnostics));
138118
- }
138119
- if (typeof afterDiagnostic === "function") {
138120
- afterDiagnostic(diagnostics);
138121
- }
138122
- logger.info(import_chalk.default.green(`${import_chalk.default.cyan("[vite:dts]")} Generating declaration files...`));
138123
- await runParallel(import_os.default.cpus().length, project.emitToMemory().getFiles(), async (outputFile) => {
138124
- let filePath = outputFile.filePath;
138125
- let content = outputFile.text;
138879
+ bundleDebug("resolve");
138880
+ if (!skipDiagnostics) {
138881
+ const diagnostics = project.getPreEmitDiagnostics();
138882
+ if ((diagnostics == null ? void 0 : diagnostics.length) && logDiagnostics) {
138883
+ logger.warn(project.formatDiagnosticsWithColorAndContext(diagnostics));
138884
+ }
138885
+ if (typeof afterDiagnostic === "function") {
138886
+ afterDiagnostic(diagnostics);
138887
+ }
138888
+ bundleDebug("diagnostics");
138889
+ }
138890
+ const service = project.getLanguageService();
138891
+ const outputFiles = project.getSourceFiles().map((sourceFile) => {
138892
+ return service.getEmitOutput(sourceFile, true).getOutputFiles();
138893
+ }).flat();
138894
+ bundleDebug("emit");
138895
+ await runParallel(import_os.default.cpus().length, outputFiles, async (outputFile) => {
138896
+ var _a3, _b2;
138897
+ let filePath = outputFile.getFilePath();
138898
+ let content = outputFile.getText();
138126
138899
  const isMapFile = filePath.endsWith(".map");
138127
138900
  if (!includedFileSet.has(isMapFile ? filePath.slice(0, -4) : filePath) || clearPureImport && content === noneExport)
138128
138901
  return;
@@ -138135,18 +138908,20 @@ ${import_chalk.default.cyan("[vite:dts]")} Compiling source files...`));
138135
138908
  if (typeof beforeWriteFile === "function") {
138136
138909
  const result = beforeWriteFile(filePath, content);
138137
138910
  if (result && isNativeObj(result)) {
138138
- filePath = result.filePath || filePath;
138139
- content = result.content || content;
138911
+ filePath = (_a3 = result.filePath) != null ? _a3 : filePath;
138912
+ content = (_b2 = result.content) != null ? _b2 : content;
138140
138913
  }
138141
138914
  }
138142
138915
  await import_fs_extra.default.mkdir((0, import_path3.dirname)(filePath), { recursive: true });
138143
138916
  await import_fs_extra.default.writeFile(filePath, cleanVueFileName ? content.replace(/['"](.+)\.vue['"]/g, '"$1"') : content, "utf8");
138144
138917
  });
138918
+ bundleDebug("output");
138145
138919
  await Promise.all(Array.from(sourceDtsFiles).map(async (filePath) => {
138146
138920
  const targetPath = (0, import_path3.resolve)(outputDir, (0, import_path3.relative)(root, filePath));
138147
138921
  await import_fs_extra.default.mkdir((0, import_path3.dirname)(targetPath), { recursive: true });
138148
138922
  await import_fs_extra.default.copyFile(filePath, targetPath);
138149
138923
  }));
138924
+ bundleDebug("copy dts");
138150
138925
  if (insertTypesEntry) {
138151
138926
  const pkgPath = (0, import_path3.resolve)(root, "package.json");
138152
138927
  const pkg = import_fs_extra.default.existsSync(pkgPath) ? JSON.parse(await import_fs_extra.default.readFile(pkgPath, "utf-8")) : {};
@@ -138154,14 +138929,15 @@ ${import_chalk.default.cyan("[vite:dts]")} Compiling source files...`));
138154
138929
  if (!import_fs_extra.default.existsSync(typesPath)) {
138155
138930
  const content = entries.map((entry) => {
138156
138931
  let filePath = (0, import_vite2.normalizePath)((0, import_path3.relative)((0, import_path3.dirname)(typesPath), (0, import_path3.resolve)(outputDir, (0, import_path3.relative)(root, entry))));
138157
- filePath = filePath.replace(/\.tsx?$/, "");
138932
+ filePath = filePath.replace(tsRE, "");
138158
138933
  filePath = /^\.\.?\//.test(filePath) ? filePath : `./${filePath}`;
138159
138934
  return `export * from '${filePath}'`;
138160
138935
  }).join("\n") + "\n";
138161
138936
  await import_fs_extra.default.writeFile(typesPath, content, "utf-8");
138162
138937
  }
138938
+ bundleDebug("insert index");
138163
138939
  }
138164
- logger.info(import_chalk.default.green(`${import_chalk.default.cyan("[vite:dts]")} Declaration files built.
138940
+ logger.info(import_chalk.default.green(`${import_chalk.default.cyan("[vite:dts]")} Declaration files built in ${Date.now() - startTime}ms.
138165
138941
  `));
138166
138942
  }
138167
138943
  };