@openpkg-ts/sdk 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3007,10 +3007,15 @@ class TypeRegistry {
|
|
|
3007
3007
|
schema["x-ts-type"] = text;
|
|
3008
3008
|
}
|
|
3009
3009
|
}
|
|
3010
|
+
let typeParameters;
|
|
3011
|
+
if (decl && (ts5.isTypeAliasDeclaration(decl) || ts5.isInterfaceDeclaration(decl) || ts5.isClassDeclaration(decl))) {
|
|
3012
|
+
typeParameters = extractTypeParameters(decl, checker);
|
|
3013
|
+
}
|
|
3010
3014
|
return {
|
|
3011
3015
|
id: name,
|
|
3012
3016
|
name,
|
|
3013
3017
|
kind,
|
|
3018
|
+
...typeParameters && typeParameters.length > 0 ? { typeParameters } : {},
|
|
3014
3019
|
schema,
|
|
3015
3020
|
...external ? { external: true } : {}
|
|
3016
3021
|
};
|
|
@@ -3297,7 +3302,7 @@ function serializeInheritedMember(symbol, inheritedFrom, ctx, isStatic) {
|
|
|
3297
3302
|
description,
|
|
3298
3303
|
tags: tags.length > 0 ? tags : undefined,
|
|
3299
3304
|
visibility,
|
|
3300
|
-
schema: kind !== "method" ? buildSchema(type, checker, ctx) :
|
|
3305
|
+
schema: kind !== "method" ? buildSchema(type, checker, ctx) : decoratePropertySchema({ "x-ts-function": true }, symbol, type, checker),
|
|
3301
3306
|
signatures,
|
|
3302
3307
|
flags: Object.keys(flags).length > 0 ? flags : undefined
|
|
3303
3308
|
};
|
|
@@ -3512,12 +3517,14 @@ function serializeMethod(node, ctx) {
|
|
|
3512
3517
|
}
|
|
3513
3518
|
const symbol = checker.getSymbolAtLocation(node.name ?? node);
|
|
3514
3519
|
const { deprecated, reason: deprecationReason } = isSymbolDeprecated(symbol);
|
|
3520
|
+
const schema = symbol ? decoratePropertySchema({ "x-ts-function": true }, symbol, type, checker) : undefined;
|
|
3515
3521
|
return {
|
|
3516
3522
|
name,
|
|
3517
3523
|
kind: "method",
|
|
3518
3524
|
description,
|
|
3519
3525
|
tags: tags.length > 0 ? tags : undefined,
|
|
3520
3526
|
visibility,
|
|
3527
|
+
schema,
|
|
3521
3528
|
signatures: signatures.length > 0 ? signatures : undefined,
|
|
3522
3529
|
flags: Object.keys(flags).length > 0 ? flags : undefined,
|
|
3523
3530
|
...deprecated ? { deprecated: true, deprecationReason } : {}
|
|
@@ -3887,11 +3894,13 @@ function serializeMethodSignature(node, ctx) {
|
|
|
3887
3894
|
flags.methodSyntax = true;
|
|
3888
3895
|
const symbol = checker.getSymbolAtLocation(node.name);
|
|
3889
3896
|
const { deprecated, reason: deprecationReason } = isSymbolDeprecated(symbol);
|
|
3897
|
+
const schema = symbol ? decoratePropertySchema({ "x-ts-function": true }, symbol, type, checker) : undefined;
|
|
3890
3898
|
return {
|
|
3891
3899
|
name,
|
|
3892
3900
|
kind: "method",
|
|
3893
3901
|
description,
|
|
3894
3902
|
tags: tags.length > 0 ? tags : undefined,
|
|
3903
|
+
schema,
|
|
3895
3904
|
signatures: signatures.length > 0 ? signatures : undefined,
|
|
3896
3905
|
flags: Object.keys(flags).length > 0 ? flags : undefined,
|
|
3897
3906
|
...deprecated ? { deprecated: true, deprecationReason } : {}
|
|
@@ -4112,10 +4121,7 @@ function serializeResolvedMembers(type, node, ctx) {
|
|
|
4112
4121
|
flags.readonly = true;
|
|
4113
4122
|
if (prop.flags & ts10.SymbolFlags.Method)
|
|
4114
4123
|
flags.methodSyntax = true;
|
|
4115
|
-
|
|
4116
|
-
if (kind === "property") {
|
|
4117
|
-
schema = decoratePropertySchema(buildSchema(propType, checker, ctx), prop, propType, checker);
|
|
4118
|
-
}
|
|
4124
|
+
const schema = kind === "property" ? decoratePropertySchema(buildSchema(propType, checker, ctx), prop, propType, checker) : decoratePropertySchema({ "x-ts-function": true }, prop, propType, checker);
|
|
4119
4125
|
members.push({
|
|
4120
4126
|
name: prop.getName(),
|
|
4121
4127
|
kind,
|
|
@@ -4794,6 +4800,10 @@ function normalizeMethodMember(member, options) {
|
|
|
4794
4800
|
if (member.flags?.methodSyntax === true) {
|
|
4795
4801
|
result["x-ts-method"] = true;
|
|
4796
4802
|
}
|
|
4803
|
+
const memberTypeText = member.schema && typeof member.schema === "object" ? member.schema["x-ts-type"] : undefined;
|
|
4804
|
+
if (typeof memberTypeText === "string") {
|
|
4805
|
+
result["x-ts-type"] = memberTypeText;
|
|
4806
|
+
}
|
|
4797
4807
|
if (member.signatures && member.signatures.length > 0) {
|
|
4798
4808
|
result["x-ts-signatures"] = member.signatures.map((sig) => normalizeSignature(sig, options));
|
|
4799
4809
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpkg-ts/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"description": "TypeScript API extraction SDK - programmatic primitives for OpenPkg specs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openpkg",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"test": "bun test"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@openpkg-ts/spec": "^0.
|
|
46
|
+
"@openpkg-ts/spec": "^0.46.0",
|
|
47
47
|
"picomatch": "4.0.3",
|
|
48
48
|
"typescript": "^5.0.0"
|
|
49
49
|
},
|