@d-fischer/documen.ts 0.16.9 → 0.17.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/index.html +36 -35
- package/lib/common/CustomError.js +1 -4
- package/lib/common/CustomError.js.map +1 -1
- package/lib/common/Paths.js +1 -2
- package/lib/common/components/Badge.js +7 -10
- package/lib/common/components/Badge.js.map +1 -1
- package/lib/common/components/BetaNotice.js +5 -10
- package/lib/common/components/BetaNotice.js.map +1 -1
- package/lib/common/components/Button.js +8 -12
- package/lib/common/components/Button.js.map +1 -1
- package/lib/common/components/CodeBlock.js +45 -61
- package/lib/common/components/CodeBlock.js.map +1 -1
- package/lib/common/components/CodeLink.js +12 -15
- package/lib/common/components/CodeLink.js.map +1 -1
- package/lib/common/components/DeprecationNotice.js +5 -10
- package/lib/common/components/DeprecationNotice.js.map +1 -1
- package/lib/common/components/FunctionParamDesc.js +7 -19
- package/lib/common/components/FunctionParamDesc.js.map +1 -1
- package/lib/common/components/FunctionParamDescEntry.js +26 -38
- package/lib/common/components/FunctionParamDescEntry.js.map +1 -1
- package/lib/common/components/FunctionReturnType.js +8 -17
- package/lib/common/components/FunctionReturnType.js.map +1 -1
- package/lib/common/components/FunctionSignature.js +7 -22
- package/lib/common/components/FunctionSignature.js.map +1 -1
- package/lib/common/components/InterfaceDetail.js +11 -18
- package/lib/common/components/InterfaceDetail.js.map +1 -1
- package/lib/common/components/InterfaceRepresentation.js +21 -40
- package/lib/common/components/InterfaceRepresentation.js.map +1 -1
- package/lib/common/components/MainMenu.js +20 -36
- package/lib/common/components/MainMenu.js.map +1 -1
- package/lib/common/components/NavMenu.js +6 -9
- package/lib/common/components/NavMenu.js.map +1 -1
- package/lib/common/components/NavMenuGroup.js +5 -10
- package/lib/common/components/NavMenuGroup.js.map +1 -1
- package/lib/common/components/NavMenuItem.js +8 -11
- package/lib/common/components/NavMenuItem.js.map +1 -1
- package/lib/common/components/PageArticle.js +7 -10
- package/lib/common/components/PageArticle.js.map +1 -1
- package/lib/common/components/SymbolHeader.js +6 -20
- package/lib/common/components/SymbolHeader.js.map +1 -1
- package/lib/common/components/TypeAliasHint.js +7 -22
- package/lib/common/components/TypeAliasHint.js.map +1 -1
- package/lib/common/components/TypeLink.js +12 -16
- package/lib/common/components/TypeLink.js.map +1 -1
- package/lib/common/components/VersionMenu.js +21 -28
- package/lib/common/components/VersionMenu.js.map +1 -1
- package/lib/common/components/cards/CardToolbar.js +11 -17
- package/lib/common/components/cards/CardToolbar.js.map +1 -1
- package/lib/common/components/cards/EventCard.js +21 -46
- package/lib/common/components/cards/EventCard.js.map +1 -1
- package/lib/common/components/cards/FunctionCardHeader.js +13 -25
- package/lib/common/components/cards/FunctionCardHeader.js.map +1 -1
- package/lib/common/components/cards/MethodCard.js +13 -23
- package/lib/common/components/cards/MethodCard.js.map +1 -1
- package/lib/common/components/cards/PropertyCard.js +15 -31
- package/lib/common/components/cards/PropertyCard.js.map +1 -1
- package/lib/common/components/codeBuilders/ReferenceTypeView.js +12 -25
- package/lib/common/components/codeBuilders/ReferenceTypeView.js.map +1 -1
- package/lib/common/components/codeBuilders/Type.js +30 -75
- package/lib/common/components/codeBuilders/Type.js.map +1 -1
- package/lib/common/components/overviewTable/OverviewTable.js +6 -21
- package/lib/common/components/overviewTable/OverviewTable.js.map +1 -1
- package/lib/common/components/overviewTable/OverviewTableEntry.js +13 -22
- package/lib/common/components/overviewTable/OverviewTableEntry.js.map +1 -1
- package/lib/common/config/Config.js +1 -2
- package/lib/common/config/Util.js +4 -8
- package/lib/common/config/Util.js.map +1 -1
- package/lib/common/config/index.js +5 -9
- package/lib/common/config/index.js.map +1 -1
- package/lib/common/containers/App.js +10 -18
- package/lib/common/containers/App.js.map +1 -1
- package/lib/common/containers/AppLayout.js +5 -10
- package/lib/common/containers/AppLayout.js.map +1 -1
- package/lib/common/containers/Card.js +6 -9
- package/lib/common/containers/Card.js.map +1 -1
- package/lib/common/containers/PageContent.js +5 -8
- package/lib/common/containers/PageContent.js.map +1 -1
- package/lib/common/containers/PageHeader.js +5 -8
- package/lib/common/containers/PageHeader.js.map +1 -1
- package/lib/common/containers/PageSwitch.js +10 -19
- package/lib/common/containers/PageSwitch.js.map +1 -1
- package/lib/common/containers/ReferencePackageContainer.js +37 -54
- package/lib/common/containers/ReferencePackageContainer.js.map +1 -1
- package/lib/common/htmlRenderer/HtmlRenderer.js +23 -37
- package/lib/common/htmlRenderer/HtmlRenderer.js.map +1 -1
- package/lib/common/htmlRenderer/RouterMode.js +1 -2
- package/lib/common/htmlRenderer/StaticRouterWithSuffix.js +20 -24
- package/lib/common/htmlRenderer/StaticRouterWithSuffix.js.map +1 -1
- package/lib/common/pages/ClassPage.js +39 -67
- package/lib/common/pages/ClassPage.js.map +1 -1
- package/lib/common/pages/DocPage.js +27 -39
- package/lib/common/pages/DocPage.js.map +1 -1
- package/lib/common/pages/EnumPage.js +20 -40
- package/lib/common/pages/EnumPage.js.map +1 -1
- package/lib/common/pages/FunctionPage.js +20 -39
- package/lib/common/pages/FunctionPage.js.map +1 -1
- package/lib/common/pages/InterfacePage.js +20 -32
- package/lib/common/pages/InterfacePage.js.map +1 -1
- package/lib/common/pages/TypeAliasPage.js +19 -34
- package/lib/common/pages/TypeAliasPage.js.map +1 -1
- package/lib/common/reference/index.js +1 -3
- package/lib/common/reference/index.js.map +1 -1
- package/lib/common/theme.js +1 -3
- package/lib/common/theme.js.map +1 -1
- package/lib/common/tools/ArrayTools.js +7 -18
- package/lib/common/tools/ArrayTools.js.map +1 -1
- package/lib/common/tools/CodeTools.js +12 -23
- package/lib/common/tools/CodeTools.js.map +1 -1
- package/lib/common/tools/ConfigTools.js +15 -20
- package/lib/common/tools/ConfigTools.js.map +1 -1
- package/lib/common/tools/FileTools.js +9 -16
- package/lib/common/tools/FileTools.js.map +1 -1
- package/lib/common/tools/FunctionTools.js +3 -7
- package/lib/common/tools/FunctionTools.js.map +1 -1
- package/lib/common/tools/NodeTools.js +22 -33
- package/lib/common/tools/NodeTools.js.map +1 -1
- package/lib/common/tools/Point.js +1 -2
- package/lib/common/tools/ReferenceTools.js +30 -43
- package/lib/common/tools/ReferenceTools.js.map +1 -1
- package/lib/common/tools/StringTools.js +3 -9
- package/lib/common/tools/StringTools.js.map +1 -1
- package/lib/common/tools/TypeTools.js +1 -2
- package/lib/common/tools/markdown/MarkdownParser.js +21 -28
- package/lib/common/tools/markdown/MarkdownParser.js.map +1 -1
- package/lib/common/tools/markdown/plugins/customDirectives.js +15 -17
- package/lib/common/tools/markdown/plugins/customDirectives.js.map +1 -1
- package/lib/common/tools/markdown/plugins/gfmTables.js +7 -12
- package/lib/common/tools/markdown/plugins/gfmTables.js.map +1 -1
- package/lib/common/tools/markdown/plugins/symbolLinks.js +9 -13
- package/lib/common/tools/markdown/plugins/symbolLinks.js.map +1 -1
- package/lib/generator/analyzer/AnalyzeContext.js +5 -6
- package/lib/generator/analyzer/AnalyzeContext.js.map +1 -1
- package/lib/generator/analyzer/DocComment.js +17 -23
- package/lib/generator/analyzer/DocComment.js.map +1 -1
- package/lib/generator/analyzer/DocCommentTag.js +4 -5
- package/lib/generator/analyzer/DocCommentTag.js.map +1 -1
- package/lib/generator/analyzer/Project.js +71 -84
- package/lib/generator/analyzer/Project.js.map +1 -1
- package/lib/generator/analyzer/createReflection.js +87 -101
- package/lib/generator/analyzer/createReflection.js.map +1 -1
- package/lib/generator/analyzer/createType.js +51 -62
- package/lib/generator/analyzer/createType.js.map +1 -1
- package/lib/generator/analyzer/reflections/AccessorReflection.js +36 -39
- package/lib/generator/analyzer/reflections/AccessorReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/ClassReflection.js +58 -51
- package/lib/generator/analyzer/reflections/ClassReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/ConstructorReflection.js +28 -36
- package/lib/generator/analyzer/reflections/ConstructorReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/EnumMemberReflection.js +15 -18
- package/lib/generator/analyzer/reflections/EnumMemberReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/EnumReflection.js +21 -23
- package/lib/generator/analyzer/reflections/EnumReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/FunctionReflection.js +14 -16
- package/lib/generator/analyzer/reflections/FunctionReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/Heritage.js +6 -11
- package/lib/generator/analyzer/reflections/Heritage.js.map +1 -1
- package/lib/generator/analyzer/reflections/InterfaceReflection.js +41 -41
- package/lib/generator/analyzer/reflections/InterfaceReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/MethodReflection.js +40 -45
- package/lib/generator/analyzer/reflections/MethodReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/ParameterReflection.js +68 -69
- package/lib/generator/analyzer/reflections/ParameterReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/PropertyReflection.js +43 -40
- package/lib/generator/analyzer/reflections/PropertyReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/ReferenceReflection.js +8 -7
- package/lib/generator/analyzer/reflections/ReferenceReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/Reflection.js +35 -38
- package/lib/generator/analyzer/reflections/Reflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/SignatureReflection.js +42 -46
- package/lib/generator/analyzer/reflections/SignatureReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/SymbolBasedReflection.js +6 -13
- package/lib/generator/analyzer/reflections/SymbolBasedReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/TypeAliasReflection.js +24 -26
- package/lib/generator/analyzer/reflections/TypeAliasReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/TypeLiteralReflection.js +22 -21
- package/lib/generator/analyzer/reflections/TypeLiteralReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/TypeParameterReflection.js +38 -39
- package/lib/generator/analyzer/reflections/TypeParameterReflection.js.map +1 -1
- package/lib/generator/analyzer/types/ArrayType.js +15 -23
- package/lib/generator/analyzer/types/ArrayType.js.map +1 -1
- package/lib/generator/analyzer/types/FunctionType.js +31 -38
- package/lib/generator/analyzer/types/FunctionType.js.map +1 -1
- package/lib/generator/analyzer/types/IntersectionType.js +12 -20
- package/lib/generator/analyzer/types/IntersectionType.js.map +1 -1
- package/lib/generator/analyzer/types/IntrinsicType.js +33 -41
- package/lib/generator/analyzer/types/IntrinsicType.js.map +1 -1
- package/lib/generator/analyzer/types/LiteralType.js +60 -68
- package/lib/generator/analyzer/types/LiteralType.js.map +1 -1
- package/lib/generator/analyzer/types/NamedTupleElementType.js +11 -15
- package/lib/generator/analyzer/types/NamedTupleElementType.js.map +1 -1
- package/lib/generator/analyzer/types/ObjectLiteralType.js +21 -30
- package/lib/generator/analyzer/types/ObjectLiteralType.js.map +1 -1
- package/lib/generator/analyzer/types/OptionalType.js +11 -17
- package/lib/generator/analyzer/types/OptionalType.js.map +1 -1
- package/lib/generator/analyzer/types/ReferenceType.js +118 -133
- package/lib/generator/analyzer/types/ReferenceType.js.map +1 -1
- package/lib/generator/analyzer/types/ReflectionType.js +4 -7
- package/lib/generator/analyzer/types/ReflectionType.js.map +1 -1
- package/lib/generator/analyzer/types/TupleType.js +27 -31
- package/lib/generator/analyzer/types/TupleType.js.map +1 -1
- package/lib/generator/analyzer/types/Type.js +1 -5
- package/lib/generator/analyzer/types/Type.js.map +1 -1
- package/lib/generator/analyzer/types/TypeOperatorType.js +38 -40
- package/lib/generator/analyzer/types/TypeOperatorType.js.map +1 -1
- package/lib/generator/analyzer/types/UnionType.js +22 -30
- package/lib/generator/analyzer/types/UnionType.js.map +1 -1
- package/lib/generator/analyzer/types/UnknownType.js +5 -6
- package/lib/generator/analyzer/types/UnknownType.js.map +1 -1
- package/lib/generator/analyzer/util/expressions.js +8 -13
- package/lib/generator/analyzer/util/expressions.js.map +1 -1
- package/lib/generator/analyzer/util/functions.js +15 -19
- package/lib/generator/analyzer/util/functions.js.map +1 -1
- package/lib/generator/analyzer/util/inheritance.js +26 -32
- package/lib/generator/analyzer/util/inheritance.js.map +1 -1
- package/lib/generator/analyzer/util/promises.js +2 -9
- package/lib/generator/analyzer/util/promises.js.map +1 -1
- package/lib/generator/analyzer/util/sourceMaps.js +12 -20
- package/lib/generator/analyzer/util/sourceMaps.js.map +1 -1
- package/lib/generator/analyzer/util/symbols.js +3 -9
- package/lib/generator/analyzer/util/symbols.js.map +1 -1
- package/lib/generator/analyzer/util/types.js +6 -10
- package/lib/generator/analyzer/util/types.js.map +1 -1
- package/lib/generator/cli.js +5 -8
- package/lib/generator/cli.js.map +1 -1
- package/lib/generator/commands/default.js +260 -259
- package/lib/generator/commands/default.js.map +1 -1
- package/lib/generator/index.js +1 -1
- package/lib/generator/modes/Generator.js +20 -31
- package/lib/generator/modes/Generator.js.map +1 -1
- package/lib/generator/modes/HtmlGenerator.js +214 -228
- package/lib/generator/modes/HtmlGenerator.js.map +1 -1
- package/lib/generator/modes/MonorepoGenerator.js +143 -159
- package/lib/generator/modes/MonorepoGenerator.js.map +1 -1
- package/lib/generator/modes/OutputGenerator.js +2 -7
- package/lib/generator/modes/OutputGenerator.js.map +1 -1
- package/lib/progressiveEnhancement/fsMap.js +2 -5
- package/lib/progressiveEnhancement/fsMap.js.map +1 -1
- package/package.json +16 -16
- package/src/common/components/CodeBlock.tsx +2 -2
- package/src/common/components/CodeLink.tsx +2 -2
- package/src/common/components/DeprecationNotice.tsx +2 -2
- package/src/common/components/FunctionParamDesc.tsx +3 -3
- package/src/common/components/FunctionParamDescEntry.tsx +6 -6
- package/src/common/components/FunctionReturnType.tsx +3 -3
- package/src/common/components/FunctionSignature.tsx +2 -2
- package/src/common/components/InterfaceDetail.tsx +15 -7
- package/src/common/components/InterfaceRepresentation.tsx +9 -9
- package/src/common/components/MainMenu.tsx +4 -4
- package/src/common/components/NavMenuItem.tsx +1 -1
- package/src/common/components/PageArticle.tsx +2 -2
- package/src/common/components/SymbolHeader.tsx +7 -9
- package/src/common/components/TypeAliasHint.tsx +3 -5
- package/src/common/components/TypeLink.tsx +6 -7
- package/src/common/components/VersionMenu.tsx +3 -3
- package/src/common/components/cards/CardToolbar.tsx +10 -6
- package/src/common/components/cards/EventCard.tsx +19 -23
- package/src/common/components/cards/FunctionCardHeader.tsx +8 -8
- package/src/common/components/cards/MethodCard.tsx +8 -8
- package/src/common/components/cards/PropertyCard.tsx +11 -11
- package/src/common/components/codeBuilders/ReferenceTypeView.tsx +4 -4
- package/src/common/components/codeBuilders/Type.tsx +4 -4
- package/src/common/components/overviewTable/OverviewTable.tsx +2 -2
- package/src/common/components/overviewTable/OverviewTableEntry.tsx +7 -7
- package/src/common/config/Config.ts +1 -1
- package/src/common/config/Util.ts +11 -3
- package/src/common/config/index.tsx +2 -2
- package/src/common/containers/App.tsx +12 -9
- package/src/common/containers/AppLayout.tsx +2 -2
- package/src/common/containers/PageHeader.tsx +2 -2
- package/src/common/containers/PageSwitch.tsx +7 -7
- package/src/common/containers/ReferencePackageContainer.tsx +13 -13
- package/src/common/htmlRenderer/HtmlRenderer.tsx +8 -9
- package/src/common/htmlRenderer/StaticRouterWithSuffix.tsx +18 -21
- package/src/common/pages/ClassPage.tsx +17 -17
- package/src/common/pages/DocPage.tsx +10 -10
- package/src/common/pages/EnumPage.tsx +14 -14
- package/src/common/pages/FunctionPage.tsx +15 -15
- package/src/common/pages/InterfacePage.tsx +13 -13
- package/src/common/pages/TypeAliasPage.tsx +12 -12
- package/src/common/reference/index.ts +0 -1
- package/src/common/tools/ArrayTools.ts +27 -11
- package/src/common/tools/CodeTools.tsx +1 -1
- package/src/common/tools/ConfigTools.ts +1 -1
- package/src/common/tools/FunctionTools.ts +2 -3
- package/src/common/tools/NodeTools.ts +3 -2
- package/src/common/tools/ReferenceTools.ts +10 -11
- package/src/common/tools/StringTools.ts +1 -1
- package/src/common/tools/markdown/MarkdownParser.tsx +13 -15
- package/src/common/tools/markdown/plugins/customDirectives.ts +1 -1
- package/src/common/tools/markdown/plugins/symbolLinks.ts +3 -3
- package/src/dev/index.tsx +9 -9
- package/src/dev/registerServiceWorker.ts +8 -16
- package/src/progressiveEnhancement/fsMap.ts +0 -1
- package/src/progressiveEnhancement/index.tsx +9 -11
- package/tsconfig-dev.json +1 -6
- package/tsconfig-enhance.json +1 -5
- package/tsconfig-html.json +1 -5
- package/tsconfig.json +7 -21
- package/types/globals.d.ts +0 -1
- package/types/react-router-hash-link.d.ts +0 -8
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
10
|
-
const that = new FunctionReflection(ctx, symbol);
|
|
11
|
-
that._signatures = yield (0, functions_1.getReflectedCallSignatures)(ctx, symbol, that);
|
|
12
|
-
that._handleFlags();
|
|
13
|
-
return that;
|
|
14
|
-
});
|
|
1
|
+
import { getReflectedCallSignatures } from '../util/functions.js';
|
|
2
|
+
import { SymbolBasedReflection } from './SymbolBasedReflection.js';
|
|
3
|
+
export class FunctionReflection extends SymbolBasedReflection {
|
|
4
|
+
_signatures;
|
|
5
|
+
static async fromSymbol(ctx, symbol) {
|
|
6
|
+
const that = new FunctionReflection(ctx, symbol);
|
|
7
|
+
that._signatures = await getReflectedCallSignatures(ctx, symbol, that);
|
|
8
|
+
that._handleFlags();
|
|
9
|
+
return that;
|
|
15
10
|
}
|
|
16
11
|
serialize() {
|
|
17
|
-
return
|
|
12
|
+
return {
|
|
13
|
+
...this._baseSerialize(),
|
|
14
|
+
kind: 'function',
|
|
15
|
+
signatures: this._signatures.map(sig => sig.serialize())
|
|
16
|
+
};
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
exports.FunctionReflection = FunctionReflection;
|
|
21
19
|
//# sourceMappingURL=FunctionReflection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionReflection.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/FunctionReflection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FunctionReflection.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/FunctionReflection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,OAAO,kBAAmB,SAAQ,qBAAqB;IACpD,WAAW,CAAyB;IAE5C,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,GAAmB,EAAE,MAAiB;QAC7D,MAAM,IAAI,GAAG,IAAI,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAEjD,IAAI,CAAC,WAAW,GAAG,MAAM,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAEvE,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,SAAS;QACR,OAAO;YACN,GAAG,IAAI,CAAC,cAAc,EAAE;YACxB,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,EAAgC,CAAC;SACtF,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
static fromTypeNode(ctx, node) {
|
|
8
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
-
return new Heritage(yield (0, createType_1.createTypeFromNode)(ctx, node), node);
|
|
10
|
-
});
|
|
1
|
+
import { createTypeFromNode } from '../createType.js';
|
|
2
|
+
export class Heritage {
|
|
3
|
+
type;
|
|
4
|
+
node;
|
|
5
|
+
static async fromTypeNode(ctx, node) {
|
|
6
|
+
return new Heritage(await createTypeFromNode(ctx, node), node);
|
|
11
7
|
}
|
|
12
8
|
constructor(type, node) {
|
|
13
9
|
this.type = type;
|
|
14
10
|
this.node = node;
|
|
15
11
|
}
|
|
16
12
|
}
|
|
17
|
-
exports.Heritage = Heritage;
|
|
18
13
|
//# sourceMappingURL=Heritage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heritage.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/Heritage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Heritage.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/Heritage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,OAAO,QAAQ;IACX,IAAI,CAAO;IACX,IAAI,CAA8B;IAE3C,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,GAAmB,EAAE,IAAiC;QAC/E,OAAO,IAAI,QAAQ,CAAC,MAAM,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC;IAED,YAAY,IAAU,EAAE,IAAiC;QACxD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD"}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
that._handleFlags();
|
|
36
|
-
that._processJsDoc();
|
|
37
|
-
return that;
|
|
38
|
-
});
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import * as ts from 'typescript';
|
|
3
|
+
import { createReflection } from '../createReflection.js';
|
|
4
|
+
import { resolvePromiseArray } from '../util/promises.js';
|
|
5
|
+
import { Heritage } from './Heritage.js';
|
|
6
|
+
import { SymbolBasedReflection } from './SymbolBasedReflection.js';
|
|
7
|
+
import { TypeParameterReflection } from './TypeParameterReflection.js';
|
|
8
|
+
export class InterfaceReflection extends SymbolBasedReflection {
|
|
9
|
+
members;
|
|
10
|
+
typeParameters;
|
|
11
|
+
extends;
|
|
12
|
+
static async fromSymbol(ctx, symbol) {
|
|
13
|
+
const that = new InterfaceReflection(ctx, symbol);
|
|
14
|
+
const type = ctx.checker.getDeclaredTypeOfSymbol(symbol);
|
|
15
|
+
assert(type.isClassOrInterface());
|
|
16
|
+
const extendsTypes = await resolvePromiseArray(symbol
|
|
17
|
+
.getDeclarations()
|
|
18
|
+
?.filter((decl) => ts.isInterfaceDeclaration(decl))
|
|
19
|
+
.flatMap(decl => decl.heritageClauses
|
|
20
|
+
?.filter(clause => clause.token === ts.SyntaxKind.ExtendsKeyword)
|
|
21
|
+
.flatMap(clause => clause.types.map(async (extendedType) => await Heritage.fromTypeNode(ctx, extendedType))) ?? []));
|
|
22
|
+
if (extendsTypes?.length) {
|
|
23
|
+
that.extends = extendsTypes;
|
|
24
|
+
}
|
|
25
|
+
that.typeParameters = await resolvePromiseArray(type.typeParameters?.map(async (param) => {
|
|
26
|
+
const declaration = param.symbol.declarations?.[0];
|
|
27
|
+
assert(declaration && ts.isTypeParameterDeclaration(declaration));
|
|
28
|
+
return await TypeParameterReflection.fromDeclaration(ctx, declaration);
|
|
29
|
+
}));
|
|
30
|
+
const members = ctx.checker.getPropertiesOfType(type);
|
|
31
|
+
that.members = await Promise.all([...members.map(async (mem) => await createReflection(ctx, mem, that))]);
|
|
32
|
+
that._handleFlags();
|
|
33
|
+
that._processJsDoc();
|
|
34
|
+
return that;
|
|
39
35
|
}
|
|
40
36
|
serialize() {
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
return {
|
|
38
|
+
...this._baseSerialize(),
|
|
39
|
+
kind: 'interface',
|
|
40
|
+
members: this.members.map(mem => mem.serialize()),
|
|
41
|
+
typeParameters: this.typeParameters?.map(param => param.serialize()),
|
|
42
|
+
extendedTypes: this.extends?.map(ext => ext.type.serialize())
|
|
43
|
+
};
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
exports.InterfaceReflection = InterfaceReflection;
|
|
46
46
|
//# sourceMappingURL=InterfaceReflection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InterfaceReflection.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/InterfaceReflection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InterfaceReflection.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/InterfaceReflection.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,OAAO,mBAAoB,SAAQ,qBAAqB;IAC7D,OAAO,CAAgB;IACvB,cAAc,CAA6B;IAE3C,OAAO,CAAc;IAErB,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,GAAmB,EAAE,MAAiB;QAC7D,MAAM,IAAI,GAAG,IAAI,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAElD,MAAM,IAAI,GAAG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AI,CAAC,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,EAAC,GAAG,EAAC,EAAE,CAAC,MAAM,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAExG,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,SAAS;QACR,OAAO;YACN,GAAG,IAAI,CAAC,cAAc,EAAE;YACxB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;YACjD,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACpE,aAAa,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;SAC7D,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,53 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import * as ts from 'typescript';
|
|
3
|
+
import { getReflectedCallSignatures } from '../util/functions.js';
|
|
4
|
+
import { handleInheritance } from '../util/inheritance.js';
|
|
5
|
+
import { SignatureReflection } from './SignatureReflection.js';
|
|
6
|
+
import { SymbolBasedReflection } from './SymbolBasedReflection.js';
|
|
7
|
+
export class MethodReflection extends SymbolBasedReflection {
|
|
8
|
+
signatures;
|
|
9
|
+
isInheritable = true;
|
|
10
|
+
inheritedFrom;
|
|
11
|
+
overwrites;
|
|
12
|
+
static async fromSymbol(ctx, symbol, parent) {
|
|
13
|
+
const that = new MethodReflection(ctx, symbol);
|
|
14
|
+
that.parent = parent;
|
|
15
|
+
that.signatures = await getReflectedCallSignatures(ctx, symbol, that, parent);
|
|
16
|
+
that._handleFlags();
|
|
17
|
+
that._processJsDoc();
|
|
18
|
+
handleInheritance(ctx, that);
|
|
19
|
+
return that;
|
|
15
20
|
}
|
|
16
|
-
static
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
const that = new MethodReflection(ctx, symbol);
|
|
30
|
-
that.parent = parent;
|
|
31
|
-
const parentDeclaration = arrow.parent;
|
|
32
|
-
const signature = ctx.checker.getSignatureFromDeclaration(arrow);
|
|
33
|
-
(0, assert_1.default)(signature);
|
|
34
|
-
that.signatures = [
|
|
35
|
-
yield SignatureReflection_1.SignatureReflection.fromTsSignature(ctx, ts.SyntaxKind.CallSignature, signature, that, arrow)
|
|
36
|
-
];
|
|
37
|
-
that._handleFlags(parentDeclaration);
|
|
38
|
-
that._processJsDoc();
|
|
39
|
-
(0, inheritance_1.handleInheritance)(ctx, that);
|
|
40
|
-
return that;
|
|
41
|
-
});
|
|
21
|
+
static async fromArrowSymbol(ctx, symbol, arrow, parent) {
|
|
22
|
+
const that = new MethodReflection(ctx, symbol);
|
|
23
|
+
that.parent = parent;
|
|
24
|
+
const parentDeclaration = arrow.parent;
|
|
25
|
+
const signature = ctx.checker.getSignatureFromDeclaration(arrow);
|
|
26
|
+
assert(signature);
|
|
27
|
+
that.signatures = [
|
|
28
|
+
await SignatureReflection.fromTsSignature(ctx, ts.SyntaxKind.CallSignature, signature, that, arrow)
|
|
29
|
+
];
|
|
30
|
+
that._handleFlags(parentDeclaration);
|
|
31
|
+
that._processJsDoc();
|
|
32
|
+
handleInheritance(ctx, that);
|
|
33
|
+
return that;
|
|
42
34
|
}
|
|
43
35
|
get locationNode() {
|
|
44
|
-
|
|
45
|
-
return (_b = (_a = this._symbol.getDeclarations()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name;
|
|
36
|
+
return this._symbol.getDeclarations()?.[0]?.name;
|
|
46
37
|
}
|
|
47
38
|
serialize() {
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
return {
|
|
40
|
+
...this._baseSerialize(),
|
|
41
|
+
kind: 'method',
|
|
42
|
+
signatures: this.signatures.map(sig => sig.serialize()),
|
|
43
|
+
inheritedFrom: this.inheritedFrom?.serialize(),
|
|
44
|
+
overwrites: this.overwrites?.serialize()
|
|
45
|
+
};
|
|
50
46
|
}
|
|
51
47
|
}
|
|
52
|
-
exports.MethodReflection = MethodReflection;
|
|
53
48
|
//# sourceMappingURL=MethodReflection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MethodReflection.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/MethodReflection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MethodReflection.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/MethodReflection.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,OAAO,gBAAiB,SAAQ,qBAAqB;IAC1D,UAAU,CAAyB;IAE1B,aAAa,GAAG,IAAI,CAAC;IA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QACf,OAAQ,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAsC,EAAE,IAAI,CAAC;IACxF,CAAC;IAED,SAAS;QACR,OAAO;YACN,GAAG,IAAI,CAAC,cAAc,EAAE;YACxB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,EAAgC,CAAC;YACrF,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,EAAE;YAC9C,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE;SACxC,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,74 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
static fromSymbol(ctx, symbol, declaration) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (ts.isParameter(valueDeclaration) && valueDeclaration.type) {
|
|
21
|
-
type = yield (0, createType_1.createTypeFromNode)(ctx, valueDeclaration.type);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
type = yield (0, createType_1.createTypeFromTsType)(ctx, ctx.checker.getTypeOfSymbolAtLocation(symbol, valueDeclaration));
|
|
25
|
-
}
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { createTypeFromNode, createTypeFromTsType } from '../createType.js';
|
|
3
|
+
import { stringifyExpression } from '../util/expressions.js';
|
|
4
|
+
import { removeUndefined } from '../util/types.js';
|
|
5
|
+
import { Reflection } from './Reflection.js';
|
|
6
|
+
export class ParameterReflection extends Reflection {
|
|
7
|
+
_declaration;
|
|
8
|
+
_name;
|
|
9
|
+
_type;
|
|
10
|
+
_defaultValue;
|
|
11
|
+
static async fromSymbol(ctx, symbol, declaration) {
|
|
12
|
+
declaration ??= symbol.getDeclarations()?.[0];
|
|
13
|
+
const that = new ParameterReflection(ctx, declaration);
|
|
14
|
+
const { valueDeclaration } = symbol;
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/init-declarations
|
|
16
|
+
let type;
|
|
17
|
+
if (valueDeclaration) {
|
|
18
|
+
if (ts.isParameter(valueDeclaration) && valueDeclaration.type) {
|
|
19
|
+
type = await createTypeFromNode(ctx, valueDeclaration.type);
|
|
26
20
|
}
|
|
27
21
|
else {
|
|
28
|
-
type =
|
|
22
|
+
type = await createTypeFromTsType(ctx, ctx.checker.getTypeOfSymbolAtLocation(symbol, valueDeclaration));
|
|
29
23
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
type = await createTypeFromTsType(ctx, symbol.type);
|
|
27
|
+
}
|
|
28
|
+
let isOptional = false;
|
|
29
|
+
if (valueDeclaration && ts.isParameter(valueDeclaration)) {
|
|
30
|
+
isOptional = !!valueDeclaration.questionToken;
|
|
31
|
+
}
|
|
32
|
+
if (isOptional) {
|
|
33
|
+
type = removeUndefined(type);
|
|
34
|
+
}
|
|
35
|
+
that._name = symbol.name;
|
|
36
|
+
that._type = type;
|
|
37
|
+
that._defaultValue = declaration?.initializer ? stringifyExpression(declaration.initializer) : undefined;
|
|
38
|
+
const isRest = valueDeclaration && ts.isParameter(valueDeclaration) ? !!valueDeclaration.dotDotDotToken : false;
|
|
39
|
+
that._handleFlags();
|
|
40
|
+
if (isOptional) {
|
|
41
|
+
that.flags.add('isOptional');
|
|
42
|
+
}
|
|
43
|
+
if (isRest) {
|
|
44
|
+
that.flags.add('isRest');
|
|
45
|
+
}
|
|
46
|
+
that._processJsDoc();
|
|
47
|
+
return that;
|
|
51
48
|
}
|
|
52
|
-
static fromNode(ctx, declaration) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return that;
|
|
71
|
-
});
|
|
49
|
+
static async fromNode(ctx, declaration) {
|
|
50
|
+
const that = new ParameterReflection(ctx, declaration);
|
|
51
|
+
let type = await createTypeFromNode(ctx, declaration.type);
|
|
52
|
+
const isRest = !!declaration.dotDotDotToken;
|
|
53
|
+
const isOptional = !!declaration.questionToken;
|
|
54
|
+
if (isOptional) {
|
|
55
|
+
type = removeUndefined(type);
|
|
56
|
+
}
|
|
57
|
+
that._name = declaration.name.getText();
|
|
58
|
+
that._type = type;
|
|
59
|
+
that._defaultValue = declaration.initializer ? stringifyExpression(declaration.initializer) : undefined;
|
|
60
|
+
if (isOptional) {
|
|
61
|
+
that.flags.add('isOptional');
|
|
62
|
+
}
|
|
63
|
+
if (isRest) {
|
|
64
|
+
that.flags.add('isRest');
|
|
65
|
+
}
|
|
66
|
+
return that;
|
|
72
67
|
}
|
|
73
68
|
constructor(ctx, _declaration) {
|
|
74
69
|
super(ctx);
|
|
@@ -79,11 +74,15 @@ class ParameterReflection extends Reflection_1.Reflection {
|
|
|
79
74
|
return this._declaration ? [this._declaration] : [];
|
|
80
75
|
}
|
|
81
76
|
serialize() {
|
|
82
|
-
return
|
|
77
|
+
return {
|
|
78
|
+
...this._baseSerialize(),
|
|
79
|
+
kind: 'parameter',
|
|
80
|
+
type: this._type.serialize(),
|
|
81
|
+
defaultValue: this._defaultValue
|
|
82
|
+
};
|
|
83
83
|
}
|
|
84
84
|
get name() {
|
|
85
85
|
return this._name;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
exports.ParameterReflection = ParameterReflection;
|
|
89
88
|
//# sourceMappingURL=ParameterReflection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterReflection.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/ParameterReflection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ParameterReflection.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/ParameterReflection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IAyEA;IAxE1C,KAAK,CAAU;IACf,KAAK,CAAQ;IACb,aAAa,CAAU;IAE/B,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,GAAmB,EAAE,MAAiB,EAAE,WAAqC;QACpG,WAAW,KAAK,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAwC,CAAC;QAErF,MAAM,IAAI,GAAG,IAAI,mBAAmB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAEvD,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;QACpC,gEAAgE;QAChE,IAAI,IAAU,CAAC;QACf,IAAI,gBAAgB,EAAE,CAAC;YACtB,IAAI,EAAE,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC;gBAC/D,IAAI,GAAG,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AC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,CAAC;IAED,SAAS;QACR,OAAO;YACN,GAAG,IAAI,CAAC,cAAc,EAAE;YACxB,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;YAC5B,YAAY,EAAE,IAAI,CAAC,aAAa;SAChC,CAAC;IACH,CAAC;IAED,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD"}
|
|
@@ -1,49 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (declaration) {
|
|
23
|
-
if (typescript_1.default.isPropertyDeclaration(declaration) && declaration.initializer && typescript_1.default.isArrowFunction(declaration.initializer)) {
|
|
24
|
-
return yield MethodReflection_1.MethodReflection.fromArrowSymbol(ctx, symbol, declaration.initializer, parent);
|
|
25
|
-
}
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { createTypeFromNode, createTypeFromTsType } from '../createType.js';
|
|
3
|
+
import { handleInheritance } from '../util/inheritance.js';
|
|
4
|
+
import { MethodReflection } from './MethodReflection.js';
|
|
5
|
+
import { SymbolBasedReflection } from './SymbolBasedReflection.js';
|
|
6
|
+
export class PropertyReflection extends SymbolBasedReflection {
|
|
7
|
+
_type;
|
|
8
|
+
isInheritable = true;
|
|
9
|
+
inheritedFrom;
|
|
10
|
+
overwrites;
|
|
11
|
+
static async fromSymbol(ctx, symbol, parent) {
|
|
12
|
+
const declarations = symbol.getDeclarations();
|
|
13
|
+
if (declarations?.every(decl => ts.isMethodDeclaration(decl) || ts.isMethodSignature(decl))) {
|
|
14
|
+
return await MethodReflection.fromSymbol(ctx, symbol, parent);
|
|
15
|
+
}
|
|
16
|
+
const declaration = declarations?.[0];
|
|
17
|
+
if (declaration) {
|
|
18
|
+
if (ts.isPropertyDeclaration(declaration) &&
|
|
19
|
+
declaration.initializer &&
|
|
20
|
+
ts.isArrowFunction(declaration.initializer)) {
|
|
21
|
+
return await MethodReflection.fromArrowSymbol(ctx, symbol, declaration.initializer, parent);
|
|
26
22
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
}
|
|
24
|
+
const that = new PropertyReflection(ctx, symbol);
|
|
25
|
+
that.parent = parent;
|
|
26
|
+
that._type =
|
|
27
|
+
declaration &&
|
|
28
|
+
(ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration)) &&
|
|
29
|
+
declaration.type
|
|
30
|
+
? await createTypeFromNode(ctx, declaration.type)
|
|
31
|
+
: await createTypeFromTsType(ctx,
|
|
31
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
33
|
+
ctx.checker.getTypeOfSymbolAtLocation(symbol, { kind: ts.SyntaxKind.SourceFile }));
|
|
34
|
+
that._handleFlags();
|
|
35
|
+
that._processJsDoc();
|
|
36
|
+
handleInheritance(ctx, that);
|
|
37
|
+
return that;
|
|
38
38
|
}
|
|
39
39
|
get locationNode() {
|
|
40
|
-
|
|
41
|
-
return (_a = this.declarations[0]) === null || _a === void 0 ? void 0 : _a.name;
|
|
40
|
+
return this.declarations[0]?.name;
|
|
42
41
|
}
|
|
43
42
|
serialize() {
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
return {
|
|
44
|
+
...this._baseSerialize(),
|
|
45
|
+
kind: 'property',
|
|
46
|
+
type: this._type.serialize(),
|
|
47
|
+
inheritedFrom: this.inheritedFrom?.serialize(),
|
|
48
|
+
overwrites: this.overwrites?.serialize()
|
|
49
|
+
};
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
|
-
exports.PropertyReflection = PropertyReflection;
|
|
49
52
|
//# sourceMappingURL=PropertyReflection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyReflection.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/PropertyReflection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PropertyReflection.js","sourceRoot":"","sources":["../../../../src/generator/analyzer/reflections/PropertyReflection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,OAAO,kBAAmB,SAAQ,qBAAqB;IACpD,KAAK,CAAQ;IAEZ,aAAa,GAAG,IAAI,CAAC;IAC9B,aAAa,CAAiB;IAC9B,UAAU,CAAiB;IAE3B,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,GAAmB,EAAE,MAAiB,EAAE,MAA6B;QAC5F,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;QAC9C,IAAI,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAC7F,OAAO,MAAM,gBAAgB,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,WAAW,GAAG,YAAY,EAA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E,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;YAC5B,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,EAAE;YAC9C,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE;SACxC,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const SymbolBasedReflection_1 = require("./SymbolBasedReflection");
|
|
5
|
-
class ReferenceReflection extends SymbolBasedReflection_1.SymbolBasedReflection {
|
|
1
|
+
import { SymbolBasedReflection } from './SymbolBasedReflection.js';
|
|
2
|
+
export class ReferenceReflection extends SymbolBasedReflection {
|
|
3
|
+
_targetId;
|
|
6
4
|
constructor(ctx, symbol, _targetId) {
|
|
7
5
|
super(ctx, symbol);
|
|
8
6
|
this._targetId = _targetId;
|
|
9
7
|
}
|
|
10
8
|
serialize() {
|
|
11
|
-
return
|
|
9
|
+
return {
|
|
10
|
+
...this._baseSerialize(),
|
|
11
|
+
kind: 'reference',
|
|
12
|
+
target: this._targetId
|
|
13
|
+
};
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
|
-
exports.ReferenceReflection = ReferenceReflection;
|
|
15
16
|
//# sourceMappingURL=ReferenceReflection.js.map
|