@storybook/react 10.6.0-alpha.4 → 10.6.0-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,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9l9ewgtxdb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9l9ewgtxdb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9l9ewgtxdb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9l9ewgtxdb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9l9ewgtxdb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9l9ewgtxdb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -53,49 +53,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
53
53
|
mod
|
|
54
54
|
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
55
55
|
|
|
56
|
-
// ../../../node_modules/ts-dedent/dist/index.js
|
|
57
|
-
var require_dist = __commonJS({
|
|
58
|
-
"../../../node_modules/ts-dedent/dist/index.js"(exports) {
|
|
59
|
-
"use strict";
|
|
60
|
-
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
61
|
-
exports.dedent = void 0;
|
|
62
|
-
function dedent4(templ) {
|
|
63
|
-
for (var values = [], _i = 1; _i < arguments.length; _i++)
|
|
64
|
-
values[_i - 1] = arguments[_i];
|
|
65
|
-
var strings = Array.from(typeof templ == "string" ? [templ] : templ);
|
|
66
|
-
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
67
|
-
var indentLengths = strings.reduce(function(arr, str) {
|
|
68
|
-
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
69
|
-
return matches ? arr.concat(matches.map(function(match) {
|
|
70
|
-
var _a, _b;
|
|
71
|
-
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
72
|
-
})) : arr;
|
|
73
|
-
}, []);
|
|
74
|
-
if (indentLengths.length) {
|
|
75
|
-
var pattern_1 = new RegExp(`
|
|
76
|
-
[ ]{` + Math.min.apply(Math, indentLengths) + "}", "g");
|
|
77
|
-
strings = strings.map(function(str) {
|
|
78
|
-
return str.replace(pattern_1, `
|
|
79
|
-
`);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
83
|
-
var string = strings[0];
|
|
84
|
-
return values.forEach(function(value, i2) {
|
|
85
|
-
var endentations = string.match(/(?:^|\n)( *)$/), endentation = endentations ? endentations[1] : "", indentedValue = value;
|
|
86
|
-
typeof value == "string" && value.includes(`
|
|
87
|
-
`) && (indentedValue = String(value).split(`
|
|
88
|
-
`).map(function(str, i3) {
|
|
89
|
-
return i3 === 0 ? str : "" + endentation + str;
|
|
90
|
-
}).join(`
|
|
91
|
-
`)), string += indentedValue + strings[i2 + 1];
|
|
92
|
-
}), string;
|
|
93
|
-
}
|
|
94
|
-
exports.dedent = dedent4;
|
|
95
|
-
exports.default = dedent4;
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
56
|
// ../../../node_modules/@volar/source-map/lib/binarySearch.js
|
|
100
57
|
var require_binarySearch = __commonJS({
|
|
101
58
|
"../../../node_modules/@volar/source-map/lib/binarySearch.js"(exports) {
|
|
@@ -653,8 +610,8 @@ var require_common = __commonJS({
|
|
|
653
610
|
"use strict";
|
|
654
611
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
655
612
|
exports.resolveFileLanguageId = resolveFileLanguageId2;
|
|
656
|
-
function resolveFileLanguageId2(
|
|
657
|
-
switch (
|
|
613
|
+
function resolveFileLanguageId2(path3) {
|
|
614
|
+
switch (path3.split(".").pop()) {
|
|
658
615
|
case "js":
|
|
659
616
|
return "javascript";
|
|
660
617
|
case "cjs":
|
|
@@ -799,11 +756,11 @@ var require_decorateLanguageServiceHost = __commonJS({
|
|
|
799
756
|
var resolveModuleName_1 = require_resolveModuleName(), utils_1 = require_utils2();
|
|
800
757
|
function decorateLanguageServiceHost(ts, language, languageServiceHost) {
|
|
801
758
|
let pluginExtensions = language.plugins.map((plugin) => plugin.typescript?.extraFileExtensions.map((ext) => "." + ext.extension) ?? []).flat(), scripts = /* @__PURE__ */ new Map(), crashFileNames = /* @__PURE__ */ new Set(), readDirectory = languageServiceHost.readDirectory?.bind(languageServiceHost), resolveModuleNameLiterals = languageServiceHost.resolveModuleNameLiterals?.bind(languageServiceHost), resolveModuleNames = languageServiceHost.resolveModuleNames?.bind(languageServiceHost), getScriptSnapshot = languageServiceHost.getScriptSnapshot.bind(languageServiceHost), getScriptKind = languageServiceHost.getScriptKind?.bind(languageServiceHost);
|
|
802
|
-
if (readDirectory && (languageServiceHost.readDirectory = (
|
|
759
|
+
if (readDirectory && (languageServiceHost.readDirectory = (path3, extensions, exclude, include, depth) => {
|
|
803
760
|
if (extensions)
|
|
804
761
|
for (let ext of pluginExtensions)
|
|
805
762
|
extensions.includes(ext) || (extensions = [...extensions, ext]);
|
|
806
|
-
return readDirectory(
|
|
763
|
+
return readDirectory(path3, extensions, exclude, include, depth);
|
|
807
764
|
}), pluginExtensions.length) {
|
|
808
765
|
let resolveModuleName = (0, resolveModuleName_1.createResolveModuleName)(ts, ts.sys.getFileSize, languageServiceHost, language.plugins, (fileName) => language.scripts.get(fileName)), moduleResolutionCache = languageServiceHost.getModuleResolutionCache?.();
|
|
809
766
|
resolveModuleNameLiterals && (languageServiceHost.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, ...rest) => {
|
|
@@ -1105,8 +1062,8 @@ var require_decorateProgram = __commonJS({
|
|
|
1105
1062
|
return getBindAndCheckDiagnostics(actualSourceFile, cancellationToken).map((d) => (0, transform_1.transformDiagnostic)(language, d, program, !0)).filter((d) => !!d).filter((d) => !serviceScript || language.scripts.get(d.file.fileName) === sourceScript);
|
|
1106
1063
|
} else
|
|
1107
1064
|
return getBindAndCheckDiagnostics(void 0, cancellationToken).map((d) => (0, transform_1.transformDiagnostic)(language, d, program, !0)).filter((d) => !!d);
|
|
1108
|
-
}, program.getSourceFileByPath = (
|
|
1109
|
-
let sourceFile = getSourceFileByPath(
|
|
1065
|
+
}, program.getSourceFileByPath = (path3) => {
|
|
1066
|
+
let sourceFile = getSourceFileByPath(path3);
|
|
1110
1067
|
return sourceFile && (0, transform_1.fillSourceFileText)(language, sourceFile), sourceFile;
|
|
1111
1068
|
};
|
|
1112
1069
|
}
|
|
@@ -1875,14 +1832,14 @@ var require_proxyLanguageService = __commonJS({
|
|
|
1875
1832
|
var require_path_browserify = __commonJS({
|
|
1876
1833
|
"../../../node_modules/path-browserify/index.js"(exports, module) {
|
|
1877
1834
|
"use strict";
|
|
1878
|
-
function assertPath(
|
|
1879
|
-
if (typeof
|
|
1880
|
-
throw new TypeError("Path must be a string. Received " + JSON.stringify(
|
|
1881
|
-
}
|
|
1882
|
-
function normalizeStringPosix(
|
|
1883
|
-
for (var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code, i2 = 0; i2 <=
|
|
1884
|
-
if (i2 <
|
|
1885
|
-
code =
|
|
1835
|
+
function assertPath(path3) {
|
|
1836
|
+
if (typeof path3 != "string")
|
|
1837
|
+
throw new TypeError("Path must be a string. Received " + JSON.stringify(path3));
|
|
1838
|
+
}
|
|
1839
|
+
function normalizeStringPosix(path3, allowAboveRoot) {
|
|
1840
|
+
for (var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code, i2 = 0; i2 <= path3.length; ++i2) {
|
|
1841
|
+
if (i2 < path3.length)
|
|
1842
|
+
code = path3.charCodeAt(i2);
|
|
1886
1843
|
else {
|
|
1887
1844
|
if (code === 47)
|
|
1888
1845
|
break;
|
|
@@ -1905,7 +1862,7 @@ var require_path_browserify = __commonJS({
|
|
|
1905
1862
|
}
|
|
1906
1863
|
allowAboveRoot && (res.length > 0 ? res += "/.." : res = "..", lastSegmentLength = 2);
|
|
1907
1864
|
} else
|
|
1908
|
-
res.length > 0 ? res += "/" +
|
|
1865
|
+
res.length > 0 ? res += "/" + path3.slice(lastSlash + 1, i2) : res = path3.slice(lastSlash + 1, i2), lastSegmentLength = i2 - lastSlash - 1;
|
|
1909
1866
|
lastSlash = i2, dots = 0;
|
|
1910
1867
|
} else code === 46 && dots !== -1 ? ++dots : dots = -1;
|
|
1911
1868
|
}
|
|
@@ -1919,18 +1876,18 @@ var require_path_browserify = __commonJS({
|
|
|
1919
1876
|
// path.resolve([from ...], to)
|
|
1920
1877
|
resolve: function() {
|
|
1921
1878
|
for (var resolvedPath = "", resolvedAbsolute = !1, cwd2, i2 = arguments.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) {
|
|
1922
|
-
var
|
|
1923
|
-
i2 >= 0 ?
|
|
1879
|
+
var path3;
|
|
1880
|
+
i2 >= 0 ? path3 = arguments[i2] : (cwd2 === void 0 && (cwd2 = process.cwd()), path3 = cwd2), assertPath(path3), path3.length !== 0 && (resolvedPath = path3 + "/" + resolvedPath, resolvedAbsolute = path3.charCodeAt(0) === 47);
|
|
1924
1881
|
}
|
|
1925
1882
|
return resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute ? resolvedPath.length > 0 ? "/" + resolvedPath : "/" : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
1926
1883
|
},
|
|
1927
|
-
normalize: function(
|
|
1928
|
-
if (assertPath(
|
|
1929
|
-
var
|
|
1930
|
-
return
|
|
1884
|
+
normalize: function(path3) {
|
|
1885
|
+
if (assertPath(path3), path3.length === 0) return ".";
|
|
1886
|
+
var isAbsolute3 = path3.charCodeAt(0) === 47, trailingSeparator = path3.charCodeAt(path3.length - 1) === 47;
|
|
1887
|
+
return path3 = normalizeStringPosix(path3, !isAbsolute3), path3.length === 0 && !isAbsolute3 && (path3 = "."), path3.length > 0 && trailingSeparator && (path3 += "/"), isAbsolute3 ? "/" + path3 : path3;
|
|
1931
1888
|
},
|
|
1932
|
-
isAbsolute: function(
|
|
1933
|
-
return assertPath(
|
|
1889
|
+
isAbsolute: function(path3) {
|
|
1890
|
+
return assertPath(path3), path3.length > 0 && path3.charCodeAt(0) === 47;
|
|
1934
1891
|
},
|
|
1935
1892
|
join: function() {
|
|
1936
1893
|
if (arguments.length === 0)
|
|
@@ -1967,30 +1924,30 @@ var require_path_browserify = __commonJS({
|
|
|
1967
1924
|
(i2 === fromEnd || from.charCodeAt(i2) === 47) && (out.length === 0 ? out += ".." : out += "/..");
|
|
1968
1925
|
return out.length > 0 ? out + to.slice(toStart + lastCommonSep) : (toStart += lastCommonSep, to.charCodeAt(toStart) === 47 && ++toStart, to.slice(toStart));
|
|
1969
1926
|
},
|
|
1970
|
-
_makeLong: function(
|
|
1971
|
-
return
|
|
1927
|
+
_makeLong: function(path3) {
|
|
1928
|
+
return path3;
|
|
1972
1929
|
},
|
|
1973
|
-
dirname: function(
|
|
1974
|
-
if (assertPath(
|
|
1975
|
-
for (var code =
|
|
1976
|
-
if (code =
|
|
1930
|
+
dirname: function(path3) {
|
|
1931
|
+
if (assertPath(path3), path3.length === 0) return ".";
|
|
1932
|
+
for (var code = path3.charCodeAt(0), hasRoot = code === 47, end = -1, matchedSlash = !0, i2 = path3.length - 1; i2 >= 1; --i2)
|
|
1933
|
+
if (code = path3.charCodeAt(i2), code === 47) {
|
|
1977
1934
|
if (!matchedSlash) {
|
|
1978
1935
|
end = i2;
|
|
1979
1936
|
break;
|
|
1980
1937
|
}
|
|
1981
1938
|
} else
|
|
1982
1939
|
matchedSlash = !1;
|
|
1983
|
-
return end === -1 ? hasRoot ? "/" : "." : hasRoot && end === 1 ? "//" :
|
|
1940
|
+
return end === -1 ? hasRoot ? "/" : "." : hasRoot && end === 1 ? "//" : path3.slice(0, end);
|
|
1984
1941
|
},
|
|
1985
|
-
basename: function(
|
|
1942
|
+
basename: function(path3, ext) {
|
|
1986
1943
|
if (ext !== void 0 && typeof ext != "string") throw new TypeError('"ext" argument must be a string');
|
|
1987
|
-
assertPath(
|
|
1944
|
+
assertPath(path3);
|
|
1988
1945
|
var start = 0, end = -1, matchedSlash = !0, i2;
|
|
1989
|
-
if (ext !== void 0 && ext.length > 0 && ext.length <=
|
|
1990
|
-
if (ext.length ===
|
|
1946
|
+
if (ext !== void 0 && ext.length > 0 && ext.length <= path3.length) {
|
|
1947
|
+
if (ext.length === path3.length && ext === path3) return "";
|
|
1991
1948
|
var extIdx = ext.length - 1, firstNonSlashEnd = -1;
|
|
1992
|
-
for (i2 =
|
|
1993
|
-
var code =
|
|
1949
|
+
for (i2 = path3.length - 1; i2 >= 0; --i2) {
|
|
1950
|
+
var code = path3.charCodeAt(i2);
|
|
1994
1951
|
if (code === 47) {
|
|
1995
1952
|
if (!matchedSlash) {
|
|
1996
1953
|
start = i2 + 1;
|
|
@@ -1999,22 +1956,22 @@ var require_path_browserify = __commonJS({
|
|
|
1999
1956
|
} else
|
|
2000
1957
|
firstNonSlashEnd === -1 && (matchedSlash = !1, firstNonSlashEnd = i2 + 1), extIdx >= 0 && (code === ext.charCodeAt(extIdx) ? --extIdx === -1 && (end = i2) : (extIdx = -1, end = firstNonSlashEnd));
|
|
2001
1958
|
}
|
|
2002
|
-
return start === end ? end = firstNonSlashEnd : end === -1 && (end =
|
|
1959
|
+
return start === end ? end = firstNonSlashEnd : end === -1 && (end = path3.length), path3.slice(start, end);
|
|
2003
1960
|
} else {
|
|
2004
|
-
for (i2 =
|
|
2005
|
-
if (
|
|
1961
|
+
for (i2 = path3.length - 1; i2 >= 0; --i2)
|
|
1962
|
+
if (path3.charCodeAt(i2) === 47) {
|
|
2006
1963
|
if (!matchedSlash) {
|
|
2007
1964
|
start = i2 + 1;
|
|
2008
1965
|
break;
|
|
2009
1966
|
}
|
|
2010
1967
|
} else end === -1 && (matchedSlash = !1, end = i2 + 1);
|
|
2011
|
-
return end === -1 ? "" :
|
|
1968
|
+
return end === -1 ? "" : path3.slice(start, end);
|
|
2012
1969
|
}
|
|
2013
1970
|
},
|
|
2014
|
-
extname: function(
|
|
2015
|
-
assertPath(
|
|
2016
|
-
for (var startDot = -1, startPart = 0, end = -1, matchedSlash = !0, preDotState = 0, i2 =
|
|
2017
|
-
var code =
|
|
1971
|
+
extname: function(path3) {
|
|
1972
|
+
assertPath(path3);
|
|
1973
|
+
for (var startDot = -1, startPart = 0, end = -1, matchedSlash = !0, preDotState = 0, i2 = path3.length - 1; i2 >= 0; --i2) {
|
|
1974
|
+
var code = path3.charCodeAt(i2);
|
|
2018
1975
|
if (code === 47) {
|
|
2019
1976
|
if (!matchedSlash) {
|
|
2020
1977
|
startPart = i2 + 1;
|
|
@@ -2026,21 +1983,21 @@ var require_path_browserify = __commonJS({
|
|
|
2026
1983
|
}
|
|
2027
1984
|
return startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
|
|
2028
1985
|
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
2029
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? "" :
|
|
1986
|
+
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? "" : path3.slice(startDot, end);
|
|
2030
1987
|
},
|
|
2031
1988
|
format: function(pathObject) {
|
|
2032
1989
|
if (pathObject === null || typeof pathObject != "object")
|
|
2033
1990
|
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
2034
1991
|
return _format("/", pathObject);
|
|
2035
1992
|
},
|
|
2036
|
-
parse: function(
|
|
2037
|
-
assertPath(
|
|
1993
|
+
parse: function(path3) {
|
|
1994
|
+
assertPath(path3);
|
|
2038
1995
|
var ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
2039
|
-
if (
|
|
2040
|
-
var code =
|
|
2041
|
-
|
|
2042
|
-
for (var startDot = -1, startPart = 0, end = -1, matchedSlash = !0, i2 =
|
|
2043
|
-
if (code =
|
|
1996
|
+
if (path3.length === 0) return ret;
|
|
1997
|
+
var code = path3.charCodeAt(0), isAbsolute3 = code === 47, start;
|
|
1998
|
+
isAbsolute3 ? (ret.root = "/", start = 1) : start = 0;
|
|
1999
|
+
for (var startDot = -1, startPart = 0, end = -1, matchedSlash = !0, i2 = path3.length - 1, preDotState = 0; i2 >= start; --i2) {
|
|
2000
|
+
if (code = path3.charCodeAt(i2), code === 47) {
|
|
2044
2001
|
if (!matchedSlash) {
|
|
2045
2002
|
startPart = i2 + 1;
|
|
2046
2003
|
break;
|
|
@@ -2051,7 +2008,7 @@ var require_path_browserify = __commonJS({
|
|
|
2051
2008
|
}
|
|
2052
2009
|
return startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
|
|
2053
2010
|
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
2054
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? end !== -1 && (startPart === 0 &&
|
|
2011
|
+
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? end !== -1 && (startPart === 0 && isAbsolute3 ? ret.base = ret.name = path3.slice(1, end) : ret.base = ret.name = path3.slice(startPart, end)) : (startPart === 0 && isAbsolute3 ? (ret.name = path3.slice(1, startDot), ret.base = path3.slice(1, end)) : (ret.name = path3.slice(startPart, startDot), ret.base = path3.slice(startPart, end)), ret.ext = path3.slice(startDot, end)), startPart > 0 ? ret.dir = path3.slice(0, startPart - 1) : isAbsolute3 && (ret.dir = "/"), ret;
|
|
2055
2012
|
},
|
|
2056
2013
|
sep: "/",
|
|
2057
2014
|
delimiter: ":",
|
|
@@ -2069,7 +2026,7 @@ var require_createProject = __commonJS({
|
|
|
2069
2026
|
"use strict";
|
|
2070
2027
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
2071
2028
|
exports.createLanguageServiceHost = createLanguageServiceHost2;
|
|
2072
|
-
var language_core_1 = require_language_core(),
|
|
2029
|
+
var language_core_1 = require_language_core(), path3 = require_path_browserify(), utils_1 = require_utils2(), resolveModuleName_1 = require_resolveModuleName();
|
|
2073
2030
|
function createLanguageServiceHost2(ts, sys, language, asScriptId, projectHost) {
|
|
2074
2031
|
let pluginExtensions = language.plugins.map((plugin) => plugin.typescript?.extraFileExtensions.map((ext) => "." + ext.extension) ?? []).flat(), scriptVersions = new language_core_1.FileMap(sys.useCaseSensitiveFileNames), lastProjectVersion, tsProjectVersion = 0, tsFileRegistry = new language_core_1.FileMap(sys.useCaseSensitiveFileNames), tsFileDirRegistry = new language_core_1.FileMap(sys.useCaseSensitiveFileNames), extraScriptRegistry = new language_core_1.FileMap(sys.useCaseSensitiveFileNames), lastTsVirtualFileSnapshots = /* @__PURE__ */ new Set(), lastOtherVirtualFileSnapshots = /* @__PURE__ */ new Set(), languageServiceHost = {
|
|
2075
2032
|
...sys,
|
|
@@ -2131,7 +2088,7 @@ var require_createProject = __commonJS({
|
|
|
2131
2088
|
if (serviceScript)
|
|
2132
2089
|
return serviceScript.scriptKind;
|
|
2133
2090
|
}
|
|
2134
|
-
switch (
|
|
2091
|
+
switch (path3.extname(fileName)) {
|
|
2135
2092
|
case ".js":
|
|
2136
2093
|
case ".cjs":
|
|
2137
2094
|
case ".mjs":
|
|
@@ -2798,23 +2755,23 @@ var require_path = __commonJS({
|
|
|
2798
2755
|
function isAnyDirectorySeparator(charCode) {
|
|
2799
2756
|
return charCode === 47 || charCode === 92;
|
|
2800
2757
|
}
|
|
2801
|
-
function isRootedDiskPath(
|
|
2802
|
-
return getEncodedRootLength(
|
|
2758
|
+
function isRootedDiskPath(path3) {
|
|
2759
|
+
return getEncodedRootLength(path3) > 0;
|
|
2803
2760
|
}
|
|
2804
2761
|
function hasExtension(fileName) {
|
|
2805
2762
|
return (0, core_1.stringContains)(getBaseFileName(fileName), ".");
|
|
2806
2763
|
}
|
|
2807
|
-
function fileExtensionIs(
|
|
2808
|
-
return
|
|
2764
|
+
function fileExtensionIs(path3, extension) {
|
|
2765
|
+
return path3.length > extension.length && (0, core_1.endsWith)(path3, extension);
|
|
2809
2766
|
}
|
|
2810
|
-
function fileExtensionIsOneOf(
|
|
2767
|
+
function fileExtensionIsOneOf(path3, extensions) {
|
|
2811
2768
|
for (let extension of extensions)
|
|
2812
|
-
if (fileExtensionIs(
|
|
2769
|
+
if (fileExtensionIs(path3, extension))
|
|
2813
2770
|
return !0;
|
|
2814
2771
|
return !1;
|
|
2815
2772
|
}
|
|
2816
|
-
function hasTrailingDirectorySeparator(
|
|
2817
|
-
return
|
|
2773
|
+
function hasTrailingDirectorySeparator(path3) {
|
|
2774
|
+
return path3.length > 0 && isAnyDirectorySeparator(path3.charCodeAt(path3.length - 1));
|
|
2818
2775
|
}
|
|
2819
2776
|
function isVolumeCharacter(charCode) {
|
|
2820
2777
|
return charCode >= 97 && charCode <= 122 || charCode >= 65 && charCode <= 90;
|
|
@@ -2830,94 +2787,94 @@ var require_path = __commonJS({
|
|
|
2830
2787
|
}
|
|
2831
2788
|
return -1;
|
|
2832
2789
|
}
|
|
2833
|
-
function getEncodedRootLength(
|
|
2834
|
-
if (!
|
|
2790
|
+
function getEncodedRootLength(path3) {
|
|
2791
|
+
if (!path3)
|
|
2835
2792
|
return 0;
|
|
2836
|
-
let ch0 =
|
|
2793
|
+
let ch0 = path3.charCodeAt(0);
|
|
2837
2794
|
if (ch0 === 47 || ch0 === 92) {
|
|
2838
|
-
if (
|
|
2795
|
+
if (path3.charCodeAt(1) !== ch0)
|
|
2839
2796
|
return 1;
|
|
2840
|
-
let p1 =
|
|
2841
|
-
return p1 < 0 ?
|
|
2797
|
+
let p1 = path3.indexOf(ch0 === 47 ? exports.directorySeparator : altDirectorySeparator, 2);
|
|
2798
|
+
return p1 < 0 ? path3.length : p1 + 1;
|
|
2842
2799
|
}
|
|
2843
|
-
if (isVolumeCharacter(ch0) &&
|
|
2844
|
-
let ch2 =
|
|
2800
|
+
if (isVolumeCharacter(ch0) && path3.charCodeAt(1) === 58) {
|
|
2801
|
+
let ch2 = path3.charCodeAt(2);
|
|
2845
2802
|
if (ch2 === 47 || ch2 === 92)
|
|
2846
2803
|
return 3;
|
|
2847
|
-
if (
|
|
2804
|
+
if (path3.length === 2)
|
|
2848
2805
|
return 2;
|
|
2849
2806
|
}
|
|
2850
|
-
let schemeEnd =
|
|
2807
|
+
let schemeEnd = path3.indexOf(urlSchemeSeparator);
|
|
2851
2808
|
if (schemeEnd !== -1) {
|
|
2852
|
-
let authorityStart = schemeEnd + urlSchemeSeparator.length, authorityEnd =
|
|
2809
|
+
let authorityStart = schemeEnd + urlSchemeSeparator.length, authorityEnd = path3.indexOf(exports.directorySeparator, authorityStart);
|
|
2853
2810
|
if (authorityEnd !== -1) {
|
|
2854
|
-
let scheme =
|
|
2855
|
-
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(
|
|
2856
|
-
let volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(
|
|
2811
|
+
let scheme = path3.slice(0, schemeEnd), authority = path3.slice(authorityStart, authorityEnd);
|
|
2812
|
+
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path3.charCodeAt(authorityEnd + 1))) {
|
|
2813
|
+
let volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path3, authorityEnd + 2);
|
|
2857
2814
|
if (volumeSeparatorEnd !== -1) {
|
|
2858
|
-
if (
|
|
2815
|
+
if (path3.charCodeAt(volumeSeparatorEnd) === 47)
|
|
2859
2816
|
return ~(volumeSeparatorEnd + 1);
|
|
2860
|
-
if (volumeSeparatorEnd ===
|
|
2817
|
+
if (volumeSeparatorEnd === path3.length)
|
|
2861
2818
|
return ~volumeSeparatorEnd;
|
|
2862
2819
|
}
|
|
2863
2820
|
}
|
|
2864
2821
|
return ~(authorityEnd + 1);
|
|
2865
2822
|
}
|
|
2866
|
-
return ~
|
|
2823
|
+
return ~path3.length;
|
|
2867
2824
|
}
|
|
2868
2825
|
return 0;
|
|
2869
2826
|
}
|
|
2870
|
-
function getRootLength(
|
|
2871
|
-
let rootLength = getEncodedRootLength(
|
|
2827
|
+
function getRootLength(path3) {
|
|
2828
|
+
let rootLength = getEncodedRootLength(path3);
|
|
2872
2829
|
return rootLength < 0 ? ~rootLength : rootLength;
|
|
2873
2830
|
}
|
|
2874
|
-
function getDirectoryPath(
|
|
2875
|
-
|
|
2876
|
-
let rootLength = getRootLength(
|
|
2877
|
-
return rootLength ===
|
|
2831
|
+
function getDirectoryPath(path3) {
|
|
2832
|
+
path3 = normalizeSlashes(path3);
|
|
2833
|
+
let rootLength = getRootLength(path3);
|
|
2834
|
+
return rootLength === path3.length ? path3 : (path3 = removeTrailingDirectorySeparator(path3), path3.slice(0, Math.max(rootLength, path3.lastIndexOf(exports.directorySeparator))));
|
|
2878
2835
|
}
|
|
2879
|
-
function getBaseFileName(
|
|
2880
|
-
if (
|
|
2836
|
+
function getBaseFileName(path3, extensions, ignoreCase) {
|
|
2837
|
+
if (path3 = normalizeSlashes(path3), getRootLength(path3) === path3.length)
|
|
2881
2838
|
return "";
|
|
2882
|
-
|
|
2883
|
-
let name =
|
|
2839
|
+
path3 = removeTrailingDirectorySeparator(path3);
|
|
2840
|
+
let name = path3.slice(Math.max(getRootLength(path3), path3.lastIndexOf(exports.directorySeparator) + 1)), extension = extensions !== void 0 && ignoreCase !== void 0 ? getAnyExtensionFromPath(name, extensions, ignoreCase) : void 0;
|
|
2884
2841
|
return extension ? name.slice(0, name.length - extension.length) : name;
|
|
2885
2842
|
}
|
|
2886
|
-
function tryGetExtensionFromPath(
|
|
2887
|
-
if ((0, core_1.startsWith)(extension, ".") || (extension = "." + extension),
|
|
2888
|
-
let pathExtension =
|
|
2843
|
+
function tryGetExtensionFromPath(path3, extension, stringEqualityComparer) {
|
|
2844
|
+
if ((0, core_1.startsWith)(extension, ".") || (extension = "." + extension), path3.length >= extension.length && path3.charCodeAt(path3.length - extension.length) === 46) {
|
|
2845
|
+
let pathExtension = path3.slice(path3.length - extension.length);
|
|
2889
2846
|
if (stringEqualityComparer(pathExtension, extension))
|
|
2890
2847
|
return pathExtension;
|
|
2891
2848
|
}
|
|
2892
2849
|
}
|
|
2893
|
-
function getAnyExtensionFromPathWorker(
|
|
2850
|
+
function getAnyExtensionFromPathWorker(path3, extensions, stringEqualityComparer) {
|
|
2894
2851
|
if (typeof extensions == "string")
|
|
2895
|
-
return tryGetExtensionFromPath(
|
|
2852
|
+
return tryGetExtensionFromPath(path3, extensions, stringEqualityComparer) || "";
|
|
2896
2853
|
for (let extension of extensions) {
|
|
2897
|
-
let result = tryGetExtensionFromPath(
|
|
2854
|
+
let result = tryGetExtensionFromPath(path3, extension, stringEqualityComparer);
|
|
2898
2855
|
if (result)
|
|
2899
2856
|
return result;
|
|
2900
2857
|
}
|
|
2901
2858
|
return "";
|
|
2902
2859
|
}
|
|
2903
|
-
function getAnyExtensionFromPath(
|
|
2860
|
+
function getAnyExtensionFromPath(path3, extensions, ignoreCase) {
|
|
2904
2861
|
if (extensions)
|
|
2905
|
-
return getAnyExtensionFromPathWorker(removeTrailingDirectorySeparator(
|
|
2906
|
-
let baseFileName = getBaseFileName(
|
|
2862
|
+
return getAnyExtensionFromPathWorker(removeTrailingDirectorySeparator(path3), extensions, ignoreCase ? core_1.equateStringsCaseInsensitive : core_1.equateStringsCaseSensitive);
|
|
2863
|
+
let baseFileName = getBaseFileName(path3), extensionIndex = baseFileName.lastIndexOf(".");
|
|
2907
2864
|
return extensionIndex >= 0 ? baseFileName.substring(extensionIndex) : "";
|
|
2908
2865
|
}
|
|
2909
|
-
function pathComponents(
|
|
2910
|
-
let root =
|
|
2866
|
+
function pathComponents(path3, rootLength) {
|
|
2867
|
+
let root = path3.substring(0, rootLength), rest = path3.substring(rootLength).split(exports.directorySeparator);
|
|
2911
2868
|
return rest.length && !(0, core_1.lastOrUndefined)(rest) && rest.pop(), [root, ...rest];
|
|
2912
2869
|
}
|
|
2913
|
-
function getPathComponents(
|
|
2914
|
-
return
|
|
2870
|
+
function getPathComponents(path3, currentDirectory = "") {
|
|
2871
|
+
return path3 = combinePaths(currentDirectory, path3), pathComponents(path3, getRootLength(path3));
|
|
2915
2872
|
}
|
|
2916
2873
|
function getPathFromPathComponents(pathComponents2) {
|
|
2917
2874
|
return pathComponents2.length === 0 ? "" : (pathComponents2[0] && ensureTrailingDirectorySeparator(pathComponents2[0])) + pathComponents2.slice(1).join(exports.directorySeparator);
|
|
2918
2875
|
}
|
|
2919
|
-
function normalizeSlashes(
|
|
2920
|
-
return
|
|
2876
|
+
function normalizeSlashes(path3) {
|
|
2877
|
+
return path3.indexOf("\\") !== -1 ? path3.replace(backslashRegExp, exports.directorySeparator) : path3;
|
|
2921
2878
|
}
|
|
2922
2879
|
function reducePathComponents(components) {
|
|
2923
2880
|
if (!(0, core_1.some)(components))
|
|
@@ -2940,29 +2897,29 @@ var require_path = __commonJS({
|
|
|
2940
2897
|
}
|
|
2941
2898
|
return reduced;
|
|
2942
2899
|
}
|
|
2943
|
-
function combinePaths(
|
|
2944
|
-
|
|
2900
|
+
function combinePaths(path3, ...paths) {
|
|
2901
|
+
path3 && (path3 = normalizeSlashes(path3));
|
|
2945
2902
|
for (let relativePath of paths)
|
|
2946
|
-
relativePath && (relativePath = normalizeSlashes(relativePath), !
|
|
2947
|
-
return
|
|
2903
|
+
relativePath && (relativePath = normalizeSlashes(relativePath), !path3 || getRootLength(relativePath) !== 0 ? path3 = relativePath : path3 = ensureTrailingDirectorySeparator(path3) + relativePath);
|
|
2904
|
+
return path3;
|
|
2948
2905
|
}
|
|
2949
|
-
function getNormalizedPathComponents(
|
|
2950
|
-
return reducePathComponents(getPathComponents(
|
|
2906
|
+
function getNormalizedPathComponents(path3, currentDirectory) {
|
|
2907
|
+
return reducePathComponents(getPathComponents(path3, currentDirectory));
|
|
2951
2908
|
}
|
|
2952
|
-
function normalizePath(
|
|
2953
|
-
if (
|
|
2954
|
-
return
|
|
2955
|
-
let simplified =
|
|
2956
|
-
if (simplified !==
|
|
2957
|
-
return
|
|
2958
|
-
let normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(
|
|
2959
|
-
return normalized && hasTrailingDirectorySeparator(
|
|
2909
|
+
function normalizePath(path3) {
|
|
2910
|
+
if (path3 = normalizeSlashes(path3), !relativePathSegmentRegExp.test(path3))
|
|
2911
|
+
return path3;
|
|
2912
|
+
let simplified = path3.replace(/\/\.\//g, "/").replace(/^\.\//, "");
|
|
2913
|
+
if (simplified !== path3 && (path3 = simplified, !relativePathSegmentRegExp.test(path3)))
|
|
2914
|
+
return path3;
|
|
2915
|
+
let normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(path3)));
|
|
2916
|
+
return normalized && hasTrailingDirectorySeparator(path3) ? ensureTrailingDirectorySeparator(normalized) : normalized;
|
|
2960
2917
|
}
|
|
2961
|
-
function removeTrailingDirectorySeparator(
|
|
2962
|
-
return hasTrailingDirectorySeparator(
|
|
2918
|
+
function removeTrailingDirectorySeparator(path3) {
|
|
2919
|
+
return hasTrailingDirectorySeparator(path3) ? path3.substr(0, path3.length - 1) : path3;
|
|
2963
2920
|
}
|
|
2964
|
-
function ensureTrailingDirectorySeparator(
|
|
2965
|
-
return hasTrailingDirectorySeparator(
|
|
2921
|
+
function ensureTrailingDirectorySeparator(path3) {
|
|
2922
|
+
return hasTrailingDirectorySeparator(path3) ? path3 : path3 + exports.directorySeparator;
|
|
2966
2923
|
}
|
|
2967
2924
|
var relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;
|
|
2968
2925
|
function containsPath(parent, child, currentDirectory, ignoreCase) {
|
|
@@ -3057,34 +3014,34 @@ var require_utilities = __commonJS({
|
|
|
3057
3014
|
function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
|
|
3058
3015
|
return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
|
|
3059
3016
|
}
|
|
3060
|
-
function getFileMatcherPatterns(
|
|
3061
|
-
|
|
3062
|
-
let absolutePath = (0, path_1.combinePaths)(currentDirectory,
|
|
3017
|
+
function getFileMatcherPatterns(path3, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
|
|
3018
|
+
path3 = (0, path_1.normalizePath)(path3), currentDirectory = (0, path_1.normalizePath)(currentDirectory);
|
|
3019
|
+
let absolutePath = (0, path_1.combinePaths)(currentDirectory, path3);
|
|
3063
3020
|
return {
|
|
3064
3021
|
includeFilePatterns: (0, core_1.map)(getRegularExpressionsForWildcards(includes, absolutePath, "files"), (pattern) => `^${pattern}$`),
|
|
3065
3022
|
includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
|
|
3066
3023
|
includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
|
|
3067
3024
|
excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
|
|
3068
|
-
basePaths: getBasePaths(
|
|
3025
|
+
basePaths: getBasePaths(path3, includes, useCaseSensitiveFileNames)
|
|
3069
3026
|
};
|
|
3070
3027
|
}
|
|
3071
3028
|
function getRegexFromPattern(pattern, useCaseSensitiveFileNames) {
|
|
3072
3029
|
return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i");
|
|
3073
3030
|
}
|
|
3074
|
-
function matchFiles(
|
|
3075
|
-
|
|
3076
|
-
let patterns = getFileMatcherPatterns(
|
|
3031
|
+
function matchFiles(path3, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
|
|
3032
|
+
path3 = (0, path_1.normalizePath)(path3), currentDirectory = (0, path_1.normalizePath)(currentDirectory);
|
|
3033
|
+
let patterns = getFileMatcherPatterns(path3, excludes, includes, useCaseSensitiveFileNames, currentDirectory), includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map((pattern) => getRegexFromPattern(pattern, useCaseSensitiveFileNames)), includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames), excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames), results = includeFileRegexes ? includeFileRegexes.map(() => []) : [[]], visited = /* @__PURE__ */ new Map(), toCanonical = (0, core_1.createGetCanonicalFileName)(useCaseSensitiveFileNames);
|
|
3077
3034
|
for (let basePath of patterns.basePaths)
|
|
3078
3035
|
visitDirectory(basePath, (0, path_1.combinePaths)(currentDirectory, basePath), depth);
|
|
3079
3036
|
return (0, core_1.flatten)(results);
|
|
3080
|
-
function visitDirectory(
|
|
3037
|
+
function visitDirectory(path4, absolutePath, depth2) {
|
|
3081
3038
|
let canonicalPath = toCanonical(realpath(absolutePath));
|
|
3082
3039
|
if (visited.has(canonicalPath))
|
|
3083
3040
|
return;
|
|
3084
3041
|
visited.set(canonicalPath, !0);
|
|
3085
|
-
let { files, directories } = getFileSystemEntries(
|
|
3042
|
+
let { files, directories } = getFileSystemEntries(path4);
|
|
3086
3043
|
for (let current2 of (0, core_1.sort)(files, core_1.compareStringsCaseSensitive)) {
|
|
3087
|
-
let name = (0, path_1.combinePaths)(
|
|
3044
|
+
let name = (0, path_1.combinePaths)(path4, current2), absoluteName = (0, path_1.combinePaths)(absolutePath, current2);
|
|
3088
3045
|
if (!(extensions && !(0, path_1.fileExtensionIsOneOf)(name, extensions)) && !(excludeRegex && excludeRegex.test(absoluteName)))
|
|
3089
3046
|
if (!includeFileRegexes)
|
|
3090
3047
|
results[0].push(name);
|
|
@@ -3095,22 +3052,22 @@ var require_utilities = __commonJS({
|
|
|
3095
3052
|
}
|
|
3096
3053
|
if (!(depth2 !== void 0 && (depth2--, depth2 === 0)))
|
|
3097
3054
|
for (let current2 of (0, core_1.sort)(directories, core_1.compareStringsCaseSensitive)) {
|
|
3098
|
-
let name = (0, path_1.combinePaths)(
|
|
3055
|
+
let name = (0, path_1.combinePaths)(path4, current2), absoluteName = (0, path_1.combinePaths)(absolutePath, current2);
|
|
3099
3056
|
(!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName)) && visitDirectory(name, absoluteName, depth2);
|
|
3100
3057
|
}
|
|
3101
3058
|
}
|
|
3102
3059
|
}
|
|
3103
|
-
function getBasePaths(
|
|
3104
|
-
let basePaths = [
|
|
3060
|
+
function getBasePaths(path3, includes, useCaseSensitiveFileNames) {
|
|
3061
|
+
let basePaths = [path3];
|
|
3105
3062
|
if (includes) {
|
|
3106
3063
|
let includeBasePaths = [];
|
|
3107
3064
|
for (let include of includes) {
|
|
3108
|
-
let absolute2 = (0, path_1.isRootedDiskPath)(include) ? include : (0, path_1.normalizePath)((0, path_1.combinePaths)(
|
|
3065
|
+
let absolute2 = (0, path_1.isRootedDiskPath)(include) ? include : (0, path_1.normalizePath)((0, path_1.combinePaths)(path3, include));
|
|
3109
3066
|
includeBasePaths.push(getIncludeBasePath(absolute2));
|
|
3110
3067
|
}
|
|
3111
3068
|
includeBasePaths.sort((0, core_1.getStringComparer)(!useCaseSensitiveFileNames));
|
|
3112
3069
|
for (let includeBasePath of includeBasePaths)
|
|
3113
|
-
(0, core_1.every)(basePaths, (basePath) => !(0, path_1.containsPath)(basePath, includeBasePath,
|
|
3070
|
+
(0, core_1.every)(basePaths, (basePath) => !(0, path_1.containsPath)(basePath, includeBasePath, path3, !useCaseSensitiveFileNames)) && basePaths.push(includeBasePath);
|
|
3114
3071
|
}
|
|
3115
3072
|
return basePaths;
|
|
3116
3073
|
}
|
|
@@ -3127,7 +3084,7 @@ var require_createSys = __commonJS({
|
|
|
3127
3084
|
"use strict";
|
|
3128
3085
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3129
3086
|
exports.createSys = createSys;
|
|
3130
|
-
var
|
|
3087
|
+
var path3 = require_path_browserify(), vscode_uri_1 = require_umd(), utilities_1 = require_utilities(), currentCwd = "";
|
|
3131
3088
|
function createSys(sys, env, getCurrentDirectory, uriConverter) {
|
|
3132
3089
|
let version2 = 0, caseSensitive = sys?.useCaseSensitiveFileNames ?? !1, root = {
|
|
3133
3090
|
name: "",
|
|
@@ -3137,7 +3094,7 @@ var require_createSys = __commonJS({
|
|
|
3137
3094
|
}, promises = /* @__PURE__ */ new Set(), fileWatcher = env.onDidChangeWatchedFiles?.(({ changes }) => {
|
|
3138
3095
|
version2++;
|
|
3139
3096
|
for (let change of changes) {
|
|
3140
|
-
let changeUri = vscode_uri_1.URI.parse(change.uri), fileName = uriConverter.asFileName(changeUri), dirName =
|
|
3097
|
+
let changeUri = vscode_uri_1.URI.parse(change.uri), fileName = uriConverter.asFileName(changeUri), dirName = path3.dirname(fileName), baseName = path3.basename(fileName), fileExists2 = change.type === 1 || change.type === 2;
|
|
3141
3098
|
getDir(dirName, fileExists2).files.set(normalizeFileId(baseName), fileExists2 ? {
|
|
3142
3099
|
name: baseName,
|
|
3143
3100
|
stat: {
|
|
@@ -3202,11 +3159,11 @@ var require_createSys = __commonJS({
|
|
|
3202
3159
|
}
|
|
3203
3160
|
return sys.resolvePath(fsPath).replace(/\\/g, "/");
|
|
3204
3161
|
}
|
|
3205
|
-
return
|
|
3162
|
+
return path3.resolve(fsPath).replace(/\\/g, "/");
|
|
3206
3163
|
}
|
|
3207
3164
|
function readFile(fileName, encoding) {
|
|
3208
3165
|
fileName = resolvePath(fileName);
|
|
3209
|
-
let dirPath =
|
|
3166
|
+
let dirPath = path3.dirname(fileName), dir = getDir(dirPath), name = path3.basename(fileName);
|
|
3210
3167
|
return readFileWorker(fileName, encoding, dir), dir.files.get(normalizeFileId(name))?.text;
|
|
3211
3168
|
}
|
|
3212
3169
|
function directoryExists(dirName) {
|
|
@@ -3247,7 +3204,7 @@ var require_createSys = __commonJS({
|
|
|
3247
3204
|
}
|
|
3248
3205
|
function getFile(fileName) {
|
|
3249
3206
|
fileName = resolvePath(fileName);
|
|
3250
|
-
let dirPath =
|
|
3207
|
+
let dirPath = path3.dirname(fileName), baseName = path3.basename(fileName), dir = getDir(dirPath), file = dir.files.get(normalizeFileId(baseName));
|
|
3251
3208
|
return file || dir.files.set(normalizeFileId(baseName), file = {
|
|
3252
3209
|
name: baseName,
|
|
3253
3210
|
requestedStat: !1,
|
|
@@ -3266,11 +3223,11 @@ var require_createSys = __commonJS({
|
|
|
3266
3223
|
files: [...dir.files.values()].filter((file) => file.stat?.type === 1).map((file) => file.name),
|
|
3267
3224
|
directories: [...dir.dirs.values()].filter((dir2) => dir2.exists).map((dir2) => dir2.name)
|
|
3268
3225
|
};
|
|
3269
|
-
}, sys?.realpath ? ((
|
|
3226
|
+
}, sys?.realpath ? ((path4) => sys.realpath(path4)) : ((path4) => path4));
|
|
3270
3227
|
return [...new Set(matches)];
|
|
3271
3228
|
}
|
|
3272
3229
|
function readFileWorker(fileName, encoding, dir) {
|
|
3273
|
-
let name =
|
|
3230
|
+
let name = path3.basename(fileName), file = dir.files.get(normalizeFileId(name));
|
|
3274
3231
|
if (file || dir.files.set(normalizeFileId(name), file = {
|
|
3275
3232
|
name,
|
|
3276
3233
|
requestedStat: !1,
|
|
@@ -3344,9 +3301,9 @@ var require_createSys = __commonJS({
|
|
|
3344
3301
|
return updated;
|
|
3345
3302
|
}
|
|
3346
3303
|
function getDir(dirName, markExists = !1) {
|
|
3347
|
-
let dirNames = [], currentDirPath = dirName, currentDirName =
|
|
3304
|
+
let dirNames = [], currentDirPath = dirName, currentDirName = path3.basename(currentDirPath), lastDirPath;
|
|
3348
3305
|
for (; lastDirPath !== currentDirPath; )
|
|
3349
|
-
lastDirPath = currentDirPath, dirNames.push(currentDirName), currentDirPath =
|
|
3306
|
+
lastDirPath = currentDirPath, dirNames.push(currentDirName), currentDirPath = path3.dirname(currentDirPath), currentDirName = path3.basename(currentDirPath);
|
|
3350
3307
|
let currentDir = root;
|
|
3351
3308
|
for (let i2 = dirNames.length - 1; i2 >= 0; i2--) {
|
|
3352
3309
|
let nextDirName = dirNames[i2];
|
|
@@ -3586,19 +3543,19 @@ var require_estraverse = __commonJS({
|
|
|
3586
3543
|
}, Reference.prototype.remove = function() {
|
|
3587
3544
|
return Array.isArray(this.parent) ? (this.parent.splice(this.key, 1), !0) : (this.replace(null), !1);
|
|
3588
3545
|
};
|
|
3589
|
-
function Element(node,
|
|
3590
|
-
this.node = node, this.path =
|
|
3546
|
+
function Element(node, path3, wrap, ref2) {
|
|
3547
|
+
this.node = node, this.path = path3, this.wrap = wrap, this.ref = ref2;
|
|
3591
3548
|
}
|
|
3592
3549
|
function Controller() {
|
|
3593
3550
|
}
|
|
3594
3551
|
Controller.prototype.path = function() {
|
|
3595
3552
|
var i2, iz, j, jz, result, element;
|
|
3596
|
-
function addToPath(result2,
|
|
3597
|
-
if (Array.isArray(
|
|
3598
|
-
for (j = 0, jz =
|
|
3599
|
-
result2.push(
|
|
3553
|
+
function addToPath(result2, path4) {
|
|
3554
|
+
if (Array.isArray(path4))
|
|
3555
|
+
for (j = 0, jz = path4.length; j < jz; ++j)
|
|
3556
|
+
result2.push(path4[j]);
|
|
3600
3557
|
else
|
|
3601
|
-
result2.push(
|
|
3558
|
+
result2.push(path4);
|
|
3602
3559
|
}
|
|
3603
3560
|
if (!this.__current.path)
|
|
3604
3561
|
return null;
|
|
@@ -4176,18 +4133,18 @@ var require_util = __commonJS({
|
|
|
4176
4133
|
}
|
|
4177
4134
|
exports.urlGenerate = urlGenerate;
|
|
4178
4135
|
function normalize2(aPath) {
|
|
4179
|
-
var
|
|
4136
|
+
var path3 = aPath, url = urlParse(aPath);
|
|
4180
4137
|
if (url) {
|
|
4181
4138
|
if (!url.path)
|
|
4182
4139
|
return aPath;
|
|
4183
|
-
|
|
4140
|
+
path3 = url.path;
|
|
4184
4141
|
}
|
|
4185
|
-
for (var
|
|
4142
|
+
for (var isAbsolute3 = exports.isAbsolute(path3), parts = path3.split(/\/+/), part, up3 = 0, i2 = parts.length - 1; i2 >= 0; i2--)
|
|
4186
4143
|
part = parts[i2], part === "." ? parts.splice(i2, 1) : part === ".." ? up3++ : up3 > 0 && (part === "" ? (parts.splice(i2 + 1, up3), up3 = 0) : (parts.splice(i2, 2), up3--));
|
|
4187
|
-
return
|
|
4144
|
+
return path3 = parts.join("/"), path3 === "" && (path3 = isAbsolute3 ? "/" : "."), url ? (url.path = path3, urlGenerate(url)) : path3;
|
|
4188
4145
|
}
|
|
4189
4146
|
exports.normalize = normalize2;
|
|
4190
|
-
function
|
|
4147
|
+
function join4(aRoot, aPath) {
|
|
4191
4148
|
aRoot === "" && (aRoot = "."), aPath === "" && (aPath = ".");
|
|
4192
4149
|
var aPathUrl = urlParse(aPath), aRootUrl = urlParse(aRoot);
|
|
4193
4150
|
if (aRootUrl && (aRoot = aRootUrl.path || "/"), aPathUrl && !aPathUrl.scheme)
|
|
@@ -4199,11 +4156,11 @@ var require_util = __commonJS({
|
|
|
4199
4156
|
var joined = aPath.charAt(0) === "/" ? aPath : normalize2(aRoot.replace(/\/+$/, "") + "/" + aPath);
|
|
4200
4157
|
return aRootUrl ? (aRootUrl.path = joined, urlGenerate(aRootUrl)) : joined;
|
|
4201
4158
|
}
|
|
4202
|
-
exports.join =
|
|
4159
|
+
exports.join = join4;
|
|
4203
4160
|
exports.isAbsolute = function(aPath) {
|
|
4204
4161
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
4205
4162
|
};
|
|
4206
|
-
function
|
|
4163
|
+
function relative2(aRoot, aPath) {
|
|
4207
4164
|
aRoot === "" && (aRoot = "."), aRoot = aRoot.replace(/\/$/, "");
|
|
4208
4165
|
for (var level = 0; aPath.indexOf(aRoot + "/") !== 0; ) {
|
|
4209
4166
|
var index = aRoot.lastIndexOf("/");
|
|
@@ -4213,7 +4170,7 @@ var require_util = __commonJS({
|
|
|
4213
4170
|
}
|
|
4214
4171
|
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
4215
4172
|
}
|
|
4216
|
-
exports.relative =
|
|
4173
|
+
exports.relative = relative2;
|
|
4217
4174
|
var supportsNullProto = (function() {
|
|
4218
4175
|
var obj = /* @__PURE__ */ Object.create(null);
|
|
4219
4176
|
return !("__proto__" in obj);
|
|
@@ -4271,7 +4228,7 @@ var require_util = __commonJS({
|
|
|
4271
4228
|
var index = parsed.path.lastIndexOf("/");
|
|
4272
4229
|
index >= 0 && (parsed.path = parsed.path.substring(0, index + 1));
|
|
4273
4230
|
}
|
|
4274
|
-
sourceURL =
|
|
4231
|
+
sourceURL = join4(urlGenerate(parsed), sourceURL);
|
|
4275
4232
|
}
|
|
4276
4233
|
return normalize2(sourceURL);
|
|
4277
4234
|
}
|
|
@@ -5415,7 +5372,7 @@ var require_escodegen = __commonJS({
|
|
|
5415
5372
|
function noEmptySpace() {
|
|
5416
5373
|
return space || " ";
|
|
5417
5374
|
}
|
|
5418
|
-
function
|
|
5375
|
+
function join4(left, right) {
|
|
5419
5376
|
var leftSource, rightSource, leftCharCode, rightCharCode;
|
|
5420
5377
|
return leftSource = toSourceNodeWhenNeeded(left).toString(), leftSource.length === 0 ? [right] : (rightSource = toSourceNodeWhenNeeded(right).toString(), rightSource.length === 0 ? [left] : (leftCharCode = leftSource.charCodeAt(leftSource.length - 1), rightCharCode = rightSource.charCodeAt(0), (leftCharCode === 43 || leftCharCode === 45) && leftCharCode === rightCharCode || esutils.code.isIdentifierPartES5(leftCharCode) && esutils.code.isIdentifierPartES5(rightCharCode) || leftCharCode === 47 && rightCharCode === 105 ? [left, noEmptySpace(), right] : esutils.code.isWhiteSpace(leftCharCode) || esutils.code.isLineTerminator(leftCharCode) || esutils.code.isWhiteSpace(rightCharCode) || esutils.code.isLineTerminator(rightCharCode) ? [left, right] : [left, space, right]));
|
|
5421
5378
|
}
|
|
@@ -5551,7 +5508,7 @@ var require_escodegen = __commonJS({
|
|
|
5551
5508
|
return withIndent(function() {
|
|
5552
5509
|
stmt.left.type === Syntax.VariableDeclaration ? withIndent(function() {
|
|
5553
5510
|
result.push(stmt.left.kind + noEmptySpace()), result.push(that.generateStatement(stmt.left.declarations[0], S_FFFF));
|
|
5554
|
-
}) : result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT)), result =
|
|
5511
|
+
}) : result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT)), result = join4(result, operator), result = [join4(
|
|
5555
5512
|
result,
|
|
5556
5513
|
that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)
|
|
5557
5514
|
), ")"];
|
|
@@ -5599,14 +5556,14 @@ var require_escodegen = __commonJS({
|
|
|
5599
5556
|
},
|
|
5600
5557
|
ClassDeclaration: function(stmt, flags) {
|
|
5601
5558
|
var result, fragment;
|
|
5602
|
-
return result = ["class"], stmt.id && (result =
|
|
5559
|
+
return result = ["class"], stmt.id && (result = join4(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT))), stmt.superClass && (fragment = join4("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT)), result = join4(result, fragment)), result.push(space), result.push(this.generateStatement(stmt.body, S_TFFT)), result;
|
|
5603
5560
|
},
|
|
5604
5561
|
DirectiveStatement: function(stmt, flags) {
|
|
5605
5562
|
return extra.raw && stmt.raw ? stmt.raw + this.semicolon(flags) : escapeDirective(stmt.directive) + this.semicolon(flags);
|
|
5606
5563
|
},
|
|
5607
5564
|
DoWhileStatement: function(stmt, flags) {
|
|
5608
|
-
var result =
|
|
5609
|
-
return result = this.maybeBlockSuffix(stmt.body, result),
|
|
5565
|
+
var result = join4("do", this.maybeBlock(stmt.body, S_TFFF));
|
|
5566
|
+
return result = this.maybeBlockSuffix(stmt.body, result), join4(result, [
|
|
5610
5567
|
"while" + space + "(",
|
|
5611
5568
|
this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
5612
5569
|
")" + this.semicolon(flags)
|
|
@@ -5631,15 +5588,15 @@ var require_escodegen = __commonJS({
|
|
|
5631
5588
|
},
|
|
5632
5589
|
ExportDefaultDeclaration: function(stmt, flags) {
|
|
5633
5590
|
var result = ["export"], bodyFlags;
|
|
5634
|
-
return bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF, result =
|
|
5591
|
+
return bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF, result = join4(result, "default"), isStatement(stmt.declaration) ? result = join4(result, this.generateStatement(stmt.declaration, bodyFlags)) : result = join4(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags)), result;
|
|
5635
5592
|
},
|
|
5636
5593
|
ExportNamedDeclaration: function(stmt, flags) {
|
|
5637
5594
|
var result = ["export"], bodyFlags, that = this;
|
|
5638
|
-
return bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF, stmt.declaration ?
|
|
5595
|
+
return bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF, stmt.declaration ? join4(result, this.generateStatement(stmt.declaration, bodyFlags)) : (stmt.specifiers && (stmt.specifiers.length === 0 ? result = join4(result, "{" + space + "}") : stmt.specifiers[0].type === Syntax.ExportBatchSpecifier ? result = join4(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT)) : (result = join4(result, "{"), withIndent(function(indent2) {
|
|
5639
5596
|
var i2, iz;
|
|
5640
5597
|
for (result.push(newline), i2 = 0, iz = stmt.specifiers.length; i2 < iz; ++i2)
|
|
5641
5598
|
result.push(indent2), result.push(that.generateExpression(stmt.specifiers[i2], Precedence.Sequence, E_TTT)), i2 + 1 < iz && result.push("," + newline);
|
|
5642
|
-
}), endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()) || result.push(newline), result.push(base2 + "}")), stmt.source ? result =
|
|
5599
|
+
}), endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()) || result.push(newline), result.push(base2 + "}")), stmt.source ? result = join4(result, [
|
|
5643
5600
|
"from" + space,
|
|
5644
5601
|
// ModuleSpecifier
|
|
5645
5602
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
@@ -5687,16 +5644,16 @@ var require_escodegen = __commonJS({
|
|
|
5687
5644
|
this.semicolon(flags)
|
|
5688
5645
|
] : (result = [
|
|
5689
5646
|
"import"
|
|
5690
|
-
], cursor = 0, stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier && (result =
|
|
5647
|
+
], cursor = 0, stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier && (result = join4(result, [
|
|
5691
5648
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
5692
|
-
]), ++cursor), stmt.specifiers[cursor] && (cursor !== 0 && result.push(","), stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier ? result =
|
|
5649
|
+
]), ++cursor), stmt.specifiers[cursor] && (cursor !== 0 && result.push(","), stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier ? result = join4(result, [
|
|
5693
5650
|
space,
|
|
5694
5651
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
5695
5652
|
]) : (result.push(space + "{"), stmt.specifiers.length - cursor === 1 ? (result.push(space), result.push(this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)), result.push(space + "}" + space)) : (withIndent(function(indent2) {
|
|
5696
5653
|
var i2, iz;
|
|
5697
5654
|
for (result.push(newline), i2 = cursor, iz = stmt.specifiers.length; i2 < iz; ++i2)
|
|
5698
5655
|
result.push(indent2), result.push(that.generateExpression(stmt.specifiers[i2], Precedence.Sequence, E_TTT)), i2 + 1 < iz && result.push("," + newline);
|
|
5699
|
-
}), endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()) || result.push(newline), result.push(base2 + "}" + space)))), result =
|
|
5656
|
+
}), endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()) || result.push(newline), result.push(base2 + "}" + space)))), result = join4(result, [
|
|
5700
5657
|
"from" + space,
|
|
5701
5658
|
// ModuleSpecifier
|
|
5702
5659
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
@@ -5724,7 +5681,7 @@ var require_escodegen = __commonJS({
|
|
|
5724
5681
|
return stmt.declarations.length > 1 ? withIndent(block) : block(), result.push(this.semicolon(flags)), result;
|
|
5725
5682
|
},
|
|
5726
5683
|
ThrowStatement: function(stmt, flags) {
|
|
5727
|
-
return [
|
|
5684
|
+
return [join4(
|
|
5728
5685
|
"throw",
|
|
5729
5686
|
this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)
|
|
5730
5687
|
), this.semicolon(flags)];
|
|
@@ -5733,18 +5690,18 @@ var require_escodegen = __commonJS({
|
|
|
5733
5690
|
var result, i2, iz, guardedHandlers;
|
|
5734
5691
|
if (result = ["try", this.maybeBlock(stmt.block, S_TFFF)], result = this.maybeBlockSuffix(stmt.block, result), stmt.handlers)
|
|
5735
5692
|
for (i2 = 0, iz = stmt.handlers.length; i2 < iz; ++i2)
|
|
5736
|
-
result =
|
|
5693
|
+
result = join4(result, this.generateStatement(stmt.handlers[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(stmt.handlers[i2].body, result));
|
|
5737
5694
|
else {
|
|
5738
5695
|
for (guardedHandlers = stmt.guardedHandlers || [], i2 = 0, iz = guardedHandlers.length; i2 < iz; ++i2)
|
|
5739
|
-
result =
|
|
5696
|
+
result = join4(result, this.generateStatement(guardedHandlers[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(guardedHandlers[i2].body, result));
|
|
5740
5697
|
if (stmt.handler)
|
|
5741
5698
|
if (Array.isArray(stmt.handler))
|
|
5742
5699
|
for (i2 = 0, iz = stmt.handler.length; i2 < iz; ++i2)
|
|
5743
|
-
result =
|
|
5700
|
+
result = join4(result, this.generateStatement(stmt.handler[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(stmt.handler[i2].body, result));
|
|
5744
5701
|
else
|
|
5745
|
-
result =
|
|
5702
|
+
result = join4(result, this.generateStatement(stmt.handler, S_TFFF)), stmt.finalizer && (result = this.maybeBlockSuffix(stmt.handler.body, result));
|
|
5746
5703
|
}
|
|
5747
|
-
return stmt.finalizer && (result =
|
|
5704
|
+
return stmt.finalizer && (result = join4(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)])), result;
|
|
5748
5705
|
},
|
|
5749
5706
|
SwitchStatement: function(stmt, flags) {
|
|
5750
5707
|
var result, fragment, i2, iz, bodyFlags, that = this;
|
|
@@ -5763,7 +5720,7 @@ var require_escodegen = __commonJS({
|
|
|
5763
5720
|
var result, fragment, i2, iz, bodyFlags, that = this;
|
|
5764
5721
|
return withIndent(function() {
|
|
5765
5722
|
for (stmt.test ? result = [
|
|
5766
|
-
|
|
5723
|
+
join4("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
|
|
5767
5724
|
":"
|
|
5768
5725
|
] : result = ["default:"], i2 = 0, iz = stmt.consequent.length, iz && stmt.consequent[0].type === Syntax.BlockStatement && (fragment = that.maybeBlock(stmt.consequent[0], S_TFFF), result.push(fragment), i2 = 1), i2 !== iz && !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()) && result.push(newline), bodyFlags = S_TFFF; i2 < iz; ++i2)
|
|
5769
5726
|
i2 === iz - 1 && flags & F_SEMICOLON_OPT && (bodyFlags |= F_SEMICOLON_OPT), fragment = addIndent(that.generateStatement(stmt.consequent[i2], bodyFlags)), result.push(fragment), i2 + 1 !== iz && !endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString()) && result.push(newline);
|
|
@@ -5777,7 +5734,7 @@ var require_escodegen = __commonJS({
|
|
|
5777
5734
|
that.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
5778
5735
|
")"
|
|
5779
5736
|
];
|
|
5780
|
-
}), semicolonOptional = flags & F_SEMICOLON_OPT, bodyFlags = S_TFFF, semicolonOptional && (bodyFlags |= F_SEMICOLON_OPT), stmt.alternate ? (result.push(this.maybeBlock(stmt.consequent, S_TFFF)), result = this.maybeBlockSuffix(stmt.consequent, result), stmt.alternate.type === Syntax.IfStatement ? result =
|
|
5737
|
+
}), semicolonOptional = flags & F_SEMICOLON_OPT, bodyFlags = S_TFFF, semicolonOptional && (bodyFlags |= F_SEMICOLON_OPT), stmt.alternate ? (result.push(this.maybeBlock(stmt.consequent, S_TFFF)), result = this.maybeBlockSuffix(stmt.consequent, result), stmt.alternate.type === Syntax.IfStatement ? result = join4(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]) : result = join4(result, join4("else", this.maybeBlock(stmt.alternate, bodyFlags)))) : result.push(this.maybeBlock(stmt.consequent, bodyFlags)), result;
|
|
5781
5738
|
},
|
|
5782
5739
|
ForStatement: function(stmt, flags) {
|
|
5783
5740
|
var result, that = this;
|
|
@@ -5811,7 +5768,7 @@ var require_escodegen = __commonJS({
|
|
|
5811
5768
|
];
|
|
5812
5769
|
},
|
|
5813
5770
|
ReturnStatement: function(stmt, flags) {
|
|
5814
|
-
return stmt.argument ? [
|
|
5771
|
+
return stmt.argument ? [join4(
|
|
5815
5772
|
"return",
|
|
5816
5773
|
this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)
|
|
5817
5774
|
), this.semicolon(flags)] : ["return" + this.semicolon(flags)];
|
|
@@ -5867,7 +5824,7 @@ var require_escodegen = __commonJS({
|
|
|
5867
5824
|
},
|
|
5868
5825
|
BinaryExpression: function(expr, precedence, flags) {
|
|
5869
5826
|
var result, leftPrecedence, rightPrecedence, currentPrecedence, fragment, leftSource;
|
|
5870
|
-
return currentPrecedence = BinaryPrecedence[expr.operator], leftPrecedence = expr.operator === "**" ? Precedence.Postfix : currentPrecedence, rightPrecedence = expr.operator === "**" ? currentPrecedence : currentPrecedence + 1, currentPrecedence < precedence && (flags |= F_ALLOW_IN), fragment = this.generateExpression(expr.left, leftPrecedence, flags), leftSource = fragment.toString(), leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0)) ? result = [fragment, noEmptySpace(), expr.operator] : result =
|
|
5827
|
+
return currentPrecedence = BinaryPrecedence[expr.operator], leftPrecedence = expr.operator === "**" ? Precedence.Postfix : currentPrecedence, rightPrecedence = expr.operator === "**" ? currentPrecedence : currentPrecedence + 1, currentPrecedence < precedence && (flags |= F_ALLOW_IN), fragment = this.generateExpression(expr.left, leftPrecedence, flags), leftSource = fragment.toString(), leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0)) ? result = [fragment, noEmptySpace(), expr.operator] : result = join4(fragment, expr.operator), fragment = this.generateExpression(expr.right, rightPrecedence, flags), expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--" ? (result.push(noEmptySpace()), result.push(fragment)) : result = join4(result, fragment), expr.operator === "in" && !(flags & F_ALLOW_IN) ? ["(", result, ")"] : (expr.operator === "||" || expr.operator === "&&") && flags & F_FOUND_COALESCE ? ["(", result, ")"] : parenthesize(result, currentPrecedence, precedence);
|
|
5871
5828
|
},
|
|
5872
5829
|
CallExpression: function(expr, precedence, flags) {
|
|
5873
5830
|
var result, i2, iz;
|
|
@@ -5882,7 +5839,7 @@ var require_escodegen = __commonJS({
|
|
|
5882
5839
|
},
|
|
5883
5840
|
NewExpression: function(expr, precedence, flags) {
|
|
5884
5841
|
var result, length, i2, iz, itemFlags;
|
|
5885
|
-
if (length = expr.arguments.length, itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF, result =
|
|
5842
|
+
if (length = expr.arguments.length, itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF, result = join4(
|
|
5886
5843
|
"new",
|
|
5887
5844
|
this.generateExpression(expr.callee, Precedence.New, itemFlags)
|
|
5888
5845
|
), !(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
|
|
@@ -5902,17 +5859,17 @@ var require_escodegen = __commonJS({
|
|
|
5902
5859
|
},
|
|
5903
5860
|
UnaryExpression: function(expr, precedence, flags) {
|
|
5904
5861
|
var result, fragment, rightCharCode, leftSource, leftCharCode;
|
|
5905
|
-
return fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT), space === "" ? result =
|
|
5862
|
+
return fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT), space === "" ? result = join4(expr.operator, fragment) : (result = [expr.operator], expr.operator.length > 2 ? result = join4(result, fragment) : (leftSource = toSourceNodeWhenNeeded(result).toString(), leftCharCode = leftSource.charCodeAt(leftSource.length - 1), rightCharCode = fragment.toString().charCodeAt(0), ((leftCharCode === 43 || leftCharCode === 45) && leftCharCode === rightCharCode || esutils.code.isIdentifierPartES5(leftCharCode) && esutils.code.isIdentifierPartES5(rightCharCode)) && result.push(noEmptySpace()), result.push(fragment))), parenthesize(result, Precedence.Unary, precedence);
|
|
5906
5863
|
},
|
|
5907
5864
|
YieldExpression: function(expr, precedence, flags) {
|
|
5908
5865
|
var result;
|
|
5909
|
-
return expr.delegate ? result = "yield*" : result = "yield", expr.argument && (result =
|
|
5866
|
+
return expr.delegate ? result = "yield*" : result = "yield", expr.argument && (result = join4(
|
|
5910
5867
|
result,
|
|
5911
5868
|
this.generateExpression(expr.argument, Precedence.Yield, E_TTT)
|
|
5912
5869
|
)), parenthesize(result, Precedence.Yield, precedence);
|
|
5913
5870
|
},
|
|
5914
5871
|
AwaitExpression: function(expr, precedence, flags) {
|
|
5915
|
-
var result =
|
|
5872
|
+
var result = join4(
|
|
5916
5873
|
expr.all ? "await*" : "await",
|
|
5917
5874
|
this.generateExpression(expr.argument, Precedence.Await, E_TTT)
|
|
5918
5875
|
);
|
|
@@ -5958,18 +5915,18 @@ var require_escodegen = __commonJS({
|
|
|
5958
5915
|
},
|
|
5959
5916
|
ClassExpression: function(expr, precedence, flags) {
|
|
5960
5917
|
var result, fragment;
|
|
5961
|
-
return result = ["class"], expr.id && (result =
|
|
5918
|
+
return result = ["class"], expr.id && (result = join4(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT))), expr.superClass && (fragment = join4("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT)), result = join4(result, fragment)), result.push(space), result.push(this.generateStatement(expr.body, S_TFFT)), result;
|
|
5962
5919
|
},
|
|
5963
5920
|
MethodDefinition: function(expr, precedence, flags) {
|
|
5964
5921
|
var result, fragment;
|
|
5965
5922
|
return expr.static ? result = ["static" + space] : result = [], expr.kind === "get" || expr.kind === "set" ? fragment = [
|
|
5966
|
-
|
|
5923
|
+
join4(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
|
|
5967
5924
|
this.generateFunctionBody(expr.value)
|
|
5968
5925
|
] : fragment = [
|
|
5969
5926
|
generateMethodPrefix(expr),
|
|
5970
5927
|
this.generatePropertyKey(expr.key, expr.computed),
|
|
5971
5928
|
this.generateFunctionBody(expr.value)
|
|
5972
|
-
],
|
|
5929
|
+
], join4(result, fragment);
|
|
5973
5930
|
},
|
|
5974
5931
|
Property: function(expr, precedence, flags) {
|
|
5975
5932
|
return expr.kind === "get" || expr.kind === "set" ? [
|
|
@@ -6060,8 +6017,8 @@ var require_escodegen = __commonJS({
|
|
|
6060
6017
|
var result, i2, iz, fragment, that = this;
|
|
6061
6018
|
return result = expr.type === Syntax.GeneratorExpression ? ["("] : ["["], extra.moz.comprehensionExpressionStartsWithAssignment && (fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT), result.push(fragment)), expr.blocks && withIndent(function() {
|
|
6062
6019
|
for (i2 = 0, iz = expr.blocks.length; i2 < iz; ++i2)
|
|
6063
|
-
fragment = that.generateExpression(expr.blocks[i2], Precedence.Sequence, E_TTT), i2 > 0 || extra.moz.comprehensionExpressionStartsWithAssignment ? result =
|
|
6064
|
-
}), expr.filter && (result =
|
|
6020
|
+
fragment = that.generateExpression(expr.blocks[i2], Precedence.Sequence, E_TTT), i2 > 0 || extra.moz.comprehensionExpressionStartsWithAssignment ? result = join4(result, fragment) : result.push(fragment);
|
|
6021
|
+
}), expr.filter && (result = join4(result, "if" + space), fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT), result = join4(result, ["(", fragment, ")"])), extra.moz.comprehensionExpressionStartsWithAssignment || (fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT), result = join4(result, fragment)), result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]"), result;
|
|
6065
6022
|
},
|
|
6066
6023
|
ComprehensionBlock: function(expr, precedence, flags) {
|
|
6067
6024
|
var fragment;
|
|
@@ -6069,7 +6026,7 @@ var require_escodegen = __commonJS({
|
|
|
6069
6026
|
expr.left.kind,
|
|
6070
6027
|
noEmptySpace(),
|
|
6071
6028
|
this.generateStatement(expr.left.declarations[0], S_FFFF)
|
|
6072
|
-
] : fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT), fragment =
|
|
6029
|
+
] : fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT), fragment = join4(fragment, expr.of ? "of" : "in"), fragment = join4(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT)), ["for" + space + "(", fragment, ")"];
|
|
6073
6030
|
},
|
|
6074
6031
|
SpreadElement: function(expr, precedence, flags) {
|
|
6075
6032
|
return [
|
|
@@ -6148,6 +6105,49 @@ var require_escodegen = __commonJS({
|
|
|
6148
6105
|
}
|
|
6149
6106
|
});
|
|
6150
6107
|
|
|
6108
|
+
// ../../../node_modules/ts-dedent/dist/index.js
|
|
6109
|
+
var require_dist = __commonJS({
|
|
6110
|
+
"../../../node_modules/ts-dedent/dist/index.js"(exports) {
|
|
6111
|
+
"use strict";
|
|
6112
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
6113
|
+
exports.dedent = void 0;
|
|
6114
|
+
function dedent3(templ) {
|
|
6115
|
+
for (var values = [], _i = 1; _i < arguments.length; _i++)
|
|
6116
|
+
values[_i - 1] = arguments[_i];
|
|
6117
|
+
var strings = Array.from(typeof templ == "string" ? [templ] : templ);
|
|
6118
|
+
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
6119
|
+
var indentLengths = strings.reduce(function(arr, str) {
|
|
6120
|
+
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
6121
|
+
return matches ? arr.concat(matches.map(function(match) {
|
|
6122
|
+
var _a, _b;
|
|
6123
|
+
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
6124
|
+
})) : arr;
|
|
6125
|
+
}, []);
|
|
6126
|
+
if (indentLengths.length) {
|
|
6127
|
+
var pattern_1 = new RegExp(`
|
|
6128
|
+
[ ]{` + Math.min.apply(Math, indentLengths) + "}", "g");
|
|
6129
|
+
strings = strings.map(function(str) {
|
|
6130
|
+
return str.replace(pattern_1, `
|
|
6131
|
+
`);
|
|
6132
|
+
});
|
|
6133
|
+
}
|
|
6134
|
+
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
6135
|
+
var string = strings[0];
|
|
6136
|
+
return values.forEach(function(value, i2) {
|
|
6137
|
+
var endentations = string.match(/(?:^|\n)( *)$/), endentation = endentations ? endentations[1] : "", indentedValue = value;
|
|
6138
|
+
typeof value == "string" && value.includes(`
|
|
6139
|
+
`) && (indentedValue = String(value).split(`
|
|
6140
|
+
`).map(function(str, i3) {
|
|
6141
|
+
return i3 === 0 ? str : "" + endentation + str;
|
|
6142
|
+
}).join(`
|
|
6143
|
+
`)), string += indentedValue + strings[i2 + 1];
|
|
6144
|
+
}), string;
|
|
6145
|
+
}
|
|
6146
|
+
exports.dedent = dedent3;
|
|
6147
|
+
exports.default = dedent3;
|
|
6148
|
+
}
|
|
6149
|
+
});
|
|
6150
|
+
|
|
6151
6151
|
// ../../../node_modules/acorn/dist/acorn.mjs
|
|
6152
6152
|
var acorn_exports = {};
|
|
6153
6153
|
__export(acorn_exports, {
|
|
@@ -10534,11 +10534,11 @@ var require_filesystem = __commonJS({
|
|
|
10534
10534
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
10535
10535
|
exports.removeExtension = exports.fileExistsAsync = exports.readJsonFromDiskAsync = exports.readJsonFromDiskSync = exports.fileExistsSync = void 0;
|
|
10536
10536
|
var fs = __require("fs");
|
|
10537
|
-
function fileExistsSync(
|
|
10538
|
-
if (!fs.existsSync(
|
|
10537
|
+
function fileExistsSync(path3) {
|
|
10538
|
+
if (!fs.existsSync(path3))
|
|
10539
10539
|
return !1;
|
|
10540
10540
|
try {
|
|
10541
|
-
var stats = fs.statSync(
|
|
10541
|
+
var stats = fs.statSync(path3);
|
|
10542
10542
|
return stats.isFile();
|
|
10543
10543
|
} catch {
|
|
10544
10544
|
return !1;
|
|
@@ -10550,8 +10550,8 @@ var require_filesystem = __commonJS({
|
|
|
10550
10550
|
return __require(packageJsonPath);
|
|
10551
10551
|
}
|
|
10552
10552
|
exports.readJsonFromDiskSync = readJsonFromDiskSync;
|
|
10553
|
-
function readJsonFromDiskAsync(
|
|
10554
|
-
fs.readFile(
|
|
10553
|
+
function readJsonFromDiskAsync(path3, callback) {
|
|
10554
|
+
fs.readFile(path3, "utf8", function(err, result) {
|
|
10555
10555
|
if (err || !result)
|
|
10556
10556
|
return callback();
|
|
10557
10557
|
var json = JSON.parse(result);
|
|
@@ -10567,8 +10567,8 @@ var require_filesystem = __commonJS({
|
|
|
10567
10567
|
});
|
|
10568
10568
|
}
|
|
10569
10569
|
exports.fileExistsAsync = fileExistsAsync;
|
|
10570
|
-
function removeExtension(
|
|
10571
|
-
return
|
|
10570
|
+
function removeExtension(path3) {
|
|
10571
|
+
return path3.substring(0, path3.lastIndexOf(".")) || path3;
|
|
10572
10572
|
}
|
|
10573
10573
|
exports.removeExtension = removeExtension;
|
|
10574
10574
|
}
|
|
@@ -10580,14 +10580,14 @@ var require_mapping_entry = __commonJS({
|
|
|
10580
10580
|
"use strict";
|
|
10581
10581
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
10582
10582
|
exports.getAbsoluteMappingEntries = void 0;
|
|
10583
|
-
var
|
|
10583
|
+
var path3 = __require("path");
|
|
10584
10584
|
function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) {
|
|
10585
10585
|
for (var sortedKeys = sortByLongestPrefix(Object.keys(paths)), absolutePaths = [], _i = 0, sortedKeys_1 = sortedKeys; _i < sortedKeys_1.length; _i++) {
|
|
10586
10586
|
var key = sortedKeys_1[_i];
|
|
10587
10587
|
absolutePaths.push({
|
|
10588
10588
|
pattern: key,
|
|
10589
10589
|
paths: paths[key].map(function(pathToResolve) {
|
|
10590
|
-
return
|
|
10590
|
+
return path3.resolve(absoluteBaseUrl, pathToResolve);
|
|
10591
10591
|
})
|
|
10592
10592
|
});
|
|
10593
10593
|
}
|
|
@@ -10615,7 +10615,7 @@ var require_try_path = __commonJS({
|
|
|
10615
10615
|
"use strict";
|
|
10616
10616
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
10617
10617
|
exports.exhaustiveTypeException = exports.getStrippedPath = exports.getPathsToTry = void 0;
|
|
10618
|
-
var
|
|
10618
|
+
var path3 = __require("path"), path_1 = __require("path"), filesystem_1 = require_filesystem();
|
|
10619
10619
|
function getPathsToTry(extensions, absolutePathMappings, requestedModule) {
|
|
10620
10620
|
if (!(!absolutePathMappings || !requestedModule || requestedModule[0] === ".")) {
|
|
10621
10621
|
for (var pathsToTry = [], _i = 0, absolutePathMappings_1 = absolutePathMappings; _i < absolutePathMappings_1.length; _i++) {
|
|
@@ -10627,9 +10627,9 @@ var require_try_path = __commonJS({
|
|
|
10627
10627
|
return { type: "extension", path: physicalPath + e };
|
|
10628
10628
|
})), pathsToTry.push({
|
|
10629
10629
|
type: "package",
|
|
10630
|
-
path:
|
|
10630
|
+
path: path3.join(physicalPath, "/package.json")
|
|
10631
10631
|
});
|
|
10632
|
-
var indexPath =
|
|
10632
|
+
var indexPath = path3.join(physicalPath, "/index");
|
|
10633
10633
|
pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
|
|
10634
10634
|
return { type: "index", path: indexPath + e };
|
|
10635
10635
|
}));
|
|
@@ -10671,7 +10671,7 @@ var require_match_path_sync = __commonJS({
|
|
|
10671
10671
|
"use strict";
|
|
10672
10672
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
10673
10673
|
exports.matchFromAbsolutePaths = exports.createMatchPath = void 0;
|
|
10674
|
-
var
|
|
10674
|
+
var path3 = __require("path"), Filesystem = require_filesystem(), MappingEntry = require_mapping_entry(), TryPath = require_try_path();
|
|
10675
10675
|
function createMatchPath2(absoluteBaseUrl, paths, mainFields, addMatchAll) {
|
|
10676
10676
|
mainFields === void 0 && (mainFields = ["main"]), addMatchAll === void 0 && (addMatchAll = !0);
|
|
10677
10677
|
var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
|
|
@@ -10693,7 +10693,7 @@ var require_match_path_sync = __commonJS({
|
|
|
10693
10693
|
return obj[key];
|
|
10694
10694
|
}, packageJson);
|
|
10695
10695
|
if (candidateMapping && typeof candidateMapping == "string") {
|
|
10696
|
-
var candidateFilePath =
|
|
10696
|
+
var candidateFilePath = path3.join(path3.dirname(packageJsonPath), candidateMapping);
|
|
10697
10697
|
if (fileExists(candidateFilePath))
|
|
10698
10698
|
return candidateFilePath;
|
|
10699
10699
|
}
|
|
@@ -10726,7 +10726,7 @@ var require_match_path_async = __commonJS({
|
|
|
10726
10726
|
"use strict";
|
|
10727
10727
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
10728
10728
|
exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = void 0;
|
|
10729
|
-
var
|
|
10729
|
+
var path3 = __require("path"), TryPath = require_try_path(), MappingEntry = require_mapping_entry(), Filesystem = require_filesystem();
|
|
10730
10730
|
function createMatchPathAsync(absoluteBaseUrl, paths, mainFields, addMatchAll) {
|
|
10731
10731
|
mainFields === void 0 && (mainFields = ["main"]), addMatchAll === void 0 && (addMatchAll = !0);
|
|
10732
10732
|
var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
|
|
@@ -10753,7 +10753,7 @@ var require_match_path_async = __commonJS({
|
|
|
10753
10753
|
}, packageJson);
|
|
10754
10754
|
if (typeof mainFieldMapping != "string")
|
|
10755
10755
|
return tryNext();
|
|
10756
|
-
var mappedFilePath =
|
|
10756
|
+
var mappedFilePath = path3.join(path3.dirname(packageJsonPath), mainFieldMapping);
|
|
10757
10757
|
fileExistsAsync(mappedFilePath, function(err, exists) {
|
|
10758
10758
|
return err ? doneCallback(err) : exists ? doneCallback(void 0, mappedFilePath) : tryNext();
|
|
10759
10759
|
});
|
|
@@ -11665,7 +11665,7 @@ var require_tsconfig_loader = __commonJS({
|
|
|
11665
11665
|
};
|
|
11666
11666
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
11667
11667
|
exports.loadTsconfig = exports.walkForTsConfig = exports.tsConfigLoader = void 0;
|
|
11668
|
-
var
|
|
11668
|
+
var path3 = __require("path"), fs = __require("fs"), JSON5 = require_lib(), StripBom = require_strip_bom();
|
|
11669
11669
|
function tsConfigLoader(_a) {
|
|
11670
11670
|
var getEnv = _a.getEnv, cwd2 = _a.cwd, _b = _a.loadSync, loadSync = _b === void 0 ? loadSyncDefault : _b, TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT"), TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL"), loadResult = loadSync(cwd2, TS_NODE_PROJECT, TS_NODE_BASEURL);
|
|
11671
11671
|
return loadResult;
|
|
@@ -11688,30 +11688,30 @@ var require_tsconfig_loader = __commonJS({
|
|
|
11688
11688
|
}
|
|
11689
11689
|
function resolveConfigPath(cwd2, filename) {
|
|
11690
11690
|
if (filename) {
|
|
11691
|
-
var absolutePath = fs.lstatSync(filename).isDirectory() ?
|
|
11691
|
+
var absolutePath = fs.lstatSync(filename).isDirectory() ? path3.resolve(filename, "./tsconfig.json") : path3.resolve(cwd2, filename);
|
|
11692
11692
|
return absolutePath;
|
|
11693
11693
|
}
|
|
11694
11694
|
if (fs.statSync(cwd2).isFile())
|
|
11695
|
-
return
|
|
11695
|
+
return path3.resolve(cwd2);
|
|
11696
11696
|
var configAbsolutePath = walkForTsConfig(cwd2);
|
|
11697
|
-
return configAbsolutePath ?
|
|
11697
|
+
return configAbsolutePath ? path3.resolve(configAbsolutePath) : void 0;
|
|
11698
11698
|
}
|
|
11699
11699
|
function walkForTsConfig(directory, readdirSync) {
|
|
11700
11700
|
readdirSync === void 0 && (readdirSync = fs.readdirSync);
|
|
11701
11701
|
for (var files = readdirSync(directory), filesToCheck = ["tsconfig.json", "jsconfig.json"], _i = 0, filesToCheck_1 = filesToCheck; _i < filesToCheck_1.length; _i++) {
|
|
11702
11702
|
var fileToCheck = filesToCheck_1[_i];
|
|
11703
11703
|
if (files.indexOf(fileToCheck) !== -1)
|
|
11704
|
-
return
|
|
11704
|
+
return path3.join(directory, fileToCheck);
|
|
11705
11705
|
}
|
|
11706
|
-
var parentDirectory =
|
|
11706
|
+
var parentDirectory = path3.dirname(directory);
|
|
11707
11707
|
if (directory !== parentDirectory)
|
|
11708
11708
|
return walkForTsConfig(parentDirectory, readdirSync);
|
|
11709
11709
|
}
|
|
11710
11710
|
exports.walkForTsConfig = walkForTsConfig;
|
|
11711
|
-
function loadTsconfig(configFilePath,
|
|
11712
|
-
if (
|
|
11711
|
+
function loadTsconfig(configFilePath, existsSync3, readFileSync2) {
|
|
11712
|
+
if (existsSync3 === void 0 && (existsSync3 = fs.existsSync), readFileSync2 === void 0 && (readFileSync2 = function(filename) {
|
|
11713
11713
|
return fs.readFileSync(filename, "utf8");
|
|
11714
|
-
}), !!
|
|
11714
|
+
}), !!existsSync3(configFilePath)) {
|
|
11715
11715
|
var configString = readFileSync2(configFilePath), cleanedJson = StripBom(configString), config;
|
|
11716
11716
|
try {
|
|
11717
11717
|
config = JSON5.parse(cleanedJson);
|
|
@@ -11722,22 +11722,22 @@ var require_tsconfig_loader = __commonJS({
|
|
|
11722
11722
|
if (extendedConfig) {
|
|
11723
11723
|
var base2 = void 0;
|
|
11724
11724
|
return Array.isArray(extendedConfig) ? base2 = extendedConfig.reduce(function(currBase, extendedConfigElement) {
|
|
11725
|
-
return mergeTsconfigs(currBase, loadTsconfigFromExtends(configFilePath, extendedConfigElement,
|
|
11726
|
-
}, {}) : base2 = loadTsconfigFromExtends(configFilePath, extendedConfig,
|
|
11725
|
+
return mergeTsconfigs(currBase, loadTsconfigFromExtends(configFilePath, extendedConfigElement, existsSync3, readFileSync2));
|
|
11726
|
+
}, {}) : base2 = loadTsconfigFromExtends(configFilePath, extendedConfig, existsSync3, readFileSync2), mergeTsconfigs(base2, config);
|
|
11727
11727
|
}
|
|
11728
11728
|
return config;
|
|
11729
11729
|
}
|
|
11730
11730
|
}
|
|
11731
11731
|
exports.loadTsconfig = loadTsconfig;
|
|
11732
|
-
function loadTsconfigFromExtends(configFilePath, extendedConfigValue,
|
|
11732
|
+
function loadTsconfigFromExtends(configFilePath, extendedConfigValue, existsSync3, readFileSync2) {
|
|
11733
11733
|
var _a;
|
|
11734
11734
|
typeof extendedConfigValue == "string" && extendedConfigValue.indexOf(".json") === -1 && (extendedConfigValue += ".json");
|
|
11735
|
-
var currentDir =
|
|
11736
|
-
extendedConfigValue.indexOf("/") !== -1 && extendedConfigValue.indexOf(".") !== -1 && !
|
|
11737
|
-
var config = loadTsconfig(extendedConfigPath,
|
|
11735
|
+
var currentDir = path3.dirname(configFilePath), extendedConfigPath = path3.join(currentDir, extendedConfigValue);
|
|
11736
|
+
extendedConfigValue.indexOf("/") !== -1 && extendedConfigValue.indexOf(".") !== -1 && !existsSync3(extendedConfigPath) && (extendedConfigPath = path3.join(currentDir, "node_modules", extendedConfigValue));
|
|
11737
|
+
var config = loadTsconfig(extendedConfigPath, existsSync3, readFileSync2) || {};
|
|
11738
11738
|
if (!((_a = config.compilerOptions) === null || _a === void 0) && _a.baseUrl) {
|
|
11739
|
-
var extendsDir =
|
|
11740
|
-
config.compilerOptions.baseUrl =
|
|
11739
|
+
var extendsDir = path3.dirname(extendedConfigValue);
|
|
11740
|
+
config.compilerOptions.baseUrl = path3.join(extendsDir, config.compilerOptions.baseUrl);
|
|
11741
11741
|
}
|
|
11742
11742
|
return config;
|
|
11743
11743
|
}
|
|
@@ -11753,7 +11753,7 @@ var require_config_loader = __commonJS({
|
|
|
11753
11753
|
"use strict";
|
|
11754
11754
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
11755
11755
|
exports.configLoader = exports.loadConfig = void 0;
|
|
11756
|
-
var TsConfigLoader2 = require_tsconfig_loader(),
|
|
11756
|
+
var TsConfigLoader2 = require_tsconfig_loader(), path3 = __require("path");
|
|
11757
11757
|
function loadConfig2(cwd2) {
|
|
11758
11758
|
return cwd2 === void 0 && (cwd2 = process.cwd()), configLoader({ cwd: cwd2 });
|
|
11759
11759
|
}
|
|
@@ -11761,7 +11761,7 @@ var require_config_loader = __commonJS({
|
|
|
11761
11761
|
function configLoader(_a) {
|
|
11762
11762
|
var cwd2 = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader2.tsConfigLoader : _b;
|
|
11763
11763
|
if (explicitParams) {
|
|
11764
|
-
var absoluteBaseUrl =
|
|
11764
|
+
var absoluteBaseUrl = path3.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path3.join(cwd2, explicitParams.baseUrl);
|
|
11765
11765
|
return {
|
|
11766
11766
|
resultType: "success",
|
|
11767
11767
|
configFileAbsolutePath: "",
|
|
@@ -11782,7 +11782,7 @@ var require_config_loader = __commonJS({
|
|
|
11782
11782
|
resultType: "success",
|
|
11783
11783
|
configFileAbsolutePath: loadResult.tsConfigPath,
|
|
11784
11784
|
baseUrl: loadResult.baseUrl,
|
|
11785
|
-
absoluteBaseUrl:
|
|
11785
|
+
absoluteBaseUrl: path3.resolve(path3.dirname(loadResult.tsConfigPath), loadResult.baseUrl || ""),
|
|
11786
11786
|
paths: loadResult.paths || {},
|
|
11787
11787
|
addMatchAll: loadResult.baseUrl !== void 0
|
|
11788
11788
|
} : {
|
|
@@ -12122,7 +12122,7 @@ var require_path_parse = __commonJS({
|
|
|
12122
12122
|
// ../../../node_modules/resolve/lib/node-modules-paths.js
|
|
12123
12123
|
var require_node_modules_paths = __commonJS({
|
|
12124
12124
|
"../../../node_modules/resolve/lib/node-modules-paths.js"(exports, module) {
|
|
12125
|
-
var
|
|
12125
|
+
var path3 = __require("path"), parse7 = path3.parse || require_path_parse(), driveLetterRegex = /^([A-Za-z]:)/, uncPathRegex = /^\\\\/;
|
|
12126
12126
|
function getNodeModulesDirs(absoluteStart, modules) {
|
|
12127
12127
|
var prefix = "/";
|
|
12128
12128
|
driveLetterRegex.test(absoluteStart) ? prefix = "" : uncPathRegex.test(absoluteStart) && (prefix = "\\\\");
|
|
@@ -12130,7 +12130,7 @@ var require_node_modules_paths = __commonJS({
|
|
|
12130
12130
|
paths.push(parsed.dir), parsed = parse7(parsed.dir);
|
|
12131
12131
|
return paths.reduce(function(dirs, aPath) {
|
|
12132
12132
|
return dirs.concat(modules.map(function(moduleDir) {
|
|
12133
|
-
return
|
|
12133
|
+
return path3.resolve(prefix, aPath, moduleDir);
|
|
12134
12134
|
}));
|
|
12135
12135
|
}, []);
|
|
12136
12136
|
}
|
|
@@ -12154,7 +12154,7 @@ var require_node_modules_paths = __commonJS({
|
|
|
12154
12154
|
// ../../../node_modules/resolve/lib/normalize-options.js
|
|
12155
12155
|
var require_normalize_options = __commonJS({
|
|
12156
12156
|
"../../../node_modules/resolve/lib/normalize-options.js"(exports, module) {
|
|
12157
|
-
var
|
|
12157
|
+
var path3 = __require("path");
|
|
12158
12158
|
module.exports = function(_, opts) {
|
|
12159
12159
|
if (opts = opts || {}, opts.forceNodeResolution || !process.versions.pnp)
|
|
12160
12160
|
return opts;
|
|
@@ -12162,7 +12162,7 @@ var require_normalize_options = __commonJS({
|
|
|
12162
12162
|
let parts = request.match(/^((?:@[^/]+\/)?[^/]+)(\/.*)?/);
|
|
12163
12163
|
if (!parts)
|
|
12164
12164
|
throw new Error(`Assertion failed: Expected the "resolve" package to call the "paths" callback with package names only (got "${request}")`);
|
|
12165
|
-
basedir.charAt(basedir.length - 1) !== "/" && (basedir =
|
|
12165
|
+
basedir.charAt(basedir.length - 1) !== "/" && (basedir = path3.join(basedir, "/"));
|
|
12166
12166
|
let api = findPnpApi(basedir);
|
|
12167
12167
|
if (api === null)
|
|
12168
12168
|
return;
|
|
@@ -12174,7 +12174,7 @@ var require_normalize_options = __commonJS({
|
|
|
12174
12174
|
}
|
|
12175
12175
|
if (manifestPath === null)
|
|
12176
12176
|
throw new Error(`Assertion failed: The resolution thinks that "${parts[1]}" is a Node builtin`);
|
|
12177
|
-
let packagePath =
|
|
12177
|
+
let packagePath = path3.dirname(manifestPath), unqualifiedPath = typeof parts[2] < "u" ? path3.join(packagePath, parts[2]) : packagePath;
|
|
12178
12178
|
return { packagePath, unqualifiedPath };
|
|
12179
12179
|
}, runPnpResolutionOnArray = (request, paths2) => {
|
|
12180
12180
|
for (let i2 = 0; i2 < paths2.length; i2++) {
|
|
@@ -12190,8 +12190,8 @@ var require_normalize_options = __commonJS({
|
|
|
12190
12190
|
let pathsToTest = [basedir].concat(originalPaths), resolution = runPnpResolutionOnArray(request, pathsToTest);
|
|
12191
12191
|
if (resolution == null)
|
|
12192
12192
|
return getNodeModulePaths().concat(originalPaths);
|
|
12193
|
-
let nodeModules =
|
|
12194
|
-
return request.match(/^@[^/]+\//) && (nodeModules =
|
|
12193
|
+
let nodeModules = path3.dirname(resolution.packagePath);
|
|
12194
|
+
return request.match(/^@[^/]+\//) && (nodeModules = path3.dirname(nodeModules)), [nodeModules];
|
|
12195
12195
|
}, isInsideIterator = !1;
|
|
12196
12196
|
return opts.__skipPackageIterator || (opts.packageIterator = function(request, basedir, getCandidates, opts2) {
|
|
12197
12197
|
isInsideIterator = !0;
|
|
@@ -12494,11 +12494,11 @@ var require_type = __commonJS({
|
|
|
12494
12494
|
// ../../../node_modules/resolve/lib/async.js
|
|
12495
12495
|
var require_async = __commonJS({
|
|
12496
12496
|
"../../../node_modules/resolve/lib/async.js"(exports, module) {
|
|
12497
|
-
var fs = __require("fs"), getHomedir = require_homedir(),
|
|
12497
|
+
var fs = __require("fs"), getHomedir = require_homedir(), path3 = __require("path"), caller = require_caller(), nodeModulesPaths = require_node_modules_paths(), normalizeOptions = require_normalize_options(), isCore = require_is_core_module(), $Error = require_es_errors(), $TypeError = require_type(), realpathFS = process.platform !== "win32" && fs.realpath && typeof fs.realpath.native == "function" ? fs.realpath.native : fs.realpath, relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/, windowsDriveRegex = /^\w:[/\\]*$/, nodeModulesRegex = /[/\\]node_modules[/\\]*$/, homedir = getHomedir();
|
|
12498
12498
|
function defaultPaths() {
|
|
12499
12499
|
return homedir ? [
|
|
12500
|
-
|
|
12501
|
-
|
|
12500
|
+
path3.join(homedir, ".node_modules"),
|
|
12501
|
+
path3.join(homedir, ".node_libraries")
|
|
12502
12502
|
] : [];
|
|
12503
12503
|
}
|
|
12504
12504
|
var defaultIsFile = function(file, cb) {
|
|
@@ -12531,7 +12531,7 @@ var require_async = __commonJS({
|
|
|
12531
12531
|
}
|
|
12532
12532
|
function getPackageCandidates(x, start, opts) {
|
|
12533
12533
|
for (var dirs = nodeModulesPaths(start, opts, x), i2 = 0; i2 < dirs.length; i2++)
|
|
12534
|
-
dirs[i2] =
|
|
12534
|
+
dirs[i2] = path3.join(dirs[i2], x);
|
|
12535
12535
|
return dirs;
|
|
12536
12536
|
}
|
|
12537
12537
|
module.exports = function(x, options, callback) {
|
|
@@ -12550,9 +12550,9 @@ var require_async = __commonJS({
|
|
|
12550
12550
|
cb(conflictErr);
|
|
12551
12551
|
});
|
|
12552
12552
|
}
|
|
12553
|
-
var packageIterator = opts.packageIterator, extensions = opts.extensions || [".js"], includeCoreModules = opts.includeCoreModules !== !1, basedir = opts.basedir ||
|
|
12553
|
+
var packageIterator = opts.packageIterator, extensions = opts.extensions || [".js"], includeCoreModules = opts.includeCoreModules !== !1, basedir = opts.basedir || path3.dirname(caller()), parent = opts.filename || basedir;
|
|
12554
12554
|
opts.paths = opts.paths || defaultPaths();
|
|
12555
|
-
var absoluteStart =
|
|
12555
|
+
var absoluteStart = path3.resolve(basedir);
|
|
12556
12556
|
maybeRealpath(
|
|
12557
12557
|
realpath,
|
|
12558
12558
|
absoluteStart,
|
|
@@ -12564,7 +12564,7 @@ var require_async = __commonJS({
|
|
|
12564
12564
|
var res;
|
|
12565
12565
|
function init(basedir2) {
|
|
12566
12566
|
if (relativePathRegex.test(x))
|
|
12567
|
-
res =
|
|
12567
|
+
res = path3.resolve(basedir2, x), (x === "." || x === ".." || x.slice(-1) === "/") && (res += "/"), x.slice(-1) === "/" && res === basedir2 ? loadAsDirectory(res, opts.package, onfile) : loadAsFile(res, opts.package, onfile);
|
|
12568
12568
|
else {
|
|
12569
12569
|
if (includeCoreModules && isCore(x))
|
|
12570
12570
|
return cb(null, x);
|
|
@@ -12602,14 +12602,14 @@ var require_async = __commonJS({
|
|
|
12602
12602
|
function load(exts2, x3, loadPackage) {
|
|
12603
12603
|
if (exts2.length === 0) return cb2(null, void 0, loadPackage);
|
|
12604
12604
|
var file = x3 + exts2[0], pkg = loadPackage;
|
|
12605
|
-
pkg ? onpkg(null, pkg) : loadpkg(
|
|
12605
|
+
pkg ? onpkg(null, pkg) : loadpkg(path3.dirname(file), onpkg);
|
|
12606
12606
|
function onpkg(err2, pkg_, dir) {
|
|
12607
12607
|
if (pkg = pkg_, err2) return cb2(err2);
|
|
12608
12608
|
if (dir && pkg && opts.pathFilter) {
|
|
12609
|
-
var rfile =
|
|
12609
|
+
var rfile = path3.relative(dir, file), rel = rfile.slice(0, rfile.length - exts2[0].length), r = opts.pathFilter(pkg, x3, rel);
|
|
12610
12610
|
if (r) return load(
|
|
12611
12611
|
[""].concat(extensions),
|
|
12612
|
-
|
|
12612
|
+
path3.resolve(dir, r),
|
|
12613
12613
|
pkg
|
|
12614
12614
|
);
|
|
12615
12615
|
}
|
|
@@ -12625,10 +12625,10 @@ var require_async = __commonJS({
|
|
|
12625
12625
|
function loadpkg(dir, cb2) {
|
|
12626
12626
|
if (dir === "" || dir === "/" || process.platform === "win32" && windowsDriveRegex.test(dir) || nodeModulesRegex.test(dir)) return cb2(null);
|
|
12627
12627
|
maybeRealpath(realpath, dir, opts, function(unwrapErr, pkgdir) {
|
|
12628
|
-
if (unwrapErr) return loadpkg(
|
|
12629
|
-
var pkgfile =
|
|
12628
|
+
if (unwrapErr) return loadpkg(path3.dirname(dir), cb2);
|
|
12629
|
+
var pkgfile = path3.join(pkgdir, "package.json");
|
|
12630
12630
|
isFile2(pkgfile, function(err2, ex) {
|
|
12631
|
-
if (!ex) return loadpkg(
|
|
12631
|
+
if (!ex) return loadpkg(path3.dirname(dir), cb2);
|
|
12632
12632
|
readPackage(readFile, pkgfile, function(err3, pkgParam) {
|
|
12633
12633
|
if (err3)
|
|
12634
12634
|
return cb2(err3);
|
|
@@ -12642,10 +12642,10 @@ var require_async = __commonJS({
|
|
|
12642
12642
|
var cb2 = callback2, fpkg = loadAsDirectoryPackage;
|
|
12643
12643
|
typeof fpkg == "function" && (cb2 = fpkg, fpkg = opts.package), maybeRealpath(realpath, x2, opts, function(unwrapErr, pkgdir) {
|
|
12644
12644
|
if (unwrapErr) return cb2(unwrapErr);
|
|
12645
|
-
var pkgfile =
|
|
12645
|
+
var pkgfile = path3.join(pkgdir, "package.json");
|
|
12646
12646
|
isFile2(pkgfile, function(err2, ex) {
|
|
12647
12647
|
if (err2) return cb2(err2);
|
|
12648
|
-
if (!ex) return loadAsFile(
|
|
12648
|
+
if (!ex) return loadAsFile(path3.join(x2, "index"), fpkg, cb2);
|
|
12649
12649
|
readPackage(readFile, pkgfile, function(err3, pkgParam) {
|
|
12650
12650
|
if (err3) return cb2(err3);
|
|
12651
12651
|
var pkg = pkgParam;
|
|
@@ -12654,20 +12654,20 @@ var require_async = __commonJS({
|
|
|
12654
12654
|
var mainError = new $TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
|
|
12655
12655
|
return mainError.code = "INVALID_PACKAGE_MAIN", cb2(mainError);
|
|
12656
12656
|
}
|
|
12657
|
-
(pkg.main === "." || pkg.main === "./") && (pkg.main = "index"), loadAsFile(
|
|
12657
|
+
(pkg.main === "." || pkg.main === "./") && (pkg.main = "index"), loadAsFile(path3.resolve(x2, pkg.main), pkg, function(err4, m, pkg2) {
|
|
12658
12658
|
if (err4) return cb2(err4);
|
|
12659
12659
|
if (m) return cb2(null, m, pkg2);
|
|
12660
|
-
if (!pkg2) return loadAsFile(
|
|
12661
|
-
var dir =
|
|
12660
|
+
if (!pkg2) return loadAsFile(path3.join(x2, "index"), pkg2, cb2);
|
|
12661
|
+
var dir = path3.resolve(x2, pkg2.main);
|
|
12662
12662
|
loadAsDirectory(dir, pkg2, function(err5, n, pkg3) {
|
|
12663
12663
|
if (err5) return cb2(err5);
|
|
12664
12664
|
if (n) return cb2(null, n, pkg3);
|
|
12665
|
-
loadAsFile(
|
|
12665
|
+
loadAsFile(path3.join(x2, "index"), pkg3, cb2);
|
|
12666
12666
|
});
|
|
12667
12667
|
});
|
|
12668
12668
|
return;
|
|
12669
12669
|
}
|
|
12670
|
-
loadAsFile(
|
|
12670
|
+
loadAsFile(path3.join(x2, "/index"), pkg, cb2);
|
|
12671
12671
|
});
|
|
12672
12672
|
});
|
|
12673
12673
|
});
|
|
@@ -12675,7 +12675,7 @@ var require_async = __commonJS({
|
|
|
12675
12675
|
function processDirs(cb2, dirs) {
|
|
12676
12676
|
if (dirs.length === 0) return cb2(null, void 0);
|
|
12677
12677
|
var dir = dirs[0];
|
|
12678
|
-
isDirectory(
|
|
12678
|
+
isDirectory(path3.dirname(dir), isdir);
|
|
12679
12679
|
function isdir(err2, isdir2) {
|
|
12680
12680
|
if (err2) return cb2(err2);
|
|
12681
12681
|
if (!isdir2) return processDirs(cb2, dirs.slice(1));
|
|
@@ -12898,11 +12898,11 @@ var require_is_core = __commonJS({
|
|
|
12898
12898
|
// ../../../node_modules/resolve/lib/sync.js
|
|
12899
12899
|
var require_sync = __commonJS({
|
|
12900
12900
|
"../../../node_modules/resolve/lib/sync.js"(exports, module) {
|
|
12901
|
-
var isCore = require_is_core_module(), fs = __require("fs"),
|
|
12901
|
+
var isCore = require_is_core_module(), fs = __require("fs"), path3 = __require("path"), $Error = require_es_errors(), $TypeError = require_type(), getHomedir = require_homedir(), caller = require_caller(), nodeModulesPaths = require_node_modules_paths(), normalizeOptions = require_normalize_options(), realpathFS = process.platform !== "win32" && fs.realpathSync && typeof fs.realpathSync.native == "function" ? fs.realpathSync.native : fs.realpathSync, relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/, windowsDriveRegex = /^\w:[/\\]*$/, nodeModulesRegex = /[/\\]node_modules[/\\]*$/, homedir = getHomedir();
|
|
12902
12902
|
function defaultPaths() {
|
|
12903
12903
|
return homedir ? [
|
|
12904
|
-
|
|
12905
|
-
|
|
12904
|
+
path3.join(homedir, ".node_modules"),
|
|
12905
|
+
path3.join(homedir, ".node_libraries")
|
|
12906
12906
|
] : [];
|
|
12907
12907
|
}
|
|
12908
12908
|
var defaultIsFile = function(file) {
|
|
@@ -12943,7 +12943,7 @@ var require_sync = __commonJS({
|
|
|
12943
12943
|
}
|
|
12944
12944
|
function getPackageCandidates(x, start, opts) {
|
|
12945
12945
|
for (var dirs = nodeModulesPaths(start, opts, x), i2 = 0; i2 < dirs.length; i2++)
|
|
12946
|
-
dirs[i2] =
|
|
12946
|
+
dirs[i2] = path3.join(dirs[i2], x);
|
|
12947
12947
|
return dirs;
|
|
12948
12948
|
}
|
|
12949
12949
|
module.exports = function(x, options) {
|
|
@@ -12952,11 +12952,11 @@ var require_sync = __commonJS({
|
|
|
12952
12952
|
var opts = normalizeOptions(x, options), isFile2 = opts.isFile || defaultIsFile, readFileSync2 = opts.readFileSync || fs.readFileSync, isDirectory = opts.isDirectory || defaultIsDir, realpathSync = opts.realpathSync || defaultRealpathSync, readPackageSync = opts.readPackageSync || defaultReadPackageSync;
|
|
12953
12953
|
if (opts.readFileSync && opts.readPackageSync)
|
|
12954
12954
|
throw new $TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
|
|
12955
|
-
var packageIterator = opts.packageIterator, extensions = opts.extensions || [".js"], includeCoreModules = opts.includeCoreModules !== !1, basedir = opts.basedir ||
|
|
12955
|
+
var packageIterator = opts.packageIterator, extensions = opts.extensions || [".js"], includeCoreModules = opts.includeCoreModules !== !1, basedir = opts.basedir || path3.dirname(caller()), parent = opts.filename || basedir;
|
|
12956
12956
|
opts.paths = opts.paths || defaultPaths();
|
|
12957
|
-
var absoluteStart = maybeRealpathSync(realpathSync,
|
|
12957
|
+
var absoluteStart = maybeRealpathSync(realpathSync, path3.resolve(basedir), opts);
|
|
12958
12958
|
if (relativePathRegex.test(x)) {
|
|
12959
|
-
var res =
|
|
12959
|
+
var res = path3.resolve(absoluteStart, x);
|
|
12960
12960
|
(x === "." || x === ".." || x.slice(-1) === "/") && (res += "/");
|
|
12961
12961
|
var m = loadAsFileSync(res) || loadAsDirectorySync(res);
|
|
12962
12962
|
if (m) return maybeRealpathSync(realpathSync, m, opts);
|
|
@@ -12969,10 +12969,10 @@ var require_sync = __commonJS({
|
|
|
12969
12969
|
var err = new $Error("Cannot find module '" + x + "' from '" + parent + "'");
|
|
12970
12970
|
throw err.code = "MODULE_NOT_FOUND", err;
|
|
12971
12971
|
function loadAsFileSync(x2) {
|
|
12972
|
-
var pkg = loadpkg(
|
|
12972
|
+
var pkg = loadpkg(path3.dirname(x2));
|
|
12973
12973
|
if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
|
|
12974
|
-
var rfile =
|
|
12975
|
-
r && (x2 =
|
|
12974
|
+
var rfile = path3.relative(pkg.dir, x2), r = opts.pathFilter(pkg.pkg, x2, rfile);
|
|
12975
|
+
r && (x2 = path3.resolve(pkg.dir, r));
|
|
12976
12976
|
}
|
|
12977
12977
|
if (isFile2(x2))
|
|
12978
12978
|
return x2;
|
|
@@ -12984,9 +12984,9 @@ var require_sync = __commonJS({
|
|
|
12984
12984
|
}
|
|
12985
12985
|
function loadpkg(dir) {
|
|
12986
12986
|
if (!(dir === "" || dir === "/") && !(process.platform === "win32" && windowsDriveRegex.test(dir)) && !nodeModulesRegex.test(dir)) {
|
|
12987
|
-
var pkgfile =
|
|
12987
|
+
var pkgfile = path3.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
|
|
12988
12988
|
if (!isFile2(pkgfile))
|
|
12989
|
-
return loadpkg(
|
|
12989
|
+
return loadpkg(path3.dirname(dir));
|
|
12990
12990
|
var pkg = readPackageSync(readFileSync2, pkgfile);
|
|
12991
12991
|
return pkg && opts.packageFilter && (pkg = opts.packageFilter(
|
|
12992
12992
|
pkg,
|
|
@@ -12996,7 +12996,7 @@ var require_sync = __commonJS({
|
|
|
12996
12996
|
}
|
|
12997
12997
|
}
|
|
12998
12998
|
function loadAsDirectorySync(x2) {
|
|
12999
|
-
var pkgfile =
|
|
12999
|
+
var pkgfile = path3.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
|
|
13000
13000
|
if (isFile2(pkgfile)) {
|
|
13001
13001
|
try {
|
|
13002
13002
|
var pkg = readPackageSync(readFileSync2, pkgfile);
|
|
@@ -13013,22 +13013,22 @@ var require_sync = __commonJS({
|
|
|
13013
13013
|
}
|
|
13014
13014
|
(pkg.main === "." || pkg.main === "./") && (pkg.main = "index");
|
|
13015
13015
|
try {
|
|
13016
|
-
var m2 = loadAsFileSync(
|
|
13016
|
+
var m2 = loadAsFileSync(path3.resolve(x2, pkg.main));
|
|
13017
13017
|
if (m2) return m2;
|
|
13018
|
-
var n2 = loadAsDirectorySync(
|
|
13018
|
+
var n2 = loadAsDirectorySync(path3.resolve(x2, pkg.main));
|
|
13019
13019
|
if (n2) return n2;
|
|
13020
13020
|
} catch {
|
|
13021
13021
|
}
|
|
13022
13022
|
}
|
|
13023
13023
|
}
|
|
13024
|
-
return loadAsFileSync(
|
|
13024
|
+
return loadAsFileSync(path3.join(x2, "/index"));
|
|
13025
13025
|
}
|
|
13026
13026
|
function loadNodeModulesSync(x2, start) {
|
|
13027
13027
|
for (var thunk = function() {
|
|
13028
13028
|
return getPackageCandidates(x2, start, opts);
|
|
13029
13029
|
}, dirs = packageIterator ? packageIterator(x2, start, thunk, opts) : thunk(), i2 = 0; i2 < dirs.length; i2++) {
|
|
13030
13030
|
var dir = dirs[i2];
|
|
13031
|
-
if (isDirectory(
|
|
13031
|
+
if (isDirectory(path3.dirname(dir))) {
|
|
13032
13032
|
var m2 = loadAsFileSync(dir);
|
|
13033
13033
|
if (m2) return m2;
|
|
13034
13034
|
var n2 = loadAsDirectorySync(dir);
|
|
@@ -13052,11 +13052,11 @@ var require_resolve = __commonJS({
|
|
|
13052
13052
|
});
|
|
13053
13053
|
|
|
13054
13054
|
// src/componentManifest/componentMeta/ComponentMetaManager.ts
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
import
|
|
13055
|
+
import {
|
|
13056
|
+
ComponentMetaManager as BaseComponentMetaManager,
|
|
13057
|
+
parseTsconfigCommandLine
|
|
13058
|
+
} from "storybook/internal/component-meta";
|
|
13059
|
+
import { logger as logger2 } from "storybook/internal/node-logger";
|
|
13060
13060
|
|
|
13061
13061
|
// src/componentManifest/utils.ts
|
|
13062
13062
|
import { readFileSync, statSync as statSync2 } from "node:fs";
|
|
@@ -13870,12 +13870,13 @@ function hasExportModifier(typescript, node) {
|
|
|
13870
13870
|
|
|
13871
13871
|
// src/componentManifest/componentMeta/ComponentMetaProject.ts
|
|
13872
13872
|
var ComponentMetaProject = class {
|
|
13873
|
-
constructor(typescript, commandLine, configFileName, fsFileSnapshots = /* @__PURE__ */ new Map(), getCommandLineFn) {
|
|
13873
|
+
constructor(typescript, commandLine, configFileName, fsFileSnapshots = /* @__PURE__ */ new Map(), getCommandLineFn, documentRegistry) {
|
|
13874
13874
|
this.typescript = typescript;
|
|
13875
13875
|
this.commandLine = commandLine;
|
|
13876
13876
|
this.configFileName = configFileName;
|
|
13877
13877
|
this.fsFileSnapshots = fsFileSnapshots;
|
|
13878
13878
|
this.getCommandLineFn = getCommandLineFn;
|
|
13879
|
+
this.documentRegistry = documentRegistry;
|
|
13879
13880
|
this.projectVersion = 0;
|
|
13880
13881
|
this.shouldCheckRootFiles = !1;
|
|
13881
13882
|
/** Entries to extract — set by the generator, replayed during warmup for targeted type resolution. */
|
|
@@ -13910,7 +13911,7 @@ var ComponentMetaProject = class {
|
|
|
13910
13911
|
// asScriptId — identity for React (no URI mapping needed)
|
|
13911
13912
|
projectHost
|
|
13912
13913
|
);
|
|
13913
|
-
this.ls = typescript.createLanguageService(languageServiceHost);
|
|
13914
|
+
this.ls = typescript.createLanguageService(languageServiceHost, this.documentRegistry);
|
|
13914
13915
|
}
|
|
13915
13916
|
getCommandLine() {
|
|
13916
13917
|
return this.commandLine;
|
|
@@ -13941,8 +13942,11 @@ var ComponentMetaProject = class {
|
|
|
13941
13942
|
let newCommandLine = this.getCommandLineFn();
|
|
13942
13943
|
arrayItemsEqual(newCommandLine.fileNames, this.commandLine.fileNames) || (this.commandLine.fileNames = newCommandLine.fileNames, this.projectVersion++);
|
|
13943
13944
|
}
|
|
13945
|
+
getSourceFile(fileName) {
|
|
13946
|
+
return this.ls.getProgram()?.getSourceFile(fileName);
|
|
13947
|
+
}
|
|
13944
13948
|
hasSourceFile(fileName) {
|
|
13945
|
-
return !!this.
|
|
13949
|
+
return !!this.getSourceFile(fileName);
|
|
13946
13950
|
}
|
|
13947
13951
|
/**
|
|
13948
13952
|
* Get all non-node_modules source file paths from the TS program. Used by ComponentMetaManager to
|
|
@@ -14121,43 +14125,60 @@ function arrayItemsEqual(a, b) {
|
|
|
14121
14125
|
}
|
|
14122
14126
|
|
|
14123
14127
|
// src/componentManifest/componentMeta/ComponentMetaManager.ts
|
|
14124
|
-
|
|
14128
|
+
import { isFileInDir, sortTSConfigs } from "storybook/internal/component-meta";
|
|
14129
|
+
var DEFAULT_INFERRED_OPTIONS = {
|
|
14125
14130
|
strict: !0,
|
|
14126
14131
|
esModuleInterop: !0,
|
|
14127
14132
|
allowJs: !0,
|
|
14128
14133
|
skipLibCheck: !0
|
|
14129
|
-
}
|
|
14134
|
+
};
|
|
14135
|
+
function createReactProjectFactory(typescript) {
|
|
14136
|
+
let fsFileSnapshots = /* @__PURE__ */ new Map(), documentRegistry = typescript.createDocumentRegistry(
|
|
14137
|
+
typescript.sys.useCaseSensitiveFileNames
|
|
14138
|
+
);
|
|
14139
|
+
return {
|
|
14140
|
+
fsFileSnapshots,
|
|
14141
|
+
factory: {
|
|
14142
|
+
parseCommandLine: (tsconfig) => parseTsconfigCommandLine(typescript, tsconfig),
|
|
14143
|
+
createConfiguredProject: (commandLine, tsconfig, getCommandLine) => new ComponentMetaProject(
|
|
14144
|
+
typescript,
|
|
14145
|
+
commandLine,
|
|
14146
|
+
tsconfig,
|
|
14147
|
+
fsFileSnapshots,
|
|
14148
|
+
getCommandLine,
|
|
14149
|
+
documentRegistry
|
|
14150
|
+
),
|
|
14151
|
+
createInferredProject: () => new ComponentMetaProject(
|
|
14152
|
+
typescript,
|
|
14153
|
+
{
|
|
14154
|
+
options: {
|
|
14155
|
+
...DEFAULT_INFERRED_OPTIONS,
|
|
14156
|
+
target: typescript.ScriptTarget.Latest,
|
|
14157
|
+
module: typescript.ModuleKind.ESNext,
|
|
14158
|
+
moduleResolution: typescript.ModuleResolutionKind.Bundler,
|
|
14159
|
+
jsx: typescript.JsxEmit.ReactJSX
|
|
14160
|
+
},
|
|
14161
|
+
fileNames: [],
|
|
14162
|
+
errors: []
|
|
14163
|
+
},
|
|
14164
|
+
void 0,
|
|
14165
|
+
fsFileSnapshots,
|
|
14166
|
+
void 0,
|
|
14167
|
+
documentRegistry
|
|
14168
|
+
),
|
|
14169
|
+
dispose: () => fsFileSnapshots.clear()
|
|
14170
|
+
}
|
|
14171
|
+
};
|
|
14172
|
+
}
|
|
14173
|
+
var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
14130
14174
|
/**
|
|
14131
|
-
* @param recycleHeapPressureRatio Fraction of the V8 heap limit at which the shared program(s)
|
|
14132
|
-
* recycled
|
|
14133
|
-
*
|
|
14134
|
-
* without the fix. Defaults to {@link RECYCLE_HEAP_PRESSURE_RATIO}.
|
|
14175
|
+
* @param recycleHeapPressureRatio Fraction of the V8 heap limit at which the shared program(s)
|
|
14176
|
+
* are recycled. Exposed for tuning and for the memory regression gate, which passes `Infinity`
|
|
14177
|
+
* to disable recycling and assert the OOM still happens without the fix.
|
|
14135
14178
|
*/
|
|
14136
|
-
constructor(typescript, recycleHeapPressureRatio
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
// https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/language-server/lib/project/typescriptProject.ts#L34-L37
|
|
14140
|
-
this.configProjects = /* @__PURE__ */ new Map();
|
|
14141
|
-
this.rootTsConfigs = /* @__PURE__ */ new Set();
|
|
14142
|
-
this.searchedDirs = /* @__PURE__ */ new Set();
|
|
14143
|
-
// Our own file watching layer
|
|
14144
|
-
this.watching = !1;
|
|
14145
|
-
this.watchersByDir = /* @__PURE__ */ new Map();
|
|
14146
|
-
this.pendingEvents = /* @__PURE__ */ new Map();
|
|
14147
|
-
// Adapted from:
|
|
14148
|
-
// https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/kit/lib/createChecker.ts#L83
|
|
14149
|
-
this.fsFileSnapshots = /* @__PURE__ */ new Map();
|
|
14150
|
-
this.heapRecycleThresholdBytes = Math.floor(
|
|
14151
|
-
v8.getHeapStatistics().heap_size_limit * recycleHeapPressureRatio
|
|
14152
|
-
);
|
|
14153
|
-
}
|
|
14154
|
-
// ---------------------------------------------------------------------------
|
|
14155
|
-
// Adapted from:
|
|
14156
|
-
// https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/language-server/lib/project/typescriptProject.ts#L70-L79
|
|
14157
|
-
// ---------------------------------------------------------------------------
|
|
14158
|
-
getProjectForFile(fileName) {
|
|
14159
|
-
let tsconfig = this.findMatchTSConfig(fileName);
|
|
14160
|
-
return tsconfig ? this.getOrCreateConfiguredProject(tsconfig) ?? this.getOrCreateInferredProject(fileName) : this.getOrCreateInferredProject(fileName);
|
|
14179
|
+
constructor(typescript, recycleHeapPressureRatio) {
|
|
14180
|
+
let { factory, fsFileSnapshots } = createReactProjectFactory(typescript);
|
|
14181
|
+
super(typescript, factory, recycleHeapPressureRatio), this.fsFileSnapshots = fsFileSnapshots;
|
|
14161
14182
|
}
|
|
14162
14183
|
/**
|
|
14163
14184
|
* Batch-extract component props across all entries, grouping by tsconfig project so each project
|
|
@@ -14178,331 +14199,20 @@ var rootTsConfigNames = ["tsconfig.json", "jsconfig.json"], DEFAULT_INFERRED_OPT
|
|
|
14178
14199
|
}
|
|
14179
14200
|
this.recycleProjectsIfHeapPressured();
|
|
14180
14201
|
}
|
|
14181
|
-
/**
|
|
14182
|
-
* Reclaim the shared program(s)' resident type-resolution cache when heap usage approaches the V8
|
|
14183
|
-
* limit, preventing the next extraction's spike from OOMing the dev server.
|
|
14184
|
-
*/
|
|
14185
|
-
recycleProjectsIfHeapPressured() {
|
|
14186
|
-
if (this.configProjects.size === 0 && !this.inferredProject || process.memoryUsage().heapUsed < this.heapRecycleThresholdBytes)
|
|
14187
|
-
return;
|
|
14188
|
-
let heapLimitMb = Math.round(v8.getHeapStatistics().heap_size_limit / (1024 * 1024));
|
|
14189
|
-
once.warn(import_ts_dedent.dedent`
|
|
14190
|
-
Storybook's experimental docgen server is nearing the Node.js memory limit (~${heapLimitMb} MB) while extracting component types, and recycled its TypeScript program to avoid an out-of-memory crash. This can briefly slow down the docs and Controls panels.
|
|
14191
|
-
|
|
14192
|
-
If this happens often, raise Node's memory limit before starting Storybook, for example:
|
|
14193
|
-
NODE_OPTIONS="--max-old-space-size=${heapLimitMb * 2}"
|
|
14194
|
-
`);
|
|
14195
|
-
for (let project of this.configProjects.values())
|
|
14196
|
-
project.dispose();
|
|
14197
|
-
this.inferredProject?.dispose(), this.configProjects.clear(), this.inferredProject = void 0;
|
|
14198
|
-
}
|
|
14199
|
-
// ---------------------------------------------------------------------------
|
|
14200
|
-
// Adapted from:
|
|
14201
|
-
// https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/language-server/lib/project/typescriptProject.ts#L101-L234
|
|
14202
|
-
// ---------------------------------------------------------------------------
|
|
14203
|
-
findMatchTSConfig(filePath) {
|
|
14204
|
-
let fileName = filePath.replace(/\\/g, "/"), dir = path2.dirname(fileName);
|
|
14205
|
-
for (; !this.searchedDirs.has(dir); ) {
|
|
14206
|
-
this.searchedDirs.add(dir);
|
|
14207
|
-
for (let tsConfigName of rootTsConfigNames) {
|
|
14208
|
-
let tsconfigPath = path2.join(dir, tsConfigName).replace(/\\/g, "/");
|
|
14209
|
-
this.typescript.sys.fileExists(tsconfigPath) && this.rootTsConfigs.add(tsconfigPath);
|
|
14210
|
-
}
|
|
14211
|
-
let parent = path2.dirname(dir);
|
|
14212
|
-
if (parent === dir)
|
|
14213
|
-
break;
|
|
14214
|
-
dir = parent;
|
|
14215
|
-
}
|
|
14216
|
-
if (this.rootTsConfigs.size === 0)
|
|
14217
|
-
return null;
|
|
14218
|
-
let prepareClosestRootCommandLine = () => {
|
|
14219
|
-
let matches = [];
|
|
14220
|
-
for (let rootTsConfig of this.rootTsConfigs)
|
|
14221
|
-
isFileInDir(fileName, path2.dirname(rootTsConfig)) && matches.push(rootTsConfig);
|
|
14222
|
-
matches = matches.sort((a, b) => sortTSConfigs(fileName, a, b)), matches.length && getCommandLine(matches[0]);
|
|
14223
|
-
}, findIndirectReferenceTsconfig = () => findTSConfig((tsconfig) => !!this.configProjects.get(tsconfig)?.hasSourceFile(fileName)), findDirectIncludeTsconfig = () => findTSConfig((tsconfig) => {
|
|
14224
|
-
let commandLine = getCommandLine(tsconfig);
|
|
14225
|
-
return new Set(commandLine?.fileNames ?? []).has(fileName);
|
|
14226
|
-
}), findTSConfig = (match) => {
|
|
14227
|
-
let checked = /* @__PURE__ */ new Set();
|
|
14228
|
-
for (let rootTsConfig of [...this.rootTsConfigs].sort(
|
|
14229
|
-
(a, b) => sortTSConfigs(fileName, a, b)
|
|
14230
|
-
)) {
|
|
14231
|
-
let project = this.configProjects.get(rootTsConfig);
|
|
14232
|
-
if (project) {
|
|
14233
|
-
let chains = getReferencesChains(project.getCommandLine(), rootTsConfig, []);
|
|
14234
|
-
chains = chains.reverse();
|
|
14235
|
-
for (let chain of chains)
|
|
14236
|
-
for (let i2 = chain.length - 1; i2 >= 0; i2--) {
|
|
14237
|
-
let tsconfig = chain[i2];
|
|
14238
|
-
if (!checked.has(tsconfig) && (checked.add(tsconfig), match(tsconfig)))
|
|
14239
|
-
return tsconfig;
|
|
14240
|
-
}
|
|
14241
|
-
}
|
|
14242
|
-
}
|
|
14243
|
-
return null;
|
|
14244
|
-
}, getReferencesChains = (commandLine, tsConfig, before) => {
|
|
14245
|
-
if (commandLine.projectReferences?.length) {
|
|
14246
|
-
let newChains = [];
|
|
14247
|
-
for (let projectReference of commandLine.projectReferences) {
|
|
14248
|
-
let tsConfigPath = projectReference.path.replace(/\\/g, "/");
|
|
14249
|
-
if (this.typescript.sys.directoryExists(tsConfigPath)) {
|
|
14250
|
-
let newTsConfigPath = path2.join(tsConfigPath, "tsconfig.json"), newJsConfigPath = path2.join(tsConfigPath, "jsconfig.json");
|
|
14251
|
-
this.typescript.sys.fileExists(newTsConfigPath) ? tsConfigPath = newTsConfigPath : this.typescript.sys.fileExists(newJsConfigPath) && (tsConfigPath = newJsConfigPath);
|
|
14252
|
-
}
|
|
14253
|
-
let beforeIndex = before.indexOf(tsConfigPath);
|
|
14254
|
-
if (beforeIndex >= 0)
|
|
14255
|
-
newChains.push(before.slice(0, Math.max(beforeIndex, 1)));
|
|
14256
|
-
else {
|
|
14257
|
-
let referenceCommandLine = getCommandLine(tsConfigPath);
|
|
14258
|
-
if (referenceCommandLine)
|
|
14259
|
-
for (let chain of getReferencesChains(referenceCommandLine, tsConfigPath, [
|
|
14260
|
-
...before,
|
|
14261
|
-
tsConfig
|
|
14262
|
-
]))
|
|
14263
|
-
newChains.push(chain);
|
|
14264
|
-
}
|
|
14265
|
-
}
|
|
14266
|
-
return newChains;
|
|
14267
|
-
} else
|
|
14268
|
-
return [[...before, tsConfig]];
|
|
14269
|
-
}, getCommandLine = (tsConfig) => this.getOrCreateConfiguredProject(tsConfig)?.getCommandLine();
|
|
14270
|
-
return prepareClosestRootCommandLine(), findDirectIncludeTsconfig() ?? findIndirectReferenceTsconfig();
|
|
14271
|
-
}
|
|
14272
|
-
// ---------------------------------------------------------------------------
|
|
14273
|
-
// Adapted from:
|
|
14274
|
-
// https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/language-server/lib/project/typescriptProject.ts#L236-L256
|
|
14275
|
-
// ---------------------------------------------------------------------------
|
|
14276
|
-
getOrCreateConfiguredProject(tsconfig) {
|
|
14277
|
-
tsconfig = tsconfig.replace(/\\/g, "/");
|
|
14278
|
-
let project = this.configProjects.get(tsconfig);
|
|
14279
|
-
if (!project)
|
|
14280
|
-
try {
|
|
14281
|
-
let getCommandLine = () => this.parseConfigWorker(tsconfig);
|
|
14282
|
-
project = new ComponentMetaProject(
|
|
14283
|
-
this.typescript,
|
|
14284
|
-
getCommandLine(),
|
|
14285
|
-
tsconfig,
|
|
14286
|
-
this.fsFileSnapshots,
|
|
14287
|
-
getCommandLine
|
|
14288
|
-
), this.configProjects.set(tsconfig, project), this.watching && (this.watchDirectory(path2.dirname(tsconfig)), this.watchProgramSourceDirs(project));
|
|
14289
|
-
} catch (err) {
|
|
14290
|
-
return logger2.debug(`[reactComponentMeta] Failed to parse tsconfig ${tsconfig}: ${err}`), null;
|
|
14291
|
-
}
|
|
14292
|
-
return project;
|
|
14293
|
-
}
|
|
14294
|
-
// ---------------------------------------------------------------------------
|
|
14295
|
-
// Adapted from:
|
|
14296
|
-
// https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/language-server/lib/project/typescriptProject.ts#L258-L284
|
|
14297
|
-
// ---------------------------------------------------------------------------
|
|
14298
|
-
getOrCreateInferredProject(fileName) {
|
|
14299
|
-
return this.inferredProject || (this.inferredProject = new ComponentMetaProject(
|
|
14300
|
-
this.typescript,
|
|
14301
|
-
{
|
|
14302
|
-
options: {
|
|
14303
|
-
...DEFAULT_INFERRED_OPTIONS,
|
|
14304
|
-
target: this.typescript.ScriptTarget.Latest,
|
|
14305
|
-
module: this.typescript.ModuleKind.ESNext,
|
|
14306
|
-
moduleResolution: this.typescript.ModuleResolutionKind.Bundler,
|
|
14307
|
-
jsx: this.typescript.JsxEmit.ReactJSX
|
|
14308
|
-
},
|
|
14309
|
-
fileNames: [],
|
|
14310
|
-
errors: []
|
|
14311
|
-
},
|
|
14312
|
-
void 0,
|
|
14313
|
-
this.fsFileSnapshots
|
|
14314
|
-
)), this.inferredProject.ensureFiles([fileName]), this.inferredProject;
|
|
14315
|
-
}
|
|
14316
|
-
// ---------------------------------------------------------------------------
|
|
14317
|
-
// Adapted from:
|
|
14318
|
-
// https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/language-server/lib/project/typescriptProjectLs.ts#L262-L353
|
|
14319
|
-
// ---------------------------------------------------------------------------
|
|
14320
|
-
parseConfigWorker(tsconfig) {
|
|
14321
|
-
let config = this.typescript.readJsonConfigFile(tsconfig, this.typescript.sys.readFile), content = this.typescript.parseJsonSourceFileConfigFileContent(
|
|
14322
|
-
config,
|
|
14323
|
-
this.typescript.sys,
|
|
14324
|
-
path2.dirname(tsconfig),
|
|
14325
|
-
{},
|
|
14326
|
-
tsconfig
|
|
14327
|
-
);
|
|
14328
|
-
return content.options.outDir = void 0, content.fileNames = content.fileNames.map((fileName) => fileName.replace(/\\/g, "/")), content;
|
|
14329
|
-
}
|
|
14330
|
-
// ---------------------------------------------------------------------------
|
|
14331
|
-
// File events
|
|
14332
|
-
// ---------------------------------------------------------------------------
|
|
14333
|
-
/**
|
|
14334
|
-
* Broadcast file changes to all projects. Each project selectively bumps projectVersion.
|
|
14335
|
-
*
|
|
14336
|
-
* Adapted from:
|
|
14337
|
-
* https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/kit/lib/createChecker.ts#L409-L432
|
|
14338
|
-
*/
|
|
14339
|
-
onFilesChanged(changes) {
|
|
14340
|
-
for (let project of this.configProjects.values())
|
|
14341
|
-
project.onFilesChanged(changes);
|
|
14342
|
-
this.inferredProject?.onFilesChanged(changes);
|
|
14343
|
-
}
|
|
14344
|
-
/**
|
|
14345
|
-
* Adapted from:
|
|
14346
|
-
* https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/language-server/lib/project/typescriptProject.ts#L43-L68
|
|
14347
|
-
*/
|
|
14348
|
-
onConfigChanged(configPath, type) {
|
|
14349
|
-
if (configPath = configPath.replace(/\\/g, "/"), type === "created")
|
|
14350
|
-
this.rootTsConfigs.add(configPath);
|
|
14351
|
-
else if ((type === "changed" || type === "deleted") && this.configProjects.has(configPath)) {
|
|
14352
|
-
type === "deleted" && this.rootTsConfigs.delete(configPath);
|
|
14353
|
-
let project = this.configProjects.get(configPath);
|
|
14354
|
-
this.configProjects.delete(configPath), project?.dispose();
|
|
14355
|
-
}
|
|
14356
|
-
this.searchedDirs.clear();
|
|
14357
|
-
}
|
|
14358
|
-
// ---------------------------------------------------------------------------
|
|
14359
|
-
// Our own file watching layer (no Volar equivalent — we're standalone)
|
|
14360
|
-
// ---------------------------------------------------------------------------
|
|
14361
|
-
startWatching() {
|
|
14362
|
-
if (!this.watching) {
|
|
14363
|
-
this.watching = !0;
|
|
14364
|
-
for (let tsconfig of this.configProjects.keys())
|
|
14365
|
-
this.watchDirectory(path2.dirname(tsconfig));
|
|
14366
|
-
this.watchProgramSourceDirs();
|
|
14367
|
-
}
|
|
14368
|
-
}
|
|
14369
|
-
/**
|
|
14370
|
-
* Watch directories that contain source files from all TS programs. This covers monorepo setups
|
|
14371
|
-
* where stories import components via path aliases (e.g. apps/storybook/ imports from
|
|
14372
|
-
* packages/ui/ via tsconfig paths).
|
|
14373
|
-
*/
|
|
14374
|
-
watchProgramSourceDirs(singleProject) {
|
|
14375
|
-
let dirs = /* @__PURE__ */ new Set();
|
|
14376
|
-
if (singleProject)
|
|
14377
|
-
for (let filePath of singleProject.getSourceFilePaths())
|
|
14378
|
-
dirs.add(path2.dirname(filePath));
|
|
14379
|
-
else {
|
|
14380
|
-
for (let project of this.configProjects.values())
|
|
14381
|
-
for (let filePath of project.getSourceFilePaths())
|
|
14382
|
-
dirs.add(path2.dirname(filePath));
|
|
14383
|
-
if (this.inferredProject)
|
|
14384
|
-
for (let filePath of this.inferredProject.getSourceFilePaths())
|
|
14385
|
-
dirs.add(path2.dirname(filePath));
|
|
14386
|
-
}
|
|
14387
|
-
let roots = /* @__PURE__ */ new Set();
|
|
14388
|
-
for (let dir of dirs) {
|
|
14389
|
-
let candidate = dir;
|
|
14390
|
-
for (; candidate !== path2.dirname(candidate); ) {
|
|
14391
|
-
let normalized = candidate.replace(/\\/g, "/"), alreadyWatched = !1;
|
|
14392
|
-
for (let watched of this.watchersByDir.keys())
|
|
14393
|
-
if (normalized === watched || normalized.startsWith(watched + "/")) {
|
|
14394
|
-
alreadyWatched = !0;
|
|
14395
|
-
break;
|
|
14396
|
-
}
|
|
14397
|
-
if (alreadyWatched)
|
|
14398
|
-
break;
|
|
14399
|
-
if (this.typescript.sys.fileExists(path2.join(candidate, "package.json")) || this.typescript.sys.fileExists(path2.join(candidate, "tsconfig.json"))) {
|
|
14400
|
-
roots.add(candidate);
|
|
14401
|
-
break;
|
|
14402
|
-
}
|
|
14403
|
-
candidate = path2.dirname(candidate);
|
|
14404
|
-
}
|
|
14405
|
-
}
|
|
14406
|
-
for (let root of roots)
|
|
14407
|
-
this.watchDirectory(root);
|
|
14408
|
-
}
|
|
14409
|
-
watchDirectory(dir) {
|
|
14410
|
-
if (!this.watching)
|
|
14411
|
-
return;
|
|
14412
|
-
let normalized = dir.replace(/\\/g, "/");
|
|
14413
|
-
for (let watched of this.watchersByDir.keys())
|
|
14414
|
-
if (normalized === watched || normalized.startsWith(watched + "/"))
|
|
14415
|
-
return;
|
|
14416
|
-
for (let [watched, watcher] of this.watchersByDir)
|
|
14417
|
-
watched.startsWith(normalized + "/") && (watcher.close(), this.watchersByDir.delete(watched));
|
|
14418
|
-
try {
|
|
14419
|
-
let watcher = watch(dir, { recursive: !0 }, (eventType, filename) => {
|
|
14420
|
-
if (!filename)
|
|
14421
|
-
return;
|
|
14422
|
-
let filePath = path2.resolve(dir, filename).replace(/\\/g, "/");
|
|
14423
|
-
if (filePath.includes("/node_modules/") || filePath.includes("/.git/"))
|
|
14424
|
-
return;
|
|
14425
|
-
let existing = this.pendingEvents.get(filePath);
|
|
14426
|
-
existing && clearTimeout(existing), this.pendingEvents.set(
|
|
14427
|
-
filePath,
|
|
14428
|
-
setTimeout(() => {
|
|
14429
|
-
this.pendingEvents.delete(filePath), eventType === "rename" ? existsSync2(filePath) ? this.handleFileEvent(filePath, "created") : this.handleFileEvent(filePath, "deleted") : this.handleFileEvent(filePath, "changed");
|
|
14430
|
-
}, 50)
|
|
14431
|
-
);
|
|
14432
|
-
});
|
|
14433
|
-
watcher.unref(), this.watchersByDir.set(normalized, watcher);
|
|
14434
|
-
} catch (err) {
|
|
14435
|
-
logger2.debug(`[reactComponentMeta] Failed to watch directory ${normalized}: ${err}`);
|
|
14436
|
-
}
|
|
14437
|
-
}
|
|
14438
|
-
stopWatching() {
|
|
14439
|
-
for (let timeout of this.pendingEvents.values())
|
|
14440
|
-
clearTimeout(timeout);
|
|
14441
|
-
this.pendingEvents.clear();
|
|
14442
|
-
for (let watcher of this.watchersByDir.values())
|
|
14443
|
-
watcher.close();
|
|
14444
|
-
this.watchersByDir.clear(), this.watching = !1;
|
|
14445
|
-
}
|
|
14446
|
-
/**
|
|
14447
|
-
* Map raw fs.watch events to LSP-style FileChangeType before broadcasting.
|
|
14448
|
-
*
|
|
14449
|
-
* Fs.watch reports atomic saves (sed -i, editors) as `rename` → we classify as `created` (file
|
|
14450
|
-
* exists after rename). But an IDE/LSP would report an atomic save of an _existing_ file as
|
|
14451
|
-
* `Changed`, not `Created`.
|
|
14452
|
-
*
|
|
14453
|
-
* We reclassify here so that onFilesChanged stays 1:1 with Volar Kit.
|
|
14454
|
-
*/
|
|
14455
|
-
handleFileEvent(filePath, type) {
|
|
14456
|
-
if (type === "created") {
|
|
14457
|
-
for (let project of this.configProjects.values())
|
|
14458
|
-
if (project.hasSourceFile(filePath)) {
|
|
14459
|
-
type = "changed";
|
|
14460
|
-
break;
|
|
14461
|
-
}
|
|
14462
|
-
type === "created" && this.inferredProject?.hasSourceFile(filePath) && (type = "changed");
|
|
14463
|
-
}
|
|
14464
|
-
let basename3 = path2.basename(filePath);
|
|
14465
|
-
if (rootTsConfigNames.includes(basename3)) {
|
|
14466
|
-
this.onConfigChanged(filePath, type);
|
|
14467
|
-
return;
|
|
14468
|
-
}
|
|
14469
|
-
this.onFilesChanged([{ filePath, type }]);
|
|
14470
|
-
}
|
|
14471
|
-
dispose() {
|
|
14472
|
-
this.stopWatching();
|
|
14473
|
-
for (let project of this.configProjects.values())
|
|
14474
|
-
project.dispose();
|
|
14475
|
-
this.inferredProject?.dispose(), this.configProjects.clear(), this.inferredProject = void 0, this.fsFileSnapshots.clear(), this.searchedDirs.clear(), this.rootTsConfigs.clear();
|
|
14476
|
-
}
|
|
14477
14202
|
};
|
|
14478
|
-
function sortTSConfigs(file, a, b) {
|
|
14479
|
-
let inA = isFileInDir(file, path2.dirname(a)), inB = isFileInDir(file, path2.dirname(b));
|
|
14480
|
-
if (inA !== inB)
|
|
14481
|
-
return (inB ? 1 : 0) - (inA ? 1 : 0);
|
|
14482
|
-
let aLength = a.split("/").length, bLength = b.split("/").length;
|
|
14483
|
-
if (aLength === bLength) {
|
|
14484
|
-
let aWeight = path2.basename(a) === "tsconfig.json" ? 1 : 0;
|
|
14485
|
-
return (path2.basename(b) === "tsconfig.json" ? 1 : 0) - aWeight;
|
|
14486
|
-
}
|
|
14487
|
-
return bLength - aLength;
|
|
14488
|
-
}
|
|
14489
|
-
function isFileInDir(fileName, dir) {
|
|
14490
|
-
let relative3 = path2.relative(dir, fileName);
|
|
14491
|
-
return !!relative3 && !relative3.startsWith("..") && !path2.isAbsolute(relative3);
|
|
14492
|
-
}
|
|
14493
14203
|
|
|
14494
14204
|
// ../../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
14495
14205
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
14496
14206
|
function normalizeWindowsPath(input = "") {
|
|
14497
14207
|
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
14498
14208
|
}
|
|
14499
|
-
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/, _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/, sep = "/", delimiter = ":", normalize = function(
|
|
14500
|
-
if (
|
|
14209
|
+
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/, _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/, sep = "/", delimiter = ":", normalize = function(path3) {
|
|
14210
|
+
if (path3.length === 0)
|
|
14501
14211
|
return ".";
|
|
14502
|
-
|
|
14503
|
-
let isUNCPath =
|
|
14504
|
-
return
|
|
14505
|
-
},
|
|
14212
|
+
path3 = normalizeWindowsPath(path3);
|
|
14213
|
+
let isUNCPath = path3.match(_UNC_REGEX), isPathAbsolute = isAbsolute2(path3), trailingSeparator = path3[path3.length - 1] === "/";
|
|
14214
|
+
return path3 = normalizeString(path3, !isPathAbsolute), path3.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path3 += "/"), _DRIVE_LETTER_RE.test(path3) && (path3 += "/"), isUNCPath ? isPathAbsolute ? `//${path3}` : `//./${path3}` : isPathAbsolute && !isAbsolute2(path3) ? `/${path3}` : path3);
|
|
14215
|
+
}, join3 = function(...arguments_) {
|
|
14506
14216
|
if (arguments_.length === 0)
|
|
14507
14217
|
return ".";
|
|
14508
14218
|
let joined;
|
|
@@ -14513,20 +14223,20 @@ var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)
|
|
|
14513
14223
|
function cwd() {
|
|
14514
14224
|
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
14515
14225
|
}
|
|
14516
|
-
var
|
|
14226
|
+
var resolve2 = function(...arguments_) {
|
|
14517
14227
|
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
14518
14228
|
let resolvedPath = "", resolvedAbsolute = !1;
|
|
14519
14229
|
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
14520
|
-
let
|
|
14521
|
-
!
|
|
14230
|
+
let path3 = index >= 0 ? arguments_[index] : cwd();
|
|
14231
|
+
!path3 || path3.length === 0 || (resolvedPath = `${path3}/${resolvedPath}`, resolvedAbsolute = isAbsolute2(path3));
|
|
14522
14232
|
}
|
|
14523
|
-
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !
|
|
14233
|
+
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute2(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
14524
14234
|
};
|
|
14525
|
-
function normalizeString(
|
|
14235
|
+
function normalizeString(path3, allowAboveRoot) {
|
|
14526
14236
|
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
14527
|
-
for (let index = 0; index <=
|
|
14528
|
-
if (index <
|
|
14529
|
-
char =
|
|
14237
|
+
for (let index = 0; index <= path3.length; ++index) {
|
|
14238
|
+
if (index < path3.length)
|
|
14239
|
+
char = path3[index];
|
|
14530
14240
|
else {
|
|
14531
14241
|
if (char === "/")
|
|
14532
14242
|
break;
|
|
@@ -14546,21 +14256,21 @@ function normalizeString(path4, allowAboveRoot) {
|
|
|
14546
14256
|
}
|
|
14547
14257
|
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
14548
14258
|
} else
|
|
14549
|
-
res.length > 0 ? res += `/${
|
|
14259
|
+
res.length > 0 ? res += `/${path3.slice(lastSlash + 1, index)}` : res = path3.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
14550
14260
|
lastSlash = index, dots = 0;
|
|
14551
14261
|
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
14552
14262
|
}
|
|
14553
14263
|
return res;
|
|
14554
14264
|
}
|
|
14555
|
-
var
|
|
14265
|
+
var isAbsolute2 = function(p) {
|
|
14556
14266
|
return _IS_ABSOLUTE_RE.test(p);
|
|
14557
14267
|
}, toNamespacedPath = function(p) {
|
|
14558
14268
|
return normalizeWindowsPath(p);
|
|
14559
14269
|
}, _EXTNAME_RE = /.(\.[^./]+)$/, extname = function(p) {
|
|
14560
14270
|
let match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
14561
14271
|
return match && match[1] || "";
|
|
14562
|
-
},
|
|
14563
|
-
let _from =
|
|
14272
|
+
}, relative = function(from, to) {
|
|
14273
|
+
let _from = resolve2(from).replace(_ROOT_FOLDER_RE, "$1").split("/"), _to = resolve2(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
14564
14274
|
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
|
|
14565
14275
|
return _to.join("/");
|
|
14566
14276
|
let _fromCopy = [..._from];
|
|
@@ -14570,40 +14280,40 @@ var isAbsolute3 = function(p) {
|
|
|
14570
14280
|
_from.shift(), _to.shift();
|
|
14571
14281
|
}
|
|
14572
14282
|
return [..._from.map(() => ".."), ..._to].join("/");
|
|
14573
|
-
},
|
|
14283
|
+
}, dirname3 = function(p) {
|
|
14574
14284
|
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
14575
|
-
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (
|
|
14285
|
+
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute2(p) ? "/" : ".");
|
|
14576
14286
|
}, format = function(p) {
|
|
14577
14287
|
let segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
|
|
14578
14288
|
return normalizeWindowsPath(
|
|
14579
|
-
p.root ?
|
|
14289
|
+
p.root ? resolve2(...segments) : segments.join("/")
|
|
14580
14290
|
);
|
|
14581
|
-
},
|
|
14291
|
+
}, basename = function(p, extension) {
|
|
14582
14292
|
let lastSegment = normalizeWindowsPath(p).split("/").pop();
|
|
14583
14293
|
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
14584
14294
|
}, parse = function(p) {
|
|
14585
|
-
let root = normalizeWindowsPath(p).split("/").shift() || "/", base2 =
|
|
14295
|
+
let root = normalizeWindowsPath(p).split("/").shift() || "/", base2 = basename(p), extension = extname(base2);
|
|
14586
14296
|
return {
|
|
14587
14297
|
root,
|
|
14588
|
-
dir:
|
|
14298
|
+
dir: dirname3(p),
|
|
14589
14299
|
base: base2,
|
|
14590
14300
|
ext: extension,
|
|
14591
14301
|
name: base2.slice(0, base2.length - extension.length)
|
|
14592
14302
|
};
|
|
14593
|
-
},
|
|
14303
|
+
}, path2 = {
|
|
14594
14304
|
__proto__: null,
|
|
14595
|
-
basename
|
|
14305
|
+
basename,
|
|
14596
14306
|
delimiter,
|
|
14597
|
-
dirname:
|
|
14307
|
+
dirname: dirname3,
|
|
14598
14308
|
extname,
|
|
14599
14309
|
format,
|
|
14600
|
-
isAbsolute:
|
|
14601
|
-
join:
|
|
14310
|
+
isAbsolute: isAbsolute2,
|
|
14311
|
+
join: join3,
|
|
14602
14312
|
normalize,
|
|
14603
14313
|
normalizeString,
|
|
14604
14314
|
parse,
|
|
14605
|
-
relative
|
|
14606
|
-
resolve:
|
|
14315
|
+
relative,
|
|
14316
|
+
resolve: resolve2,
|
|
14607
14317
|
sep,
|
|
14608
14318
|
toNamespacedPath
|
|
14609
14319
|
};
|
|
@@ -14628,7 +14338,7 @@ import {
|
|
|
14628
14338
|
var CUSTOM_CAPTION = "custom", OBJECT_CAPTION = "object", ARRAY_CAPTION = "array", CLASS_CAPTION = "class", FUNCTION_CAPTION = "func", ELEMENT_CAPTION = "element";
|
|
14629
14339
|
|
|
14630
14340
|
// src/docs/lib/generateCode.ts
|
|
14631
|
-
var import_escodegen = __toESM(require_escodegen(), 1),
|
|
14341
|
+
var import_escodegen = __toESM(require_escodegen(), 1), import_ts_dedent = __toESM(require_dist(), 1), BASIC_OPTIONS = {
|
|
14632
14342
|
format: {
|
|
14633
14343
|
indent: {
|
|
14634
14344
|
style: " "
|
|
@@ -14658,7 +14368,7 @@ function generateArrayCode(ast, compact = !1) {
|
|
|
14658
14368
|
}
|
|
14659
14369
|
function generateMultilineArrayCode(ast) {
|
|
14660
14370
|
let result = generateCode(ast);
|
|
14661
|
-
return result.endsWith(" }]") && (result = (0,
|
|
14371
|
+
return result.endsWith(" }]") && (result = (0, import_ts_dedent.dedent)(result)), result;
|
|
14662
14372
|
}
|
|
14663
14373
|
function generateCompactArrayCode(ast) {
|
|
14664
14374
|
let result = generateCode(ast, !0);
|
|
@@ -15797,9 +15507,9 @@ var extractArgTypes = (component) => {
|
|
|
15797
15507
|
};
|
|
15798
15508
|
|
|
15799
15509
|
// src/componentManifest/reactDocgen.ts
|
|
15800
|
-
var
|
|
15801
|
-
import { existsSync as
|
|
15802
|
-
import { dirname as
|
|
15510
|
+
var import_ts_dedent2 = __toESM(require_dist(), 1), TsconfigPaths = __toESM(require_lib2(), 1);
|
|
15511
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
15512
|
+
import { dirname as dirname4, sep as sep2 } from "node:path";
|
|
15803
15513
|
import { babelParse, types as t } from "storybook/internal/babel";
|
|
15804
15514
|
import { supportedExtensions as supportedExtensions2 } from "storybook/internal/common";
|
|
15805
15515
|
import { extractJSDocInfo } from "storybook/internal/csf-tools";
|
|
@@ -15853,16 +15563,16 @@ var ReactDocgenResolveError = class extends Error {
|
|
|
15853
15563
|
// src/componentManifest/reactDocgen/exportNameHandler.ts
|
|
15854
15564
|
import { utils as utils2 } from "react-docgen";
|
|
15855
15565
|
var { isReactForwardRefCall: isReactForwardRefCall2 } = utils2;
|
|
15856
|
-
function nameFromId(
|
|
15857
|
-
if (
|
|
15858
|
-
if (
|
|
15859
|
-
return
|
|
15860
|
-
if (
|
|
15861
|
-
return
|
|
15566
|
+
function nameFromId(path3) {
|
|
15567
|
+
if (path3) {
|
|
15568
|
+
if (path3.isIdentifier())
|
|
15569
|
+
return path3.node.name;
|
|
15570
|
+
if (path3.isStringLiteral())
|
|
15571
|
+
return path3.node.value;
|
|
15862
15572
|
}
|
|
15863
15573
|
}
|
|
15864
|
-
function isInlineDefaultExport(
|
|
15865
|
-
let p =
|
|
15574
|
+
function isInlineDefaultExport(path3) {
|
|
15575
|
+
let p = path3;
|
|
15866
15576
|
for (; p && p.parentPath; ) {
|
|
15867
15577
|
if (p.parentPath.isExportDefaultDeclaration())
|
|
15868
15578
|
return !0;
|
|
@@ -15870,8 +15580,8 @@ function isInlineDefaultExport(path4) {
|
|
|
15870
15580
|
}
|
|
15871
15581
|
return !1;
|
|
15872
15582
|
}
|
|
15873
|
-
function findProgram(
|
|
15874
|
-
let found =
|
|
15583
|
+
function findProgram(path3) {
|
|
15584
|
+
let found = path3.findParent((p) => p.isProgram());
|
|
15875
15585
|
return found && found.isProgram() ? found : void 0;
|
|
15876
15586
|
}
|
|
15877
15587
|
function getLocalName(componentDefinition, fallback) {
|
|
@@ -15984,13 +15694,13 @@ var getTsConfig = cached(
|
|
|
15984
15694
|
},
|
|
15985
15695
|
{ name: "getTsConfig" }
|
|
15986
15696
|
), parseWithReactDocgen = cached(
|
|
15987
|
-
(code,
|
|
15697
|
+
(code, path3) => parse6(code, {
|
|
15988
15698
|
resolver: defaultResolver2,
|
|
15989
15699
|
handlers,
|
|
15990
15700
|
importer: getReactDocgenImporter(),
|
|
15991
|
-
filename:
|
|
15701
|
+
filename: path3
|
|
15992
15702
|
}),
|
|
15993
|
-
{ key: (code,
|
|
15703
|
+
{ key: (code, path3) => path3, name: "parseWithReactDocgen" }
|
|
15994
15704
|
), getExportPaths = cached(
|
|
15995
15705
|
(code, filePath) => {
|
|
15996
15706
|
let ast;
|
|
@@ -15999,7 +15709,7 @@ var getTsConfig = cached(
|
|
|
15999
15709
|
} catch {
|
|
16000
15710
|
return [];
|
|
16001
15711
|
}
|
|
16002
|
-
let basedir =
|
|
15712
|
+
let basedir = dirname4(filePath);
|
|
16003
15713
|
return ast.program.body.flatMap(
|
|
16004
15714
|
(statement) => t.isExportAllDeclaration(statement) ? [statement.source.value] : t.isExportNamedDeclaration(statement) && statement.source && !statement.declaration ? [statement.source.value] : []
|
|
16005
15715
|
).map((id) => matchPath(id, basedir)).flatMap((id) => {
|
|
@@ -16012,16 +15722,16 @@ var getTsConfig = cached(
|
|
|
16012
15722
|
},
|
|
16013
15723
|
{ name: "getExportPaths" }
|
|
16014
15724
|
), gatherDocgensForPath = cached(
|
|
16015
|
-
(
|
|
16016
|
-
if (
|
|
15725
|
+
(path3, depth) => {
|
|
15726
|
+
if (path3.includes("node_modules"))
|
|
16017
15727
|
return {
|
|
16018
15728
|
docgens: [],
|
|
16019
15729
|
errors: [
|
|
16020
15730
|
{
|
|
16021
|
-
path:
|
|
15731
|
+
path: path3,
|
|
16022
15732
|
code: "/* File in node_modules */",
|
|
16023
15733
|
name: "Component file in node_modules",
|
|
16024
|
-
message:
|
|
15734
|
+
message: import_ts_dedent2.dedent`
|
|
16025
15735
|
Component files in node_modules are not supported.
|
|
16026
15736
|
The distributed files in node_modules usually don't contain the necessary comments or types needed to analyze component information.
|
|
16027
15737
|
Configure TypeScript path aliases to map your package name to the source file instead.
|
|
@@ -16047,16 +15757,16 @@ var getTsConfig = cached(
|
|
|
16047
15757
|
};
|
|
16048
15758
|
let code;
|
|
16049
15759
|
try {
|
|
16050
|
-
code = cachedReadFileSync(
|
|
15760
|
+
code = cachedReadFileSync(path3, "utf-8");
|
|
16051
15761
|
} catch {
|
|
16052
15762
|
return {
|
|
16053
15763
|
docgens: [],
|
|
16054
15764
|
errors: [
|
|
16055
15765
|
{
|
|
16056
|
-
path:
|
|
15766
|
+
path: path3,
|
|
16057
15767
|
code: "/* File not found or unreadable */",
|
|
16058
15768
|
name: "Component file could not be read",
|
|
16059
|
-
message: `Could not read the component file located at "${
|
|
15769
|
+
message: `Could not read the component file located at "${path3}".
|
|
16060
15770
|
Prefer relative imports if possible.`
|
|
16061
15771
|
}
|
|
16062
15772
|
]
|
|
@@ -16067,10 +15777,10 @@ Prefer relative imports if possible.`
|
|
|
16067
15777
|
docgens: [],
|
|
16068
15778
|
errors: [
|
|
16069
15779
|
{
|
|
16070
|
-
path:
|
|
15780
|
+
path: path3,
|
|
16071
15781
|
code,
|
|
16072
15782
|
name: "Max re-export depth exceeded",
|
|
16073
|
-
message:
|
|
15783
|
+
message: import_ts_dedent2.dedent`
|
|
16074
15784
|
Traversal stopped after 5 steps while following re-exports starting from this file.
|
|
16075
15785
|
This usually indicates a deep or circular re-export chain. Try one of the following:
|
|
16076
15786
|
- Import the component file directly (e.g., src/components/Button.tsx),
|
|
@@ -16079,10 +15789,10 @@ Prefer relative imports if possible.`
|
|
|
16079
15789
|
}
|
|
16080
15790
|
]
|
|
16081
15791
|
};
|
|
16082
|
-
let exportPaths = getExportPaths(code,
|
|
15792
|
+
let exportPaths = getExportPaths(code, path3).map((p) => gatherDocgensForPath(p, depth + 1)), docgens = exportPaths.flatMap((r) => r.docgens), errors = exportPaths.flatMap((r) => r.errors);
|
|
16083
15793
|
try {
|
|
16084
15794
|
return {
|
|
16085
|
-
docgens: [...parseWithReactDocgen(code,
|
|
15795
|
+
docgens: [...parseWithReactDocgen(code, path3), ...docgens],
|
|
16086
15796
|
errors
|
|
16087
15797
|
};
|
|
16088
15798
|
} catch (e) {
|
|
@@ -16091,10 +15801,10 @@ Prefer relative imports if possible.`
|
|
|
16091
15801
|
docgens,
|
|
16092
15802
|
errors: [
|
|
16093
15803
|
{
|
|
16094
|
-
path:
|
|
15804
|
+
path: path3,
|
|
16095
15805
|
code,
|
|
16096
15806
|
name: "No component definition found",
|
|
16097
|
-
message:
|
|
15807
|
+
message: import_ts_dedent2.dedent`
|
|
16098
15808
|
${message}
|
|
16099
15809
|
You can debug your component file in this playground: https://react-docgen.dev/playground
|
|
16100
15810
|
`
|
|
@@ -16106,12 +15816,12 @@ Prefer relative imports if possible.`
|
|
|
16106
15816
|
},
|
|
16107
15817
|
{ name: "gatherDocgensWithTrace", key: (filePath) => filePath }
|
|
16108
15818
|
), getReactDocgen = cached(
|
|
16109
|
-
(
|
|
16110
|
-
let { docgens, errors } = gatherDocgensForPath(
|
|
15819
|
+
(path3, component) => {
|
|
15820
|
+
let { docgens, errors } = gatherDocgensForPath(path3, 0), docgen = getMatchingDocgen(docgens, component);
|
|
16111
15821
|
return docgen ? { type: "success", data: docgen } : { type: "error", error: {
|
|
16112
15822
|
name: errors.at(-1)?.name ?? "No component definition found",
|
|
16113
15823
|
message: errors.map(
|
|
16114
|
-
(e) =>
|
|
15824
|
+
(e) => import_ts_dedent2.dedent`
|
|
16115
15825
|
File: ${e.path}
|
|
16116
15826
|
Error:
|
|
16117
15827
|
${e.message}
|
|
@@ -16122,7 +15832,7 @@ Prefer relative imports if possible.`
|
|
|
16122
15832
|
`)
|
|
16123
15833
|
} };
|
|
16124
15834
|
},
|
|
16125
|
-
{ name: "getReactDocgen", key: (
|
|
15835
|
+
{ name: "getReactDocgen", key: (path3, component) => path3 + JSON.stringify(component) }
|
|
16126
15836
|
);
|
|
16127
15837
|
function getReactDocgenImporter() {
|
|
16128
15838
|
return makeFsImporter((filename, basedir) => {
|
|
@@ -16132,7 +15842,7 @@ function getReactDocgenImporter() {
|
|
|
16132
15842
|
`${sep2}react-native${sep2}index.js`,
|
|
16133
15843
|
`${sep2}react-native-web${sep2}dist${sep2}index.js`
|
|
16134
15844
|
);
|
|
16135
|
-
if (
|
|
15845
|
+
if (existsSync2(replaced) && supportedExtensions2.find((ext) => result.endsWith(ext)))
|
|
16136
15846
|
return replaced;
|
|
16137
15847
|
}
|
|
16138
15848
|
if (supportedExtensions2.find((ext) => result.endsWith(ext)))
|
|
@@ -16146,7 +15856,7 @@ function getImportTag(docgen) {
|
|
|
16146
15856
|
}
|
|
16147
15857
|
|
|
16148
15858
|
// src/componentManifest/reactDocgenTypescript.ts
|
|
16149
|
-
import { dirname as
|
|
15859
|
+
import { dirname as dirname5 } from "node:path";
|
|
16150
15860
|
import { logger as logger4 } from "storybook/internal/node-logger";
|
|
16151
15861
|
var typeScriptPromise, reactDocgenTypescriptPromise, loadTypeScript = () => typeScriptPromise ??= import("typescript"), loadReactDocgenTypescript = () => reactDocgenTypescriptPromise ??= import("react-docgen-typescript"), LARGE_NON_USER_SOURCE_THRESHOLD = 30, getPropSource = (prop) => prop.parent?.fileName ?? prop.declarations?.[0]?.fileName, getLargeNonUserPropSources = (props) => {
|
|
16152
15862
|
let countBySource = /* @__PURE__ */ new Map();
|
|
@@ -16207,7 +15917,7 @@ async function getParser(userOptions) {
|
|
|
16207
15917
|
let { config } = typescript.readConfigFile(configPath, typescript.sys.readFile), parsed = typescript.parseJsonConfigFileContent(
|
|
16208
15918
|
config,
|
|
16209
15919
|
typescript.sys,
|
|
16210
|
-
|
|
15920
|
+
dirname5(configPath)
|
|
16211
15921
|
);
|
|
16212
15922
|
cachedCompilerOptions = { ...parsed.options, noErrorTruncation: !0 }, cachedFileNames = parsed.fileNames;
|
|
16213
15923
|
} else
|
|
@@ -16245,7 +15955,7 @@ function matchComponentDoc(docs, {
|
|
|
16245
15955
|
(doc) => doc.exportName === importName || doc.exportName === localImportName || doc.displayName === importName || doc.displayName === localImportName || doc.displayName === componentName
|
|
16246
15956
|
);
|
|
16247
15957
|
}
|
|
16248
|
-
function getReactDocgenTypescriptError(
|
|
15958
|
+
function getReactDocgenTypescriptError(path3, {
|
|
16249
15959
|
importName,
|
|
16250
15960
|
localImportName,
|
|
16251
15961
|
componentName
|
|
@@ -16253,14 +15963,14 @@ function getReactDocgenTypescriptError(path4, {
|
|
|
16253
15963
|
return docs.length === 0 ? {
|
|
16254
15964
|
name: "react-docgen-typescript found no component docs",
|
|
16255
15965
|
message: [
|
|
16256
|
-
`File: ${
|
|
15966
|
+
`File: ${path3}`,
|
|
16257
15967
|
"react-docgen-typescript did not return any component docs for this file."
|
|
16258
15968
|
].join(`
|
|
16259
15969
|
`)
|
|
16260
15970
|
} : {
|
|
16261
15971
|
name: "react-docgen-typescript could not match component docs",
|
|
16262
15972
|
message: [
|
|
16263
|
-
`File: ${
|
|
15973
|
+
`File: ${path3}`,
|
|
16264
15974
|
"react-docgen-typescript returned component docs for this file, but none matched the story's component import.",
|
|
16265
15975
|
`Looked for: componentName=${componentName}, localImportName=${localImportName ?? "<none>"}, importName=${importName ?? "<none>"}.`
|
|
16266
15976
|
].join(`
|
|
@@ -16292,74 +16002,30 @@ var parseWithReactDocgenTypescript = asyncCache(
|
|
|
16292
16002
|
|
|
16293
16003
|
// src/componentManifest/generateCodeSnippet.ts
|
|
16294
16004
|
import { types as t2 } from "storybook/internal/babel";
|
|
16005
|
+
import {
|
|
16006
|
+
argsRecordFromObjectPath,
|
|
16007
|
+
keyOf,
|
|
16008
|
+
metaObjectPath,
|
|
16009
|
+
mergeArgsRecords,
|
|
16010
|
+
metaArgsRecord,
|
|
16011
|
+
normalizeStoryDeclaration,
|
|
16012
|
+
resolveRenderFunction,
|
|
16013
|
+
storyAssignedArgsPath
|
|
16014
|
+
} from "storybook/internal/csf-tools";
|
|
16295
16015
|
function getCodeSnippet(csf, storyName, componentName) {
|
|
16296
16016
|
let storyDeclaration = csf._storyDeclarationPath[storyName], metaObj = csf._metaNode;
|
|
16297
16017
|
if (!storyDeclaration) {
|
|
16298
16018
|
let message = "Expected story to be a function or variable declaration";
|
|
16299
16019
|
throw csf._storyPaths[storyName]?.buildCodeFrameError(message) ?? message;
|
|
16300
16020
|
}
|
|
16301
|
-
let
|
|
16302
|
-
|
|
16303
|
-
|
|
16304
|
-
else if (storyDeclaration.isVariableDeclarator()) {
|
|
16305
|
-
let init = storyDeclaration.get("init");
|
|
16306
|
-
invariant(
|
|
16307
|
-
init.isExpression(),
|
|
16308
|
-
() => storyDeclaration.buildCodeFrameError("Expected story initializer to be an expression").message
|
|
16309
|
-
), storyPath = init;
|
|
16310
|
-
} else
|
|
16311
|
-
throw storyDeclaration.buildCodeFrameError(
|
|
16312
|
-
"Expected story to be a function or variable declaration"
|
|
16313
|
-
);
|
|
16314
|
-
let normalizedPath = storyPath;
|
|
16315
|
-
if (storyPath.isCallExpression()) {
|
|
16316
|
-
let callee = storyPath.get("callee");
|
|
16317
|
-
if (callee.isMemberExpression()) {
|
|
16318
|
-
let obj = callee.get("object"), prop = callee.get("property"), isBind = prop.isIdentifier() && prop.node.name === "bind" || t2.isStringLiteral(prop.node) && prop.node.value === "bind";
|
|
16319
|
-
if (obj.isIdentifier() && isBind) {
|
|
16320
|
-
let resolved = resolveIdentifierInit(storyDeclaration, obj);
|
|
16321
|
-
resolved && (normalizedPath = resolved);
|
|
16322
|
-
}
|
|
16323
|
-
}
|
|
16324
|
-
if (storyPath === normalizedPath) {
|
|
16325
|
-
let args = storyPath.get("arguments");
|
|
16326
|
-
if (args.length !== 0) {
|
|
16327
|
-
invariant(
|
|
16328
|
-
args.length === 1,
|
|
16329
|
-
() => storyPath.buildCodeFrameError("Could not evaluate story expression").message
|
|
16330
|
-
);
|
|
16331
|
-
let storyArg = args[0];
|
|
16332
|
-
invariant(
|
|
16333
|
-
storyArg.isExpression(),
|
|
16334
|
-
() => storyPath.buildCodeFrameError("Could not evaluate story expression").message
|
|
16335
|
-
), normalizedPath = storyArg;
|
|
16336
|
-
}
|
|
16337
|
-
}
|
|
16338
|
-
}
|
|
16339
|
-
normalizedPath = normalizedPath.isTSSatisfiesExpression() || normalizedPath.isTSAsExpression() ? normalizedPath.get("expression") : normalizedPath;
|
|
16340
|
-
let storyFn;
|
|
16341
|
-
if (normalizedPath.isArrowFunctionExpression() || normalizedPath.isFunctionExpression() || normalizedPath.isFunctionDeclaration())
|
|
16342
|
-
storyFn = normalizedPath;
|
|
16343
|
-
else if (!normalizedPath.isObjectExpression() && !(normalizedPath.isCallExpression() && Array.isArray(normalizedPath.node.arguments) && normalizedPath.node.arguments.length === 0))
|
|
16344
|
-
throw normalizedPath.buildCodeFrameError(
|
|
16345
|
-
"Expected story to be csf factory, function or an object expression"
|
|
16346
|
-
);
|
|
16347
|
-
let storyProps = normalizedPath.isObjectExpression() ? normalizedPath.get("properties").filter((p) => p.isObjectProperty()) : [], metaPath = pathForNode(csf._file.path, metaObj), metaProps = metaPath?.isObjectExpression() ? metaPath.get("properties").filter((p) => p.isObjectProperty()) : [], getRenderPath = (object) => {
|
|
16348
|
-
let renderPath = object.find((p) => keyOf(p.node) === "render")?.get("value");
|
|
16349
|
-
if (!renderPath)
|
|
16350
|
-
return { kind: "missing" };
|
|
16351
|
-
if (renderPath.isIdentifier()) {
|
|
16352
|
-
let resolved = resolveIdentifierInit(storyDeclaration, renderPath);
|
|
16353
|
-
return resolved && (resolved.isArrowFunctionExpression() || resolved.isFunctionExpression() || resolved.isFunctionDeclaration()) ? { kind: "resolved", path: resolved } : { kind: "unresolved" };
|
|
16354
|
-
}
|
|
16355
|
-
if (!(renderPath.isArrowFunctionExpression() || renderPath.isFunctionExpression()))
|
|
16356
|
-
throw renderPath.buildCodeFrameError(
|
|
16357
|
-
"Expected render to be an arrow function or function expression"
|
|
16358
|
-
);
|
|
16359
|
-
return { kind: "resolved", path: renderPath };
|
|
16360
|
-
}, metaRender = getRenderPath(metaProps), storyRender = getRenderPath(storyProps);
|
|
16021
|
+
let normalizedStory = normalizeStoryDeclaration(storyDeclaration), storyFn;
|
|
16022
|
+
normalizedStory.type === "fn" && (storyFn = normalizedStory.path);
|
|
16023
|
+
let storyProps = normalizedStory.type === "config" ? normalizedStory.path.get("properties").filter((p) => p.isObjectProperty()) : [], metaProps = metaObjectPath(csf)?.get("properties").filter((p) => p.isObjectProperty()) ?? [], metaRender = resolveRenderFunction(metaProps, storyDeclaration), storyRender = resolveRenderFunction(storyProps, storyDeclaration);
|
|
16361
16024
|
storyFn || (storyFn = storyRender.kind === "resolved" ? storyRender.path : storyRender.kind === "missing" && metaRender.kind === "resolved" ? metaRender.path : void 0);
|
|
16362
|
-
let metaArgs = metaArgsRecord(metaObj ?? null), storyArgsPath = storyProps.filter((p) => keyOf(p.node) === "args").map((p) => p.get("value")).find((v) => v.isObjectExpression()), storyArgs = argsRecordFromObjectPath(storyArgsPath),
|
|
16025
|
+
let metaArgs = metaArgsRecord(metaObj ?? null), storyArgsPath = storyProps.filter((p) => keyOf(p.node) === "args").map((p) => p.get("value")).find((v) => v.isObjectExpression()), storyArgs = argsRecordFromObjectPath(storyArgsPath), assignedArgsPath = storyAssignedArgsPath(csf._file.path, storyName), storyAssignedArgs = argsRecordFromObjectPath(assignedArgsPath), merged = {
|
|
16026
|
+
...mergeArgsRecords(metaArgs, storyArgs),
|
|
16027
|
+
...storyAssignedArgs
|
|
16028
|
+
}, entries = Object.entries(merged).filter(([k]) => k !== "children"), validEntries = entries.filter(([k, v]) => isValidJsxAttrName(k) && v != null), invalidEntries = entries.filter(([k, v]) => !isValidJsxAttrName(k) && v != null), injectedAttrs = validEntries.map(([k, v]) => toAttr(k, v)).filter((a) => a != null);
|
|
16363
16029
|
if (storyFn) {
|
|
16364
16030
|
let fn = storyFn.node;
|
|
16365
16031
|
if (t2.isArrowFunctionExpression(fn) && (t2.isJSXElement(fn.body) || t2.isJSXFragment(fn.body))) {
|
|
@@ -16417,31 +16083,7 @@ function buildInvalidSpread(entries) {
|
|
|
16417
16083
|
);
|
|
16418
16084
|
return t2.jsxSpreadAttribute(t2.objectExpression(objectProps));
|
|
16419
16085
|
}
|
|
16420
|
-
var
|
|
16421
|
-
objPath.get("properties").filter((p) => p.isObjectProperty()).map((p) => [keyOf(p.node), p.get("value").node]).filter((e) => !!e[0])
|
|
16422
|
-
) : {};
|
|
16423
|
-
function storyArgsAssignmentPath(program, storyName) {
|
|
16424
|
-
let found = null;
|
|
16425
|
-
return program.traverse({
|
|
16426
|
-
AssignmentExpression(p) {
|
|
16427
|
-
let left = p.get("left"), right = p.get("right");
|
|
16428
|
-
if (left.isMemberExpression()) {
|
|
16429
|
-
let obj = left.get("object"), prop = left.get("property"), isStoryIdent = obj.isIdentifier() && obj.node.name === storyName, isArgsProp = prop.isIdentifier() && prop.node.name === "args" && !left.node.computed || t2.isStringLiteral(prop.node) && left.node.computed && prop.node.value === "args";
|
|
16430
|
-
isStoryIdent && isArgsProp && right.isObjectExpression() && (found = right);
|
|
16431
|
-
}
|
|
16432
|
-
}
|
|
16433
|
-
}), found;
|
|
16434
|
-
}
|
|
16435
|
-
var argsRecordFromObjectNode = (obj) => obj ? Object.fromEntries(
|
|
16436
|
-
obj.properties.filter((p) => t2.isObjectProperty(p)).map((p) => [keyOf(p), p.value]).filter((e) => !!e[0])
|
|
16437
|
-
) : {}, metaArgsRecord = (meta) => {
|
|
16438
|
-
if (!meta)
|
|
16439
|
-
return {};
|
|
16440
|
-
let argsProp = meta.properties.find(
|
|
16441
|
-
(p) => t2.isObjectProperty(p) && keyOf(p) === "args"
|
|
16442
|
-
);
|
|
16443
|
-
return argsProp && t2.isObjectExpression(argsProp.value) ? argsRecordFromObjectNode(argsProp.value) : {};
|
|
16444
|
-
}, toAttr = (key, value) => t2.isBooleanLiteral(value) ? value.value ? t2.jsxAttribute(t2.jsxIdentifier(key), null) : t2.jsxAttribute(t2.jsxIdentifier(key), t2.jsxExpressionContainer(value)) : t2.isStringLiteral(value) ? t2.jsxAttribute(t2.jsxIdentifier(key), t2.stringLiteral(value.value)) : t2.isExpression(value) ? t2.jsxAttribute(t2.jsxIdentifier(key), t2.jsxExpressionContainer(value)) : null, toJsxChildren = (node) => node ? t2.isStringLiteral(node) ? [t2.jsxText(node.value)] : t2.isJSXElement(node) || t2.isJSXFragment(node) ? [node] : t2.isExpression(node) ? [t2.jsxExpressionContainer(node)] : [] : [];
|
|
16086
|
+
var isValidJsxAttrName = (n) => /^[A-Za-z_][A-Za-z0-9_:-]*$/.test(n), toAttr = (key, value) => t2.isBooleanLiteral(value) ? value.value ? t2.jsxAttribute(t2.jsxIdentifier(key), null) : t2.jsxAttribute(t2.jsxIdentifier(key), t2.jsxExpressionContainer(value)) : t2.isStringLiteral(value) ? t2.jsxAttribute(t2.jsxIdentifier(key), t2.stringLiteral(value.value)) : t2.isExpression(value) ? t2.jsxAttribute(t2.jsxIdentifier(key), t2.jsxExpressionContainer(value)) : null, toJsxChildren = (node) => node ? t2.isStringLiteral(node) ? [t2.jsxText(node.value)] : t2.isJSXElement(node) || t2.isJSXFragment(node) ? [node] : t2.isExpression(node) ? [t2.jsxExpressionContainer(node)] : [] : [];
|
|
16445
16087
|
function getArgsMemberKey(expr) {
|
|
16446
16088
|
if (t2.isMemberExpression(expr) && t2.isIdentifier(expr.object) && expr.object.name === "args") {
|
|
16447
16089
|
if (t2.isIdentifier(expr.property) && !expr.computed)
|
|
@@ -16539,58 +16181,22 @@ function transformArgsSpreadsInJsx(node, merged) {
|
|
|
16539
16181
|
});
|
|
16540
16182
|
return { node: t2.jsxFragment(node.openingFragment, node.closingFragment, fragChildren), changed };
|
|
16541
16183
|
}
|
|
16542
|
-
function resolveIdentifierInit(storyPath, identifier) {
|
|
16543
|
-
let programPath = storyPath.findParent((p) => p.isProgram());
|
|
16544
|
-
if (!programPath)
|
|
16545
|
-
return null;
|
|
16546
|
-
for (let stmt of programPath.get("body")) {
|
|
16547
|
-
if (stmt.isFunctionDeclaration() && stmt.node.id?.name === identifier.node.name)
|
|
16548
|
-
return stmt;
|
|
16549
|
-
if (stmt.isExportNamedDeclaration()) {
|
|
16550
|
-
let decl = stmt.get("declaration");
|
|
16551
|
-
if (decl.isFunctionDeclaration() && decl.node.id?.name === identifier.node.name)
|
|
16552
|
-
return decl;
|
|
16553
|
-
}
|
|
16554
|
-
}
|
|
16555
|
-
let match = programPath.get("body").flatMap((stmt) => {
|
|
16556
|
-
if (stmt.isVariableDeclaration())
|
|
16557
|
-
return stmt.get("declarations");
|
|
16558
|
-
if (stmt.isExportNamedDeclaration()) {
|
|
16559
|
-
let decl = stmt.get("declaration");
|
|
16560
|
-
if (decl && decl.isVariableDeclaration())
|
|
16561
|
-
return decl.get("declarations");
|
|
16562
|
-
}
|
|
16563
|
-
return [];
|
|
16564
|
-
}).find((d) => {
|
|
16565
|
-
let id = d.get("id");
|
|
16566
|
-
return id.isIdentifier() && id.node.name === identifier.node.name;
|
|
16567
|
-
});
|
|
16568
|
-
if (!match)
|
|
16569
|
-
return null;
|
|
16570
|
-
let init = match.get("init");
|
|
16571
|
-
return init && init.isExpression() ? init : null;
|
|
16572
|
-
}
|
|
16573
|
-
function pathForNode(program, target) {
|
|
16574
|
-
if (!target)
|
|
16575
|
-
return;
|
|
16576
|
-
let found;
|
|
16577
|
-
return program.traverse({
|
|
16578
|
-
enter(p) {
|
|
16579
|
-
p.node && p.node === target && (found = p, p.stop());
|
|
16580
|
-
}
|
|
16581
|
-
}), found;
|
|
16582
|
-
}
|
|
16583
16184
|
|
|
16584
16185
|
// src/componentManifest/resolveComponents.ts
|
|
16585
16186
|
import { recast as recast2 } from "storybook/internal/babel";
|
|
16586
16187
|
import { storyNameFromExport } from "storybook/internal/csf";
|
|
16587
|
-
import {
|
|
16188
|
+
import { extractStoryJSDocInfo, loadCsf } from "storybook/internal/csf-tools";
|
|
16588
16189
|
|
|
16589
16190
|
// src/componentManifest/getComponentImports.ts
|
|
16590
|
-
import { dirname as
|
|
16191
|
+
import { dirname as dirname6 } from "node:path";
|
|
16591
16192
|
import { babelParse as babelParse2, recast, types as t3 } from "storybook/internal/babel";
|
|
16193
|
+
import {
|
|
16194
|
+
collectImportBindings,
|
|
16195
|
+
importedName,
|
|
16196
|
+
isTypeSpecifier
|
|
16197
|
+
} from "storybook/internal/csf-tools";
|
|
16592
16198
|
import { logger as logger5 } from "storybook/internal/node-logger";
|
|
16593
|
-
var baseIdentifier = (component) => component.split(".")[0] ?? component,
|
|
16199
|
+
var baseIdentifier = (component) => component.split(".")[0] ?? component, addUniqueBy = (arr, item, eq2) => {
|
|
16594
16200
|
arr.find(eq2) || arr.push(item);
|
|
16595
16201
|
}, getComponents = async ({
|
|
16596
16202
|
csf,
|
|
@@ -16599,7 +16205,7 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
|
|
|
16599
16205
|
docgenEngine,
|
|
16600
16206
|
additionalComponentNames = []
|
|
16601
16207
|
}) => {
|
|
16602
|
-
let { reactDocgenTypescriptOptions } = typescriptOptions, program = csf._file.path, componentSet = /* @__PURE__ */ new Set(), componentDepth = /* @__PURE__ */ new Map(), localToImport =
|
|
16208
|
+
let { reactDocgenTypescriptOptions } = typescriptOptions, program = csf._file.path, componentSet = /* @__PURE__ */ new Set(), componentDepth = /* @__PURE__ */ new Map(), localToImport = collectImportBindings(program), jsxDepth = 0;
|
|
16603
16209
|
program.traverse({
|
|
16604
16210
|
JSXElement: {
|
|
16605
16211
|
enter() {
|
|
@@ -16627,30 +16233,7 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
|
|
|
16627
16233
|
metaComp && componentSet.add(metaComp);
|
|
16628
16234
|
for (let componentName of additionalComponentNames)
|
|
16629
16235
|
componentSet.add(componentName);
|
|
16630
|
-
let components = Array.from(componentSet).sort((a, b) => a.localeCompare(b)),
|
|
16631
|
-
for (let stmt of body) {
|
|
16632
|
-
if (!stmt.isImportDeclaration())
|
|
16633
|
-
continue;
|
|
16634
|
-
let decl = stmt.node;
|
|
16635
|
-
if (decl.importKind === "type")
|
|
16636
|
-
continue;
|
|
16637
|
-
let specifiers = decl.specifiers ?? [];
|
|
16638
|
-
if (specifiers.length !== 0)
|
|
16639
|
-
for (let s of specifiers) {
|
|
16640
|
-
if (!("local" in s) || !s.local || isTypeSpecifier(s))
|
|
16641
|
-
continue;
|
|
16642
|
-
let importId = decl.source.value;
|
|
16643
|
-
if (t3.isImportDefaultSpecifier(s))
|
|
16644
|
-
localToImport.set(s.local.name, { importId, importName: "default" });
|
|
16645
|
-
else if (t3.isImportNamespaceSpecifier(s))
|
|
16646
|
-
localToImport.set(s.local.name, { importId, importName: "*" });
|
|
16647
|
-
else if (t3.isImportSpecifier(s)) {
|
|
16648
|
-
let imported = importedName(s.imported);
|
|
16649
|
-
localToImport.set(s.local.name, { importId, importName: imported });
|
|
16650
|
-
}
|
|
16651
|
-
}
|
|
16652
|
-
}
|
|
16653
|
-
let isLocallyDefinedWithoutImport = (base2) => {
|
|
16236
|
+
let components = Array.from(componentSet).sort((a, b) => a.localeCompare(b)), isLocallyDefinedWithoutImport = (base2) => {
|
|
16654
16237
|
let binding = program.scope.getBinding(base2);
|
|
16655
16238
|
return binding ? !!!(binding.path.isImportSpecifier?.() || binding.path.isImportDefaultSpecifier?.() || binding.path.isImportNamespaceSpecifier?.()) : !1;
|
|
16656
16239
|
}, filteredComponents = components.filter(
|
|
@@ -16685,47 +16268,47 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
|
|
|
16685
16268
|
importName: direct.importName,
|
|
16686
16269
|
jsxDepth: depth
|
|
16687
16270
|
} : { componentName: c, jsxDepth: depth };
|
|
16688
|
-
})(),
|
|
16271
|
+
})(), path3, isPackage = !1;
|
|
16689
16272
|
try {
|
|
16690
|
-
component.importId && storyFilePath && (
|
|
16691
|
-
basedir:
|
|
16273
|
+
component.importId && storyFilePath && (path3 = cachedResolveImport(matchPath(component.importId, dirname6(storyFilePath)), {
|
|
16274
|
+
basedir: dirname6(storyFilePath)
|
|
16692
16275
|
}));
|
|
16693
16276
|
} catch (e) {
|
|
16694
16277
|
logger5.debug(e);
|
|
16695
16278
|
}
|
|
16696
16279
|
try {
|
|
16697
|
-
component.importId && !component.importId.startsWith(".") && storyFilePath && (cachedResolveImport(component.importId, { basedir:
|
|
16280
|
+
component.importId && !component.importId.startsWith(".") && storyFilePath && (cachedResolveImport(component.importId, { basedir: dirname6(storyFilePath) }), isPackage = !0);
|
|
16698
16281
|
} catch {
|
|
16699
16282
|
}
|
|
16700
16283
|
let componentWithPackage = { ...component, isPackage };
|
|
16701
|
-
if (
|
|
16284
|
+
if (path3) {
|
|
16702
16285
|
if (docgenEngine === "react-docgen-typescript") {
|
|
16703
16286
|
let reactDocgenTypescript, reactDocgenTypescriptError;
|
|
16704
16287
|
try {
|
|
16705
|
-
let docs = await parseWithReactDocgenTypescript(
|
|
16706
|
-
reactDocgenTypescript = matchComponentDoc(docs, component), reactDocgenTypescript || (reactDocgenTypescriptError = getReactDocgenTypescriptError(
|
|
16288
|
+
let docs = await parseWithReactDocgenTypescript(path3, reactDocgenTypescriptOptions);
|
|
16289
|
+
reactDocgenTypescript = matchComponentDoc(docs, component), reactDocgenTypescript || (reactDocgenTypescriptError = getReactDocgenTypescriptError(path3, component, docs));
|
|
16707
16290
|
} catch (e) {
|
|
16708
16291
|
let message = e instanceof Error ? e.message : String(e);
|
|
16709
|
-
logger5.debug(`react-docgen-typescript failed for ${
|
|
16292
|
+
logger5.debug(`react-docgen-typescript failed for ${path3}: ${message}`), reactDocgenTypescriptError = {
|
|
16710
16293
|
name: "react-docgen-typescript parse error",
|
|
16711
|
-
message: `File: ${
|
|
16294
|
+
message: `File: ${path3}
|
|
16712
16295
|
${message}`
|
|
16713
16296
|
};
|
|
16714
16297
|
}
|
|
16715
16298
|
let importOverride = reactDocgenTypescript ? getImportTag(reactDocgenTypescript) : void 0;
|
|
16716
16299
|
return {
|
|
16717
16300
|
...componentWithPackage,
|
|
16718
|
-
path:
|
|
16301
|
+
path: path3,
|
|
16719
16302
|
...reactDocgenTypescript ? { reactDocgenTypescript } : {},
|
|
16720
16303
|
...reactDocgenTypescriptError ? { reactDocgenTypescriptError } : {},
|
|
16721
16304
|
importOverride
|
|
16722
16305
|
};
|
|
16723
16306
|
}
|
|
16724
16307
|
if (docgenEngine === "react-docgen") {
|
|
16725
|
-
let reactDocgen = getReactDocgen(
|
|
16308
|
+
let reactDocgen = getReactDocgen(path3, componentWithPackage);
|
|
16726
16309
|
return {
|
|
16727
16310
|
...componentWithPackage,
|
|
16728
|
-
path:
|
|
16311
|
+
path: path3,
|
|
16729
16312
|
reactDocgen,
|
|
16730
16313
|
importOverride: reactDocgen.type === "success" ? getImportTag(reactDocgen.data) : void 0
|
|
16731
16314
|
};
|
|
@@ -16733,7 +16316,7 @@ ${message}`
|
|
|
16733
16316
|
if (docgenEngine === "react-component-meta")
|
|
16734
16317
|
return {
|
|
16735
16318
|
...componentWithPackage,
|
|
16736
|
-
path:
|
|
16319
|
+
path: path3
|
|
16737
16320
|
};
|
|
16738
16321
|
}
|
|
16739
16322
|
return componentWithPackage;
|
|
@@ -16977,13 +16560,13 @@ function extractStorySnippets(csf, componentName, filterStoryIds) {
|
|
|
16977
16560
|
return Object.entries(csf._stories).filter(([, story]) => !filterStoryIds || filterStoryIds.has(story.id)).map(([storyExport, story]) => {
|
|
16978
16561
|
let name = story.name ?? storyNameFromExport(storyExport);
|
|
16979
16562
|
try {
|
|
16980
|
-
let
|
|
16563
|
+
let { description, summary } = extractStoryJSDocInfo(csf._storyStatements[storyExport]);
|
|
16981
16564
|
return {
|
|
16982
16565
|
id: story.id,
|
|
16983
16566
|
name,
|
|
16984
16567
|
snippet: recast2.print(getCodeSnippet(csf, storyExport, componentName)).code,
|
|
16985
|
-
description
|
|
16986
|
-
summary
|
|
16568
|
+
description,
|
|
16569
|
+
summary
|
|
16987
16570
|
};
|
|
16988
16571
|
} catch (e) {
|
|
16989
16572
|
let err = e instanceof Error ? e : new Error(String(e));
|
|
@@ -16994,10 +16577,10 @@ function extractStorySnippets(csf, componentName, filterStoryIds) {
|
|
|
16994
16577
|
|
|
16995
16578
|
// src/componentManifest/buildReactComponentDocgen.ts
|
|
16996
16579
|
import { getComponentIdFromEntry } from "storybook/internal/common";
|
|
16997
|
-
import { extractComponentDescription, extractDescription
|
|
16580
|
+
import { extractComponentDescription, extractDescription } from "storybook/internal/csf-tools";
|
|
16998
16581
|
function getPackageInfo(componentPath, fallbackPath) {
|
|
16999
16582
|
let nearestPkg = cachedFindUp("package.json", {
|
|
17000
|
-
cwd:
|
|
16583
|
+
cwd: path2.dirname(componentPath ?? fallbackPath)
|
|
17001
16584
|
});
|
|
17002
16585
|
try {
|
|
17003
16586
|
if (!nearestPkg)
|
|
@@ -17013,7 +16596,7 @@ function getFallbackImport(packageName, componentName) {
|
|
|
17013
16596
|
return packageName && exportName ? `import { ${exportName} } from "${packageName}";` : "";
|
|
17014
16597
|
}
|
|
17015
16598
|
function relativizeComponentMetaPaths(doc) {
|
|
17016
|
-
let relativize = (fileName) =>
|
|
16599
|
+
let relativize = (fileName) => path2.relative(process.cwd(), fileName), relativizeProp = (prop) => ({
|
|
17017
16600
|
...prop,
|
|
17018
16601
|
parent: prop.parent ? { ...prop.parent, fileName: relativize(prop.parent.fileName) } : prop.parent,
|
|
17019
16602
|
declarations: prop.declarations?.map((declaration) => ({
|
|
@@ -17143,7 +16726,7 @@ ${storyFile}`
|
|
|
17143
16726
|
}
|
|
17144
16727
|
};
|
|
17145
16728
|
}
|
|
17146
|
-
let metaJsDoc =
|
|
16729
|
+
let metaJsDoc = extractDescription(csf._metaStatement) || void 0, { description, summary, jsDocTags } = extractComponentDescription(
|
|
17147
16730
|
metaJsDoc,
|
|
17148
16731
|
docgenDescription,
|
|
17149
16732
|
docgenJsDocTags
|
|
@@ -17213,9 +16796,9 @@ function buildReactComponentDocgenFromResolved({
|
|
|
17213
16796
|
}
|
|
17214
16797
|
|
|
17215
16798
|
export {
|
|
17216
|
-
|
|
17217
|
-
|
|
17218
|
-
|
|
16799
|
+
join3 as join,
|
|
16800
|
+
dirname3 as dirname,
|
|
16801
|
+
path2 as path,
|
|
17219
16802
|
extractArgTypes,
|
|
17220
16803
|
invalidateCache,
|
|
17221
16804
|
cachedReadFileSync,
|