@openpkg-ts/sdk 0.54.1 → 0.54.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1790,6 +1790,9 @@ var NODE_MODULES_PKG = /node_modules\/(@[^/]+\/[^/]+|[^/]+)/g;
|
|
|
1790
1790
|
function isLibFile(fileName) {
|
|
1791
1791
|
return fileName.includes("/typescript/lib/lib.") || fileName.includes("\\typescript\\lib\\lib.");
|
|
1792
1792
|
}
|
|
1793
|
+
function isLibSymbol(symbol) {
|
|
1794
|
+
return symbol?.declarations?.some((d) => isLibFile(d.getSourceFile().fileName)) ?? false;
|
|
1795
|
+
}
|
|
1793
1796
|
function packageNameFromPath(fileName) {
|
|
1794
1797
|
return [...fileName.matchAll(NODE_MODULES_PKG)].at(-1)?.[1];
|
|
1795
1798
|
}
|
|
@@ -2830,12 +2833,7 @@ function isPrimitiveName(name) {
|
|
|
2830
2833
|
return PRIMITIVES.has(name);
|
|
2831
2834
|
}
|
|
2832
2835
|
function isBuiltinSymbol(symbol) {
|
|
2833
|
-
|
|
2834
|
-
return false;
|
|
2835
|
-
const declarations = symbol.getDeclarations();
|
|
2836
|
-
if (!declarations || declarations.length === 0)
|
|
2837
|
-
return false;
|
|
2838
|
-
return isLibFile(declarations[0].getSourceFile().fileName);
|
|
2836
|
+
return isLibSymbol(symbol);
|
|
2839
2837
|
}
|
|
2840
2838
|
function getTypeOrigin(type, _checker) {
|
|
2841
2839
|
const symbol = type.getSymbol() ?? type.aliasSymbol;
|
|
@@ -2844,10 +2842,9 @@ function getTypeOrigin(type, _checker) {
|
|
|
2844
2842
|
const declarations = symbol.getDeclarations();
|
|
2845
2843
|
if (!declarations || declarations.length === 0)
|
|
2846
2844
|
return;
|
|
2847
|
-
|
|
2848
|
-
if (isLibFile(fileName))
|
|
2845
|
+
if (isLibSymbol(symbol))
|
|
2849
2846
|
return;
|
|
2850
|
-
return packageNameFromPath(fileName);
|
|
2847
|
+
return packageNameFromPath(declarations[0].getSourceFile().fileName);
|
|
2851
2848
|
}
|
|
2852
2849
|
function isBuiltinGeneric(name) {
|
|
2853
2850
|
return BUILTIN_GENERICS.has(name);
|
|
@@ -6980,10 +6977,9 @@ function createExternalExpansionPredicate(opts) {
|
|
|
6980
6977
|
const decl = symbol.declarations?.[0];
|
|
6981
6978
|
if (!decl)
|
|
6982
6979
|
return false;
|
|
6983
|
-
|
|
6984
|
-
if (isLibFile(fileName))
|
|
6980
|
+
if (isLibSymbol(symbol))
|
|
6985
6981
|
return false;
|
|
6986
|
-
const pkg = packageNameFromPath(fileName);
|
|
6982
|
+
const pkg = packageNameFromPath(decl.getSourceFile().fileName);
|
|
6987
6983
|
if (pkg)
|
|
6988
6984
|
return packageAllowed(pkg);
|
|
6989
6985
|
return true;
|