@openpkg-ts/sdk 0.54.0 → 0.54.1
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 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1787,6 +1787,9 @@ import ts13 from "typescript";
|
|
|
1787
1787
|
import * as path3 from "node:path";
|
|
1788
1788
|
import ts from "typescript";
|
|
1789
1789
|
var NODE_MODULES_PKG = /node_modules\/(@[^/]+\/[^/]+|[^/]+)/g;
|
|
1790
|
+
function isLibFile(fileName) {
|
|
1791
|
+
return fileName.includes("/typescript/lib/lib.") || fileName.includes("\\typescript\\lib\\lib.");
|
|
1792
|
+
}
|
|
1790
1793
|
function packageNameFromPath(fileName) {
|
|
1791
1794
|
return [...fileName.matchAll(NODE_MODULES_PKG)].at(-1)?.[1];
|
|
1792
1795
|
}
|
|
@@ -2832,9 +2835,7 @@ function isBuiltinSymbol(symbol) {
|
|
|
2832
2835
|
const declarations = symbol.getDeclarations();
|
|
2833
2836
|
if (!declarations || declarations.length === 0)
|
|
2834
2837
|
return false;
|
|
2835
|
-
|
|
2836
|
-
const fileName = sourceFile.fileName;
|
|
2837
|
-
return fileName.includes("/typescript/lib/lib.") || fileName.includes("\\typescript\\lib\\lib.");
|
|
2838
|
+
return isLibFile(declarations[0].getSourceFile().fileName);
|
|
2838
2839
|
}
|
|
2839
2840
|
function getTypeOrigin(type, _checker) {
|
|
2840
2841
|
const symbol = type.getSymbol() ?? type.aliasSymbol;
|
|
@@ -2844,10 +2845,9 @@ function getTypeOrigin(type, _checker) {
|
|
|
2844
2845
|
if (!declarations || declarations.length === 0)
|
|
2845
2846
|
return;
|
|
2846
2847
|
const fileName = declarations[0].getSourceFile().fileName;
|
|
2847
|
-
|
|
2848
|
-
if (pkg === "typescript")
|
|
2848
|
+
if (isLibFile(fileName))
|
|
2849
2849
|
return;
|
|
2850
|
-
return
|
|
2850
|
+
return packageNameFromPath(fileName);
|
|
2851
2851
|
}
|
|
2852
2852
|
function isBuiltinGeneric(name) {
|
|
2853
2853
|
return BUILTIN_GENERICS.has(name);
|
|
@@ -3977,7 +3977,7 @@ class TypeRegistry {
|
|
|
3977
3977
|
const props = {};
|
|
3978
3978
|
const required = [];
|
|
3979
3979
|
const limit = ctx.maxProperties;
|
|
3980
|
-
const isArrayLike = checker.isArrayType(type) || checker.isTupleType(type) || type.symbol?.getName() === "Array" && type.symbol?.getDeclarations()?.[0]?.getSourceFile()?.fileName
|
|
3980
|
+
const isArrayLike = checker.isArrayType(type) || checker.isTupleType(type) || type.symbol?.getName() === "Array" && isLibFile(type.symbol?.getDeclarations()?.[0]?.getSourceFile()?.fileName ?? "");
|
|
3981
3981
|
const isStringLike = type.flags & ts6.TypeFlags.StringLike;
|
|
3982
3982
|
const isNumberLike = type.flags & ts6.TypeFlags.NumberLike;
|
|
3983
3983
|
const included = properties.filter((prop) => {
|
|
@@ -6961,9 +6961,6 @@ function hasInternalTag(typeName, program, sourceFile) {
|
|
|
6961
6961
|
|
|
6962
6962
|
// src/builder/type-expansion.ts
|
|
6963
6963
|
import ts18 from "typescript";
|
|
6964
|
-
function isLibFile(fileName) {
|
|
6965
|
-
return fileName.includes("/typescript/lib/lib.") || fileName.includes("\\typescript\\lib\\lib.");
|
|
6966
|
-
}
|
|
6967
6964
|
function createExternalExpansionPredicate(opts) {
|
|
6968
6965
|
const matchesEntry = (entry, pkg) => {
|
|
6969
6966
|
if (!entry.includes("*"))
|
|
@@ -6972,8 +6969,6 @@ function createExternalExpansionPredicate(opts) {
|
|
|
6972
6969
|
return rx.test(pkg);
|
|
6973
6970
|
};
|
|
6974
6971
|
const packageAllowed = (pkg) => {
|
|
6975
|
-
if (pkg === "typescript")
|
|
6976
|
-
return false;
|
|
6977
6972
|
if (opts.followExternal === true)
|
|
6978
6973
|
return true;
|
|
6979
6974
|
if (Array.isArray(opts.followExternal) && opts.followExternal.some((e) => matchesEntry(e, pkg))) {
|
|
@@ -7963,7 +7958,7 @@ function findTypeInProgram(name, checker, program, sourceFile, symFlags) {
|
|
|
7963
7958
|
const entryDir = path10.dirname(sourceFile.fileName);
|
|
7964
7959
|
for (const sf of program.getSourceFiles()) {
|
|
7965
7960
|
const fn = sf.fileName;
|
|
7966
|
-
if (
|
|
7961
|
+
if (isLibFile(fn))
|
|
7967
7962
|
continue;
|
|
7968
7963
|
if (fn.includes("/@types/node/") || fn.includes("\\@types\\node\\"))
|
|
7969
7964
|
continue;
|