Updated the declaration builder
parent
f100001bad
commit
bdf09b2077
|
@ -3,6 +3,8 @@
|
||||||
- Splitup the file transfer & management part
|
- Splitup the file transfer & management part
|
||||||
- Added the ability to register a custom file transfer provider (required for the native client)
|
- Added the ability to register a custom file transfer provider (required for the native client)
|
||||||
- Added DockerHub image deploy automatisation
|
- Added DockerHub image deploy automatisation
|
||||||
|
- Fixed enum member declaration for the dts generator
|
||||||
|
- Hiding non exported classes from `.d.ts` files
|
||||||
|
|
||||||
* **25.04.20**
|
* **25.04.20**
|
||||||
- Fixed missing channel tree update on talk power change
|
- Fixed missing channel tree update on talk power change
|
||||||
|
|
|
@ -7,7 +7,7 @@ export interface Event<Events, T = keyof Events> {
|
||||||
as<T extends keyof Events>() : Events[T];
|
as<T extends keyof Events>() : Events[T];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SingletonEvents {
|
export interface SingletonEvents {
|
||||||
"singletone-instance": never;
|
"singletone-instance": never;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ export interface IconManagerEvents {
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Invalidate icon after certain time if loading has failed and try to redownload (only if an icon loader has been set!)
|
//TODO: Invalidate icon after certain time if loading has failed and try to redownload (only if an icon loader has been set!)
|
||||||
type IconLoader = (icon?: LocalIcon) => Promise<Response>;
|
export type IconLoader = (icon?: LocalIcon) => Promise<Response>;
|
||||||
export class LocalIcon {
|
export class LocalIcon {
|
||||||
readonly icon_id: number;
|
readonly icon_id: number;
|
||||||
readonly server_unique_id: string;
|
readonly server_unique_id: string;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {icon_cache_loader, IconManager, LocalIcon} from "tc-shared/file/FileManager";
|
|
||||||
import {spawnBookmarkModal} from "tc-shared/ui/modal/ModalBookmarks";
|
import {spawnBookmarkModal} from "tc-shared/ui/modal/ModalBookmarks";
|
||||||
import {
|
import {
|
||||||
add_server_to_bookmarks,
|
add_server_to_bookmarks,
|
||||||
|
@ -24,6 +23,7 @@ import {server_connections} from "tc-shared/ui/frames/connection_handlers";
|
||||||
import * as loader from "tc-loader";
|
import * as loader from "tc-loader";
|
||||||
import {formatMessage} from "tc-shared/ui/frames/chat";
|
import {formatMessage} from "tc-shared/ui/frames/chat";
|
||||||
import {control_bar_instance} from "tc-shared/ui/frames/control-bar";
|
import {control_bar_instance} from "tc-shared/ui/frames/control-bar";
|
||||||
|
import {icon_cache_loader, IconManager, LocalIcon} from "tc-shared/file/Icons";
|
||||||
|
|
||||||
export interface HRItem { }
|
export interface HRItem { }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import {ReactComponentBase} from "tc-shared/ui/react-elements/ReactComponentBase";
|
import {ReactComponentBase} from "tc-shared/ui/react-elements/ReactComponentBase";
|
||||||
import {IconRenderer} from "tc-shared/ui/react-elements/Icon";
|
import {IconRenderer} from "tc-shared/ui/react-elements/Icon";
|
||||||
import {LocalIcon} from "tc-shared/file/FileManager";
|
import {LocalIcon} from "tc-shared/file/Icons";
|
||||||
const cssStyle = require("./button.scss");
|
const cssStyle = require("./button.scss");
|
||||||
|
|
||||||
export interface DropdownEntryProperties {
|
export interface DropdownEntryProperties {
|
||||||
|
|
|
@ -16,11 +16,11 @@ import {
|
||||||
DirectoryBookmark,
|
DirectoryBookmark,
|
||||||
find_bookmark
|
find_bookmark
|
||||||
} from "tc-shared/bookmarks";
|
} from "tc-shared/bookmarks";
|
||||||
import {icon_cache_loader, IconManager} from "tc-shared/file/FileManager";
|
|
||||||
import * as contextmenu from "tc-shared/ui/elements/ContextMenu";
|
import * as contextmenu from "tc-shared/ui/elements/ContextMenu";
|
||||||
import {createInputModal} from "tc-shared/ui/elements/Modal";
|
import {createInputModal} from "tc-shared/ui/elements/Modal";
|
||||||
import {default_recorder} from "tc-shared/voice/RecorderProfile";
|
import {default_recorder} from "tc-shared/voice/RecorderProfile";
|
||||||
import {global_client_actions} from "tc-shared/events/GlobalEvents";
|
import {global_client_actions} from "tc-shared/events/GlobalEvents";
|
||||||
|
import {icon_cache_loader} from "tc-shared/file/Icons";
|
||||||
|
|
||||||
const cssStyle = require("./index.scss");
|
const cssStyle = require("./index.scss");
|
||||||
const cssButtonStyle = require("./button.scss");
|
const cssButtonStyle = require("./button.scss");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import {LocalIcon} from "tc-shared/file/FileManager";
|
import {LocalIcon} from "tc-shared/file/Icons";
|
||||||
|
|
||||||
export interface IconProperties {
|
export interface IconProperties {
|
||||||
icon: string | LocalIcon;
|
icon: string | LocalIcon;
|
||||||
|
|
|
@ -214,7 +214,7 @@ class ChannelEntryName extends ReactComponentBase<ChannelEntryNameProperties, {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ChannelEntryViewProperties {
|
export interface ChannelEntryViewProperties {
|
||||||
channel: ChannelEntryController;
|
channel: ChannelEntryController;
|
||||||
depth: number;
|
depth: number;
|
||||||
offset: number;
|
offset: number;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import * as ts from "typescript";
|
import * as ts from "typescript";
|
||||||
import {SyntaxKind} from "typescript";
|
import {SyntaxKind} from "typescript";
|
||||||
|
import * as webpack from "webpack";
|
||||||
|
|
||||||
interface Array<T> {
|
interface Array<T> {
|
||||||
last?(): T;
|
last?(): T;
|
||||||
|
@ -321,6 +322,9 @@ generators[SyntaxKind.PropertyDeclaration] = (settings, stack, node: ts.Property
|
||||||
|
|
||||||
/* class types */
|
/* class types */
|
||||||
generators[SyntaxKind.ClassDeclaration] = (settings, stack, node: ts.ClassDeclaration) => {
|
generators[SyntaxKind.ClassDeclaration] = (settings, stack, node: ts.ClassDeclaration) => {
|
||||||
|
if((stack.flag_namespace || settings.module_mode) && !has_modifier(node.modifiers, SyntaxKind.ExportKeyword))
|
||||||
|
return;
|
||||||
|
|
||||||
const members = [] as ts.Node[];
|
const members = [] as ts.Node[];
|
||||||
{
|
{
|
||||||
stack.push({
|
stack.push({
|
||||||
|
@ -350,7 +354,15 @@ generators[SyntaxKind.ClassDeclaration] = (settings, stack, node: ts.ClassDeclar
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return ts.createClassDeclaration(node.decorators, append_export(append_declare(node.modifiers, !stack.flag_declare), stack.flag_namespace), node.name, node.typeParameters, node.heritageClauses, members as any);
|
const decorators = node.decorators?.map(e => {
|
||||||
|
let text: string;
|
||||||
|
if(e.getSourceFile())
|
||||||
|
text = e.getText();
|
||||||
|
else
|
||||||
|
text = "*synthetic added annotation*";
|
||||||
|
return ts.createIdentifier("/* " + text.replace("*/", "* /") + " */");
|
||||||
|
});
|
||||||
|
return ts.createClassDeclaration(decorators as any, append_export(append_declare(node.modifiers, !stack.flag_declare), stack.flag_namespace), node.name, node.typeParameters, node.heritageClauses, members as any);
|
||||||
};
|
};
|
||||||
|
|
||||||
generators[SyntaxKind.PropertySignature] = (settings, stack, node: ts.PropertySignature) => {
|
generators[SyntaxKind.PropertySignature] = (settings, stack, node: ts.PropertySignature) => {
|
||||||
|
@ -428,8 +440,14 @@ generators[SyntaxKind.EnumMember] = (settings, stack, node: ts.EnumMember) => {
|
||||||
|
|
||||||
generators[SyntaxKind.EnumDeclaration] = (settings, stack, node: ts.EnumDeclaration) => {
|
generators[SyntaxKind.EnumDeclaration] = (settings, stack, node: ts.EnumDeclaration) => {
|
||||||
const members: any[] = [];
|
const members: any[] = [];
|
||||||
for(const member of node.members)
|
|
||||||
members.push(generators[SyntaxKind.EnumMember](settings, stack, member));
|
let uninitialized_index = 0;
|
||||||
|
for(const member of node.members) {
|
||||||
|
let initializer = member.initializer;
|
||||||
|
if(!initializer)
|
||||||
|
initializer = ts.createIdentifier((uninitialized_index++).toString());
|
||||||
|
members.push(ts.createEnumMember(member.name, initializer));
|
||||||
|
}
|
||||||
return ts.createEnumDeclaration(undefined, append_export(append_declare(node.modifiers, !stack.flag_declare), stack.flag_namespace), node.name, members);
|
return ts.createEnumDeclaration(undefined, append_export(append_declare(node.modifiers, !stack.flag_declare), stack.flag_namespace), node.name, members);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -248,6 +248,11 @@ function analyze_type_node(node: ts.TypeNode | ts.LeftHandSideExpression, data:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SyntaxKind.PropertyAccessExpression:
|
case SyntaxKind.PropertyAccessExpression:
|
||||||
|
let pae = node as ts.PropertyAccessExpression;
|
||||||
|
while(pae.expression.kind == SyntaxKind.PropertyAccessExpression)
|
||||||
|
pae = pae.expression as ts.PropertyAccessExpression;
|
||||||
|
|
||||||
|
analyze_type_node(pae.expression, data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -113,7 +113,7 @@ source_files.forEach(file => {
|
||||||
|
|
||||||
console.log("Compile %s (%s)", _file, relpath);
|
console.log("Compile %s (%s)", _file, relpath);
|
||||||
const decl_nodes = decl.generate(source, {
|
const decl_nodes = decl.generate(source, {
|
||||||
remove_private: false,
|
remove_private: true,
|
||||||
module_mode: module_mode
|
module_mode: module_mode
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
enum A {
|
||||||
|
A = "_a",
|
||||||
|
B = 2,
|
||||||
|
C,
|
||||||
|
D = 3,
|
||||||
|
E
|
||||||
|
}
|
||||||
|
|
||||||
|
export type B = {
|
||||||
|
a: A.B
|
||||||
|
}
|
Loading…
Reference in New Issue