@storybook/react 10.6.0-alpha.5 → 10.6.0-alpha.7
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_5mro4fxxrdb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_5mro4fxxrdb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_5mro4fxxrdb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_5mro4fxxrdb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_5mro4fxxrdb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_5mro4fxxrdb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -610,8 +610,8 @@ var require_common = __commonJS({
|
|
|
610
610
|
"use strict";
|
|
611
611
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
612
612
|
exports.resolveFileLanguageId = resolveFileLanguageId2;
|
|
613
|
-
function resolveFileLanguageId2(
|
|
614
|
-
switch (
|
|
613
|
+
function resolveFileLanguageId2(path2) {
|
|
614
|
+
switch (path2.split(".").pop()) {
|
|
615
615
|
case "js":
|
|
616
616
|
return "javascript";
|
|
617
617
|
case "cjs":
|
|
@@ -756,11 +756,11 @@ var require_decorateLanguageServiceHost = __commonJS({
|
|
|
756
756
|
var resolveModuleName_1 = require_resolveModuleName(), utils_1 = require_utils2();
|
|
757
757
|
function decorateLanguageServiceHost(ts, language, languageServiceHost) {
|
|
758
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);
|
|
759
|
-
if (readDirectory && (languageServiceHost.readDirectory = (
|
|
759
|
+
if (readDirectory && (languageServiceHost.readDirectory = (path2, extensions, exclude, include, depth) => {
|
|
760
760
|
if (extensions)
|
|
761
761
|
for (let ext of pluginExtensions)
|
|
762
762
|
extensions.includes(ext) || (extensions = [...extensions, ext]);
|
|
763
|
-
return readDirectory(
|
|
763
|
+
return readDirectory(path2, extensions, exclude, include, depth);
|
|
764
764
|
}), pluginExtensions.length) {
|
|
765
765
|
let resolveModuleName = (0, resolveModuleName_1.createResolveModuleName)(ts, ts.sys.getFileSize, languageServiceHost, language.plugins, (fileName) => language.scripts.get(fileName)), moduleResolutionCache = languageServiceHost.getModuleResolutionCache?.();
|
|
766
766
|
resolveModuleNameLiterals && (languageServiceHost.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, ...rest) => {
|
|
@@ -1062,8 +1062,8 @@ var require_decorateProgram = __commonJS({
|
|
|
1062
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);
|
|
1063
1063
|
} else
|
|
1064
1064
|
return getBindAndCheckDiagnostics(void 0, cancellationToken).map((d) => (0, transform_1.transformDiagnostic)(language, d, program, !0)).filter((d) => !!d);
|
|
1065
|
-
}, program.getSourceFileByPath = (
|
|
1066
|
-
let sourceFile = getSourceFileByPath(
|
|
1065
|
+
}, program.getSourceFileByPath = (path2) => {
|
|
1066
|
+
let sourceFile = getSourceFileByPath(path2);
|
|
1067
1067
|
return sourceFile && (0, transform_1.fillSourceFileText)(language, sourceFile), sourceFile;
|
|
1068
1068
|
};
|
|
1069
1069
|
}
|
|
@@ -1832,14 +1832,14 @@ var require_proxyLanguageService = __commonJS({
|
|
|
1832
1832
|
var require_path_browserify = __commonJS({
|
|
1833
1833
|
"../../../node_modules/path-browserify/index.js"(exports, module) {
|
|
1834
1834
|
"use strict";
|
|
1835
|
-
function assertPath(
|
|
1836
|
-
if (typeof
|
|
1837
|
-
throw new TypeError("Path must be a string. Received " + JSON.stringify(
|
|
1838
|
-
}
|
|
1839
|
-
function normalizeStringPosix(
|
|
1840
|
-
for (var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code, i2 = 0; i2 <=
|
|
1841
|
-
if (i2 <
|
|
1842
|
-
code =
|
|
1835
|
+
function assertPath(path2) {
|
|
1836
|
+
if (typeof path2 != "string")
|
|
1837
|
+
throw new TypeError("Path must be a string. Received " + JSON.stringify(path2));
|
|
1838
|
+
}
|
|
1839
|
+
function normalizeStringPosix(path2, allowAboveRoot) {
|
|
1840
|
+
for (var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code, i2 = 0; i2 <= path2.length; ++i2) {
|
|
1841
|
+
if (i2 < path2.length)
|
|
1842
|
+
code = path2.charCodeAt(i2);
|
|
1843
1843
|
else {
|
|
1844
1844
|
if (code === 47)
|
|
1845
1845
|
break;
|
|
@@ -1862,7 +1862,7 @@ var require_path_browserify = __commonJS({
|
|
|
1862
1862
|
}
|
|
1863
1863
|
allowAboveRoot && (res.length > 0 ? res += "/.." : res = "..", lastSegmentLength = 2);
|
|
1864
1864
|
} else
|
|
1865
|
-
res.length > 0 ? res += "/" +
|
|
1865
|
+
res.length > 0 ? res += "/" + path2.slice(lastSlash + 1, i2) : res = path2.slice(lastSlash + 1, i2), lastSegmentLength = i2 - lastSlash - 1;
|
|
1866
1866
|
lastSlash = i2, dots = 0;
|
|
1867
1867
|
} else code === 46 && dots !== -1 ? ++dots : dots = -1;
|
|
1868
1868
|
}
|
|
@@ -1872,22 +1872,22 @@ var require_path_browserify = __commonJS({
|
|
|
1872
1872
|
var dir = pathObject.dir || pathObject.root, base2 = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
1873
1873
|
return dir ? dir === pathObject.root ? dir + base2 : dir + sep3 + base2 : base2;
|
|
1874
1874
|
}
|
|
1875
|
-
var
|
|
1875
|
+
var posix2 = {
|
|
1876
1876
|
// path.resolve([from ...], to)
|
|
1877
1877
|
resolve: function() {
|
|
1878
1878
|
for (var resolvedPath = "", resolvedAbsolute = !1, cwd2, i2 = arguments.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) {
|
|
1879
|
-
var
|
|
1880
|
-
i2 >= 0 ?
|
|
1879
|
+
var path2;
|
|
1880
|
+
i2 >= 0 ? path2 = arguments[i2] : (cwd2 === void 0 && (cwd2 = process.cwd()), path2 = cwd2), assertPath(path2), path2.length !== 0 && (resolvedPath = path2 + "/" + resolvedPath, resolvedAbsolute = path2.charCodeAt(0) === 47);
|
|
1881
1881
|
}
|
|
1882
1882
|
return resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute ? resolvedPath.length > 0 ? "/" + resolvedPath : "/" : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
1883
1883
|
},
|
|
1884
|
-
normalize: function(
|
|
1885
|
-
if (assertPath(
|
|
1886
|
-
var isAbsolute3 =
|
|
1887
|
-
return
|
|
1884
|
+
normalize: function(path2) {
|
|
1885
|
+
if (assertPath(path2), path2.length === 0) return ".";
|
|
1886
|
+
var isAbsolute3 = path2.charCodeAt(0) === 47, trailingSeparator = path2.charCodeAt(path2.length - 1) === 47;
|
|
1887
|
+
return path2 = normalizeStringPosix(path2, !isAbsolute3), path2.length === 0 && !isAbsolute3 && (path2 = "."), path2.length > 0 && trailingSeparator && (path2 += "/"), isAbsolute3 ? "/" + path2 : path2;
|
|
1888
1888
|
},
|
|
1889
|
-
isAbsolute: function(
|
|
1890
|
-
return assertPath(
|
|
1889
|
+
isAbsolute: function(path2) {
|
|
1890
|
+
return assertPath(path2), path2.length > 0 && path2.charCodeAt(0) === 47;
|
|
1891
1891
|
},
|
|
1892
1892
|
join: function() {
|
|
1893
1893
|
if (arguments.length === 0)
|
|
@@ -1896,10 +1896,10 @@ var require_path_browserify = __commonJS({
|
|
|
1896
1896
|
var arg = arguments[i2];
|
|
1897
1897
|
assertPath(arg), arg.length > 0 && (joined === void 0 ? joined = arg : joined += "/" + arg);
|
|
1898
1898
|
}
|
|
1899
|
-
return joined === void 0 ? "." :
|
|
1899
|
+
return joined === void 0 ? "." : posix2.normalize(joined);
|
|
1900
1900
|
},
|
|
1901
1901
|
relative: function(from, to) {
|
|
1902
|
-
if (assertPath(from), assertPath(to), from === to || (from =
|
|
1902
|
+
if (assertPath(from), assertPath(to), from === to || (from = posix2.resolve(from), to = posix2.resolve(to), from === to)) return "";
|
|
1903
1903
|
for (var fromStart = 1; fromStart < from.length && from.charCodeAt(fromStart) === 47; ++fromStart)
|
|
1904
1904
|
;
|
|
1905
1905
|
for (var fromEnd = from.length, fromLen = fromEnd - fromStart, toStart = 1; toStart < to.length && to.charCodeAt(toStart) === 47; ++toStart)
|
|
@@ -1924,30 +1924,30 @@ var require_path_browserify = __commonJS({
|
|
|
1924
1924
|
(i2 === fromEnd || from.charCodeAt(i2) === 47) && (out.length === 0 ? out += ".." : out += "/..");
|
|
1925
1925
|
return out.length > 0 ? out + to.slice(toStart + lastCommonSep) : (toStart += lastCommonSep, to.charCodeAt(toStart) === 47 && ++toStart, to.slice(toStart));
|
|
1926
1926
|
},
|
|
1927
|
-
_makeLong: function(
|
|
1928
|
-
return
|
|
1927
|
+
_makeLong: function(path2) {
|
|
1928
|
+
return path2;
|
|
1929
1929
|
},
|
|
1930
|
-
dirname: function(
|
|
1931
|
-
if (assertPath(
|
|
1932
|
-
for (var code =
|
|
1933
|
-
if (code =
|
|
1930
|
+
dirname: function(path2) {
|
|
1931
|
+
if (assertPath(path2), path2.length === 0) return ".";
|
|
1932
|
+
for (var code = path2.charCodeAt(0), hasRoot = code === 47, end = -1, matchedSlash = !0, i2 = path2.length - 1; i2 >= 1; --i2)
|
|
1933
|
+
if (code = path2.charCodeAt(i2), code === 47) {
|
|
1934
1934
|
if (!matchedSlash) {
|
|
1935
1935
|
end = i2;
|
|
1936
1936
|
break;
|
|
1937
1937
|
}
|
|
1938
1938
|
} else
|
|
1939
1939
|
matchedSlash = !1;
|
|
1940
|
-
return end === -1 ? hasRoot ? "/" : "." : hasRoot && end === 1 ? "//" :
|
|
1940
|
+
return end === -1 ? hasRoot ? "/" : "." : hasRoot && end === 1 ? "//" : path2.slice(0, end);
|
|
1941
1941
|
},
|
|
1942
|
-
basename: function(
|
|
1942
|
+
basename: function(path2, ext) {
|
|
1943
1943
|
if (ext !== void 0 && typeof ext != "string") throw new TypeError('"ext" argument must be a string');
|
|
1944
|
-
assertPath(
|
|
1944
|
+
assertPath(path2);
|
|
1945
1945
|
var start = 0, end = -1, matchedSlash = !0, i2;
|
|
1946
|
-
if (ext !== void 0 && ext.length > 0 && ext.length <=
|
|
1947
|
-
if (ext.length ===
|
|
1946
|
+
if (ext !== void 0 && ext.length > 0 && ext.length <= path2.length) {
|
|
1947
|
+
if (ext.length === path2.length && ext === path2) return "";
|
|
1948
1948
|
var extIdx = ext.length - 1, firstNonSlashEnd = -1;
|
|
1949
|
-
for (i2 =
|
|
1950
|
-
var code =
|
|
1949
|
+
for (i2 = path2.length - 1; i2 >= 0; --i2) {
|
|
1950
|
+
var code = path2.charCodeAt(i2);
|
|
1951
1951
|
if (code === 47) {
|
|
1952
1952
|
if (!matchedSlash) {
|
|
1953
1953
|
start = i2 + 1;
|
|
@@ -1956,22 +1956,22 @@ var require_path_browserify = __commonJS({
|
|
|
1956
1956
|
} else
|
|
1957
1957
|
firstNonSlashEnd === -1 && (matchedSlash = !1, firstNonSlashEnd = i2 + 1), extIdx >= 0 && (code === ext.charCodeAt(extIdx) ? --extIdx === -1 && (end = i2) : (extIdx = -1, end = firstNonSlashEnd));
|
|
1958
1958
|
}
|
|
1959
|
-
return start === end ? end = firstNonSlashEnd : end === -1 && (end =
|
|
1959
|
+
return start === end ? end = firstNonSlashEnd : end === -1 && (end = path2.length), path2.slice(start, end);
|
|
1960
1960
|
} else {
|
|
1961
|
-
for (i2 =
|
|
1962
|
-
if (
|
|
1961
|
+
for (i2 = path2.length - 1; i2 >= 0; --i2)
|
|
1962
|
+
if (path2.charCodeAt(i2) === 47) {
|
|
1963
1963
|
if (!matchedSlash) {
|
|
1964
1964
|
start = i2 + 1;
|
|
1965
1965
|
break;
|
|
1966
1966
|
}
|
|
1967
1967
|
} else end === -1 && (matchedSlash = !1, end = i2 + 1);
|
|
1968
|
-
return end === -1 ? "" :
|
|
1968
|
+
return end === -1 ? "" : path2.slice(start, end);
|
|
1969
1969
|
}
|
|
1970
1970
|
},
|
|
1971
|
-
extname: function(
|
|
1972
|
-
assertPath(
|
|
1973
|
-
for (var startDot = -1, startPart = 0, end = -1, matchedSlash = !0, preDotState = 0, i2 =
|
|
1974
|
-
var code =
|
|
1971
|
+
extname: function(path2) {
|
|
1972
|
+
assertPath(path2);
|
|
1973
|
+
for (var startDot = -1, startPart = 0, end = -1, matchedSlash = !0, preDotState = 0, i2 = path2.length - 1; i2 >= 0; --i2) {
|
|
1974
|
+
var code = path2.charCodeAt(i2);
|
|
1975
1975
|
if (code === 47) {
|
|
1976
1976
|
if (!matchedSlash) {
|
|
1977
1977
|
startPart = i2 + 1;
|
|
@@ -1983,21 +1983,21 @@ var require_path_browserify = __commonJS({
|
|
|
1983
1983
|
}
|
|
1984
1984
|
return startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
|
|
1985
1985
|
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
1986
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? "" :
|
|
1986
|
+
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? "" : path2.slice(startDot, end);
|
|
1987
1987
|
},
|
|
1988
1988
|
format: function(pathObject) {
|
|
1989
1989
|
if (pathObject === null || typeof pathObject != "object")
|
|
1990
1990
|
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
1991
1991
|
return _format("/", pathObject);
|
|
1992
1992
|
},
|
|
1993
|
-
parse: function(
|
|
1994
|
-
assertPath(
|
|
1993
|
+
parse: function(path2) {
|
|
1994
|
+
assertPath(path2);
|
|
1995
1995
|
var ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
1996
|
-
if (
|
|
1997
|
-
var code =
|
|
1996
|
+
if (path2.length === 0) return ret;
|
|
1997
|
+
var code = path2.charCodeAt(0), isAbsolute3 = code === 47, start;
|
|
1998
1998
|
isAbsolute3 ? (ret.root = "/", start = 1) : start = 0;
|
|
1999
|
-
for (var startDot = -1, startPart = 0, end = -1, matchedSlash = !0, i2 =
|
|
2000
|
-
if (code =
|
|
1999
|
+
for (var startDot = -1, startPart = 0, end = -1, matchedSlash = !0, i2 = path2.length - 1, preDotState = 0; i2 >= start; --i2) {
|
|
2000
|
+
if (code = path2.charCodeAt(i2), code === 47) {
|
|
2001
2001
|
if (!matchedSlash) {
|
|
2002
2002
|
startPart = i2 + 1;
|
|
2003
2003
|
break;
|
|
@@ -2008,15 +2008,15 @@ var require_path_browserify = __commonJS({
|
|
|
2008
2008
|
}
|
|
2009
2009
|
return startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
|
|
2010
2010
|
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
2011
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? end !== -1 && (startPart === 0 && isAbsolute3 ? ret.base = ret.name =
|
|
2011
|
+
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? end !== -1 && (startPart === 0 && isAbsolute3 ? ret.base = ret.name = path2.slice(1, end) : ret.base = ret.name = path2.slice(startPart, end)) : (startPart === 0 && isAbsolute3 ? (ret.name = path2.slice(1, startDot), ret.base = path2.slice(1, end)) : (ret.name = path2.slice(startPart, startDot), ret.base = path2.slice(startPart, end)), ret.ext = path2.slice(startDot, end)), startPart > 0 ? ret.dir = path2.slice(0, startPart - 1) : isAbsolute3 && (ret.dir = "/"), ret;
|
|
2012
2012
|
},
|
|
2013
2013
|
sep: "/",
|
|
2014
2014
|
delimiter: ":",
|
|
2015
2015
|
win32: null,
|
|
2016
2016
|
posix: null
|
|
2017
2017
|
};
|
|
2018
|
-
|
|
2019
|
-
module.exports =
|
|
2018
|
+
posix2.posix = posix2;
|
|
2019
|
+
module.exports = posix2;
|
|
2020
2020
|
}
|
|
2021
2021
|
});
|
|
2022
2022
|
|
|
@@ -2026,7 +2026,7 @@ var require_createProject = __commonJS({
|
|
|
2026
2026
|
"use strict";
|
|
2027
2027
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
2028
2028
|
exports.createLanguageServiceHost = createLanguageServiceHost2;
|
|
2029
|
-
var language_core_1 = require_language_core(),
|
|
2029
|
+
var language_core_1 = require_language_core(), path2 = require_path_browserify(), utils_1 = require_utils2(), resolveModuleName_1 = require_resolveModuleName();
|
|
2030
2030
|
function createLanguageServiceHost2(ts, sys, language, asScriptId, projectHost) {
|
|
2031
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 = {
|
|
2032
2032
|
...sys,
|
|
@@ -2088,7 +2088,7 @@ var require_createProject = __commonJS({
|
|
|
2088
2088
|
if (serviceScript)
|
|
2089
2089
|
return serviceScript.scriptKind;
|
|
2090
2090
|
}
|
|
2091
|
-
switch (
|
|
2091
|
+
switch (path2.extname(fileName)) {
|
|
2092
2092
|
case ".js":
|
|
2093
2093
|
case ".cjs":
|
|
2094
2094
|
case ".mjs":
|
|
@@ -2755,23 +2755,23 @@ var require_path = __commonJS({
|
|
|
2755
2755
|
function isAnyDirectorySeparator(charCode) {
|
|
2756
2756
|
return charCode === 47 || charCode === 92;
|
|
2757
2757
|
}
|
|
2758
|
-
function isRootedDiskPath(
|
|
2759
|
-
return getEncodedRootLength(
|
|
2758
|
+
function isRootedDiskPath(path2) {
|
|
2759
|
+
return getEncodedRootLength(path2) > 0;
|
|
2760
2760
|
}
|
|
2761
2761
|
function hasExtension(fileName) {
|
|
2762
2762
|
return (0, core_1.stringContains)(getBaseFileName(fileName), ".");
|
|
2763
2763
|
}
|
|
2764
|
-
function fileExtensionIs(
|
|
2765
|
-
return
|
|
2764
|
+
function fileExtensionIs(path2, extension) {
|
|
2765
|
+
return path2.length > extension.length && (0, core_1.endsWith)(path2, extension);
|
|
2766
2766
|
}
|
|
2767
|
-
function fileExtensionIsOneOf(
|
|
2767
|
+
function fileExtensionIsOneOf(path2, extensions) {
|
|
2768
2768
|
for (let extension of extensions)
|
|
2769
|
-
if (fileExtensionIs(
|
|
2769
|
+
if (fileExtensionIs(path2, extension))
|
|
2770
2770
|
return !0;
|
|
2771
2771
|
return !1;
|
|
2772
2772
|
}
|
|
2773
|
-
function hasTrailingDirectorySeparator(
|
|
2774
|
-
return
|
|
2773
|
+
function hasTrailingDirectorySeparator(path2) {
|
|
2774
|
+
return path2.length > 0 && isAnyDirectorySeparator(path2.charCodeAt(path2.length - 1));
|
|
2775
2775
|
}
|
|
2776
2776
|
function isVolumeCharacter(charCode) {
|
|
2777
2777
|
return charCode >= 97 && charCode <= 122 || charCode >= 65 && charCode <= 90;
|
|
@@ -2787,94 +2787,94 @@ var require_path = __commonJS({
|
|
|
2787
2787
|
}
|
|
2788
2788
|
return -1;
|
|
2789
2789
|
}
|
|
2790
|
-
function getEncodedRootLength(
|
|
2791
|
-
if (!
|
|
2790
|
+
function getEncodedRootLength(path2) {
|
|
2791
|
+
if (!path2)
|
|
2792
2792
|
return 0;
|
|
2793
|
-
let ch0 =
|
|
2793
|
+
let ch0 = path2.charCodeAt(0);
|
|
2794
2794
|
if (ch0 === 47 || ch0 === 92) {
|
|
2795
|
-
if (
|
|
2795
|
+
if (path2.charCodeAt(1) !== ch0)
|
|
2796
2796
|
return 1;
|
|
2797
|
-
let p1 =
|
|
2798
|
-
return p1 < 0 ?
|
|
2797
|
+
let p1 = path2.indexOf(ch0 === 47 ? exports.directorySeparator : altDirectorySeparator, 2);
|
|
2798
|
+
return p1 < 0 ? path2.length : p1 + 1;
|
|
2799
2799
|
}
|
|
2800
|
-
if (isVolumeCharacter(ch0) &&
|
|
2801
|
-
let ch2 =
|
|
2800
|
+
if (isVolumeCharacter(ch0) && path2.charCodeAt(1) === 58) {
|
|
2801
|
+
let ch2 = path2.charCodeAt(2);
|
|
2802
2802
|
if (ch2 === 47 || ch2 === 92)
|
|
2803
2803
|
return 3;
|
|
2804
|
-
if (
|
|
2804
|
+
if (path2.length === 2)
|
|
2805
2805
|
return 2;
|
|
2806
2806
|
}
|
|
2807
|
-
let schemeEnd =
|
|
2807
|
+
let schemeEnd = path2.indexOf(urlSchemeSeparator);
|
|
2808
2808
|
if (schemeEnd !== -1) {
|
|
2809
|
-
let authorityStart = schemeEnd + urlSchemeSeparator.length, authorityEnd =
|
|
2809
|
+
let authorityStart = schemeEnd + urlSchemeSeparator.length, authorityEnd = path2.indexOf(exports.directorySeparator, authorityStart);
|
|
2810
2810
|
if (authorityEnd !== -1) {
|
|
2811
|
-
let scheme =
|
|
2812
|
-
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(
|
|
2813
|
-
let volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(
|
|
2811
|
+
let scheme = path2.slice(0, schemeEnd), authority = path2.slice(authorityStart, authorityEnd);
|
|
2812
|
+
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path2.charCodeAt(authorityEnd + 1))) {
|
|
2813
|
+
let volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path2, authorityEnd + 2);
|
|
2814
2814
|
if (volumeSeparatorEnd !== -1) {
|
|
2815
|
-
if (
|
|
2815
|
+
if (path2.charCodeAt(volumeSeparatorEnd) === 47)
|
|
2816
2816
|
return ~(volumeSeparatorEnd + 1);
|
|
2817
|
-
if (volumeSeparatorEnd ===
|
|
2817
|
+
if (volumeSeparatorEnd === path2.length)
|
|
2818
2818
|
return ~volumeSeparatorEnd;
|
|
2819
2819
|
}
|
|
2820
2820
|
}
|
|
2821
2821
|
return ~(authorityEnd + 1);
|
|
2822
2822
|
}
|
|
2823
|
-
return ~
|
|
2823
|
+
return ~path2.length;
|
|
2824
2824
|
}
|
|
2825
2825
|
return 0;
|
|
2826
2826
|
}
|
|
2827
|
-
function getRootLength(
|
|
2828
|
-
let rootLength = getEncodedRootLength(
|
|
2827
|
+
function getRootLength(path2) {
|
|
2828
|
+
let rootLength = getEncodedRootLength(path2);
|
|
2829
2829
|
return rootLength < 0 ? ~rootLength : rootLength;
|
|
2830
2830
|
}
|
|
2831
|
-
function getDirectoryPath(
|
|
2832
|
-
|
|
2833
|
-
let rootLength = getRootLength(
|
|
2834
|
-
return rootLength ===
|
|
2831
|
+
function getDirectoryPath(path2) {
|
|
2832
|
+
path2 = normalizeSlashes(path2);
|
|
2833
|
+
let rootLength = getRootLength(path2);
|
|
2834
|
+
return rootLength === path2.length ? path2 : (path2 = removeTrailingDirectorySeparator(path2), path2.slice(0, Math.max(rootLength, path2.lastIndexOf(exports.directorySeparator))));
|
|
2835
2835
|
}
|
|
2836
|
-
function getBaseFileName(
|
|
2837
|
-
if (
|
|
2836
|
+
function getBaseFileName(path2, extensions, ignoreCase) {
|
|
2837
|
+
if (path2 = normalizeSlashes(path2), getRootLength(path2) === path2.length)
|
|
2838
2838
|
return "";
|
|
2839
|
-
|
|
2840
|
-
let name =
|
|
2839
|
+
path2 = removeTrailingDirectorySeparator(path2);
|
|
2840
|
+
let name = path2.slice(Math.max(getRootLength(path2), path2.lastIndexOf(exports.directorySeparator) + 1)), extension = extensions !== void 0 && ignoreCase !== void 0 ? getAnyExtensionFromPath(name, extensions, ignoreCase) : void 0;
|
|
2841
2841
|
return extension ? name.slice(0, name.length - extension.length) : name;
|
|
2842
2842
|
}
|
|
2843
|
-
function tryGetExtensionFromPath(
|
|
2844
|
-
if ((0, core_1.startsWith)(extension, ".") || (extension = "." + extension),
|
|
2845
|
-
let pathExtension =
|
|
2843
|
+
function tryGetExtensionFromPath(path2, extension, stringEqualityComparer) {
|
|
2844
|
+
if ((0, core_1.startsWith)(extension, ".") || (extension = "." + extension), path2.length >= extension.length && path2.charCodeAt(path2.length - extension.length) === 46) {
|
|
2845
|
+
let pathExtension = path2.slice(path2.length - extension.length);
|
|
2846
2846
|
if (stringEqualityComparer(pathExtension, extension))
|
|
2847
2847
|
return pathExtension;
|
|
2848
2848
|
}
|
|
2849
2849
|
}
|
|
2850
|
-
function getAnyExtensionFromPathWorker(
|
|
2850
|
+
function getAnyExtensionFromPathWorker(path2, extensions, stringEqualityComparer) {
|
|
2851
2851
|
if (typeof extensions == "string")
|
|
2852
|
-
return tryGetExtensionFromPath(
|
|
2852
|
+
return tryGetExtensionFromPath(path2, extensions, stringEqualityComparer) || "";
|
|
2853
2853
|
for (let extension of extensions) {
|
|
2854
|
-
let result = tryGetExtensionFromPath(
|
|
2854
|
+
let result = tryGetExtensionFromPath(path2, extension, stringEqualityComparer);
|
|
2855
2855
|
if (result)
|
|
2856
2856
|
return result;
|
|
2857
2857
|
}
|
|
2858
2858
|
return "";
|
|
2859
2859
|
}
|
|
2860
|
-
function getAnyExtensionFromPath(
|
|
2860
|
+
function getAnyExtensionFromPath(path2, extensions, ignoreCase) {
|
|
2861
2861
|
if (extensions)
|
|
2862
|
-
return getAnyExtensionFromPathWorker(removeTrailingDirectorySeparator(
|
|
2863
|
-
let baseFileName = getBaseFileName(
|
|
2862
|
+
return getAnyExtensionFromPathWorker(removeTrailingDirectorySeparator(path2), extensions, ignoreCase ? core_1.equateStringsCaseInsensitive : core_1.equateStringsCaseSensitive);
|
|
2863
|
+
let baseFileName = getBaseFileName(path2), extensionIndex = baseFileName.lastIndexOf(".");
|
|
2864
2864
|
return extensionIndex >= 0 ? baseFileName.substring(extensionIndex) : "";
|
|
2865
2865
|
}
|
|
2866
|
-
function pathComponents(
|
|
2867
|
-
let root =
|
|
2866
|
+
function pathComponents(path2, rootLength) {
|
|
2867
|
+
let root = path2.substring(0, rootLength), rest = path2.substring(rootLength).split(exports.directorySeparator);
|
|
2868
2868
|
return rest.length && !(0, core_1.lastOrUndefined)(rest) && rest.pop(), [root, ...rest];
|
|
2869
2869
|
}
|
|
2870
|
-
function getPathComponents(
|
|
2871
|
-
return
|
|
2870
|
+
function getPathComponents(path2, currentDirectory = "") {
|
|
2871
|
+
return path2 = combinePaths(currentDirectory, path2), pathComponents(path2, getRootLength(path2));
|
|
2872
2872
|
}
|
|
2873
2873
|
function getPathFromPathComponents(pathComponents2) {
|
|
2874
2874
|
return pathComponents2.length === 0 ? "" : (pathComponents2[0] && ensureTrailingDirectorySeparator(pathComponents2[0])) + pathComponents2.slice(1).join(exports.directorySeparator);
|
|
2875
2875
|
}
|
|
2876
|
-
function normalizeSlashes(
|
|
2877
|
-
return
|
|
2876
|
+
function normalizeSlashes(path2) {
|
|
2877
|
+
return path2.indexOf("\\") !== -1 ? path2.replace(backslashRegExp, exports.directorySeparator) : path2;
|
|
2878
2878
|
}
|
|
2879
2879
|
function reducePathComponents(components) {
|
|
2880
2880
|
if (!(0, core_1.some)(components))
|
|
@@ -2897,29 +2897,29 @@ var require_path = __commonJS({
|
|
|
2897
2897
|
}
|
|
2898
2898
|
return reduced;
|
|
2899
2899
|
}
|
|
2900
|
-
function combinePaths(
|
|
2901
|
-
|
|
2900
|
+
function combinePaths(path2, ...paths) {
|
|
2901
|
+
path2 && (path2 = normalizeSlashes(path2));
|
|
2902
2902
|
for (let relativePath of paths)
|
|
2903
|
-
relativePath && (relativePath = normalizeSlashes(relativePath), !
|
|
2904
|
-
return
|
|
2903
|
+
relativePath && (relativePath = normalizeSlashes(relativePath), !path2 || getRootLength(relativePath) !== 0 ? path2 = relativePath : path2 = ensureTrailingDirectorySeparator(path2) + relativePath);
|
|
2904
|
+
return path2;
|
|
2905
2905
|
}
|
|
2906
|
-
function getNormalizedPathComponents(
|
|
2907
|
-
return reducePathComponents(getPathComponents(
|
|
2906
|
+
function getNormalizedPathComponents(path2, currentDirectory) {
|
|
2907
|
+
return reducePathComponents(getPathComponents(path2, currentDirectory));
|
|
2908
2908
|
}
|
|
2909
|
-
function normalizePath(
|
|
2910
|
-
if (
|
|
2911
|
-
return
|
|
2912
|
-
let simplified =
|
|
2913
|
-
if (simplified !==
|
|
2914
|
-
return
|
|
2915
|
-
let normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(
|
|
2916
|
-
return normalized && hasTrailingDirectorySeparator(
|
|
2909
|
+
function normalizePath(path2) {
|
|
2910
|
+
if (path2 = normalizeSlashes(path2), !relativePathSegmentRegExp.test(path2))
|
|
2911
|
+
return path2;
|
|
2912
|
+
let simplified = path2.replace(/\/\.\//g, "/").replace(/^\.\//, "");
|
|
2913
|
+
if (simplified !== path2 && (path2 = simplified, !relativePathSegmentRegExp.test(path2)))
|
|
2914
|
+
return path2;
|
|
2915
|
+
let normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(path2)));
|
|
2916
|
+
return normalized && hasTrailingDirectorySeparator(path2) ? ensureTrailingDirectorySeparator(normalized) : normalized;
|
|
2917
2917
|
}
|
|
2918
|
-
function removeTrailingDirectorySeparator(
|
|
2919
|
-
return hasTrailingDirectorySeparator(
|
|
2918
|
+
function removeTrailingDirectorySeparator(path2) {
|
|
2919
|
+
return hasTrailingDirectorySeparator(path2) ? path2.substr(0, path2.length - 1) : path2;
|
|
2920
2920
|
}
|
|
2921
|
-
function ensureTrailingDirectorySeparator(
|
|
2922
|
-
return hasTrailingDirectorySeparator(
|
|
2921
|
+
function ensureTrailingDirectorySeparator(path2) {
|
|
2922
|
+
return hasTrailingDirectorySeparator(path2) ? path2 : path2 + exports.directorySeparator;
|
|
2923
2923
|
}
|
|
2924
2924
|
var relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;
|
|
2925
2925
|
function containsPath(parent, child, currentDirectory, ignoreCase) {
|
|
@@ -3014,34 +3014,34 @@ var require_utilities = __commonJS({
|
|
|
3014
3014
|
function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
|
|
3015
3015
|
return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
|
|
3016
3016
|
}
|
|
3017
|
-
function getFileMatcherPatterns(
|
|
3018
|
-
|
|
3019
|
-
let absolutePath = (0, path_1.combinePaths)(currentDirectory,
|
|
3017
|
+
function getFileMatcherPatterns(path2, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
|
|
3018
|
+
path2 = (0, path_1.normalizePath)(path2), currentDirectory = (0, path_1.normalizePath)(currentDirectory);
|
|
3019
|
+
let absolutePath = (0, path_1.combinePaths)(currentDirectory, path2);
|
|
3020
3020
|
return {
|
|
3021
3021
|
includeFilePatterns: (0, core_1.map)(getRegularExpressionsForWildcards(includes, absolutePath, "files"), (pattern) => `^${pattern}$`),
|
|
3022
3022
|
includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
|
|
3023
3023
|
includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
|
|
3024
3024
|
excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
|
|
3025
|
-
basePaths: getBasePaths(
|
|
3025
|
+
basePaths: getBasePaths(path2, includes, useCaseSensitiveFileNames)
|
|
3026
3026
|
};
|
|
3027
3027
|
}
|
|
3028
3028
|
function getRegexFromPattern(pattern, useCaseSensitiveFileNames) {
|
|
3029
3029
|
return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i");
|
|
3030
3030
|
}
|
|
3031
|
-
function matchFiles(
|
|
3032
|
-
|
|
3033
|
-
let patterns = getFileMatcherPatterns(
|
|
3031
|
+
function matchFiles(path2, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
|
|
3032
|
+
path2 = (0, path_1.normalizePath)(path2), currentDirectory = (0, path_1.normalizePath)(currentDirectory);
|
|
3033
|
+
let patterns = getFileMatcherPatterns(path2, 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);
|
|
3034
3034
|
for (let basePath of patterns.basePaths)
|
|
3035
3035
|
visitDirectory(basePath, (0, path_1.combinePaths)(currentDirectory, basePath), depth);
|
|
3036
3036
|
return (0, core_1.flatten)(results);
|
|
3037
|
-
function visitDirectory(
|
|
3037
|
+
function visitDirectory(path3, absolutePath, depth2) {
|
|
3038
3038
|
let canonicalPath = toCanonical(realpath(absolutePath));
|
|
3039
3039
|
if (visited.has(canonicalPath))
|
|
3040
3040
|
return;
|
|
3041
3041
|
visited.set(canonicalPath, !0);
|
|
3042
|
-
let { files, directories } = getFileSystemEntries(
|
|
3042
|
+
let { files, directories } = getFileSystemEntries(path3);
|
|
3043
3043
|
for (let current2 of (0, core_1.sort)(files, core_1.compareStringsCaseSensitive)) {
|
|
3044
|
-
let name = (0, path_1.combinePaths)(
|
|
3044
|
+
let name = (0, path_1.combinePaths)(path3, current2), absoluteName = (0, path_1.combinePaths)(absolutePath, current2);
|
|
3045
3045
|
if (!(extensions && !(0, path_1.fileExtensionIsOneOf)(name, extensions)) && !(excludeRegex && excludeRegex.test(absoluteName)))
|
|
3046
3046
|
if (!includeFileRegexes)
|
|
3047
3047
|
results[0].push(name);
|
|
@@ -3052,22 +3052,22 @@ var require_utilities = __commonJS({
|
|
|
3052
3052
|
}
|
|
3053
3053
|
if (!(depth2 !== void 0 && (depth2--, depth2 === 0)))
|
|
3054
3054
|
for (let current2 of (0, core_1.sort)(directories, core_1.compareStringsCaseSensitive)) {
|
|
3055
|
-
let name = (0, path_1.combinePaths)(
|
|
3055
|
+
let name = (0, path_1.combinePaths)(path3, current2), absoluteName = (0, path_1.combinePaths)(absolutePath, current2);
|
|
3056
3056
|
(!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName)) && visitDirectory(name, absoluteName, depth2);
|
|
3057
3057
|
}
|
|
3058
3058
|
}
|
|
3059
3059
|
}
|
|
3060
|
-
function getBasePaths(
|
|
3061
|
-
let basePaths = [
|
|
3060
|
+
function getBasePaths(path2, includes, useCaseSensitiveFileNames) {
|
|
3061
|
+
let basePaths = [path2];
|
|
3062
3062
|
if (includes) {
|
|
3063
3063
|
let includeBasePaths = [];
|
|
3064
3064
|
for (let include of includes) {
|
|
3065
|
-
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)(path2, include));
|
|
3066
3066
|
includeBasePaths.push(getIncludeBasePath(absolute2));
|
|
3067
3067
|
}
|
|
3068
3068
|
includeBasePaths.sort((0, core_1.getStringComparer)(!useCaseSensitiveFileNames));
|
|
3069
3069
|
for (let includeBasePath of includeBasePaths)
|
|
3070
|
-
(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, path2, !useCaseSensitiveFileNames)) && basePaths.push(includeBasePath);
|
|
3071
3071
|
}
|
|
3072
3072
|
return basePaths;
|
|
3073
3073
|
}
|
|
@@ -3084,7 +3084,7 @@ var require_createSys = __commonJS({
|
|
|
3084
3084
|
"use strict";
|
|
3085
3085
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3086
3086
|
exports.createSys = createSys;
|
|
3087
|
-
var
|
|
3087
|
+
var path2 = require_path_browserify(), vscode_uri_1 = require_umd(), utilities_1 = require_utilities(), currentCwd = "";
|
|
3088
3088
|
function createSys(sys, env, getCurrentDirectory, uriConverter) {
|
|
3089
3089
|
let version2 = 0, caseSensitive = sys?.useCaseSensitiveFileNames ?? !1, root = {
|
|
3090
3090
|
name: "",
|
|
@@ -3094,7 +3094,7 @@ var require_createSys = __commonJS({
|
|
|
3094
3094
|
}, promises = /* @__PURE__ */ new Set(), fileWatcher = env.onDidChangeWatchedFiles?.(({ changes }) => {
|
|
3095
3095
|
version2++;
|
|
3096
3096
|
for (let change of changes) {
|
|
3097
|
-
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 = path2.dirname(fileName), baseName = path2.basename(fileName), fileExists2 = change.type === 1 || change.type === 2;
|
|
3098
3098
|
getDir(dirName, fileExists2).files.set(normalizeFileId(baseName), fileExists2 ? {
|
|
3099
3099
|
name: baseName,
|
|
3100
3100
|
stat: {
|
|
@@ -3159,11 +3159,11 @@ var require_createSys = __commonJS({
|
|
|
3159
3159
|
}
|
|
3160
3160
|
return sys.resolvePath(fsPath).replace(/\\/g, "/");
|
|
3161
3161
|
}
|
|
3162
|
-
return
|
|
3162
|
+
return path2.resolve(fsPath).replace(/\\/g, "/");
|
|
3163
3163
|
}
|
|
3164
3164
|
function readFile(fileName, encoding) {
|
|
3165
3165
|
fileName = resolvePath(fileName);
|
|
3166
|
-
let dirPath =
|
|
3166
|
+
let dirPath = path2.dirname(fileName), dir = getDir(dirPath), name = path2.basename(fileName);
|
|
3167
3167
|
return readFileWorker(fileName, encoding, dir), dir.files.get(normalizeFileId(name))?.text;
|
|
3168
3168
|
}
|
|
3169
3169
|
function directoryExists(dirName) {
|
|
@@ -3204,7 +3204,7 @@ var require_createSys = __commonJS({
|
|
|
3204
3204
|
}
|
|
3205
3205
|
function getFile(fileName) {
|
|
3206
3206
|
fileName = resolvePath(fileName);
|
|
3207
|
-
let dirPath =
|
|
3207
|
+
let dirPath = path2.dirname(fileName), baseName = path2.basename(fileName), dir = getDir(dirPath), file = dir.files.get(normalizeFileId(baseName));
|
|
3208
3208
|
return file || dir.files.set(normalizeFileId(baseName), file = {
|
|
3209
3209
|
name: baseName,
|
|
3210
3210
|
requestedStat: !1,
|
|
@@ -3223,11 +3223,11 @@ var require_createSys = __commonJS({
|
|
|
3223
3223
|
files: [...dir.files.values()].filter((file) => file.stat?.type === 1).map((file) => file.name),
|
|
3224
3224
|
directories: [...dir.dirs.values()].filter((dir2) => dir2.exists).map((dir2) => dir2.name)
|
|
3225
3225
|
};
|
|
3226
|
-
}, sys?.realpath ? ((
|
|
3226
|
+
}, sys?.realpath ? ((path3) => sys.realpath(path3)) : ((path3) => path3));
|
|
3227
3227
|
return [...new Set(matches)];
|
|
3228
3228
|
}
|
|
3229
3229
|
function readFileWorker(fileName, encoding, dir) {
|
|
3230
|
-
let name =
|
|
3230
|
+
let name = path2.basename(fileName), file = dir.files.get(normalizeFileId(name));
|
|
3231
3231
|
if (file || dir.files.set(normalizeFileId(name), file = {
|
|
3232
3232
|
name,
|
|
3233
3233
|
requestedStat: !1,
|
|
@@ -3301,9 +3301,9 @@ var require_createSys = __commonJS({
|
|
|
3301
3301
|
return updated;
|
|
3302
3302
|
}
|
|
3303
3303
|
function getDir(dirName, markExists = !1) {
|
|
3304
|
-
let dirNames = [], currentDirPath = dirName, currentDirName =
|
|
3304
|
+
let dirNames = [], currentDirPath = dirName, currentDirName = path2.basename(currentDirPath), lastDirPath;
|
|
3305
3305
|
for (; lastDirPath !== currentDirPath; )
|
|
3306
|
-
lastDirPath = currentDirPath, dirNames.push(currentDirName), currentDirPath =
|
|
3306
|
+
lastDirPath = currentDirPath, dirNames.push(currentDirName), currentDirPath = path2.dirname(currentDirPath), currentDirName = path2.basename(currentDirPath);
|
|
3307
3307
|
let currentDir = root;
|
|
3308
3308
|
for (let i2 = dirNames.length - 1; i2 >= 0; i2--) {
|
|
3309
3309
|
let nextDirName = dirNames[i2];
|
|
@@ -3543,19 +3543,19 @@ var require_estraverse = __commonJS({
|
|
|
3543
3543
|
}, Reference.prototype.remove = function() {
|
|
3544
3544
|
return Array.isArray(this.parent) ? (this.parent.splice(this.key, 1), !0) : (this.replace(null), !1);
|
|
3545
3545
|
};
|
|
3546
|
-
function Element(node,
|
|
3547
|
-
this.node = node, this.path =
|
|
3546
|
+
function Element(node, path2, wrap, ref2) {
|
|
3547
|
+
this.node = node, this.path = path2, this.wrap = wrap, this.ref = ref2;
|
|
3548
3548
|
}
|
|
3549
3549
|
function Controller() {
|
|
3550
3550
|
}
|
|
3551
3551
|
Controller.prototype.path = function() {
|
|
3552
3552
|
var i2, iz, j, jz, result, element;
|
|
3553
|
-
function addToPath(result2,
|
|
3554
|
-
if (Array.isArray(
|
|
3555
|
-
for (j = 0, jz =
|
|
3556
|
-
result2.push(
|
|
3553
|
+
function addToPath(result2, path3) {
|
|
3554
|
+
if (Array.isArray(path3))
|
|
3555
|
+
for (j = 0, jz = path3.length; j < jz; ++j)
|
|
3556
|
+
result2.push(path3[j]);
|
|
3557
3557
|
else
|
|
3558
|
-
result2.push(
|
|
3558
|
+
result2.push(path3);
|
|
3559
3559
|
}
|
|
3560
3560
|
if (!this.__current.path)
|
|
3561
3561
|
return null;
|
|
@@ -4133,18 +4133,18 @@ var require_util = __commonJS({
|
|
|
4133
4133
|
}
|
|
4134
4134
|
exports.urlGenerate = urlGenerate;
|
|
4135
4135
|
function normalize2(aPath) {
|
|
4136
|
-
var
|
|
4136
|
+
var path2 = aPath, url = urlParse(aPath);
|
|
4137
4137
|
if (url) {
|
|
4138
4138
|
if (!url.path)
|
|
4139
4139
|
return aPath;
|
|
4140
|
-
|
|
4140
|
+
path2 = url.path;
|
|
4141
4141
|
}
|
|
4142
|
-
for (var isAbsolute3 = exports.isAbsolute(
|
|
4142
|
+
for (var isAbsolute3 = exports.isAbsolute(path2), parts = path2.split(/\/+/), part, up3 = 0, i2 = parts.length - 1; i2 >= 0; i2--)
|
|
4143
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--));
|
|
4144
|
-
return
|
|
4144
|
+
return path2 = parts.join("/"), path2 === "" && (path2 = isAbsolute3 ? "/" : "."), url ? (url.path = path2, urlGenerate(url)) : path2;
|
|
4145
4145
|
}
|
|
4146
4146
|
exports.normalize = normalize2;
|
|
4147
|
-
function
|
|
4147
|
+
function join5(aRoot, aPath) {
|
|
4148
4148
|
aRoot === "" && (aRoot = "."), aPath === "" && (aPath = ".");
|
|
4149
4149
|
var aPathUrl = urlParse(aPath), aRootUrl = urlParse(aRoot);
|
|
4150
4150
|
if (aRootUrl && (aRoot = aRootUrl.path || "/"), aPathUrl && !aPathUrl.scheme)
|
|
@@ -4156,7 +4156,7 @@ var require_util = __commonJS({
|
|
|
4156
4156
|
var joined = aPath.charAt(0) === "/" ? aPath : normalize2(aRoot.replace(/\/+$/, "") + "/" + aPath);
|
|
4157
4157
|
return aRootUrl ? (aRootUrl.path = joined, urlGenerate(aRootUrl)) : joined;
|
|
4158
4158
|
}
|
|
4159
|
-
exports.join =
|
|
4159
|
+
exports.join = join5;
|
|
4160
4160
|
exports.isAbsolute = function(aPath) {
|
|
4161
4161
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
4162
4162
|
};
|
|
@@ -4228,7 +4228,7 @@ var require_util = __commonJS({
|
|
|
4228
4228
|
var index = parsed.path.lastIndexOf("/");
|
|
4229
4229
|
index >= 0 && (parsed.path = parsed.path.substring(0, index + 1));
|
|
4230
4230
|
}
|
|
4231
|
-
sourceURL =
|
|
4231
|
+
sourceURL = join5(urlGenerate(parsed), sourceURL);
|
|
4232
4232
|
}
|
|
4233
4233
|
return normalize2(sourceURL);
|
|
4234
4234
|
}
|
|
@@ -5372,7 +5372,7 @@ var require_escodegen = __commonJS({
|
|
|
5372
5372
|
function noEmptySpace() {
|
|
5373
5373
|
return space || " ";
|
|
5374
5374
|
}
|
|
5375
|
-
function
|
|
5375
|
+
function join5(left, right) {
|
|
5376
5376
|
var leftSource, rightSource, leftCharCode, rightCharCode;
|
|
5377
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]));
|
|
5378
5378
|
}
|
|
@@ -5508,7 +5508,7 @@ var require_escodegen = __commonJS({
|
|
|
5508
5508
|
return withIndent(function() {
|
|
5509
5509
|
stmt.left.type === Syntax.VariableDeclaration ? withIndent(function() {
|
|
5510
5510
|
result.push(stmt.left.kind + noEmptySpace()), result.push(that.generateStatement(stmt.left.declarations[0], S_FFFF));
|
|
5511
|
-
}) : result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT)), result =
|
|
5511
|
+
}) : result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT)), result = join5(result, operator), result = [join5(
|
|
5512
5512
|
result,
|
|
5513
5513
|
that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)
|
|
5514
5514
|
), ")"];
|
|
@@ -5556,14 +5556,14 @@ var require_escodegen = __commonJS({
|
|
|
5556
5556
|
},
|
|
5557
5557
|
ClassDeclaration: function(stmt, flags) {
|
|
5558
5558
|
var result, fragment;
|
|
5559
|
-
return result = ["class"], stmt.id && (result =
|
|
5559
|
+
return result = ["class"], stmt.id && (result = join5(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT))), stmt.superClass && (fragment = join5("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT)), result = join5(result, fragment)), result.push(space), result.push(this.generateStatement(stmt.body, S_TFFT)), result;
|
|
5560
5560
|
},
|
|
5561
5561
|
DirectiveStatement: function(stmt, flags) {
|
|
5562
5562
|
return extra.raw && stmt.raw ? stmt.raw + this.semicolon(flags) : escapeDirective(stmt.directive) + this.semicolon(flags);
|
|
5563
5563
|
},
|
|
5564
5564
|
DoWhileStatement: function(stmt, flags) {
|
|
5565
|
-
var result =
|
|
5566
|
-
return result = this.maybeBlockSuffix(stmt.body, result),
|
|
5565
|
+
var result = join5("do", this.maybeBlock(stmt.body, S_TFFF));
|
|
5566
|
+
return result = this.maybeBlockSuffix(stmt.body, result), join5(result, [
|
|
5567
5567
|
"while" + space + "(",
|
|
5568
5568
|
this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
5569
5569
|
")" + this.semicolon(flags)
|
|
@@ -5588,15 +5588,15 @@ var require_escodegen = __commonJS({
|
|
|
5588
5588
|
},
|
|
5589
5589
|
ExportDefaultDeclaration: function(stmt, flags) {
|
|
5590
5590
|
var result = ["export"], bodyFlags;
|
|
5591
|
-
return bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF, result =
|
|
5591
|
+
return bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF, result = join5(result, "default"), isStatement(stmt.declaration) ? result = join5(result, this.generateStatement(stmt.declaration, bodyFlags)) : result = join5(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags)), result;
|
|
5592
5592
|
},
|
|
5593
5593
|
ExportNamedDeclaration: function(stmt, flags) {
|
|
5594
5594
|
var result = ["export"], bodyFlags, that = this;
|
|
5595
|
-
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 ? join5(result, this.generateStatement(stmt.declaration, bodyFlags)) : (stmt.specifiers && (stmt.specifiers.length === 0 ? result = join5(result, "{" + space + "}") : stmt.specifiers[0].type === Syntax.ExportBatchSpecifier ? result = join5(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT)) : (result = join5(result, "{"), withIndent(function(indent2) {
|
|
5596
5596
|
var i2, iz;
|
|
5597
5597
|
for (result.push(newline), i2 = 0, iz = stmt.specifiers.length; i2 < iz; ++i2)
|
|
5598
5598
|
result.push(indent2), result.push(that.generateExpression(stmt.specifiers[i2], Precedence.Sequence, E_TTT)), i2 + 1 < iz && result.push("," + newline);
|
|
5599
|
-
}), 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 = join5(result, [
|
|
5600
5600
|
"from" + space,
|
|
5601
5601
|
// ModuleSpecifier
|
|
5602
5602
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
@@ -5644,16 +5644,16 @@ var require_escodegen = __commonJS({
|
|
|
5644
5644
|
this.semicolon(flags)
|
|
5645
5645
|
] : (result = [
|
|
5646
5646
|
"import"
|
|
5647
|
-
], cursor = 0, stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier && (result =
|
|
5647
|
+
], cursor = 0, stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier && (result = join5(result, [
|
|
5648
5648
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
5649
|
-
]), ++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 = join5(result, [
|
|
5650
5650
|
space,
|
|
5651
5651
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
5652
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) {
|
|
5653
5653
|
var i2, iz;
|
|
5654
5654
|
for (result.push(newline), i2 = cursor, iz = stmt.specifiers.length; i2 < iz; ++i2)
|
|
5655
5655
|
result.push(indent2), result.push(that.generateExpression(stmt.specifiers[i2], Precedence.Sequence, E_TTT)), i2 + 1 < iz && result.push("," + newline);
|
|
5656
|
-
}), 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 = join5(result, [
|
|
5657
5657
|
"from" + space,
|
|
5658
5658
|
// ModuleSpecifier
|
|
5659
5659
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
@@ -5681,7 +5681,7 @@ var require_escodegen = __commonJS({
|
|
|
5681
5681
|
return stmt.declarations.length > 1 ? withIndent(block) : block(), result.push(this.semicolon(flags)), result;
|
|
5682
5682
|
},
|
|
5683
5683
|
ThrowStatement: function(stmt, flags) {
|
|
5684
|
-
return [
|
|
5684
|
+
return [join5(
|
|
5685
5685
|
"throw",
|
|
5686
5686
|
this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)
|
|
5687
5687
|
), this.semicolon(flags)];
|
|
@@ -5690,18 +5690,18 @@ var require_escodegen = __commonJS({
|
|
|
5690
5690
|
var result, i2, iz, guardedHandlers;
|
|
5691
5691
|
if (result = ["try", this.maybeBlock(stmt.block, S_TFFF)], result = this.maybeBlockSuffix(stmt.block, result), stmt.handlers)
|
|
5692
5692
|
for (i2 = 0, iz = stmt.handlers.length; i2 < iz; ++i2)
|
|
5693
|
-
result =
|
|
5693
|
+
result = join5(result, this.generateStatement(stmt.handlers[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(stmt.handlers[i2].body, result));
|
|
5694
5694
|
else {
|
|
5695
5695
|
for (guardedHandlers = stmt.guardedHandlers || [], i2 = 0, iz = guardedHandlers.length; i2 < iz; ++i2)
|
|
5696
|
-
result =
|
|
5696
|
+
result = join5(result, this.generateStatement(guardedHandlers[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(guardedHandlers[i2].body, result));
|
|
5697
5697
|
if (stmt.handler)
|
|
5698
5698
|
if (Array.isArray(stmt.handler))
|
|
5699
5699
|
for (i2 = 0, iz = stmt.handler.length; i2 < iz; ++i2)
|
|
5700
|
-
result =
|
|
5700
|
+
result = join5(result, this.generateStatement(stmt.handler[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(stmt.handler[i2].body, result));
|
|
5701
5701
|
else
|
|
5702
|
-
result =
|
|
5702
|
+
result = join5(result, this.generateStatement(stmt.handler, S_TFFF)), stmt.finalizer && (result = this.maybeBlockSuffix(stmt.handler.body, result));
|
|
5703
5703
|
}
|
|
5704
|
-
return stmt.finalizer && (result =
|
|
5704
|
+
return stmt.finalizer && (result = join5(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)])), result;
|
|
5705
5705
|
},
|
|
5706
5706
|
SwitchStatement: function(stmt, flags) {
|
|
5707
5707
|
var result, fragment, i2, iz, bodyFlags, that = this;
|
|
@@ -5720,7 +5720,7 @@ var require_escodegen = __commonJS({
|
|
|
5720
5720
|
var result, fragment, i2, iz, bodyFlags, that = this;
|
|
5721
5721
|
return withIndent(function() {
|
|
5722
5722
|
for (stmt.test ? result = [
|
|
5723
|
-
|
|
5723
|
+
join5("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
|
|
5724
5724
|
":"
|
|
5725
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)
|
|
5726
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);
|
|
@@ -5734,7 +5734,7 @@ var require_escodegen = __commonJS({
|
|
|
5734
5734
|
that.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
5735
5735
|
")"
|
|
5736
5736
|
];
|
|
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 =
|
|
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 = join5(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]) : result = join5(result, join5("else", this.maybeBlock(stmt.alternate, bodyFlags)))) : result.push(this.maybeBlock(stmt.consequent, bodyFlags)), result;
|
|
5738
5738
|
},
|
|
5739
5739
|
ForStatement: function(stmt, flags) {
|
|
5740
5740
|
var result, that = this;
|
|
@@ -5768,7 +5768,7 @@ var require_escodegen = __commonJS({
|
|
|
5768
5768
|
];
|
|
5769
5769
|
},
|
|
5770
5770
|
ReturnStatement: function(stmt, flags) {
|
|
5771
|
-
return stmt.argument ? [
|
|
5771
|
+
return stmt.argument ? [join5(
|
|
5772
5772
|
"return",
|
|
5773
5773
|
this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)
|
|
5774
5774
|
), this.semicolon(flags)] : ["return" + this.semicolon(flags)];
|
|
@@ -5824,7 +5824,7 @@ var require_escodegen = __commonJS({
|
|
|
5824
5824
|
},
|
|
5825
5825
|
BinaryExpression: function(expr, precedence, flags) {
|
|
5826
5826
|
var result, leftPrecedence, rightPrecedence, currentPrecedence, fragment, leftSource;
|
|
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 =
|
|
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 = join5(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 = join5(result, fragment), expr.operator === "in" && !(flags & F_ALLOW_IN) ? ["(", result, ")"] : (expr.operator === "||" || expr.operator === "&&") && flags & F_FOUND_COALESCE ? ["(", result, ")"] : parenthesize(result, currentPrecedence, precedence);
|
|
5828
5828
|
},
|
|
5829
5829
|
CallExpression: function(expr, precedence, flags) {
|
|
5830
5830
|
var result, i2, iz;
|
|
@@ -5839,7 +5839,7 @@ var require_escodegen = __commonJS({
|
|
|
5839
5839
|
},
|
|
5840
5840
|
NewExpression: function(expr, precedence, flags) {
|
|
5841
5841
|
var result, length, i2, iz, itemFlags;
|
|
5842
|
-
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 = join5(
|
|
5843
5843
|
"new",
|
|
5844
5844
|
this.generateExpression(expr.callee, Precedence.New, itemFlags)
|
|
5845
5845
|
), !(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
|
|
@@ -5859,17 +5859,17 @@ var require_escodegen = __commonJS({
|
|
|
5859
5859
|
},
|
|
5860
5860
|
UnaryExpression: function(expr, precedence, flags) {
|
|
5861
5861
|
var result, fragment, rightCharCode, leftSource, leftCharCode;
|
|
5862
|
-
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 = join5(expr.operator, fragment) : (result = [expr.operator], expr.operator.length > 2 ? result = join5(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);
|
|
5863
5863
|
},
|
|
5864
5864
|
YieldExpression: function(expr, precedence, flags) {
|
|
5865
5865
|
var result;
|
|
5866
|
-
return expr.delegate ? result = "yield*" : result = "yield", expr.argument && (result =
|
|
5866
|
+
return expr.delegate ? result = "yield*" : result = "yield", expr.argument && (result = join5(
|
|
5867
5867
|
result,
|
|
5868
5868
|
this.generateExpression(expr.argument, Precedence.Yield, E_TTT)
|
|
5869
5869
|
)), parenthesize(result, Precedence.Yield, precedence);
|
|
5870
5870
|
},
|
|
5871
5871
|
AwaitExpression: function(expr, precedence, flags) {
|
|
5872
|
-
var result =
|
|
5872
|
+
var result = join5(
|
|
5873
5873
|
expr.all ? "await*" : "await",
|
|
5874
5874
|
this.generateExpression(expr.argument, Precedence.Await, E_TTT)
|
|
5875
5875
|
);
|
|
@@ -5915,18 +5915,18 @@ var require_escodegen = __commonJS({
|
|
|
5915
5915
|
},
|
|
5916
5916
|
ClassExpression: function(expr, precedence, flags) {
|
|
5917
5917
|
var result, fragment;
|
|
5918
|
-
return result = ["class"], expr.id && (result =
|
|
5918
|
+
return result = ["class"], expr.id && (result = join5(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT))), expr.superClass && (fragment = join5("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT)), result = join5(result, fragment)), result.push(space), result.push(this.generateStatement(expr.body, S_TFFT)), result;
|
|
5919
5919
|
},
|
|
5920
5920
|
MethodDefinition: function(expr, precedence, flags) {
|
|
5921
5921
|
var result, fragment;
|
|
5922
5922
|
return expr.static ? result = ["static" + space] : result = [], expr.kind === "get" || expr.kind === "set" ? fragment = [
|
|
5923
|
-
|
|
5923
|
+
join5(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
|
|
5924
5924
|
this.generateFunctionBody(expr.value)
|
|
5925
5925
|
] : fragment = [
|
|
5926
5926
|
generateMethodPrefix(expr),
|
|
5927
5927
|
this.generatePropertyKey(expr.key, expr.computed),
|
|
5928
5928
|
this.generateFunctionBody(expr.value)
|
|
5929
|
-
],
|
|
5929
|
+
], join5(result, fragment);
|
|
5930
5930
|
},
|
|
5931
5931
|
Property: function(expr, precedence, flags) {
|
|
5932
5932
|
return expr.kind === "get" || expr.kind === "set" ? [
|
|
@@ -6017,8 +6017,8 @@ var require_escodegen = __commonJS({
|
|
|
6017
6017
|
var result, i2, iz, fragment, that = this;
|
|
6018
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() {
|
|
6019
6019
|
for (i2 = 0, iz = expr.blocks.length; i2 < iz; ++i2)
|
|
6020
|
-
fragment = that.generateExpression(expr.blocks[i2], Precedence.Sequence, E_TTT), i2 > 0 || extra.moz.comprehensionExpressionStartsWithAssignment ? result =
|
|
6021
|
-
}), expr.filter && (result =
|
|
6020
|
+
fragment = that.generateExpression(expr.blocks[i2], Precedence.Sequence, E_TTT), i2 > 0 || extra.moz.comprehensionExpressionStartsWithAssignment ? result = join5(result, fragment) : result.push(fragment);
|
|
6021
|
+
}), expr.filter && (result = join5(result, "if" + space), fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT), result = join5(result, ["(", fragment, ")"])), extra.moz.comprehensionExpressionStartsWithAssignment || (fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT), result = join5(result, fragment)), result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]"), result;
|
|
6022
6022
|
},
|
|
6023
6023
|
ComprehensionBlock: function(expr, precedence, flags) {
|
|
6024
6024
|
var fragment;
|
|
@@ -6026,7 +6026,7 @@ var require_escodegen = __commonJS({
|
|
|
6026
6026
|
expr.left.kind,
|
|
6027
6027
|
noEmptySpace(),
|
|
6028
6028
|
this.generateStatement(expr.left.declarations[0], S_FFFF)
|
|
6029
|
-
] : fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT), fragment =
|
|
6029
|
+
] : fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT), fragment = join5(fragment, expr.of ? "of" : "in"), fragment = join5(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT)), ["for" + space + "(", fragment, ")"];
|
|
6030
6030
|
},
|
|
6031
6031
|
SpreadElement: function(expr, precedence, flags) {
|
|
6032
6032
|
return [
|
|
@@ -6167,7 +6167,7 @@ __export(acorn_exports, {
|
|
|
6167
6167
|
lineBreak: () => lineBreak,
|
|
6168
6168
|
lineBreakG: () => lineBreakG,
|
|
6169
6169
|
nonASCIIwhitespace: () => nonASCIIwhitespace,
|
|
6170
|
-
parse: () =>
|
|
6170
|
+
parse: () => parse3,
|
|
6171
6171
|
parseExpressionAt: () => parseExpressionAt2,
|
|
6172
6172
|
tokContexts: () => types,
|
|
6173
6173
|
tokTypes: () => types$1,
|
|
@@ -6335,7 +6335,7 @@ function stringToNumber(str, isLegacyOctalNumericLiteral) {
|
|
|
6335
6335
|
function stringToBigInt(str) {
|
|
6336
6336
|
return typeof BigInt != "function" ? null : BigInt(str.replace(/_/g, ""));
|
|
6337
6337
|
}
|
|
6338
|
-
function
|
|
6338
|
+
function parse3(input, options) {
|
|
6339
6339
|
return Parser.parse(input, options);
|
|
6340
6340
|
}
|
|
6341
6341
|
function parseExpressionAt2(input, pos, options) {
|
|
@@ -6629,8 +6629,8 @@ var astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars,
|
|
|
6629
6629
|
return new this(options, input).parse();
|
|
6630
6630
|
};
|
|
6631
6631
|
Parser.parseExpressionAt = function(input, pos, options) {
|
|
6632
|
-
var
|
|
6633
|
-
return
|
|
6632
|
+
var parser = new this(options, input, pos);
|
|
6633
|
+
return parser.nextToken(), parser.parseExpression();
|
|
6634
6634
|
};
|
|
6635
6635
|
Parser.tokenizer = function(input, options) {
|
|
6636
6636
|
return new this(options, input);
|
|
@@ -7958,8 +7958,8 @@ var astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars,
|
|
|
7958
7958
|
return scope;
|
|
7959
7959
|
}
|
|
7960
7960
|
};
|
|
7961
|
-
Node = function(
|
|
7962
|
-
this.type = "", this.start = pos, this.end = 0,
|
|
7961
|
+
Node = function(parser, pos, loc) {
|
|
7962
|
+
this.type = "", this.start = pos, this.end = 0, parser.options.locations && (this.loc = new SourceLocation(parser, loc)), parser.options.directSourceFile && (this.sourceFile = parser.options.directSourceFile), parser.options.ranges && (this.range = [pos, 0]);
|
|
7963
7963
|
}, pp$2 = Parser.prototype;
|
|
7964
7964
|
pp$2.startNode = function() {
|
|
7965
7965
|
return new Node(this, this.start, this.startLoc);
|
|
@@ -8016,8 +8016,8 @@ var astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars,
|
|
|
8016
8016
|
BranchID.prototype.sibling = function() {
|
|
8017
8017
|
return new BranchID(this.parent, this.base);
|
|
8018
8018
|
};
|
|
8019
|
-
RegExpValidationState = function(
|
|
8020
|
-
this.parser =
|
|
8019
|
+
RegExpValidationState = function(parser) {
|
|
8020
|
+
this.parser = parser, this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion], this.source = "", this.flags = "", this.start = 0, this.switchU = !1, this.switchV = !1, this.switchN = !1, this.pos = 0, this.lastIntValue = 0, this.lastStringValue = "", this.lastAssertionIsQuantifiable = !1, this.numCapturingParens = 0, this.maxBackReference = 0, this.groupNames = /* @__PURE__ */ Object.create(null), this.backReferenceNames = [], this.branchID = null;
|
|
8021
8021
|
};
|
|
8022
8022
|
RegExpValidationState.prototype.reset = function(start, pattern, flags) {
|
|
8023
8023
|
var unicodeSets = flags.indexOf("v") !== -1, unicode = flags.indexOf("u") !== -1;
|
|
@@ -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(path2) {
|
|
10538
|
+
if (!fs.existsSync(path2))
|
|
10539
10539
|
return !1;
|
|
10540
10540
|
try {
|
|
10541
|
-
var stats = fs.statSync(
|
|
10541
|
+
var stats = fs.statSync(path2);
|
|
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(path2, callback) {
|
|
10554
|
+
fs.readFile(path2, "utf8", function(err, result) {
|
|
10555
10555
|
if (err || !result)
|
|
10556
10556
|
return callback();
|
|
10557
10557
|
var json = JSON.parse(result);
|
|
@@ -10559,16 +10559,16 @@ var require_filesystem = __commonJS({
|
|
|
10559
10559
|
});
|
|
10560
10560
|
}
|
|
10561
10561
|
exports.readJsonFromDiskAsync = readJsonFromDiskAsync;
|
|
10562
|
-
function fileExistsAsync(
|
|
10563
|
-
fs.stat(
|
|
10562
|
+
function fileExistsAsync(path2, callback2) {
|
|
10563
|
+
fs.stat(path2, function(err, stats) {
|
|
10564
10564
|
if (err)
|
|
10565
10565
|
return callback2(void 0, !1);
|
|
10566
10566
|
callback2(void 0, stats ? stats.isFile() : !1);
|
|
10567
10567
|
});
|
|
10568
10568
|
}
|
|
10569
10569
|
exports.fileExistsAsync = fileExistsAsync;
|
|
10570
|
-
function removeExtension(
|
|
10571
|
-
return
|
|
10570
|
+
function removeExtension(path2) {
|
|
10571
|
+
return path2.substring(0, path2.lastIndexOf(".")) || path2;
|
|
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 path2 = __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 path2.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 path2 = __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: path2.join(physicalPath, "/package.json")
|
|
10631
10631
|
});
|
|
10632
|
-
var indexPath =
|
|
10632
|
+
var indexPath = path2.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 path2 = __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 = path2.join(path2.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 path2 = __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 = path2.join(path2.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 path2 = __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,22 +11688,22 @@ 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() ? path2.resolve(filename, "./tsconfig.json") : path2.resolve(cwd2, filename);
|
|
11692
11692
|
return absolutePath;
|
|
11693
11693
|
}
|
|
11694
11694
|
if (fs.statSync(cwd2).isFile())
|
|
11695
|
-
return
|
|
11695
|
+
return path2.resolve(cwd2);
|
|
11696
11696
|
var configAbsolutePath = walkForTsConfig(cwd2);
|
|
11697
|
-
return configAbsolutePath ?
|
|
11697
|
+
return configAbsolutePath ? path2.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 path2.join(directory, fileToCheck);
|
|
11705
11705
|
}
|
|
11706
|
-
var parentDirectory =
|
|
11706
|
+
var parentDirectory = path2.dirname(directory);
|
|
11707
11707
|
if (directory !== parentDirectory)
|
|
11708
11708
|
return walkForTsConfig(parentDirectory, readdirSync);
|
|
11709
11709
|
}
|
|
@@ -11732,12 +11732,12 @@ var require_tsconfig_loader = __commonJS({
|
|
|
11732
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 && !existsSync3(extendedConfigPath) && (extendedConfigPath =
|
|
11735
|
+
var currentDir = path2.dirname(configFilePath), extendedConfigPath = path2.join(currentDir, extendedConfigValue);
|
|
11736
|
+
extendedConfigValue.indexOf("/") !== -1 && extendedConfigValue.indexOf(".") !== -1 && !existsSync3(extendedConfigPath) && (extendedConfigPath = path2.join(currentDir, "node_modules", extendedConfigValue));
|
|
11737
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 = path2.dirname(extendedConfigValue);
|
|
11740
|
+
config.compilerOptions.baseUrl = path2.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(), path2 = __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 = path2.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path2.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: path2.resolve(path2.dirname(loadResult.tsConfigPath), loadResult.baseUrl || ""),
|
|
11786
11786
|
paths: loadResult.paths || {},
|
|
11787
11787
|
addMatchAll: loadResult.baseUrl !== void 0
|
|
11788
11788
|
} : {
|
|
@@ -12073,11 +12073,11 @@ var require_caller = __commonJS({
|
|
|
12073
12073
|
var require_path_parse = __commonJS({
|
|
12074
12074
|
"../../../node_modules/path-parse/index.js"(exports, module) {
|
|
12075
12075
|
"use strict";
|
|
12076
|
-
var isWindows = process.platform === "win32", splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/,
|
|
12076
|
+
var isWindows = process.platform === "win32", splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/, win322 = {};
|
|
12077
12077
|
function win32SplitPath(filename) {
|
|
12078
12078
|
return splitWindowsRe.exec(filename).slice(1);
|
|
12079
12079
|
}
|
|
12080
|
-
|
|
12080
|
+
win322.parse = function(pathString) {
|
|
12081
12081
|
if (typeof pathString != "string")
|
|
12082
12082
|
throw new TypeError(
|
|
12083
12083
|
"Parameter 'pathString' must be a string, not " + typeof pathString
|
|
@@ -12093,11 +12093,11 @@ var require_path_parse = __commonJS({
|
|
|
12093
12093
|
name: allParts[3]
|
|
12094
12094
|
};
|
|
12095
12095
|
};
|
|
12096
|
-
var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/,
|
|
12096
|
+
var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/, posix2 = {};
|
|
12097
12097
|
function posixSplitPath(filename) {
|
|
12098
12098
|
return splitPathRe.exec(filename).slice(1);
|
|
12099
12099
|
}
|
|
12100
|
-
|
|
12100
|
+
posix2.parse = function(pathString) {
|
|
12101
12101
|
if (typeof pathString != "string")
|
|
12102
12102
|
throw new TypeError(
|
|
12103
12103
|
"Parameter 'pathString' must be a string, not " + typeof pathString
|
|
@@ -12113,16 +12113,16 @@ var require_path_parse = __commonJS({
|
|
|
12113
12113
|
name: allParts[3]
|
|
12114
12114
|
};
|
|
12115
12115
|
};
|
|
12116
|
-
isWindows ? module.exports =
|
|
12117
|
-
module.exports.posix =
|
|
12118
|
-
module.exports.win32 =
|
|
12116
|
+
isWindows ? module.exports = win322.parse : module.exports = posix2.parse;
|
|
12117
|
+
module.exports.posix = posix2.parse;
|
|
12118
|
+
module.exports.win32 = win322.parse;
|
|
12119
12119
|
}
|
|
12120
12120
|
});
|
|
12121
12121
|
|
|
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 path2 = __require("path"), parse7 = path2.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 path2.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 path2 = __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 = path2.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 = path2.dirname(manifestPath), unqualifiedPath = typeof parts[2] < "u" ? path2.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 = path2.dirname(resolution.packagePath);
|
|
12194
|
+
return request.match(/^@[^/]+\//) && (nodeModules = path2.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(), path2 = __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
|
+
path2.join(homedir, ".node_modules"),
|
|
12501
|
+
path2.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] = path2.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 || path2.dirname(caller()), parent = opts.filename || basedir;
|
|
12554
12554
|
opts.paths = opts.paths || defaultPaths();
|
|
12555
|
-
var absoluteStart =
|
|
12555
|
+
var absoluteStart = path2.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 = path2.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(path2.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 = path2.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
|
+
path2.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(path2.dirname(dir), cb2);
|
|
12629
|
+
var pkgfile = path2.join(pkgdir, "package.json");
|
|
12630
12630
|
isFile2(pkgfile, function(err2, ex) {
|
|
12631
|
-
if (!ex) return loadpkg(
|
|
12631
|
+
if (!ex) return loadpkg(path2.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 = path2.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(path2.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(path2.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(path2.join(x2, "index"), pkg2, cb2);
|
|
12661
|
+
var dir = path2.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(path2.join(x2, "index"), pkg3, cb2);
|
|
12666
12666
|
});
|
|
12667
12667
|
});
|
|
12668
12668
|
return;
|
|
12669
12669
|
}
|
|
12670
|
-
loadAsFile(
|
|
12670
|
+
loadAsFile(path2.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(path2.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"), path2 = __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
|
+
path2.join(homedir, ".node_modules"),
|
|
12905
|
+
path2.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] = path2.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 || path2.dirname(caller()), parent = opts.filename || basedir;
|
|
12956
12956
|
opts.paths = opts.paths || defaultPaths();
|
|
12957
|
-
var absoluteStart = maybeRealpathSync(realpathSync,
|
|
12957
|
+
var absoluteStart = maybeRealpathSync(realpathSync, path2.resolve(basedir), opts);
|
|
12958
12958
|
if (relativePathRegex.test(x)) {
|
|
12959
|
-
var res =
|
|
12959
|
+
var res = path2.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(path2.dirname(x2));
|
|
12973
12973
|
if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
|
|
12974
|
-
var rfile =
|
|
12975
|
-
r && (x2 =
|
|
12974
|
+
var rfile = path2.relative(pkg.dir, x2), r = opts.pathFilter(pkg.pkg, x2, rfile);
|
|
12975
|
+
r && (x2 = path2.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 = path2.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
|
|
12988
12988
|
if (!isFile2(pkgfile))
|
|
12989
|
-
return loadpkg(
|
|
12989
|
+
return loadpkg(path2.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 = path2.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(path2.resolve(x2, pkg.main));
|
|
13017
13017
|
if (m2) return m2;
|
|
13018
|
-
var n2 = loadAsDirectorySync(
|
|
13018
|
+
var n2 = loadAsDirectorySync(path2.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(path2.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(path2.dirname(dir))) {
|
|
13032
13032
|
var m2 = loadAsFileSync(dir);
|
|
13033
13033
|
if (m2) return m2;
|
|
13034
13034
|
var n2 = loadAsDirectorySync(dir);
|
|
@@ -13060,7 +13060,10 @@ 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";
|
|
13063
|
-
import {
|
|
13063
|
+
import {
|
|
13064
|
+
findTsconfigPath as findTsconfigPathCommon,
|
|
13065
|
+
resolveImport
|
|
13066
|
+
} from "storybook/internal/common";
|
|
13064
13067
|
import { logger } from "storybook/internal/node-logger";
|
|
13065
13068
|
|
|
13066
13069
|
// ../../../node_modules/empathic/find.mjs
|
|
@@ -13109,7 +13112,7 @@ function invariant(condition, message) {
|
|
|
13109
13112
|
throw new Error((typeof message == "function" ? message() : message) ?? "Invariant failed");
|
|
13110
13113
|
}
|
|
13111
13114
|
var memoStore = /* @__PURE__ */ new WeakMap(), asyncMemoStore = /* @__PURE__ */ new WeakMap(), textFileCache = /* @__PURE__ */ new Map(), cached = (fn, opts = {}) => {
|
|
13112
|
-
let
|
|
13115
|
+
let keyOf = opts.key ?? ((...args) => {
|
|
13113
13116
|
try {
|
|
13114
13117
|
return JSON.stringify(args);
|
|
13115
13118
|
} catch {
|
|
@@ -13117,14 +13120,14 @@ var memoStore = /* @__PURE__ */ new WeakMap(), asyncMemoStore = /* @__PURE__ */
|
|
|
13117
13120
|
}
|
|
13118
13121
|
});
|
|
13119
13122
|
return (...args) => {
|
|
13120
|
-
let k =
|
|
13123
|
+
let k = keyOf(...args), name = fn.name || opts.name || "anonymous", store = memoStore.get(fn);
|
|
13121
13124
|
if (store || (store = /* @__PURE__ */ new Map(), memoStore.set(fn, store)), store.has(k))
|
|
13122
13125
|
return logger.verbose(`[cache] hit ${name} key=${k}`), store.get(k);
|
|
13123
13126
|
let start = Date.now(), result = fn(...args), duration = Date.now() - start;
|
|
13124
13127
|
return store.set(k, result), logger.verbose(`[cache] miss ${name} took ${duration}ms key=${k}`), result;
|
|
13125
13128
|
};
|
|
13126
13129
|
}, asyncCache = (fn, opts = {}) => {
|
|
13127
|
-
let
|
|
13130
|
+
let keyOf = opts.key ?? ((...args) => {
|
|
13128
13131
|
try {
|
|
13129
13132
|
return JSON.stringify(args);
|
|
13130
13133
|
} catch {
|
|
@@ -13132,7 +13135,7 @@ var memoStore = /* @__PURE__ */ new WeakMap(), asyncMemoStore = /* @__PURE__ */
|
|
|
13132
13135
|
}
|
|
13133
13136
|
});
|
|
13134
13137
|
return (...args) => {
|
|
13135
|
-
let k =
|
|
13138
|
+
let k = keyOf(...args), name = fn.name || opts.name || "anonymous", store = asyncMemoStore.get(fn);
|
|
13136
13139
|
store || (store = /* @__PURE__ */ new Map(), asyncMemoStore.set(fn, store));
|
|
13137
13140
|
let existing = store.get(k);
|
|
13138
13141
|
if (existing)
|
|
@@ -13160,20 +13163,19 @@ var memoStore = /* @__PURE__ */ new WeakMap(), asyncMemoStore = /* @__PURE__ */
|
|
|
13160
13163
|
return mtimeMs !== void 0 && textFileCache.set(filePath, { mtimeMs, content }), content;
|
|
13161
13164
|
}, cachedFindUp = cached(up2, { name: "findUp" }), cachedResolveImport = cached(resolveImport, {
|
|
13162
13165
|
name: "resolveImport"
|
|
13163
|
-
}),
|
|
13164
|
-
(cwd2) =>
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
|
|
13168
|
-
if (found)
|
|
13169
|
-
return found;
|
|
13170
|
-
}
|
|
13171
|
-
},
|
|
13172
|
-
{ name: "findTsconfigPath" }
|
|
13166
|
+
}), findTsconfigPath = cached(
|
|
13167
|
+
(cwd2) => findTsconfigPathCommon(cwd2),
|
|
13168
|
+
{
|
|
13169
|
+
name: "findTsconfigPath"
|
|
13170
|
+
}
|
|
13173
13171
|
);
|
|
13174
13172
|
|
|
13175
13173
|
// src/componentManifest/componentMeta/ComponentMetaProject.ts
|
|
13176
13174
|
var import_language_core = __toESM(require_language_core(), 1), import_typescript = __toESM(require_typescript(), 1);
|
|
13175
|
+
import {
|
|
13176
|
+
ProgramBackedProject,
|
|
13177
|
+
ProjectFileTracker
|
|
13178
|
+
} from "storybook/internal/component-meta";
|
|
13177
13179
|
import * as path from "path";
|
|
13178
13180
|
|
|
13179
13181
|
// src/componentManifest/componentMeta/componentMetaExtractor.ts
|
|
@@ -13637,8 +13639,8 @@ function getJSDocDefault(typescript, prop, checker) {
|
|
|
13637
13639
|
if (tag.name === "default" || tag.name === "defaultValue")
|
|
13638
13640
|
return typescript.displayPartsToString(tag.text) || void 0;
|
|
13639
13641
|
}
|
|
13640
|
-
function extractPropItem(typescript, checker, prop, contextNode, defaultsMap) {
|
|
13641
|
-
let isRequired = !!!(prop.flags & typescript.SymbolFlags.Optional), propType = checker.getTypeOfSymbolAtLocation(prop, contextNode), type = serializeType(typescript, checker, propType, isRequired), description = typescript.displayPartsToString(prop.getDocumentationComment(checker)), parent = getParentType(typescript, prop), declarations = getAllDeclarationParents(typescript, prop), propName = prop.getName(), destructuringDefault = defaultsMap?.get(propName), jsDocDefault = getJSDocDefault(typescript, prop, checker), defaultStr = destructuringDefault ?? jsDocDefault;
|
|
13642
|
+
function extractPropItem(typescript, checker, prop, contextNode, defaultsMap, typeOverride) {
|
|
13643
|
+
let isRequired = !!!(prop.flags & typescript.SymbolFlags.Optional), propType = typeOverride ?? checker.getTypeOfSymbolAtLocation(prop, contextNode), type = serializeType(typescript, checker, propType, isRequired), description = typescript.displayPartsToString(prop.getDocumentationComment(checker)), parent = getParentType(typescript, prop), declarations = getAllDeclarationParents(typescript, prop), propName = prop.getName(), destructuringDefault = defaultsMap?.get(propName), jsDocDefault = getJSDocDefault(typescript, prop, checker), defaultStr = destructuringDefault ?? jsDocDefault;
|
|
13642
13644
|
return {
|
|
13643
13645
|
name: propName,
|
|
13644
13646
|
required: isRequired,
|
|
@@ -13742,7 +13744,14 @@ function serializeComponentDoc(typescript, checker, {
|
|
|
13742
13744
|
for (let prop of allProperties) {
|
|
13743
13745
|
if (excluded.has(prop.getName()))
|
|
13744
13746
|
continue;
|
|
13745
|
-
let
|
|
13747
|
+
let unionProp = isUnionType(propsType) ? checker.getPropertyOfType(propsType, prop.getName()) : void 0, unionPropType = unionProp ? checker.getTypeOfSymbolAtLocation(unionProp, contextNode) : void 0, item = extractPropItem(
|
|
13748
|
+
typescript,
|
|
13749
|
+
checker,
|
|
13750
|
+
prop,
|
|
13751
|
+
contextNode,
|
|
13752
|
+
defaultsMap,
|
|
13753
|
+
unionPropType
|
|
13754
|
+
);
|
|
13746
13755
|
unionForceOptional?.has(prop.getName()) && (item.required = !1), props[prop.getName()] = item;
|
|
13747
13756
|
}
|
|
13748
13757
|
let displayName = (isMemberSelection ? displayNameOverride : void 0) ?? computeDisplayName({
|
|
@@ -13869,116 +13878,68 @@ function hasExportModifier(typescript, node) {
|
|
|
13869
13878
|
}
|
|
13870
13879
|
|
|
13871
13880
|
// src/componentManifest/componentMeta/ComponentMetaProject.ts
|
|
13872
|
-
var ComponentMetaProject = class {
|
|
13881
|
+
var ComponentMetaProject = class extends ProgramBackedProject {
|
|
13873
13882
|
constructor(typescript, commandLine, configFileName, fsFileSnapshots = /* @__PURE__ */ new Map(), getCommandLineFn, documentRegistry) {
|
|
13883
|
+
super();
|
|
13874
13884
|
this.typescript = typescript;
|
|
13875
13885
|
this.commandLine = commandLine;
|
|
13876
13886
|
this.configFileName = configFileName;
|
|
13877
|
-
this.fsFileSnapshots = fsFileSnapshots;
|
|
13878
|
-
this.getCommandLineFn = getCommandLineFn;
|
|
13879
13887
|
this.documentRegistry = documentRegistry;
|
|
13880
|
-
|
|
13881
|
-
this.shouldCheckRootFiles = !1;
|
|
13882
|
-
/** Entries to extract — set by the generator, replayed during warmup for targeted type resolution. */
|
|
13888
|
+
/** Entries to extract - set by the generator, replayed during warmup for targeted type resolution. */
|
|
13883
13889
|
this.entries = [];
|
|
13890
|
+
this.files = new ProjectFileTracker(
|
|
13891
|
+
typescript,
|
|
13892
|
+
commandLine,
|
|
13893
|
+
fsFileSnapshots,
|
|
13894
|
+
(text) => typescript.ScriptSnapshot.fromString(text),
|
|
13895
|
+
getCommandLineFn
|
|
13896
|
+
);
|
|
13884
13897
|
let language = (0, import_language_core.createLanguage)(
|
|
13885
13898
|
[{ getLanguageId: (fileName) => (0, import_typescript.resolveFileLanguageId)(fileName) }],
|
|
13886
13899
|
new import_language_core.FileMap(typescript.sys.useCaseSensitiveFileNames),
|
|
13887
13900
|
(fileName, includeFsFiles) => {
|
|
13888
13901
|
if (!includeFsFiles)
|
|
13889
13902
|
return;
|
|
13890
|
-
let
|
|
13891
|
-
if (!cache || cache[0] !== modifiedTime)
|
|
13892
|
-
if (typescript.sys.fileExists(fileName)) {
|
|
13893
|
-
let text = typescript.sys.readFile(fileName), snapshot2 = text !== void 0 ? typescript.ScriptSnapshot.fromString(text) : void 0;
|
|
13894
|
-
fsFileSnapshots.set(fileName, [modifiedTime, snapshot2]);
|
|
13895
|
-
} else
|
|
13896
|
-
fsFileSnapshots.set(fileName, [modifiedTime, void 0]);
|
|
13897
|
-
let snapshot = fsFileSnapshots.get(fileName)?.[1];
|
|
13903
|
+
let snapshot = this.files.getSnapshot(fileName);
|
|
13898
13904
|
snapshot ? language.scripts.set(fileName, snapshot) : language.scripts.delete(fileName);
|
|
13899
13905
|
}
|
|
13900
13906
|
), projectHost = {
|
|
13901
13907
|
getCurrentDirectory: () => configFileName ? path.dirname(configFileName) : commandLine.options.rootDir ?? process.cwd(),
|
|
13902
13908
|
getCompilationSettings: () => this.commandLine.options,
|
|
13903
13909
|
getProjectReferences: () => this.commandLine.projectReferences,
|
|
13904
|
-
getProjectVersion
|
|
13905
|
-
|
|
13910
|
+
// getProjectVersion gates the language service's host re-sync; the tracker funnels every
|
|
13911
|
+
// invalidation into it.
|
|
13912
|
+
getProjectVersion: () => this.files.getProjectVersion(),
|
|
13913
|
+
getScriptFileNames: () => this.files.getScriptFileNames()
|
|
13906
13914
|
}, { languageServiceHost } = (0, import_typescript.createLanguageServiceHost)(
|
|
13907
13915
|
typescript,
|
|
13908
13916
|
typescript.sys,
|
|
13909
13917
|
language,
|
|
13910
13918
|
(s) => s,
|
|
13911
|
-
// asScriptId
|
|
13919
|
+
// asScriptId - identity for React (no URI mapping needed)
|
|
13912
13920
|
projectHost
|
|
13913
13921
|
);
|
|
13914
|
-
this.
|
|
13922
|
+
this.service = typescript.createLanguageService(languageServiceHost, this.documentRegistry);
|
|
13915
13923
|
}
|
|
13916
13924
|
getCommandLine() {
|
|
13917
13925
|
return this.commandLine;
|
|
13918
13926
|
}
|
|
13919
|
-
dispose() {
|
|
13920
|
-
clearTimeout(this.warmupTimer), this.ls.dispose();
|
|
13921
|
-
}
|
|
13922
13927
|
// ---------------------------------------------------------------------------
|
|
13923
13928
|
// Project management
|
|
13924
13929
|
// ---------------------------------------------------------------------------
|
|
13925
|
-
/**
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
*/
|
|
13929
|
-
ensureFiles(fileNames) {
|
|
13930
|
-
let added = !1;
|
|
13931
|
-
for (let fileName of fileNames)
|
|
13932
|
-
this.commandLine.fileNames.includes(fileName) || (this.commandLine.fileNames.push(fileName), added = !0);
|
|
13933
|
-
added && this.projectVersion++;
|
|
13934
|
-
}
|
|
13935
|
-
/**
|
|
13936
|
-
* Adapted from:
|
|
13937
|
-
* https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/kit/lib/createChecker.ts#L436-L447
|
|
13938
|
-
*/
|
|
13939
|
-
checkRootFilesUpdate() {
|
|
13940
|
-
if (!this.shouldCheckRootFiles || (this.shouldCheckRootFiles = !1, !this.getCommandLineFn))
|
|
13941
|
-
return;
|
|
13942
|
-
let newCommandLine = this.getCommandLineFn();
|
|
13943
|
-
arrayItemsEqual(newCommandLine.fileNames, this.commandLine.fileNames) || (this.commandLine.fileNames = newCommandLine.fileNames, this.projectVersion++);
|
|
13930
|
+
/** Cancels the warmup the base does not know about. */
|
|
13931
|
+
dispose() {
|
|
13932
|
+
clearTimeout(this.warmupTimer), super.dispose();
|
|
13944
13933
|
}
|
|
13945
13934
|
getSourceFile(fileName) {
|
|
13946
|
-
return this.
|
|
13947
|
-
}
|
|
13948
|
-
hasSourceFile(fileName) {
|
|
13949
|
-
return !!this.getSourceFile(fileName);
|
|
13950
|
-
}
|
|
13951
|
-
/**
|
|
13952
|
-
* Get all non-node_modules source file paths from the TS program. Used by ComponentMetaManager to
|
|
13953
|
-
* watch directories for file changes.
|
|
13954
|
-
*/
|
|
13955
|
-
getSourceFilePaths() {
|
|
13956
|
-
let program = this.ls.getProgram();
|
|
13957
|
-
return program ? program.getSourceFiles().map((sf) => sf.fileName.replace(/\\/g, "/")).filter((f) => !f.includes("node_modules")) : [];
|
|
13935
|
+
return this.service.getProgram()?.getSourceFile(fileName);
|
|
13958
13936
|
}
|
|
13959
|
-
/**
|
|
13960
|
-
* Adapted from:
|
|
13961
|
-
* https://github.com/volarjs/volar.js/blob/882cd56d46a13d272f34e451f495d3d62251969a/packages/kit/lib/createChecker.ts#L409-L432
|
|
13962
|
-
*
|
|
13963
|
-
* Created events only set shouldCheckRootFiles (version bump happens in checkRootFilesUpdate if
|
|
13964
|
-
* the file list actually changed). Deleted/created break early since they trigger a full config
|
|
13965
|
-
* reparse — processing remaining changes is unnecessary.
|
|
13966
|
-
*/
|
|
13967
13937
|
onFilesChanged(changes) {
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
program?.getSourceFile(filePath) && this.projectVersion++;
|
|
13974
|
-
else if (type === "deleted") {
|
|
13975
|
-
program?.getSourceFile(filePath) && this.projectVersion++, this.shouldCheckRootFiles = !0;
|
|
13976
|
-
break;
|
|
13977
|
-
} else if (type === "created") {
|
|
13978
|
-
this.shouldCheckRootFiles = !0;
|
|
13979
|
-
break;
|
|
13980
|
-
}
|
|
13981
|
-
this.projectVersion !== oldVersion && this.entries.length > 0 && (clearTimeout(this.warmupTimer), this.warmupTimer = setTimeout(() => {
|
|
13938
|
+
let program = this.service.getProgram();
|
|
13939
|
+
this.files.onFilesChanged(
|
|
13940
|
+
changes,
|
|
13941
|
+
(fileName) => !!program?.getSourceFile(fileName)
|
|
13942
|
+
) && this.entries.length > 0 && (clearTimeout(this.warmupTimer), this.warmupTimer = setTimeout(() => {
|
|
13982
13943
|
try {
|
|
13983
13944
|
this.extractPropsFromStories(this.entries);
|
|
13984
13945
|
} catch {
|
|
@@ -13986,15 +13947,15 @@ var ComponentMetaProject = class {
|
|
|
13986
13947
|
}, 100), this.warmupTimer?.unref?.());
|
|
13987
13948
|
}
|
|
13988
13949
|
// ---------------------------------------------------------------------------
|
|
13989
|
-
// Primary extraction method
|
|
13950
|
+
// Primary extraction method - probe-free
|
|
13990
13951
|
// ---------------------------------------------------------------------------
|
|
13991
13952
|
extractPropsFromStories(entries) {
|
|
13992
13953
|
this.entries = entries;
|
|
13993
13954
|
let allFiles = entries.flatMap(
|
|
13994
13955
|
(entry) => entry.component?.path ? [entry.storyPath, entry.component.path] : [entry.storyPath]
|
|
13995
13956
|
);
|
|
13996
|
-
this.ensureFiles(allFiles), this.ensureFresh(allFiles);
|
|
13997
|
-
let program = this.
|
|
13957
|
+
this.files.ensureFiles(allFiles), this.files.ensureFresh(allFiles);
|
|
13958
|
+
let program = this.service.getProgram();
|
|
13998
13959
|
if (!program)
|
|
13999
13960
|
return;
|
|
14000
13961
|
let checker = program.getTypeChecker(), serializationContextByComponentPath = /* @__PURE__ */ new Map();
|
|
@@ -14051,31 +14012,12 @@ var ComponentMetaProject = class {
|
|
|
14051
14012
|
continue;
|
|
14052
14013
|
}
|
|
14053
14014
|
}
|
|
14054
|
-
/**
|
|
14055
|
-
* Check mtime for specific files and bump projectVersion if any changed.
|
|
14056
|
-
*
|
|
14057
|
-
* This bypasses the sync() gate in createLanguageServiceHost — sync() only runs when
|
|
14058
|
-
* projectVersion changes, so mtime-based cache alone can't detect stale files. We do a targeted
|
|
14059
|
-
* mtime check for the files we're about to extract from, ensuring freshness even when the
|
|
14060
|
-
* fs.watch event hasn't arrived yet (race with HMR) or was missed entirely.
|
|
14061
|
-
*/
|
|
14062
|
-
ensureFresh(fileNames) {
|
|
14063
|
-
let stale = !1;
|
|
14064
|
-
for (let fileName of fileNames) {
|
|
14065
|
-
let cache = this.fsFileSnapshots.get(fileName);
|
|
14066
|
-
if (!cache)
|
|
14067
|
-
continue;
|
|
14068
|
-
let currentMtime = this.typescript.sys.getModifiedTime?.(fileName)?.valueOf();
|
|
14069
|
-
cache[0] !== currentMtime && (this.fsFileSnapshots.delete(fileName), stale = !0);
|
|
14070
|
-
}
|
|
14071
|
-
stale && this.projectVersion++;
|
|
14072
|
-
}
|
|
14073
14015
|
// ---------------------------------------------------------------------------
|
|
14074
14016
|
// Internal helpers
|
|
14075
14017
|
// ---------------------------------------------------------------------------
|
|
14076
14018
|
/**
|
|
14077
14019
|
* Path 2 fallback: resolve the component type from the story file's `meta.component` property.
|
|
14078
|
-
* Only works when the user explicitly set `component:` in the meta
|
|
14020
|
+
* Only works when the user explicitly set `component:` in the meta - no node means no
|
|
14079
14021
|
* extraction.
|
|
14080
14022
|
*/
|
|
14081
14023
|
resolveFromMetaComponent(checker, storySourceFile, componentRef) {
|
|
@@ -14097,7 +14039,7 @@ var ComponentMetaProject = class {
|
|
|
14097
14039
|
metaComponentInitializer
|
|
14098
14040
|
))
|
|
14099
14041
|
return;
|
|
14100
|
-
let componentType = checker.getTypeOfSymbol(componentProp), selectedSymbol =
|
|
14042
|
+
let componentType = checker.getTypeOfSymbol(componentProp), selectedSymbol = checker.getSymbolAtLocation(metaComponentInitializer);
|
|
14101
14043
|
if (memberAccess) {
|
|
14102
14044
|
let prop = componentType.getProperty(memberAccess);
|
|
14103
14045
|
if (prop)
|
|
@@ -14114,15 +14056,6 @@ var ComponentMetaProject = class {
|
|
|
14114
14056
|
};
|
|
14115
14057
|
}
|
|
14116
14058
|
};
|
|
14117
|
-
function arrayItemsEqual(a, b) {
|
|
14118
|
-
if (a.length !== b.length)
|
|
14119
|
-
return !1;
|
|
14120
|
-
let set = new Set(a);
|
|
14121
|
-
for (let file of b)
|
|
14122
|
-
if (!set.has(file))
|
|
14123
|
-
return !1;
|
|
14124
|
-
return !0;
|
|
14125
|
-
}
|
|
14126
14059
|
|
|
14127
14060
|
// src/componentManifest/componentMeta/ComponentMetaManager.ts
|
|
14128
14061
|
import { isFileInDir, sortTSConfigs } from "storybook/internal/component-meta";
|
|
@@ -14201,123 +14134,6 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
14201
14134
|
}
|
|
14202
14135
|
};
|
|
14203
14136
|
|
|
14204
|
-
// ../../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
14205
|
-
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
14206
|
-
function normalizeWindowsPath(input = "") {
|
|
14207
|
-
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
14208
|
-
}
|
|
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)
|
|
14211
|
-
return ".";
|
|
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_) {
|
|
14216
|
-
if (arguments_.length === 0)
|
|
14217
|
-
return ".";
|
|
14218
|
-
let joined;
|
|
14219
|
-
for (let argument of arguments_)
|
|
14220
|
-
argument && argument.length > 0 && (joined === void 0 ? joined = argument : joined += `/${argument}`);
|
|
14221
|
-
return joined === void 0 ? "." : normalize(joined.replace(/\/\/+/g, "/"));
|
|
14222
|
-
};
|
|
14223
|
-
function cwd() {
|
|
14224
|
-
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
14225
|
-
}
|
|
14226
|
-
var resolve2 = function(...arguments_) {
|
|
14227
|
-
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
14228
|
-
let resolvedPath = "", resolvedAbsolute = !1;
|
|
14229
|
-
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
14230
|
-
let path3 = index >= 0 ? arguments_[index] : cwd();
|
|
14231
|
-
!path3 || path3.length === 0 || (resolvedPath = `${path3}/${resolvedPath}`, resolvedAbsolute = isAbsolute2(path3));
|
|
14232
|
-
}
|
|
14233
|
-
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute2(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
14234
|
-
};
|
|
14235
|
-
function normalizeString(path3, allowAboveRoot) {
|
|
14236
|
-
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
14237
|
-
for (let index = 0; index <= path3.length; ++index) {
|
|
14238
|
-
if (index < path3.length)
|
|
14239
|
-
char = path3[index];
|
|
14240
|
-
else {
|
|
14241
|
-
if (char === "/")
|
|
14242
|
-
break;
|
|
14243
|
-
char = "/";
|
|
14244
|
-
}
|
|
14245
|
-
if (char === "/") {
|
|
14246
|
-
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
|
14247
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
14248
|
-
if (res.length > 2) {
|
|
14249
|
-
let lastSlashIndex = res.lastIndexOf("/");
|
|
14250
|
-
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
|
14251
|
-
continue;
|
|
14252
|
-
} else if (res.length > 0) {
|
|
14253
|
-
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
14254
|
-
continue;
|
|
14255
|
-
}
|
|
14256
|
-
}
|
|
14257
|
-
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
14258
|
-
} else
|
|
14259
|
-
res.length > 0 ? res += `/${path3.slice(lastSlash + 1, index)}` : res = path3.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
14260
|
-
lastSlash = index, dots = 0;
|
|
14261
|
-
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
14262
|
-
}
|
|
14263
|
-
return res;
|
|
14264
|
-
}
|
|
14265
|
-
var isAbsolute2 = function(p) {
|
|
14266
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
14267
|
-
}, toNamespacedPath = function(p) {
|
|
14268
|
-
return normalizeWindowsPath(p);
|
|
14269
|
-
}, _EXTNAME_RE = /.(\.[^./]+)$/, extname = function(p) {
|
|
14270
|
-
let match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
14271
|
-
return match && match[1] || "";
|
|
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("/");
|
|
14274
|
-
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
|
|
14275
|
-
return _to.join("/");
|
|
14276
|
-
let _fromCopy = [..._from];
|
|
14277
|
-
for (let segment of _fromCopy) {
|
|
14278
|
-
if (_to[0] !== segment)
|
|
14279
|
-
break;
|
|
14280
|
-
_from.shift(), _to.shift();
|
|
14281
|
-
}
|
|
14282
|
-
return [..._from.map(() => ".."), ..._to].join("/");
|
|
14283
|
-
}, dirname3 = function(p) {
|
|
14284
|
-
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
14285
|
-
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute2(p) ? "/" : ".");
|
|
14286
|
-
}, format = function(p) {
|
|
14287
|
-
let segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
|
|
14288
|
-
return normalizeWindowsPath(
|
|
14289
|
-
p.root ? resolve2(...segments) : segments.join("/")
|
|
14290
|
-
);
|
|
14291
|
-
}, basename = function(p, extension) {
|
|
14292
|
-
let lastSegment = normalizeWindowsPath(p).split("/").pop();
|
|
14293
|
-
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
14294
|
-
}, parse = function(p) {
|
|
14295
|
-
let root = normalizeWindowsPath(p).split("/").shift() || "/", base2 = basename(p), extension = extname(base2);
|
|
14296
|
-
return {
|
|
14297
|
-
root,
|
|
14298
|
-
dir: dirname3(p),
|
|
14299
|
-
base: base2,
|
|
14300
|
-
ext: extension,
|
|
14301
|
-
name: base2.slice(0, base2.length - extension.length)
|
|
14302
|
-
};
|
|
14303
|
-
}, path2 = {
|
|
14304
|
-
__proto__: null,
|
|
14305
|
-
basename,
|
|
14306
|
-
delimiter,
|
|
14307
|
-
dirname: dirname3,
|
|
14308
|
-
extname,
|
|
14309
|
-
format,
|
|
14310
|
-
isAbsolute: isAbsolute2,
|
|
14311
|
-
join: join3,
|
|
14312
|
-
normalize,
|
|
14313
|
-
normalizeString,
|
|
14314
|
-
parse,
|
|
14315
|
-
relative,
|
|
14316
|
-
resolve: resolve2,
|
|
14317
|
-
sep,
|
|
14318
|
-
toNamespacedPath
|
|
14319
|
-
};
|
|
14320
|
-
|
|
14321
14137
|
// src/extractProps.ts
|
|
14322
14138
|
import {
|
|
14323
14139
|
TypeSystem,
|
|
@@ -14510,7 +14326,7 @@ function parseExpression(expression) {
|
|
|
14510
14326
|
return null;
|
|
14511
14327
|
}
|
|
14512
14328
|
}
|
|
14513
|
-
function
|
|
14329
|
+
function parse4(value) {
|
|
14514
14330
|
let ast = acornParser.parse(`(${value})`, { ecmaVersion: 2020 }), parsingResult = {
|
|
14515
14331
|
inferredType: { type: "Unknown" /* UNKNOWN */ },
|
|
14516
14332
|
ast
|
|
@@ -14528,7 +14344,7 @@ function parse5(value) {
|
|
|
14528
14344
|
// src/docs/lib/inspection/inspectValue.ts
|
|
14529
14345
|
function inspectValue(value) {
|
|
14530
14346
|
try {
|
|
14531
|
-
return { ...
|
|
14347
|
+
return { ...parse4(value) };
|
|
14532
14348
|
} catch {
|
|
14533
14349
|
}
|
|
14534
14350
|
return { inferredType: { type: "Unknown" /* UNKNOWN */ } };
|
|
@@ -15509,16 +15325,16 @@ var extractArgTypes = (component) => {
|
|
|
15509
15325
|
// src/componentManifest/reactDocgen.ts
|
|
15510
15326
|
var import_ts_dedent2 = __toESM(require_dist(), 1), TsconfigPaths = __toESM(require_lib2(), 1);
|
|
15511
15327
|
import { existsSync as existsSync2 } from "node:fs";
|
|
15512
|
-
import { dirname as
|
|
15328
|
+
import { dirname as dirname3, sep } from "node:path";
|
|
15513
15329
|
import { babelParse, types as t } from "storybook/internal/babel";
|
|
15514
|
-
import { supportedExtensions as supportedExtensions2 } from "storybook/internal/common";
|
|
15330
|
+
import { findTsconfigPathForPath, supportedExtensions as supportedExtensions2 } from "storybook/internal/common";
|
|
15515
15331
|
import { extractJSDocInfo } from "storybook/internal/csf-tools";
|
|
15516
15332
|
import { logger as logger3 } from "storybook/internal/node-logger";
|
|
15517
15333
|
import {
|
|
15518
15334
|
builtinHandlers as docgenHandlers,
|
|
15519
15335
|
builtinResolvers as docgenResolver,
|
|
15520
15336
|
makeFsImporter,
|
|
15521
|
-
parse as
|
|
15337
|
+
parse as parse5
|
|
15522
15338
|
} from "react-docgen";
|
|
15523
15339
|
|
|
15524
15340
|
// src/componentManifest/reactDocgen/actualNameHandler.ts
|
|
@@ -15563,16 +15379,16 @@ var ReactDocgenResolveError = class extends Error {
|
|
|
15563
15379
|
// src/componentManifest/reactDocgen/exportNameHandler.ts
|
|
15564
15380
|
import { utils as utils2 } from "react-docgen";
|
|
15565
15381
|
var { isReactForwardRefCall: isReactForwardRefCall2 } = utils2;
|
|
15566
|
-
function nameFromId(
|
|
15567
|
-
if (
|
|
15568
|
-
if (
|
|
15569
|
-
return
|
|
15570
|
-
if (
|
|
15571
|
-
return
|
|
15382
|
+
function nameFromId(path2) {
|
|
15383
|
+
if (path2) {
|
|
15384
|
+
if (path2.isIdentifier())
|
|
15385
|
+
return path2.node.name;
|
|
15386
|
+
if (path2.isStringLiteral())
|
|
15387
|
+
return path2.node.value;
|
|
15572
15388
|
}
|
|
15573
15389
|
}
|
|
15574
|
-
function isInlineDefaultExport(
|
|
15575
|
-
let p =
|
|
15390
|
+
function isInlineDefaultExport(path2) {
|
|
15391
|
+
let p = path2;
|
|
15576
15392
|
for (; p && p.parentPath; ) {
|
|
15577
15393
|
if (p.parentPath.isExportDefaultDeclaration())
|
|
15578
15394
|
return !0;
|
|
@@ -15580,8 +15396,8 @@ function isInlineDefaultExport(path3) {
|
|
|
15580
15396
|
}
|
|
15581
15397
|
return !1;
|
|
15582
15398
|
}
|
|
15583
|
-
function findProgram(
|
|
15584
|
-
let found =
|
|
15399
|
+
function findProgram(path2) {
|
|
15400
|
+
let found = path2.findParent((p) => p.isProgram());
|
|
15585
15401
|
return found && found.isProgram() ? found : void 0;
|
|
15586
15402
|
}
|
|
15587
15403
|
function getLocalName(componentDefinition, fallback) {
|
|
@@ -15678,9 +15494,9 @@ function getMatchingDocgen(docgens, component) {
|
|
|
15678
15494
|
)
|
|
15679
15495
|
) ?? docgens[0];
|
|
15680
15496
|
}
|
|
15681
|
-
function matchPath(id,
|
|
15682
|
-
|
|
15683
|
-
let tsconfig = getTsConfig(
|
|
15497
|
+
function matchPath(id, importerPath) {
|
|
15498
|
+
importerPath ??= process.cwd();
|
|
15499
|
+
let tsconfig = getTsConfig(importerPath);
|
|
15684
15500
|
return tsconfig.resultType === "success" ? TsconfigPaths.createMatchPath(tsconfig.absoluteBaseUrl, tsconfig.paths, [
|
|
15685
15501
|
"browser",
|
|
15686
15502
|
"module",
|
|
@@ -15688,19 +15504,19 @@ function matchPath(id, basedir) {
|
|
|
15688
15504
|
])(id, void 0, void 0, supportedExtensions2) ?? id : id;
|
|
15689
15505
|
}
|
|
15690
15506
|
var getTsConfig = cached(
|
|
15691
|
-
(
|
|
15692
|
-
let tsconfigPath =
|
|
15693
|
-
return TsconfigPaths.loadConfig(tsconfigPath);
|
|
15507
|
+
(path2) => {
|
|
15508
|
+
let tsconfigPath = findTsconfigPathForPath(path2);
|
|
15509
|
+
return tsconfigPath ? TsconfigPaths.loadConfig(tsconfigPath) : { resultType: "failed", message: "Couldn't find tsconfig.json" };
|
|
15694
15510
|
},
|
|
15695
15511
|
{ name: "getTsConfig" }
|
|
15696
15512
|
), parseWithReactDocgen = cached(
|
|
15697
|
-
(code,
|
|
15513
|
+
(code, path2) => parse5(code, {
|
|
15698
15514
|
resolver: defaultResolver2,
|
|
15699
15515
|
handlers,
|
|
15700
15516
|
importer: getReactDocgenImporter(),
|
|
15701
|
-
filename:
|
|
15517
|
+
filename: path2
|
|
15702
15518
|
}),
|
|
15703
|
-
{ key: (code,
|
|
15519
|
+
{ key: (code, path2) => path2, name: "parseWithReactDocgen" }
|
|
15704
15520
|
), getExportPaths = cached(
|
|
15705
15521
|
(code, filePath) => {
|
|
15706
15522
|
let ast;
|
|
@@ -15709,10 +15525,10 @@ var getTsConfig = cached(
|
|
|
15709
15525
|
} catch {
|
|
15710
15526
|
return [];
|
|
15711
15527
|
}
|
|
15712
|
-
let basedir =
|
|
15528
|
+
let basedir = dirname3(filePath);
|
|
15713
15529
|
return ast.program.body.flatMap(
|
|
15714
15530
|
(statement) => t.isExportAllDeclaration(statement) ? [statement.source.value] : t.isExportNamedDeclaration(statement) && statement.source && !statement.declaration ? [statement.source.value] : []
|
|
15715
|
-
).map((id) => matchPath(id,
|
|
15531
|
+
).map((id) => matchPath(id, filePath)).flatMap((id) => {
|
|
15716
15532
|
try {
|
|
15717
15533
|
return [cachedResolveImport(id, { basedir })];
|
|
15718
15534
|
} catch (e) {
|
|
@@ -15722,13 +15538,13 @@ var getTsConfig = cached(
|
|
|
15722
15538
|
},
|
|
15723
15539
|
{ name: "getExportPaths" }
|
|
15724
15540
|
), gatherDocgensForPath = cached(
|
|
15725
|
-
(
|
|
15726
|
-
if (
|
|
15541
|
+
(path2, depth) => {
|
|
15542
|
+
if (path2.includes("node_modules"))
|
|
15727
15543
|
return {
|
|
15728
15544
|
docgens: [],
|
|
15729
15545
|
errors: [
|
|
15730
15546
|
{
|
|
15731
|
-
path:
|
|
15547
|
+
path: path2,
|
|
15732
15548
|
code: "/* File in node_modules */",
|
|
15733
15549
|
name: "Component file in node_modules",
|
|
15734
15550
|
message: import_ts_dedent2.dedent`
|
|
@@ -15757,16 +15573,16 @@ var getTsConfig = cached(
|
|
|
15757
15573
|
};
|
|
15758
15574
|
let code;
|
|
15759
15575
|
try {
|
|
15760
|
-
code = cachedReadFileSync(
|
|
15576
|
+
code = cachedReadFileSync(path2, "utf-8");
|
|
15761
15577
|
} catch {
|
|
15762
15578
|
return {
|
|
15763
15579
|
docgens: [],
|
|
15764
15580
|
errors: [
|
|
15765
15581
|
{
|
|
15766
|
-
path:
|
|
15582
|
+
path: path2,
|
|
15767
15583
|
code: "/* File not found or unreadable */",
|
|
15768
15584
|
name: "Component file could not be read",
|
|
15769
|
-
message: `Could not read the component file located at "${
|
|
15585
|
+
message: `Could not read the component file located at "${path2}".
|
|
15770
15586
|
Prefer relative imports if possible.`
|
|
15771
15587
|
}
|
|
15772
15588
|
]
|
|
@@ -15777,7 +15593,7 @@ Prefer relative imports if possible.`
|
|
|
15777
15593
|
docgens: [],
|
|
15778
15594
|
errors: [
|
|
15779
15595
|
{
|
|
15780
|
-
path:
|
|
15596
|
+
path: path2,
|
|
15781
15597
|
code,
|
|
15782
15598
|
name: "Max re-export depth exceeded",
|
|
15783
15599
|
message: import_ts_dedent2.dedent`
|
|
@@ -15789,10 +15605,10 @@ Prefer relative imports if possible.`
|
|
|
15789
15605
|
}
|
|
15790
15606
|
]
|
|
15791
15607
|
};
|
|
15792
|
-
let exportPaths = getExportPaths(code,
|
|
15608
|
+
let exportPaths = getExportPaths(code, path2).map((p) => gatherDocgensForPath(p, depth + 1)), docgens = exportPaths.flatMap((r) => r.docgens), errors = exportPaths.flatMap((r) => r.errors);
|
|
15793
15609
|
try {
|
|
15794
15610
|
return {
|
|
15795
|
-
docgens: [...parseWithReactDocgen(code,
|
|
15611
|
+
docgens: [...parseWithReactDocgen(code, path2), ...docgens],
|
|
15796
15612
|
errors
|
|
15797
15613
|
};
|
|
15798
15614
|
} catch (e) {
|
|
@@ -15801,7 +15617,7 @@ Prefer relative imports if possible.`
|
|
|
15801
15617
|
docgens,
|
|
15802
15618
|
errors: [
|
|
15803
15619
|
{
|
|
15804
|
-
path:
|
|
15620
|
+
path: path2,
|
|
15805
15621
|
code,
|
|
15806
15622
|
name: "No component definition found",
|
|
15807
15623
|
message: import_ts_dedent2.dedent`
|
|
@@ -15816,8 +15632,8 @@ Prefer relative imports if possible.`
|
|
|
15816
15632
|
},
|
|
15817
15633
|
{ name: "gatherDocgensWithTrace", key: (filePath) => filePath }
|
|
15818
15634
|
), getReactDocgen = cached(
|
|
15819
|
-
(
|
|
15820
|
-
let { docgens, errors } = gatherDocgensForPath(
|
|
15635
|
+
(path2, component) => {
|
|
15636
|
+
let { docgens, errors } = gatherDocgensForPath(path2, 0), docgen = getMatchingDocgen(docgens, component);
|
|
15821
15637
|
return docgen ? { type: "success", data: docgen } : { type: "error", error: {
|
|
15822
15638
|
name: errors.at(-1)?.name ?? "No component definition found",
|
|
15823
15639
|
message: errors.map(
|
|
@@ -15832,15 +15648,15 @@ Prefer relative imports if possible.`
|
|
|
15832
15648
|
`)
|
|
15833
15649
|
} };
|
|
15834
15650
|
},
|
|
15835
|
-
{ name: "getReactDocgen", key: (
|
|
15651
|
+
{ name: "getReactDocgen", key: (path2, component) => path2 + JSON.stringify(component) }
|
|
15836
15652
|
);
|
|
15837
15653
|
function getReactDocgenImporter() {
|
|
15838
15654
|
return makeFsImporter((filename, basedir) => {
|
|
15839
15655
|
let mappedFilenameByPaths = matchPath(filename, basedir), result = cachedResolveImport(mappedFilenameByPaths, { basedir });
|
|
15840
|
-
if (result.includes(`${
|
|
15656
|
+
if (result.includes(`${sep}react-native${sep}index.js`)) {
|
|
15841
15657
|
let replaced = result.replace(
|
|
15842
|
-
`${
|
|
15843
|
-
`${
|
|
15658
|
+
`${sep}react-native${sep}index.js`,
|
|
15659
|
+
`${sep}react-native-web${sep}dist${sep}index.js`
|
|
15844
15660
|
);
|
|
15845
15661
|
if (existsSync2(replaced) && supportedExtensions2.find((ext) => result.endsWith(ext)))
|
|
15846
15662
|
return replaced;
|
|
@@ -15855,189 +15671,342 @@ function getImportTag(docgen) {
|
|
|
15855
15671
|
return (jsdocComment ? extractJSDocInfo(jsdocComment).tags : void 0)?.import?.[0];
|
|
15856
15672
|
}
|
|
15857
15673
|
|
|
15858
|
-
//
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
var
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15674
|
+
// ../../../node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
15675
|
+
var _lazyMatch = () => {
|
|
15676
|
+
var __lib__ = (() => {
|
|
15677
|
+
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
15678
|
+
for (var n in e) m(r, n, { get: e[n], enumerable: !0 });
|
|
15679
|
+
}, H = (r, e, n, a) => {
|
|
15680
|
+
if (e && typeof e == "object" || typeof e == "function") for (let t5 of G(e)) !T.call(r, t5) && t5 !== n && m(r, t5, { get: () => e[t5], enumerable: !(a = V(e, t5)) || a.enumerable });
|
|
15681
|
+
return r;
|
|
15682
|
+
}, J = (r) => H(m({}, "__esModule", { value: !0 }), r), w = {};
|
|
15683
|
+
q(w, { default: () => re });
|
|
15684
|
+
var A = (r) => Array.isArray(r), d = (r) => typeof r == "function", Q = (r) => r.length === 0, W = (r) => typeof r == "number", K = (r) => typeof r == "object" && r !== null, X = (r) => r instanceof RegExp, b = (r) => typeof r == "string", h = (r) => r === void 0, Y = (r) => {
|
|
15685
|
+
let e = /* @__PURE__ */ new Map();
|
|
15686
|
+
return (n) => {
|
|
15687
|
+
let a = e.get(n);
|
|
15688
|
+
if (a) return a;
|
|
15689
|
+
let t5 = r(n);
|
|
15690
|
+
return e.set(n, t5), t5;
|
|
15691
|
+
};
|
|
15692
|
+
}, rr = (r, e, n = {}) => {
|
|
15693
|
+
let a = { cache: {}, input: r, index: 0, indexMax: 0, options: n, output: [] };
|
|
15694
|
+
if (v(e)(a) && a.index === r.length) return a.output;
|
|
15695
|
+
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
15696
|
+
}, i2 = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
|
|
15697
|
+
let n = {};
|
|
15698
|
+
for (let a of r) {
|
|
15699
|
+
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
15700
|
+
let t5 = a.charCodeAt(0);
|
|
15701
|
+
n[t5] = !0;
|
|
15702
|
+
}
|
|
15703
|
+
return (a) => {
|
|
15704
|
+
let t5 = a.index, o = a.input;
|
|
15705
|
+
for (; a.index < o.length && o.charCodeAt(a.index) in n; ) a.index += 1;
|
|
15706
|
+
let u = a.index;
|
|
15707
|
+
if (u > t5) {
|
|
15708
|
+
if (!h(e) && !a.options.silent) {
|
|
15709
|
+
let s = a.input.slice(t5, u), c = d(e) ? e(s, o, String(t5)) : e;
|
|
15710
|
+
h(c) || a.output.push(c);
|
|
15711
|
+
}
|
|
15712
|
+
a.indexMax = Math.max(a.indexMax, a.index);
|
|
15713
|
+
}
|
|
15714
|
+
return !0;
|
|
15715
|
+
};
|
|
15716
|
+
}, nr = (r, e) => {
|
|
15717
|
+
let n = r.source, a = r.flags.replace(/y|$/, "y"), t5 = new RegExp(n, a);
|
|
15718
|
+
return g((o) => {
|
|
15719
|
+
t5.lastIndex = o.index;
|
|
15720
|
+
let u = t5.exec(o.input);
|
|
15721
|
+
if (u) {
|
|
15722
|
+
if (!h(e) && !o.options.silent) {
|
|
15723
|
+
let s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
15724
|
+
h(s) || o.output.push(s);
|
|
15725
|
+
}
|
|
15726
|
+
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), !0;
|
|
15727
|
+
} else return !1;
|
|
15728
|
+
});
|
|
15729
|
+
}, ar = (r, e) => (n) => {
|
|
15730
|
+
if (n.input.startsWith(r, n.index)) {
|
|
15731
|
+
if (!h(e) && !n.options.silent) {
|
|
15732
|
+
let t5 = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
15733
|
+
h(t5) || n.output.push(t5);
|
|
15734
|
+
}
|
|
15735
|
+
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), !0;
|
|
15736
|
+
} else return !1;
|
|
15737
|
+
}, C = (r, e, n, a) => {
|
|
15738
|
+
let t5 = v(r);
|
|
15739
|
+
return g(_(M((o) => {
|
|
15740
|
+
let u = 0;
|
|
15741
|
+
for (; u < n; ) {
|
|
15742
|
+
let s = o.index;
|
|
15743
|
+
if (!t5(o) || (u += 1, o.index === s)) break;
|
|
15744
|
+
}
|
|
15745
|
+
return u >= e;
|
|
15746
|
+
})));
|
|
15747
|
+
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
|
|
15748
|
+
let n = r.map(v);
|
|
15749
|
+
return g(_(M((a) => {
|
|
15750
|
+
for (let t5 = 0, o = n.length; t5 < o; t5++) if (!n[t5](a)) return !1;
|
|
15751
|
+
return !0;
|
|
15752
|
+
})));
|
|
15753
|
+
}, l = (r, e) => {
|
|
15754
|
+
let n = r.map(v);
|
|
15755
|
+
return g(_((a) => {
|
|
15756
|
+
for (let t5 = 0, o = n.length; t5 < o; t5++) if (n[t5](a)) return !0;
|
|
15757
|
+
return !1;
|
|
15758
|
+
}));
|
|
15759
|
+
}, M = (r, e = !1) => {
|
|
15760
|
+
let n = v(r);
|
|
15761
|
+
return (a) => {
|
|
15762
|
+
let t5 = a.index, o = a.output.length, u = n(a);
|
|
15763
|
+
return (!u || e) && (a.index = t5, a.output.length !== o && (a.output.length = o)), u;
|
|
15764
|
+
};
|
|
15765
|
+
}, _ = (r, e) => v(r), g = /* @__PURE__ */ (() => {
|
|
15766
|
+
let r = 0;
|
|
15767
|
+
return (e) => {
|
|
15768
|
+
let n = v(e), a = r += 1;
|
|
15769
|
+
return (t5) => {
|
|
15770
|
+
var o;
|
|
15771
|
+
if (t5.options.memoization === !1) return n(t5);
|
|
15772
|
+
let u = t5.index, s = (o = t5.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
|
|
15773
|
+
if (c === !1) return !1;
|
|
15774
|
+
if (W(c)) return t5.index = c, !0;
|
|
15775
|
+
if (c) return t5.index = c.index, c.output?.length && t5.output.push(...c.output), !0;
|
|
15776
|
+
{
|
|
15777
|
+
let Z = t5.output.length;
|
|
15778
|
+
if (n(t5)) {
|
|
15779
|
+
let D = t5.index, U = t5.output.length;
|
|
15780
|
+
if (U > Z) {
|
|
15781
|
+
let ee = t5.output.slice(Z, U);
|
|
15782
|
+
s.set(u, { index: D, output: ee });
|
|
15783
|
+
} else s.set(u, D);
|
|
15784
|
+
return !0;
|
|
15785
|
+
} else return s.set(u, !1), !1;
|
|
15786
|
+
}
|
|
15787
|
+
};
|
|
15788
|
+
};
|
|
15789
|
+
})(), E = (r) => {
|
|
15790
|
+
let e;
|
|
15791
|
+
return (n) => (e || (e = v(r())), e(n));
|
|
15792
|
+
}, v = Y((r) => {
|
|
15793
|
+
if (d(r)) return Q(r) ? E(r) : r;
|
|
15794
|
+
if (b(r) || X(r)) return i2(r);
|
|
15795
|
+
if (A(r)) return x(r);
|
|
15796
|
+
if (K(r)) return l(Object.values(r));
|
|
15797
|
+
throw new Error("Invalid rule");
|
|
15798
|
+
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
15799
|
+
let e = "";
|
|
15800
|
+
for (; r > 0; ) {
|
|
15801
|
+
let n = (r - 1) % 26;
|
|
15802
|
+
e = P[n] + e, r = Math.floor((r - 1) / 26);
|
|
15803
|
+
}
|
|
15804
|
+
return e;
|
|
15805
|
+
}, O = (r) => {
|
|
15806
|
+
let e = 0;
|
|
15807
|
+
for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
|
|
15808
|
+
return e;
|
|
15809
|
+
}, S = (r, e) => {
|
|
15810
|
+
if (e < r) return S(e, r);
|
|
15811
|
+
let n = [];
|
|
15812
|
+
for (; r <= e; ) n.push(r++);
|
|
15813
|
+
return n;
|
|
15814
|
+
}, or = (r, e, n) => S(r, e).map((a) => String(a).padStart(n, "0")), R = (r, e) => S(O(r), O(e)).map(ir), p = (r) => r, z = (r) => ur((e) => rr(e, r, { memoization: !1 }).join("")), ur = (r) => {
|
|
15815
|
+
let e = {};
|
|
15816
|
+
return (n) => e[n] ?? (e[n] = r(n));
|
|
15817
|
+
}, sr = i2(/^\*\*\/\*$/, ".*"), cr = i2(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i2(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i2(/\\./, p), pr = i2(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i2(/./, p), hr = i2(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), dr = i2(/^(!!)+/, ""), fr = l([hr, dr]), xr = i2(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i2(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i2(/\/(\*\*)$/, "(?:/.*|$)"), _r = i2(/\*\*/, ".*"), j = l([xr, gr, mr, _r]), Sr = i2(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i2(/\*/, "[^/]*"), N = l([Sr, yr]), k = i2("?", "[^/]"), $r = i2("[", p), wr = i2("]", p), Ar = i2(/[!^]/, "^/"), br = i2(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Cr = i2(/[$.*+?^(){}[\|]/, (r) => `\\${r}`), Mr = i2(/[^\]]/, p), Er = l([y, Cr, br, Mr]), B = x([$r, tr(Ar), f(Er), wr]), Pr = i2("{", "(?:"), Or = i2("}", ")"), Rr = i2(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")), zr = i2(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => R(e, n).join("|")), jr = i2(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n) => R(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase()), Nr = l([Rr, zr, jr]), I = x([Pr, Nr, Or]), kr = i2("{", "(?:"), Br = i2("}", ")"), Ir = i2(",", "|"), Fr = i2(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i2(/[^}]/, p), Zr = E(() => F), Dr = l([j, N, k, B, I, Zr, y, Fr, Ir, Lr]), F = x([kr, f(Dr), Br]), Ur = f(l([sr, cr, lr, fr, j, N, k, B, I, F, y, pr, vr])), Vr = Ur, Gr = z(Vr), L = Gr, Tr = i2(/\\./, p), qr = i2(/./, p), Hr = i2(/\*\*\*+/, "*"), Jr = i2(/([^/{[(!])\*\*/, (r, e) => `${e}*`), Qr = i2(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`), Wr = f(l([Tr, Hr, Jr, Qr, qr])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r, e) => {
|
|
15818
|
+
let n = Array.isArray(r) ? r : [r];
|
|
15819
|
+
if (!n.length) return !1;
|
|
15820
|
+
let a = n.map($.compile), t5 = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t5 ? "/" : "");
|
|
15821
|
+
return a.some((s) => s.test(o));
|
|
15822
|
+
};
|
|
15823
|
+
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
15824
|
+
var re = $;
|
|
15825
|
+
return J(w);
|
|
15826
|
+
})();
|
|
15827
|
+
return __lib__.default || __lib__;
|
|
15828
|
+
}, _match, zeptomatch = (path2, pattern) => (_match || (_match = _lazyMatch(), _lazyMatch = null), _match(path2, pattern)), _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
15829
|
+
function normalizeWindowsPath(input = "") {
|
|
15830
|
+
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
15831
|
+
}
|
|
15832
|
+
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/, _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/, _EXTNAME_RE = /.(\.[^./]+|\.)$/, _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/, sep2 = "/", normalize = function(path2) {
|
|
15833
|
+
if (path2.length === 0)
|
|
15834
|
+
return ".";
|
|
15835
|
+
path2 = normalizeWindowsPath(path2);
|
|
15836
|
+
let isUNCPath = path2.match(_UNC_REGEX), isPathAbsolute = isAbsolute2(path2), trailingSeparator = path2[path2.length - 1] === "/";
|
|
15837
|
+
return path2 = normalizeString(path2, !isPathAbsolute), path2.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path2 += "/"), _DRIVE_LETTER_RE.test(path2) && (path2 += "/"), isUNCPath ? isPathAbsolute ? `//${path2}` : `//./${path2}` : isPathAbsolute && !isAbsolute2(path2) ? `/${path2}` : path2);
|
|
15838
|
+
}, join3 = function(...segments) {
|
|
15839
|
+
let path2 = "";
|
|
15840
|
+
for (let seg of segments)
|
|
15841
|
+
if (seg)
|
|
15842
|
+
if (path2.length > 0) {
|
|
15843
|
+
let pathTrailing = path2[path2.length - 1] === "/", segLeading = seg[0] === "/";
|
|
15844
|
+
pathTrailing && segLeading ? path2 += seg.slice(1) : path2 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
15845
|
+
} else
|
|
15846
|
+
path2 += seg;
|
|
15847
|
+
return normalize(path2);
|
|
15871
15848
|
};
|
|
15872
|
-
function
|
|
15873
|
-
|
|
15874
|
-
if (!typescript.isExpressionStatement(statement))
|
|
15875
|
-
continue;
|
|
15876
|
-
let expr = statement.expression;
|
|
15877
|
-
if (typescript.isBinaryExpression(expr) && expr.operatorToken.kind === typescript.SyntaxKind.EqualsToken && typescript.isPropertyAccessExpression(expr.left) && expr.left.name.text === "displayName" && typescript.isIdentifier(expr.left.expression) && expr.left.expression.text === identifierName && typescript.isStringLiteral(expr.right))
|
|
15878
|
-
return expr.right.text;
|
|
15879
|
-
}
|
|
15849
|
+
function cwd() {
|
|
15850
|
+
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
15880
15851
|
}
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
let displayNameValue = findDisplayNameAssignment(typescript, sourceFile, resolvedName);
|
|
15900
|
-
displayNameValue && result.set(displayNameValue, exportName);
|
|
15852
|
+
var resolve3 = function(...arguments_) {
|
|
15853
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
15854
|
+
let resolvedPath = "", resolvedAbsolute = !1;
|
|
15855
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
15856
|
+
let path2 = index >= 0 ? arguments_[index] : cwd();
|
|
15857
|
+
!path2 || path2.length === 0 || (resolvedPath = `${path2}/${resolvedPath}`, resolvedAbsolute = isAbsolute2(path2));
|
|
15858
|
+
}
|
|
15859
|
+
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute2(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
15860
|
+
};
|
|
15861
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
15862
|
+
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
15863
|
+
for (let index = 0; index <= path2.length; ++index) {
|
|
15864
|
+
if (index < path2.length)
|
|
15865
|
+
char = path2[index];
|
|
15866
|
+
else {
|
|
15867
|
+
if (char === "/")
|
|
15868
|
+
break;
|
|
15869
|
+
char = "/";
|
|
15901
15870
|
}
|
|
15871
|
+
if (char === "/") {
|
|
15872
|
+
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
|
15873
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
15874
|
+
if (res.length > 2) {
|
|
15875
|
+
let lastSlashIndex = res.lastIndexOf("/");
|
|
15876
|
+
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
|
15877
|
+
continue;
|
|
15878
|
+
} else if (res.length > 0) {
|
|
15879
|
+
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
15880
|
+
continue;
|
|
15881
|
+
}
|
|
15882
|
+
}
|
|
15883
|
+
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
15884
|
+
} else
|
|
15885
|
+
res.length > 0 ? res += `/${path2.slice(lastSlash + 1, index)}` : res = path2.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
15886
|
+
lastSlash = index, dots = 0;
|
|
15887
|
+
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
15902
15888
|
}
|
|
15903
|
-
return
|
|
15904
|
-
}
|
|
15905
|
-
var cachedCompilerOptions, cachedFileNames, previousProgram, parser, cachedParserOptionsKey;
|
|
15906
|
-
function invalidateParser() {
|
|
15907
|
-
parser = void 0, cachedCompilerOptions = void 0, cachedFileNames = void 0, cachedParserOptionsKey = void 0;
|
|
15889
|
+
return res;
|
|
15908
15890
|
}
|
|
15909
|
-
|
|
15910
|
-
|
|
15911
|
-
|
|
15912
|
-
|
|
15913
|
-
|
|
15914
|
-
if (
|
|
15915
|
-
|
|
15916
|
-
|
|
15917
|
-
|
|
15918
|
-
|
|
15919
|
-
|
|
15920
|
-
|
|
15921
|
-
|
|
15922
|
-
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
);
|
|
15927
|
-
let program = typescript.createProgram(
|
|
15928
|
-
cachedFileNames ?? [],
|
|
15929
|
-
cachedCompilerOptions,
|
|
15930
|
-
void 0,
|
|
15931
|
-
previousProgram
|
|
15932
|
-
);
|
|
15933
|
-
previousProgram = program;
|
|
15934
|
-
let parserOptions = {
|
|
15935
|
-
shouldExtractLiteralValuesFromEnum: !0,
|
|
15936
|
-
shouldRemoveUndefinedFromOptional: !0,
|
|
15937
|
-
...userOptions,
|
|
15938
|
-
// Always force savePropValueAsString so default values are in a consistent format
|
|
15939
|
-
savePropValueAsString: !0
|
|
15940
|
-
};
|
|
15941
|
-
parser = {
|
|
15942
|
-
program,
|
|
15943
|
-
fileParser: reactDocgenTypescript.withCompilerOptions(cachedCompilerOptions, parserOptions)
|
|
15944
|
-
}, cachedParserOptionsKey = optionsKey;
|
|
15891
|
+
var isAbsolute2 = function(p) {
|
|
15892
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
15893
|
+
}, toNamespacedPath = function(p) {
|
|
15894
|
+
return normalizeWindowsPath(p);
|
|
15895
|
+
}, extname = function(p) {
|
|
15896
|
+
if (p === "..") return "";
|
|
15897
|
+
let match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
15898
|
+
return match && match[1] || "";
|
|
15899
|
+
}, relative = function(from, to) {
|
|
15900
|
+
let _from = resolve3(from).replace(_ROOT_FOLDER_RE, "$1").split("/"), _to = resolve3(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
15901
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
|
|
15902
|
+
return _to.join("/");
|
|
15903
|
+
let _fromCopy = [..._from];
|
|
15904
|
+
for (let segment of _fromCopy) {
|
|
15905
|
+
if (_to[0] !== segment)
|
|
15906
|
+
break;
|
|
15907
|
+
_from.shift(), _to.shift();
|
|
15945
15908
|
}
|
|
15946
|
-
return
|
|
15947
|
-
}
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
}
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
`Looked for: componentName=${componentName}, localImportName=${localImportName ?? "<none>"}, importName=${importName ?? "<none>"}.`
|
|
15976
|
-
].join(`
|
|
15977
|
-
`)
|
|
15909
|
+
return [..._from.map(() => ".."), ..._to].join("/");
|
|
15910
|
+
}, dirname4 = function(p) {
|
|
15911
|
+
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
15912
|
+
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute2(p) ? "/" : ".");
|
|
15913
|
+
}, format = function(p) {
|
|
15914
|
+
let ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "", segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
|
|
15915
|
+
Boolean
|
|
15916
|
+
);
|
|
15917
|
+
return normalizeWindowsPath(
|
|
15918
|
+
p.root ? resolve3(...segments) : segments.join("/")
|
|
15919
|
+
);
|
|
15920
|
+
}, basename = function(p, extension) {
|
|
15921
|
+
let segments = normalizeWindowsPath(p).split("/"), lastSegment = "";
|
|
15922
|
+
for (let i2 = segments.length - 1; i2 >= 0; i2--) {
|
|
15923
|
+
let val = segments[i2];
|
|
15924
|
+
if (val) {
|
|
15925
|
+
lastSegment = val;
|
|
15926
|
+
break;
|
|
15927
|
+
}
|
|
15928
|
+
}
|
|
15929
|
+
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
15930
|
+
}, parse6 = function(p) {
|
|
15931
|
+
let root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "", base2 = basename(p), extension = extname(base2);
|
|
15932
|
+
return {
|
|
15933
|
+
root,
|
|
15934
|
+
dir: dirname4(p),
|
|
15935
|
+
base: base2,
|
|
15936
|
+
ext: extension,
|
|
15937
|
+
name: base2.slice(0, base2.length - extension.length)
|
|
15978
15938
|
};
|
|
15979
|
-
}
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
15939
|
+
}, matchesGlob = (path2, pattern) => zeptomatch(pattern, normalize(path2)), _path = {
|
|
15940
|
+
__proto__: null,
|
|
15941
|
+
basename,
|
|
15942
|
+
dirname: dirname4,
|
|
15943
|
+
extname,
|
|
15944
|
+
format,
|
|
15945
|
+
isAbsolute: isAbsolute2,
|
|
15946
|
+
join: join3,
|
|
15947
|
+
matchesGlob,
|
|
15948
|
+
normalize,
|
|
15949
|
+
normalizeString,
|
|
15950
|
+
parse: parse6,
|
|
15951
|
+
relative,
|
|
15952
|
+
resolve: resolve3,
|
|
15953
|
+
sep: sep2,
|
|
15954
|
+
toNamespacedPath
|
|
15955
|
+
};
|
|
15956
|
+
|
|
15957
|
+
// ../../../node_modules/pathe/dist/index.mjs
|
|
15958
|
+
var delimiter = globalThis.process?.platform === "win32" ? ";" : ":", _platforms = { posix: void 0, win32: void 0 }, mix = (del = delimiter) => new Proxy(_path, {
|
|
15959
|
+
get(_, prop) {
|
|
15960
|
+
return prop === "delimiter" ? del : prop === "posix" ? posix : prop === "win32" ? win32 : _platforms[prop] || _path[prop];
|
|
15961
|
+
}
|
|
15962
|
+
}), posix = mix(":"), win32 = mix(";");
|
|
16002
15963
|
|
|
16003
15964
|
// src/componentManifest/generateCodeSnippet.ts
|
|
16004
15965
|
import { types as t2 } from "storybook/internal/babel";
|
|
16005
15966
|
import {
|
|
16006
|
-
|
|
16007
|
-
keyOf,
|
|
15967
|
+
createStoryArgsResolver,
|
|
16008
15968
|
metaObjectPath,
|
|
16009
|
-
mergeArgsRecords,
|
|
16010
|
-
metaArgsRecord,
|
|
16011
15969
|
normalizeStoryDeclaration,
|
|
16012
|
-
resolveRenderFunction
|
|
16013
|
-
storyAssignedArgsPath
|
|
15970
|
+
resolveRenderFunction
|
|
16014
15971
|
} from "storybook/internal/csf-tools";
|
|
16015
|
-
function
|
|
16016
|
-
|
|
15972
|
+
function renderFunctionOf(resolution) {
|
|
15973
|
+
return resolution.kind === "resolved" ? resolution.path : resolution.kind === "unresolved" ? resolution.shadowedRender : void 0;
|
|
15974
|
+
}
|
|
15975
|
+
function getCodeSnippet(csf, storyName, componentName, resolver = createStoryArgsResolver(csf)) {
|
|
15976
|
+
let { args, imports, unresolved } = resolver.resolve(storyName);
|
|
15977
|
+
return {
|
|
15978
|
+
node: buildSnippetNode(csf, storyName, componentName, args, resolver.ctx),
|
|
15979
|
+
imports,
|
|
15980
|
+
unresolved
|
|
15981
|
+
};
|
|
15982
|
+
}
|
|
15983
|
+
function buildSnippetNode(csf, storyName, componentName, merged, ctx) {
|
|
15984
|
+
let storyDeclaration = csf._storyDeclarationPath[storyName];
|
|
16017
15985
|
if (!storyDeclaration) {
|
|
16018
15986
|
let message = "Expected story to be a function or variable declaration";
|
|
16019
15987
|
throw csf._storyPaths[storyName]?.buildCodeFrameError(message) ?? message;
|
|
16020
15988
|
}
|
|
16021
15989
|
let normalizedStory = normalizeStoryDeclaration(storyDeclaration), storyFn;
|
|
16022
15990
|
normalizedStory.type === "fn" && (storyFn = normalizedStory.path);
|
|
16023
|
-
let
|
|
16024
|
-
storyFn || (storyFn = storyRender
|
|
16025
|
-
let
|
|
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);
|
|
15991
|
+
let storyConfigPath = normalizedStory.type === "config" ? normalizedStory.path : void 0, metaRender = resolveRenderFunction(metaObjectPath(csf), storyDeclaration, ctx), storyRender = resolveRenderFunction(storyConfigPath, storyDeclaration, ctx);
|
|
15992
|
+
storyFn || (storyFn = renderFunctionOf(storyRender) ?? (storyRender.kind === "missing" ? renderFunctionOf(metaRender) : void 0));
|
|
15993
|
+
let 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);
|
|
16029
15994
|
if (storyFn) {
|
|
16030
15995
|
let fn = storyFn.node;
|
|
16031
15996
|
if (t2.isArrowFunctionExpression(fn) && (t2.isJSXElement(fn.body) || t2.isJSXFragment(fn.body))) {
|
|
16032
15997
|
let spreadRes = transformArgsSpreadsInJsx(fn.body, merged), inlineRes = inlineArgsInJsx(spreadRes.node, merged);
|
|
16033
15998
|
if (spreadRes.changed || inlineRes.changed) {
|
|
16034
|
-
let newFn = t2.arrowFunctionExpression(
|
|
15999
|
+
let newFn = t2.arrowFunctionExpression(
|
|
16000
|
+
remainingParams(fn, inlineRes.node),
|
|
16001
|
+
inlineRes.node,
|
|
16002
|
+
fn.async
|
|
16003
|
+
);
|
|
16035
16004
|
return t2.variableDeclaration("const", [
|
|
16036
16005
|
t2.variableDeclarator(t2.identifier(storyName), newFn)
|
|
16037
16006
|
]);
|
|
16038
16007
|
}
|
|
16039
16008
|
}
|
|
16040
|
-
let stmts = t2.isFunctionDeclaration(fn) || t2.isArrowFunctionExpression(fn) && t2.isBlockStatement(fn.body) || t2.isFunctionExpression(fn) && t2.isBlockStatement(fn.body) ? fn.body.body : void 0;
|
|
16009
|
+
let stmts = t2.isFunctionDeclaration(fn) || t2.isObjectMethod(fn) || t2.isArrowFunctionExpression(fn) && t2.isBlockStatement(fn.body) || t2.isFunctionExpression(fn) && t2.isBlockStatement(fn.body) ? fn.body.body : void 0;
|
|
16041
16010
|
if (stmts) {
|
|
16042
16011
|
let changed = !1, newBody = stmts.map((stmt) => {
|
|
16043
16012
|
if (t2.isReturnStatement(stmt) && stmt.argument && (t2.isJSXElement(stmt.argument) || t2.isJSXFragment(stmt.argument))) {
|
|
@@ -16047,21 +16016,22 @@ function getCodeSnippet(csf, storyName, componentName) {
|
|
|
16047
16016
|
}
|
|
16048
16017
|
return stmt;
|
|
16049
16018
|
});
|
|
16050
|
-
if (changed)
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
[],
|
|
16054
|
-
t2.blockStatement(newBody),
|
|
16055
|
-
fn.generator,
|
|
16056
|
-
fn.async
|
|
16057
|
-
) : t2.variableDeclaration("const", [
|
|
16019
|
+
if (changed) {
|
|
16020
|
+
let body = t2.blockStatement(newBody), params = remainingParams(fn, body);
|
|
16021
|
+
return t2.isFunctionDeclaration(fn) ? t2.functionDeclaration(t2.identifier(storyName), params, body, fn.generator, fn.async) : t2.variableDeclaration("const", [
|
|
16058
16022
|
t2.variableDeclarator(
|
|
16059
16023
|
t2.identifier(storyName),
|
|
16060
|
-
t2.arrowFunctionExpression(
|
|
16024
|
+
t2.arrowFunctionExpression(params, body, fn.async)
|
|
16061
16025
|
)
|
|
16062
16026
|
]);
|
|
16027
|
+
}
|
|
16063
16028
|
}
|
|
16064
|
-
return t2.isFunctionDeclaration(fn) ? t2.functionDeclaration(t2.identifier(storyName), fn.params, fn.body, fn.generator, fn.async) : t2.variableDeclaration("const", [
|
|
16029
|
+
return t2.isFunctionDeclaration(fn) ? t2.functionDeclaration(t2.identifier(storyName), fn.params, fn.body, fn.generator, fn.async) : t2.variableDeclaration("const", [
|
|
16030
|
+
t2.variableDeclarator(
|
|
16031
|
+
t2.identifier(storyName),
|
|
16032
|
+
t2.isObjectMethod(fn) ? t2.arrowFunctionExpression(fn.params, fn.body, fn.async) : fn
|
|
16033
|
+
)
|
|
16034
|
+
]);
|
|
16065
16035
|
}
|
|
16066
16036
|
invariant(componentName, "Could not generate snippet without component name.");
|
|
16067
16037
|
let invalidSpread = buildInvalidSpread(invalidEntries), name = t2.jsxIdentifier(componentName), openingElAttrs = invalidSpread ? [...injectedAttrs, invalidSpread] : injectedAttrs, children = toJsxChildren(merged.children), selfClosing = children.length === 0, arrow = t2.arrowFunctionExpression(
|
|
@@ -16075,6 +16045,15 @@ function getCodeSnippet(csf, storyName, componentName) {
|
|
|
16075
16045
|
);
|
|
16076
16046
|
return t2.variableDeclaration("const", [t2.variableDeclarator(t2.identifier(storyName), arrow)]);
|
|
16077
16047
|
}
|
|
16048
|
+
function remainingParams(fn, body) {
|
|
16049
|
+
return readsArgs(body) ? fn.params : [];
|
|
16050
|
+
}
|
|
16051
|
+
function readsArgs(node) {
|
|
16052
|
+
let named = /* @__PURE__ */ new Set(), reads = !1;
|
|
16053
|
+
return t2.traverseFast(node, (current2) => {
|
|
16054
|
+
t2.isMemberExpression(current2) && !current2.computed && named.add(current2.property), (t2.isObjectProperty(current2) || t2.isObjectMethod(current2)) && !current2.computed && named.add(current2.key), t2.isIdentifier(current2) && current2.name === "args" && !named.has(current2) && (reads = !0);
|
|
16055
|
+
}), reads;
|
|
16056
|
+
}
|
|
16078
16057
|
function buildInvalidSpread(entries) {
|
|
16079
16058
|
if (entries.length === 0)
|
|
16080
16059
|
return null;
|
|
@@ -16182,23 +16161,231 @@ function transformArgsSpreadsInJsx(node, merged) {
|
|
|
16182
16161
|
return { node: t2.jsxFragment(node.openingFragment, node.closingFragment, fragChildren), changed };
|
|
16183
16162
|
}
|
|
16184
16163
|
|
|
16164
|
+
// src/componentManifest/reactDocgenTypescript.ts
|
|
16165
|
+
import { dirname as dirname5, join as join4, resolve as resolve4 } from "node:path";
|
|
16166
|
+
import { logger as logger4 } from "storybook/internal/node-logger";
|
|
16167
|
+
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) => {
|
|
16168
|
+
let countBySource = /* @__PURE__ */ new Map();
|
|
16169
|
+
for (let prop of Object.values(props)) {
|
|
16170
|
+
let source = getPropSource(prop);
|
|
16171
|
+
(source?.includes("node_modules") || source?.endsWith(".d.ts")) && countBySource.set(source, (countBySource.get(source) ?? 0) + 1);
|
|
16172
|
+
}
|
|
16173
|
+
let largeNonUserSources = /* @__PURE__ */ new Set();
|
|
16174
|
+
for (let [source, count] of countBySource)
|
|
16175
|
+
count > LARGE_NON_USER_SOURCE_THRESHOLD && largeNonUserSources.add(source);
|
|
16176
|
+
return largeNonUserSources;
|
|
16177
|
+
};
|
|
16178
|
+
function findDisplayNameAssignment(typescript, sourceFile, identifierName) {
|
|
16179
|
+
for (let statement of sourceFile.statements) {
|
|
16180
|
+
if (!typescript.isExpressionStatement(statement))
|
|
16181
|
+
continue;
|
|
16182
|
+
let expr = statement.expression;
|
|
16183
|
+
if (typescript.isBinaryExpression(expr) && expr.operatorToken.kind === typescript.SyntaxKind.EqualsToken && typescript.isPropertyAccessExpression(expr.left) && expr.left.name.text === "displayName" && typescript.isIdentifier(expr.left.expression) && expr.left.expression.text === identifierName && typescript.isStringLiteral(expr.right))
|
|
16184
|
+
return expr.right.text;
|
|
16185
|
+
}
|
|
16186
|
+
}
|
|
16187
|
+
function getExportNameMap(typescript, checker, sourceFile) {
|
|
16188
|
+
let moduleSymbol = checker.getSymbolAtLocation(sourceFile);
|
|
16189
|
+
if (!moduleSymbol)
|
|
16190
|
+
return /* @__PURE__ */ new Map();
|
|
16191
|
+
let result = /* @__PURE__ */ new Map(), fileName = sourceFile.fileName.replace(/.*\//, "").replace(/\.[^.]+$/, "");
|
|
16192
|
+
for (let exportSymbol of checker.getExportsOfModule(moduleSymbol)) {
|
|
16193
|
+
let resolved = exportSymbol.flags & typescript.SymbolFlags.Alias ? checker.getAliasedSymbol(exportSymbol) : exportSymbol, declaration = resolved.valueDeclaration ?? resolved.getDeclarations()?.[0];
|
|
16194
|
+
if (!declaration)
|
|
16195
|
+
continue;
|
|
16196
|
+
let type = checker.getTypeOfSymbolAtLocation(resolved, declaration), isStateless = type.getCallSignatures().some((sig) => {
|
|
16197
|
+
let params = sig.getParameters();
|
|
16198
|
+
return params.length === 1 || params.length > 0 && params[0].getName() === "props";
|
|
16199
|
+
}), isStateful = type.getConstructSignatures().some(
|
|
16200
|
+
(sig) => sig.getReturnType().getProperty("props") !== void 0
|
|
16201
|
+
);
|
|
16202
|
+
if (isStateless || isStateful) {
|
|
16203
|
+
let exportName = exportSymbol.getName(), resolvedName = resolved.getName();
|
|
16204
|
+
result.set(resolvedName, exportName), exportName === "default" && result.set(fileName, "default");
|
|
16205
|
+
let displayNameValue = findDisplayNameAssignment(typescript, sourceFile, resolvedName);
|
|
16206
|
+
displayNameValue && result.set(displayNameValue, exportName);
|
|
16207
|
+
}
|
|
16208
|
+
}
|
|
16209
|
+
return result;
|
|
16210
|
+
}
|
|
16211
|
+
var previousProgramsByConfigKey = /* @__PURE__ */ new Map(), parserCache = /* @__PURE__ */ new Map(), parserBuilds = /* @__PURE__ */ new Map();
|
|
16212
|
+
function invalidateParser() {
|
|
16213
|
+
parserCache = /* @__PURE__ */ new Map(), parserBuilds = /* @__PURE__ */ new Map(), previousProgramsByConfigKey.clear();
|
|
16214
|
+
}
|
|
16215
|
+
async function getParser(filePath, userOptions) {
|
|
16216
|
+
let [typescript, reactDocgenTypescript] = await Promise.all([
|
|
16217
|
+
loadTypeScript(),
|
|
16218
|
+
loadReactDocgenTypescript()
|
|
16219
|
+
]), optionsKey = JSON.stringify(userOptions ?? {}), configPath = findOwningTsconfigPath(typescript, process.cwd(), filePath) ?? findTsconfigPath(process.cwd()), configKey = configPath ?? "<no-tsconfig>", parserKey = `${configKey}::${optionsKey}`, cachedParser = parserCache.get(parserKey);
|
|
16220
|
+
if (cachedParser)
|
|
16221
|
+
return { ...cachedParser, typescript };
|
|
16222
|
+
let pendingParser = parserBuilds.get(parserKey);
|
|
16223
|
+
if (pendingParser)
|
|
16224
|
+
return { ...await pendingParser, typescript };
|
|
16225
|
+
let buildParser = (async () => {
|
|
16226
|
+
let compilerOptions = { noErrorTruncation: !0, strict: !0 }, fileNames = [];
|
|
16227
|
+
if (configPath) {
|
|
16228
|
+
let parsed = parseTsconfig(typescript, configPath);
|
|
16229
|
+
compilerOptions = { ...parsed.options, noErrorTruncation: !0 }, fileNames = parsed.fileNames;
|
|
16230
|
+
} else
|
|
16231
|
+
logger4.warn(
|
|
16232
|
+
"No tsconfig.json (or tsconfig.base.json / tsconfig.app.json) found. TypeScript component props will not be documented by react-docgen-typescript. Create a tsconfig.json in your project root to enable automatic controls."
|
|
16233
|
+
);
|
|
16234
|
+
let program = typescript.createProgram(
|
|
16235
|
+
fileNames,
|
|
16236
|
+
compilerOptions,
|
|
16237
|
+
void 0,
|
|
16238
|
+
previousProgramsByConfigKey.get(configKey)
|
|
16239
|
+
);
|
|
16240
|
+
previousProgramsByConfigKey.set(configKey, program);
|
|
16241
|
+
let parserOptions = {
|
|
16242
|
+
shouldExtractLiteralValuesFromEnum: !0,
|
|
16243
|
+
shouldRemoveUndefinedFromOptional: !0,
|
|
16244
|
+
...userOptions,
|
|
16245
|
+
// Always force savePropValueAsString so default values are in a consistent format
|
|
16246
|
+
savePropValueAsString: !0
|
|
16247
|
+
}, state = {
|
|
16248
|
+
program,
|
|
16249
|
+
fileParser: reactDocgenTypescript.withCompilerOptions(compilerOptions, parserOptions)
|
|
16250
|
+
};
|
|
16251
|
+
return parserCache.set(parserKey, state), state;
|
|
16252
|
+
})();
|
|
16253
|
+
parserBuilds.set(parserKey, buildParser);
|
|
16254
|
+
try {
|
|
16255
|
+
return { ...await buildParser, typescript };
|
|
16256
|
+
} finally {
|
|
16257
|
+
parserBuilds.delete(parserKey);
|
|
16258
|
+
}
|
|
16259
|
+
}
|
|
16260
|
+
function matchComponentDoc(docs, {
|
|
16261
|
+
importName,
|
|
16262
|
+
localImportName,
|
|
16263
|
+
componentName
|
|
16264
|
+
}) {
|
|
16265
|
+
if (docs.length !== 0)
|
|
16266
|
+
return docs.length === 1 ? docs[0] : docs.find(
|
|
16267
|
+
(doc) => doc.exportName === importName || doc.exportName === localImportName || doc.displayName === importName || doc.displayName === localImportName || doc.displayName === componentName
|
|
16268
|
+
);
|
|
16269
|
+
}
|
|
16270
|
+
function getReactDocgenTypescriptError(path2, {
|
|
16271
|
+
importName,
|
|
16272
|
+
localImportName,
|
|
16273
|
+
componentName
|
|
16274
|
+
}, docs) {
|
|
16275
|
+
return docs.length === 0 ? {
|
|
16276
|
+
name: "react-docgen-typescript found no component docs",
|
|
16277
|
+
message: [
|
|
16278
|
+
`File: ${path2}`,
|
|
16279
|
+
"react-docgen-typescript did not return any component docs for this file."
|
|
16280
|
+
].join(`
|
|
16281
|
+
`)
|
|
16282
|
+
} : {
|
|
16283
|
+
name: "react-docgen-typescript could not match component docs",
|
|
16284
|
+
message: [
|
|
16285
|
+
`File: ${path2}`,
|
|
16286
|
+
"react-docgen-typescript returned component docs for this file, but none matched the story's component import.",
|
|
16287
|
+
`Looked for: componentName=${componentName}, localImportName=${localImportName ?? "<none>"}, importName=${importName ?? "<none>"}.`
|
|
16288
|
+
].join(`
|
|
16289
|
+
`)
|
|
16290
|
+
};
|
|
16291
|
+
}
|
|
16292
|
+
var parseWithReactDocgenTypescript = asyncCache(
|
|
16293
|
+
async (filePath, userOptions) => {
|
|
16294
|
+
let { program, fileParser, typescript } = await getParser(filePath, userOptions), checker = program.getTypeChecker(), sourceFile = program.getSourceFile(filePath), docs = fileParser.parseWithProgramProvider(filePath, () => program), exportNameMap = sourceFile ? getExportNameMap(typescript, checker, sourceFile) : /* @__PURE__ */ new Map();
|
|
16295
|
+
return docs.map((doc) => {
|
|
16296
|
+
let largeNonUserSources = getLargeNonUserPropSources(doc.props);
|
|
16297
|
+
return {
|
|
16298
|
+
...doc,
|
|
16299
|
+
// Use name-based lookup: displayName is the resolved symbol name, so look it up in the
|
|
16300
|
+
// export map to get the public export name. Falls back to displayName when not aliased.
|
|
16301
|
+
exportName: exportNameMap.get(doc.displayName) ?? doc.displayName,
|
|
16302
|
+
// Filter out bulk props from non-user sources (React built-ins, DOM, CSS-in-JS system props)
|
|
16303
|
+
props: Object.fromEntries(
|
|
16304
|
+
Object.entries(doc.props).filter(([, prop]) => {
|
|
16305
|
+
let source = getPropSource(prop);
|
|
16306
|
+
return !source || !largeNonUserSources.has(source);
|
|
16307
|
+
})
|
|
16308
|
+
)
|
|
16309
|
+
};
|
|
16310
|
+
});
|
|
16311
|
+
},
|
|
16312
|
+
{ name: "parseWithReactDocgenTypescript" }
|
|
16313
|
+
), findOwningTsconfigPath = cached(
|
|
16314
|
+
(typescript, cwd2, filePath) => {
|
|
16315
|
+
let configPath = findTsconfigPath(cwd2);
|
|
16316
|
+
if (configPath)
|
|
16317
|
+
return findTsconfigPathIncludingFile(typescript, configPath, filePath, /* @__PURE__ */ new Set()) ?? configPath;
|
|
16318
|
+
},
|
|
16319
|
+
{
|
|
16320
|
+
key: (typescript, cwd2, filePath) => `${normalizeFileName(typescript, resolve4(cwd2))}::${normalizeFileName(
|
|
16321
|
+
typescript,
|
|
16322
|
+
resolve4(filePath)
|
|
16323
|
+
)}`,
|
|
16324
|
+
name: "findOwningTsconfigPath"
|
|
16325
|
+
}
|
|
16326
|
+
);
|
|
16327
|
+
function findTsconfigPathIncludingFile(typescript, configPath, filePath, seenConfigPaths) {
|
|
16328
|
+
let normalizedConfigPath = normalizeFileName(typescript, configPath);
|
|
16329
|
+
if (seenConfigPaths.has(normalizedConfigPath))
|
|
16330
|
+
return;
|
|
16331
|
+
seenConfigPaths.add(normalizedConfigPath);
|
|
16332
|
+
let { config, parsed } = readTsconfig(typescript, configPath);
|
|
16333
|
+
if (parsed.fileNames.some((name) => isSameFileName(typescript, name, filePath)))
|
|
16334
|
+
return configPath;
|
|
16335
|
+
for (let referencedConfigPath of getReferencedTsconfigPaths(typescript, configPath, config)) {
|
|
16336
|
+
let matchingConfigPath = findTsconfigPathIncludingFile(
|
|
16337
|
+
typescript,
|
|
16338
|
+
referencedConfigPath,
|
|
16339
|
+
filePath,
|
|
16340
|
+
seenConfigPaths
|
|
16341
|
+
);
|
|
16342
|
+
if (matchingConfigPath)
|
|
16343
|
+
return matchingConfigPath;
|
|
16344
|
+
}
|
|
16345
|
+
}
|
|
16346
|
+
function getReferencedTsconfigPaths(typescript, configPath, config) {
|
|
16347
|
+
return (Array.isArray(config?.references) ? config.references : []).map((reference) => reference.path).filter((referencePath) => typeof referencePath == "string").map((referencePath) => resolve4(dirname5(configPath), referencePath)).map(
|
|
16348
|
+
(referencePath) => referencePath.endsWith(".json") ? referencePath : join4(referencePath, "tsconfig.json")
|
|
16349
|
+
).filter((referencePath) => typescript.sys.fileExists(referencePath));
|
|
16350
|
+
}
|
|
16351
|
+
function parseTsconfig(typescript, configPath) {
|
|
16352
|
+
return readTsconfig(typescript, configPath).parsed;
|
|
16353
|
+
}
|
|
16354
|
+
function readTsconfig(typescript, configPath) {
|
|
16355
|
+
let { config } = typescript.readConfigFile(configPath, typescript.sys.readFile);
|
|
16356
|
+
return {
|
|
16357
|
+
config,
|
|
16358
|
+
parsed: typescript.parseJsonConfigFileContent(config, typescript.sys, dirname5(configPath))
|
|
16359
|
+
};
|
|
16360
|
+
}
|
|
16361
|
+
function isSameFileName(typescript, left, right) {
|
|
16362
|
+
return normalizeFileName(typescript, left) === normalizeFileName(typescript, right);
|
|
16363
|
+
}
|
|
16364
|
+
function normalizeFileName(typescript, fileName) {
|
|
16365
|
+
let normalized = resolve4(fileName).replace(/\\/g, "/");
|
|
16366
|
+
return typescript.sys.useCaseSensitiveFileNames ? normalized : normalized.toLowerCase();
|
|
16367
|
+
}
|
|
16368
|
+
|
|
16185
16369
|
// src/componentManifest/resolveComponents.ts
|
|
16186
|
-
import { recast
|
|
16370
|
+
import { recast } from "storybook/internal/babel";
|
|
16187
16371
|
import { storyNameFromExport } from "storybook/internal/csf";
|
|
16188
|
-
import {
|
|
16372
|
+
import {
|
|
16373
|
+
createStoryArgsResolver as createStoryArgsResolver2,
|
|
16374
|
+
extractStoryJSDocInfo,
|
|
16375
|
+
loadCsf,
|
|
16376
|
+
unresolvedWarning
|
|
16377
|
+
} from "storybook/internal/csf-tools";
|
|
16189
16378
|
|
|
16190
16379
|
// src/componentManifest/getComponentImports.ts
|
|
16191
16380
|
import { dirname as dirname6 } from "node:path";
|
|
16192
|
-
import {
|
|
16381
|
+
import { types as t3 } from "storybook/internal/babel";
|
|
16193
16382
|
import {
|
|
16383
|
+
buildImportStatements,
|
|
16194
16384
|
collectImportBindings,
|
|
16195
|
-
|
|
16196
|
-
isTypeSpecifier
|
|
16385
|
+
resolveComponentImport
|
|
16197
16386
|
} from "storybook/internal/csf-tools";
|
|
16198
16387
|
import { logger as logger5 } from "storybook/internal/node-logger";
|
|
16199
|
-
var baseIdentifier = (component) => component.split(".")[0] ?? component,
|
|
16200
|
-
arr.find(eq2) || arr.push(item);
|
|
16201
|
-
}, getComponents = async ({
|
|
16388
|
+
var baseIdentifier = (component) => component.split(".")[0] ?? component, getComponents = async ({
|
|
16202
16389
|
csf,
|
|
16203
16390
|
storyFilePath,
|
|
16204
16391
|
typescriptOptions = {},
|
|
@@ -16241,36 +16428,12 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, addUni
|
|
|
16241
16428
|
);
|
|
16242
16429
|
return (await Promise.all(
|
|
16243
16430
|
filteredComponents.map(async (c) => {
|
|
16244
|
-
let
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
localImportName: ns,
|
|
16249
|
-
importId: direct.importId,
|
|
16250
|
-
importName: mem,
|
|
16251
|
-
namespace: ns,
|
|
16252
|
-
member: mem,
|
|
16253
|
-
jsxDepth: depth
|
|
16254
|
-
} : {
|
|
16255
|
-
componentName: c,
|
|
16256
|
-
localImportName: ns,
|
|
16257
|
-
importId: direct.importId,
|
|
16258
|
-
importName: direct.importName,
|
|
16259
|
-
member: mem,
|
|
16260
|
-
jsxDepth: depth
|
|
16261
|
-
} : { componentName: c, member: mem, jsxDepth: depth };
|
|
16262
|
-
})() : (() => {
|
|
16263
|
-
let direct = localToImport.get(c);
|
|
16264
|
-
return direct ? {
|
|
16265
|
-
componentName: c,
|
|
16266
|
-
localImportName: c,
|
|
16267
|
-
importId: direct.importId,
|
|
16268
|
-
importName: direct.importName,
|
|
16269
|
-
jsxDepth: depth
|
|
16270
|
-
} : { componentName: c, jsxDepth: depth };
|
|
16271
|
-
})(), path3, isPackage = !1;
|
|
16431
|
+
let component = {
|
|
16432
|
+
...resolveComponentImport(c, localToImport),
|
|
16433
|
+
jsxDepth: componentDepth.get(c)
|
|
16434
|
+
}, path2, isPackage = !1;
|
|
16272
16435
|
try {
|
|
16273
|
-
component.importId && storyFilePath && (
|
|
16436
|
+
component.importId && storyFilePath && (path2 = cachedResolveImport(matchPath(component.importId, dirname6(storyFilePath)), {
|
|
16274
16437
|
basedir: dirname6(storyFilePath)
|
|
16275
16438
|
}));
|
|
16276
16439
|
} catch (e) {
|
|
@@ -16281,34 +16444,34 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, addUni
|
|
|
16281
16444
|
} catch {
|
|
16282
16445
|
}
|
|
16283
16446
|
let componentWithPackage = { ...component, isPackage };
|
|
16284
|
-
if (
|
|
16447
|
+
if (path2) {
|
|
16285
16448
|
if (docgenEngine === "react-docgen-typescript") {
|
|
16286
16449
|
let reactDocgenTypescript, reactDocgenTypescriptError;
|
|
16287
16450
|
try {
|
|
16288
|
-
let docs = await parseWithReactDocgenTypescript(
|
|
16289
|
-
reactDocgenTypescript = matchComponentDoc(docs, component), reactDocgenTypescript || (reactDocgenTypescriptError = getReactDocgenTypescriptError(
|
|
16451
|
+
let docs = await parseWithReactDocgenTypescript(path2, reactDocgenTypescriptOptions);
|
|
16452
|
+
reactDocgenTypescript = matchComponentDoc(docs, component), reactDocgenTypescript || (reactDocgenTypescriptError = getReactDocgenTypescriptError(path2, component, docs));
|
|
16290
16453
|
} catch (e) {
|
|
16291
16454
|
let message = e instanceof Error ? e.message : String(e);
|
|
16292
|
-
logger5.debug(`react-docgen-typescript failed for ${
|
|
16455
|
+
logger5.debug(`react-docgen-typescript failed for ${path2}: ${message}`), reactDocgenTypescriptError = {
|
|
16293
16456
|
name: "react-docgen-typescript parse error",
|
|
16294
|
-
message: `File: ${
|
|
16457
|
+
message: `File: ${path2}
|
|
16295
16458
|
${message}`
|
|
16296
16459
|
};
|
|
16297
16460
|
}
|
|
16298
16461
|
let importOverride = reactDocgenTypescript ? getImportTag(reactDocgenTypescript) : void 0;
|
|
16299
16462
|
return {
|
|
16300
16463
|
...componentWithPackage,
|
|
16301
|
-
path:
|
|
16464
|
+
path: path2,
|
|
16302
16465
|
...reactDocgenTypescript ? { reactDocgenTypescript } : {},
|
|
16303
16466
|
...reactDocgenTypescriptError ? { reactDocgenTypescriptError } : {},
|
|
16304
16467
|
importOverride
|
|
16305
16468
|
};
|
|
16306
16469
|
}
|
|
16307
16470
|
if (docgenEngine === "react-docgen") {
|
|
16308
|
-
let reactDocgen = getReactDocgen(
|
|
16471
|
+
let reactDocgen = getReactDocgen(path2, componentWithPackage);
|
|
16309
16472
|
return {
|
|
16310
16473
|
...componentWithPackage,
|
|
16311
|
-
path:
|
|
16474
|
+
path: path2,
|
|
16312
16475
|
reactDocgen,
|
|
16313
16476
|
importOverride: reactDocgen.type === "success" ? getImportTag(reactDocgen.data) : void 0
|
|
16314
16477
|
};
|
|
@@ -16316,151 +16479,12 @@ ${message}`
|
|
|
16316
16479
|
if (docgenEngine === "react-component-meta")
|
|
16317
16480
|
return {
|
|
16318
16481
|
...componentWithPackage,
|
|
16319
|
-
path:
|
|
16482
|
+
path: path2
|
|
16320
16483
|
};
|
|
16321
16484
|
}
|
|
16322
16485
|
return componentWithPackage;
|
|
16323
16486
|
})
|
|
16324
16487
|
)).sort((a, b) => a.componentName.localeCompare(b.componentName));
|
|
16325
|
-
}, getImports = ({
|
|
16326
|
-
components,
|
|
16327
|
-
packageName
|
|
16328
|
-
}) => {
|
|
16329
|
-
let withSource = components.filter((c) => !!c.importId).map((c, idx) => {
|
|
16330
|
-
let importId = c.importId, overrideSource = (() => {
|
|
16331
|
-
if (c.importOverride)
|
|
16332
|
-
try {
|
|
16333
|
-
let src = babelParse2(c.importOverride).program.body.find((n) => t3.isImportDeclaration(n))?.source?.value;
|
|
16334
|
-
return typeof src == "string" ? src : void 0;
|
|
16335
|
-
} catch {
|
|
16336
|
-
return;
|
|
16337
|
-
}
|
|
16338
|
-
})(), rewritten = overrideSource !== void 0 ? overrideSource : (
|
|
16339
|
-
// only rewrite to the package name it the import id is not already a valid package
|
|
16340
|
-
// tsconfig paths such as ~/components/Button and components/Button are not seen as packages
|
|
16341
|
-
packageName && !c.isPackage ? packageName : importId
|
|
16342
|
-
);
|
|
16343
|
-
return { c, src: t3.stringLiteral(rewritten), key: rewritten, ord: idx };
|
|
16344
|
-
}), orderOfSource = {};
|
|
16345
|
-
for (let w of withSource)
|
|
16346
|
-
orderOfSource[w.key] === void 0 && (orderOfSource[w.key] = w.ord);
|
|
16347
|
-
let buckets = /* @__PURE__ */ new Map(), ensureBucket = (key, src) => {
|
|
16348
|
-
let prev = buckets.get(key);
|
|
16349
|
-
if (prev)
|
|
16350
|
-
return prev;
|
|
16351
|
-
let b = {
|
|
16352
|
-
source: src,
|
|
16353
|
-
defaults: [],
|
|
16354
|
-
namespaces: [],
|
|
16355
|
-
named: [],
|
|
16356
|
-
order: orderOfSource[key] ?? 0
|
|
16357
|
-
};
|
|
16358
|
-
return buckets.set(key, b), b;
|
|
16359
|
-
};
|
|
16360
|
-
for (let { c, src, key } of withSource) {
|
|
16361
|
-
let b = ensureBucket(key, src), rewritten = src.value !== c.importId, overrideSpec = (() => {
|
|
16362
|
-
if (c.importOverride)
|
|
16363
|
-
try {
|
|
16364
|
-
let decl = babelParse2(c.importOverride).program.body.find((n) => t3.isImportDeclaration(n));
|
|
16365
|
-
if (!decl)
|
|
16366
|
-
return;
|
|
16367
|
-
let spec = (decl.specifiers ?? []).find((s) => !isTypeSpecifier(s));
|
|
16368
|
-
return spec ? t3.isImportNamespaceSpecifier(spec) ? { kind: "namespace", local: spec.local.name } : t3.isImportDefaultSpecifier(spec) ? { kind: "default" } : t3.isImportSpecifier(spec) ? { kind: "named", imported: t3.isIdentifier(spec.imported) ? spec.imported.name : spec.imported.value } : void 0 : void 0;
|
|
16369
|
-
} catch {
|
|
16370
|
-
return;
|
|
16371
|
-
}
|
|
16372
|
-
})();
|
|
16373
|
-
if (overrideSpec) {
|
|
16374
|
-
if (overrideSpec.kind === "namespace") {
|
|
16375
|
-
let ns = t3.identifier(overrideSpec.local);
|
|
16376
|
-
addUniqueBy(b.namespaces, ns, (n) => n.name === ns.name);
|
|
16377
|
-
continue;
|
|
16378
|
-
}
|
|
16379
|
-
if (!c.localImportName)
|
|
16380
|
-
continue;
|
|
16381
|
-
if (overrideSpec.kind === "default") {
|
|
16382
|
-
let id = t3.identifier(c.localImportName);
|
|
16383
|
-
addUniqueBy(b.defaults, id, (d) => d.name === id.name);
|
|
16384
|
-
continue;
|
|
16385
|
-
}
|
|
16386
|
-
if (overrideSpec.kind === "named") {
|
|
16387
|
-
let local = t3.identifier(c.localImportName), imported = t3.identifier(overrideSpec.imported);
|
|
16388
|
-
addUniqueBy(
|
|
16389
|
-
b.named,
|
|
16390
|
-
t3.importSpecifier(local, imported),
|
|
16391
|
-
(n) => n.local.name === local.name && importedName(n.imported) === imported.name
|
|
16392
|
-
);
|
|
16393
|
-
continue;
|
|
16394
|
-
}
|
|
16395
|
-
}
|
|
16396
|
-
if (c.namespace) {
|
|
16397
|
-
if (rewritten) {
|
|
16398
|
-
if (!c.importName)
|
|
16399
|
-
continue;
|
|
16400
|
-
let member = c.importName, id = t3.identifier(member);
|
|
16401
|
-
addUniqueBy(
|
|
16402
|
-
b.named,
|
|
16403
|
-
t3.importSpecifier(id, id),
|
|
16404
|
-
(n) => n.local.name === member && importedName(n.imported) === member
|
|
16405
|
-
);
|
|
16406
|
-
} else {
|
|
16407
|
-
let ns = t3.identifier(c.namespace);
|
|
16408
|
-
addUniqueBy(b.namespaces, ns, (n) => n.name === ns.name);
|
|
16409
|
-
}
|
|
16410
|
-
continue;
|
|
16411
|
-
}
|
|
16412
|
-
if (c.importName === "default") {
|
|
16413
|
-
if (!c.localImportName)
|
|
16414
|
-
continue;
|
|
16415
|
-
if (rewritten) {
|
|
16416
|
-
let id = t3.identifier(c.localImportName);
|
|
16417
|
-
addUniqueBy(
|
|
16418
|
-
b.named,
|
|
16419
|
-
t3.importSpecifier(id, id),
|
|
16420
|
-
(n) => n.local.name === id.name && importedName(n.imported) === id.name
|
|
16421
|
-
);
|
|
16422
|
-
} else {
|
|
16423
|
-
let id = t3.identifier(c.localImportName);
|
|
16424
|
-
addUniqueBy(b.defaults, id, (d) => d.name === id.name);
|
|
16425
|
-
}
|
|
16426
|
-
continue;
|
|
16427
|
-
}
|
|
16428
|
-
if (c.importName) {
|
|
16429
|
-
if (!c.localImportName)
|
|
16430
|
-
continue;
|
|
16431
|
-
let local = t3.identifier(c.localImportName), imported = t3.identifier(c.importName);
|
|
16432
|
-
addUniqueBy(
|
|
16433
|
-
b.named,
|
|
16434
|
-
t3.importSpecifier(local, imported),
|
|
16435
|
-
(n) => n.local.name === local.name && importedName(n.imported) === imported.name
|
|
16436
|
-
);
|
|
16437
|
-
continue;
|
|
16438
|
-
}
|
|
16439
|
-
}
|
|
16440
|
-
let merged = [], printDecl = (specs, src) => {
|
|
16441
|
-
let node = t3.importDeclaration(specs, src), code = recast.print(node, {}).code;
|
|
16442
|
-
merged.push(code);
|
|
16443
|
-
}, sortedBuckets = Array.from(buckets.values()).sort((a, b) => a.order - b.order);
|
|
16444
|
-
for (let bucket of sortedBuckets) {
|
|
16445
|
-
let { source, defaults, namespaces, named } = bucket;
|
|
16446
|
-
if (!(defaults.length === 0 && namespaces.length === 0 && named.length === 0))
|
|
16447
|
-
if (namespaces.length > 0) {
|
|
16448
|
-
let firstSpecs = [];
|
|
16449
|
-
defaults[0] && firstSpecs.push(t3.importDefaultSpecifier(defaults[0])), firstSpecs.push(t3.importNamespaceSpecifier(namespaces[0])), printDecl(firstSpecs, source), named.length > 0 && printDecl(named, source);
|
|
16450
|
-
for (let d of defaults.slice(1))
|
|
16451
|
-
printDecl([t3.importDefaultSpecifier(d)], source);
|
|
16452
|
-
for (let ns of namespaces.slice(1))
|
|
16453
|
-
printDecl([t3.importNamespaceSpecifier(ns)], source);
|
|
16454
|
-
} else {
|
|
16455
|
-
if (defaults.length > 0 || named.length > 0) {
|
|
16456
|
-
let specs = [];
|
|
16457
|
-
defaults[0] && specs.push(t3.importDefaultSpecifier(defaults[0])), specs.push(...named), printDecl(specs, source);
|
|
16458
|
-
}
|
|
16459
|
-
for (let d of defaults.slice(1))
|
|
16460
|
-
printDecl([t3.importDefaultSpecifier(d)], source);
|
|
16461
|
-
}
|
|
16462
|
-
}
|
|
16463
|
-
return merged;
|
|
16464
16488
|
};
|
|
16465
16489
|
|
|
16466
16490
|
// src/componentManifest/subcomponents.ts
|
|
@@ -16556,31 +16580,41 @@ async function resolveStoryFileComponents(options) {
|
|
|
16556
16580
|
}));
|
|
16557
16581
|
return { storyPath, storyFile, csf, componentName, allComponents, component, subcomponents };
|
|
16558
16582
|
}
|
|
16559
|
-
function extractStorySnippets(csf, componentName, filterStoryIds) {
|
|
16560
|
-
|
|
16583
|
+
function extractStorySnippets(csf, componentName, filterStoryIds, references) {
|
|
16584
|
+
let imports = [], resolver = createStoryArgsResolver2(csf, references);
|
|
16585
|
+
return { stories: Object.entries(csf._stories).filter(([, story]) => !filterStoryIds || filterStoryIds.has(story.id)).map(([storyExport, story]) => {
|
|
16561
16586
|
let name = story.name ?? storyNameFromExport(storyExport);
|
|
16562
16587
|
try {
|
|
16563
|
-
let { description, summary } = extractStoryJSDocInfo(csf._storyStatements[storyExport]);
|
|
16588
|
+
let { description, summary } = extractStoryJSDocInfo(csf._storyStatements[storyExport]), snippet = getCodeSnippet(csf, storyExport, componentName, resolver);
|
|
16589
|
+
imports.push(...snippet.imports);
|
|
16590
|
+
let warning = unresolvedWarning(snippet.unresolved);
|
|
16564
16591
|
return {
|
|
16565
16592
|
id: story.id,
|
|
16566
16593
|
name,
|
|
16567
|
-
snippet:
|
|
16594
|
+
snippet: recast.print(snippet.node).code,
|
|
16568
16595
|
description,
|
|
16569
|
-
summary
|
|
16596
|
+
summary,
|
|
16597
|
+
...warning ? { warning } : {}
|
|
16570
16598
|
};
|
|
16571
16599
|
} catch (e) {
|
|
16572
16600
|
let err = e instanceof Error ? e : new Error(String(e));
|
|
16573
16601
|
return { id: story.id, name, error: { name: err.name, message: err.message } };
|
|
16574
16602
|
}
|
|
16575
|
-
});
|
|
16603
|
+
}), imports };
|
|
16576
16604
|
}
|
|
16577
16605
|
|
|
16578
16606
|
// src/componentManifest/buildReactComponentDocgen.ts
|
|
16579
16607
|
import { getComponentIdFromEntry } from "storybook/internal/common";
|
|
16580
|
-
import {
|
|
16608
|
+
import {
|
|
16609
|
+
buildImportStatements as buildImportStatements2,
|
|
16610
|
+
createStoryReferenceResolver,
|
|
16611
|
+
extractComponentDescription,
|
|
16612
|
+
extractDescription
|
|
16613
|
+
} from "storybook/internal/csf-tools";
|
|
16614
|
+
var openStoryReferences = createStoryReferenceResolver();
|
|
16581
16615
|
function getPackageInfo(componentPath, fallbackPath) {
|
|
16582
16616
|
let nearestPkg = cachedFindUp("package.json", {
|
|
16583
|
-
cwd:
|
|
16617
|
+
cwd: posix.dirname(componentPath ?? fallbackPath)
|
|
16584
16618
|
});
|
|
16585
16619
|
try {
|
|
16586
16620
|
if (!nearestPkg)
|
|
@@ -16593,10 +16627,13 @@ function getPackageInfo(componentPath, fallbackPath) {
|
|
|
16593
16627
|
}
|
|
16594
16628
|
function getFallbackImport(packageName, componentName) {
|
|
16595
16629
|
let exportName = componentName?.split(".").at(-1);
|
|
16596
|
-
return packageName && exportName ?
|
|
16630
|
+
return packageName && exportName ? buildImportStatements2({
|
|
16631
|
+
refs: [{ importId: packageName, importName: exportName, localImportName: exportName }]
|
|
16632
|
+
}).join(`
|
|
16633
|
+
`) : "";
|
|
16597
16634
|
}
|
|
16598
16635
|
function relativizeComponentMetaPaths(doc) {
|
|
16599
|
-
let relativize = (fileName) =>
|
|
16636
|
+
let relativize = (fileName) => posix.relative(process.cwd(), fileName), relativizeProp = (prop) => ({
|
|
16600
16637
|
...prop,
|
|
16601
16638
|
parent: prop.parent ? { ...prop.parent, fileName: relativize(prop.parent.fileName) } : prop.parent,
|
|
16602
16639
|
declarations: prop.declarations?.map((declaration) => ({
|
|
@@ -16633,7 +16670,7 @@ function createSubcomponentDocgen({
|
|
|
16633
16670
|
packageName,
|
|
16634
16671
|
storyFilePath
|
|
16635
16672
|
}) {
|
|
16636
|
-
let imports =
|
|
16673
|
+
let imports = buildImportStatements2({ refs: component ? [component] : [], packageName }).join(`
|
|
16637
16674
|
`).trim() || getFallbackImport(packageName, component?.componentName), {
|
|
16638
16675
|
reactDocgen,
|
|
16639
16676
|
reactDocgenTypescript,
|
|
@@ -16672,14 +16709,17 @@ function buildStoryDocsFromResolved({
|
|
|
16672
16709
|
allComponents,
|
|
16673
16710
|
filterStoryIds
|
|
16674
16711
|
}) {
|
|
16675
|
-
let id = getComponentIdFromEntry(entry), title = entry.title.split("/").at(-1).replace(/\s+/g, ""), packageName = getPackageInfo(component?.path, storyPath), fallbackImport = getFallbackImport(packageName, componentName),
|
|
16676
|
-
|
|
16712
|
+
let id = getComponentIdFromEntry(entry), title = entry.title.split("/").at(-1).replace(/\s+/g, ""), packageName = getPackageInfo(component?.path, storyPath), fallbackImport = getFallbackImport(packageName, componentName), storyEntries = extractStorySnippets(csf, component?.componentName, filterStoryIds, {
|
|
16713
|
+
filePath: storyPath,
|
|
16714
|
+
...openStoryReferences()
|
|
16715
|
+
}), argRefs = storyEntries.imports.map((ref2) => ({ ...ref2, isPackage: !0 })), imports = buildImportStatements2({ refs: [...allComponents, ...argRefs], packageName }).join(`
|
|
16716
|
+
`).trim() || fallbackImport;
|
|
16677
16717
|
return {
|
|
16678
16718
|
id,
|
|
16679
16719
|
name: componentName ?? title,
|
|
16680
16720
|
path: storyFilePath,
|
|
16681
16721
|
...imports ? { import: imports } : {},
|
|
16682
|
-
stories: Object.fromEntries(storyEntries.map((story) => [story.id, story]))
|
|
16722
|
+
stories: Object.fromEntries(storyEntries.stories.map((story) => [story.id, story]))
|
|
16683
16723
|
};
|
|
16684
16724
|
}
|
|
16685
16725
|
function buildComponentDocgenFromResolved({
|
|
@@ -16796,15 +16836,14 @@ function buildReactComponentDocgenFromResolved({
|
|
|
16796
16836
|
}
|
|
16797
16837
|
|
|
16798
16838
|
export {
|
|
16799
|
-
join3 as join,
|
|
16800
|
-
dirname3 as dirname,
|
|
16801
|
-
path2 as path,
|
|
16802
16839
|
extractArgTypes,
|
|
16803
16840
|
invalidateCache,
|
|
16804
16841
|
cachedReadFileSync,
|
|
16805
16842
|
parseWithReactDocgen,
|
|
16806
|
-
|
|
16843
|
+
join3 as join,
|
|
16844
|
+
posix,
|
|
16807
16845
|
getCodeSnippet,
|
|
16846
|
+
invalidateParser,
|
|
16808
16847
|
resolveStoryFileComponents,
|
|
16809
16848
|
buildStoryDocsFromResolved,
|
|
16810
16849
|
buildComponentDocgenFromResolved,
|