Disabled the transpile only flag in the typescript loader plugin

canary
WolverinDEV 2020-07-19 17:12:41 +02:00
parent e383748c34
commit 64cefce509
35 changed files with 100 additions and 61 deletions

View File

@ -706,7 +706,7 @@ namespace watcher {
}
protected start_command(): string[] {
return ["npm", "run", "sass", "--", "--watch", ".:."];
return ["npm", "run", "sass", "--", "--watch", "shared/css:shared/css"];
}
}

View File

@ -12,6 +12,9 @@ declare global {
log: any;
StaticSettings: any;
}
const tr: typeof window.tr;
const tra: typeof window.tr;
}
export interface Config {

View File

@ -149,7 +149,7 @@ export class ConnectionHandler {
private _clientId: number = 0;
private _local_client: LocalClientEntry;
private _reconnect_timer: NodeJS.Timer;
private _reconnect_timer: number;
private _reconnect_attempt: boolean = false;
private _connect_initialize_id: number = 1;
@ -1058,6 +1058,9 @@ export class ConnectionHandler {
areQueriesShown() {
return this.client_status.queries_visible;
}
hasInputHardware() { return this.client_status.input_hardware; }
hasOutputHardware() { return this.client_status.output_muted; }
}
export type ConnectionStateUpdateType = "microphone" | "speaker" | "away" | "subscribe" | "query";

View File

@ -3,6 +3,7 @@ import {
ServerCommand,
SingleCommandHandler
} from "tc-shared/connection/ConnectionBase";
import {tr} from "tc-shared/i18n/localize";
export abstract class AbstractCommandHandler {
readonly connection: AbstractServerConnection;

View File

@ -22,6 +22,7 @@ import {AbstractCommandHandler, AbstractCommandHandlerBoss} from "tc-shared/conn
import {batch_updates, BatchUpdateType, flush_batched_updates} from "tc-shared/ui/react-elements/ReactComponentBase";
import {OutOfViewClient} from "tc-shared/ui/frames/side/PrivateConversationManager";
import {renderBBCodeAsJQuery} from "tc-shared/text/bbcode";
import {tr} from "tc-shared/i18n/localize";
export class ServerConnectionCommandBoss extends AbstractCommandHandlerBoss {
constructor(connection: AbstractServerConnection) {

View File

@ -12,6 +12,7 @@ import {ChannelEntry} from "tc-shared/ui/channel";
import {ClientEntry} from "tc-shared/ui/client";
import {ChatType} from "tc-shared/ui/frames/chat";
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler";
import {tr} from "tc-shared/i18n/localize";
export class CommandHelper extends AbstractCommandHandler {
private _who_am_i: any;

View File

@ -5,6 +5,7 @@ import {AbstractServerConnection} from "tc-shared/connection/ConnectionBase";
import {ConnectionProfile} from "tc-shared/profiles/ConnectionProfile";
import {settings} from "tc-shared/settings";
import {ConnectParameters, DisconnectReason} from "tc-shared/ConnectionHandler";
import {tr} from "tc-shared/i18n/localize";
export interface HandshakeIdentityHandler {
connection: AbstractServerConnection;
@ -13,7 +14,6 @@ export interface HandshakeIdentityHandler {
register_callback(callback: (success: boolean, message?: string) => any);
}
declare const native_client;
export class HandshakeHandler {
private connection: AbstractServerConnection;
private handshake_handler: HandshakeIdentityHandler;
@ -101,10 +101,10 @@ export class HandshakeHandler {
client_server_password: this.parameters.password ? this.parameters.password.password : undefined,
client_browser_engine: navigator.product,
client_input_hardware: this.connection.client.client_status.input_hardware, //FIXME: No direct access to that state!
client_input_hardware: this.connection.client.hasInputHardware(),
client_output_hardware: false,
client_input_muted: this.connection.client.client_status.input_muted, //FIXME: No direct access to that state!
client_output_muted: this.connection.client.client_status.output_muted, //FIXME: No direct access to that state!
client_input_muted: this.connection.client.isMicrophoneMuted(),
client_output_muted: this.connection.client.isSpeakerMuted(),
};
if(version) {

View File

@ -13,6 +13,7 @@ import {formatMessage} from "tc-shared/ui/frames/chat";
import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
import {spawnSettingsModal} from "tc-shared/ui/modal/ModalSettings";
import {spawnPermissionEditorModal} from "tc-shared/ui/modal/permission/ModalPermissionEditor";
import {tr} from "tc-shared/i18n/localize";
/*
function initialize_sounds(event_registry: Registry<ClientGlobalControlEvents>) {

View File

@ -14,6 +14,7 @@ import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDecla
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
import {Registry} from "tc-shared/events";
import {ClientEntry} from "tc-shared/ui/client";
import {tr} from "tc-shared/i18n/localize";
/* FIXME: Retry avatar download after some time! */

View File

@ -20,7 +20,7 @@ import {
TransferTargetSupplier,
} from "tc-shared/file/Transfer";
import {Registry} from "tc-shared/events";
import {tra} from "tc-shared/i18n/localize";
import {tr, tra} from "tc-shared/i18n/localize";
export enum FileType {
DIRECTORY = 0,

View File

@ -11,6 +11,7 @@ import {
TransferTargetType
} from "tc-shared/file/Transfer";
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
import {tr} from "tc-shared/i18n/localize";
const icon_cache: ImageCache = new ImageCache("icons");
export interface IconManagerEvents {

View File

@ -1,3 +1,4 @@
import {tr} from "tc-shared/i18n/localize";
export enum ImageType {
UNKNOWN,

View File

@ -1,5 +1,6 @@
import {Registry} from "tc-shared/events";
import {CommandResult, ErrorCode} from "tc-shared/connection/ServerConnectionDeclaration";
import {tr} from "tc-shared/i18n/localize";
/* Transfer source types */
export enum TransferSourceType {

View File

@ -1,3 +1,5 @@
import {tr} from "tc-shared/i18n/localize";
interface CountryInfo {
name: string;
alpha_2: string;

View File

@ -350,7 +350,7 @@ function main() {
/** Setup the XF forum identity **/
fidentity.update_forum();
let _resize_timeout: NodeJS.Timer;
let _resize_timeout;
$(window).on('resize', event => {
if(event.target !== window)
return;

View File

@ -7,6 +7,7 @@ import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration";
import {ConnectionEvents, ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler";
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler";
import {Registry} from "tc-shared/events";
import {tr} from "tc-shared/i18n/localize";
export enum GroupType {
QUERY,

View File

@ -7,6 +7,7 @@ import {CommandResult, ErrorID} from "tc-shared/connection/ServerConnectionDecla
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
import {AbstractCommandHandler} from "tc-shared/connection/AbstractCommandHandler";
import {Registry} from "tc-shared/events";
import {tr} from "tc-shared/i18n/localize";
export class PermissionInfo {
name: string;

View File

@ -143,11 +143,11 @@ export async function load() {
if (profiles_data.version == 1) {
for (const profile_data of profiles_data.profiles) {
const profile = await decode_profile(profile_data);
if (typeof (profile) === 'string') {
if (typeof profile === "string") {
console.error(tr("Failed to load profile. Reason: %s, Profile data: %s"), profile, profiles_data);
continue;
} else {
available_profiles.push(profile as ConnectionProfile);
}
available_profiles.push(profile);
}
}

View File

@ -2,6 +2,7 @@ import {createErrorModal} from "tc-shared/ui/elements/Modal";
import {LogCategory} from "tc-shared/log";
import * as loader from "tc-loader";
import * as log from "tc-shared/log";
import {Registry} from "tc-shared/events";
if(typeof(customElements) !== "undefined") {
try {
@ -141,6 +142,16 @@ export class StaticSettings extends SettingsBase {
}
}
export interface SettingsEvents {
notify_setting_changed: {
setting: string,
mode: "global" | "server",
oldValue: string,
newValue: string
}
}
export class Settings extends StaticSettings {
static readonly KEY_USER_IS_NEW: SettingsKey<boolean> = {
key: 'user_is_new_user',
@ -420,13 +431,15 @@ export class Settings extends StaticSettings {
(window as any).Settings = Settings;
}
private cacheGlobal = {};
private saveWorker: NodeJS.Timer;
readonly events: Registry<SettingsEvents>;
private readonly cacheGlobal = {};
private saveWorker: number;
private updated: boolean = false;
constructor() {
super();
this.events = new Registry<SettingsEvents>();
const json = localStorage.getItem("settings.global");
try {
this.cacheGlobal = JSON.parse(json);
@ -471,8 +484,14 @@ export class Settings extends StaticSettings {
if(this.cacheGlobal[key.key] === value) return;
this.updated = true;
const oldValue = this.cacheGlobal[key.key];
this.cacheGlobal[key.key] = StaticSettings.transformOtS(value);
this.events.fire("notify_setting_changed", {
mode: "global",
newValue: this.cacheGlobal[key.key],
oldValue: oldValue,
setting: key.key
});
if(Settings.UPDATE_DIRECT)
this.save();
}
@ -489,7 +508,7 @@ export class Settings extends StaticSettings {
export class ServerSettings extends SettingsBase {
private cacheServer = {};
private _server_unique_id: string;
private _server_save_worker: NodeJS.Timer;
private _server_save_worker: number;
private _server_settings_updated: boolean = false;
private _destroyed = false;

View File

@ -243,7 +243,7 @@ export class SoundManager {
if(volume == 0 || master_volume == 0)
return;
if(this._handle && !options.ignore_muted && !ignore_output_muted() && this._handle.client_status.output_muted)
if(this._handle && !options.ignore_muted && !ignore_output_muted() && this._handle.isSpeakerMuted())
return;
resolve_sound(_sound).then(handle => {

View File

@ -1,8 +1,6 @@
import {LogCategory} from "tc-shared/log";
import * as log from "tc-shared/log";
const LOG_PREFIX = "[Statistics] ";
enum CloseCodes {
UNSET = 3000,
RECONNECT = 3001,
@ -45,7 +43,7 @@ export interface UserCountData {
export type UserCountListener = (data: UserCountData) => any;
let reconnect_timer: NodeJS.Timer;
let reconnect_timer: number;
let current_config: Config;
let last_user_count_update: number;
@ -241,21 +239,4 @@ namespace connection {
handler["notifyinitialized"] = handle_notify_initialized;
handler["notifyusercount"] = handle_notify_user_count;
}
}
{
var X; /* just declare the identifier so we'll not getting a reference error */
const A = () => {
console.log("Variable X: %o", X);
};
{
class X {
}
A();
}
A();
}

View File

@ -42,7 +42,7 @@ function process_urls(message: string) : string {
return message || words.join(" ");
}
export function preprocess_chat_message(message: string) : string {
export function preprocessChatMessageForSend(message: string) : string {
const process_url = settings.static_global(Settings.KEY_CHAT_TAG_URLS);
const parse_markdown = settings.static_global(Settings.KEY_CHAT_ENABLE_MARKDOWN);
const escape_bb = !settings.static_global(Settings.KEY_CHAT_ENABLE_BBCODE);

View File

@ -10,7 +10,7 @@ import {
TextToken,
Token
} from "remarkable/lib";
import {escapeBBCode} from "tc-shared/text/BBCodeHelper";
import {escapeBBCode} from "tc-shared/text/bbcode";
const { Remarkable } = require("remarkable");
export class MD2BBCodeRenderer {

View File

@ -8,7 +8,7 @@ export class Hostbanner {
readonly client: ConnectionHandler;
private _destryed = false;
private updater: NodeJS.Timer;
private updater;
constructor(client: ConnectionHandler) {
this.client = client;

View File

@ -4,6 +4,8 @@ import {Registry} from "tc-shared/events";
import '!style-loader!css-loader!emoji-mart/css/emoji-mart.css'
import { Picker } from 'emoji-mart'
import {settings, Settings} from "tc-shared/settings";
import {Translatable} from "tc-shared/ui/react-elements/i18n";
const cssStyle = require("./ChatBox.scss");
@ -266,6 +268,27 @@ export interface ChatBoxState {
enabled: boolean;
}
const MarkdownFormatHelper = () => {
const [ visible, setVisible ] = useState(settings.global(Settings.KEY_CHAT_ENABLE_MARKDOWN));
settings.events.reactUse("notify_setting_changed", event => {
if(event.setting !== Settings.KEY_CHAT_ENABLE_MARKDOWN.key)
return;
setVisible(settings.global(Settings.KEY_CHAT_ENABLE_MARKDOWN));
});
if(visible) {
return (
<div key={"help"} className={cssStyle.containerHelp}>*italic*, **bold**, ~~strikethrough~~, `code`, <Translatable>and more</Translatable>...</div>
);
} else {
return (
<div key={"placeholder"} className={cssStyle.containerHelp}>&nbsp;</div>
);
}
};
export class ChatBox extends React.Component<ChatBoxProperties, ChatBoxState> {
readonly events = new Registry<ChatBoxEvents>();
private callbackSubmit = event => this.props.onSubmit(event.message);
@ -294,7 +317,7 @@ export class ChatBox extends React.Component<ChatBoxProperties, ChatBoxState> {
<EmojiButton events={this.events} />
<TextInput events={this.events} placeholder={tr("Type your message here...")} />
</div>
<div className={cssStyle.containerHelp}>*italic*, **bold**, ~~strikethrough~~, `code`, and more...</div>
<MarkdownFormatHelper />
</div>
}

View File

@ -18,6 +18,7 @@ import {
ConversationUIEvents
} from "tc-shared/ui/frames/side/ConversationDefinitions";
import {ConversationPanel} from "tc-shared/ui/frames/side/ConversationUI";
import {preprocessChatMessageForSend} from "tc-shared/text/chat";
const kMaxChatFrameMessageSize = 50; /* max 100 messages, since the server does not support more than 100 messages queried at once */
@ -171,7 +172,7 @@ export abstract class AbstractChat<Events extends ConversationUIEvents> {
}
protected doSendMessage(message: string, targetMode: number, target: number) : Promise<boolean> {
let msg = helpers.preprocess_chat_message(message);
let msg = preprocessChatMessageForSend(message);
return this.connection.serverConnection.send_command("sendtextmessage", {
targetmode: targetMode,
cid: target,

View File

@ -8,7 +8,6 @@ import {AvatarRenderer} from "tc-shared/ui/react-elements/Avatar";
import {format} from "tc-shared/ui/frames/side/chat_helper";
import {Translatable} from "tc-shared/ui/react-elements/i18n";
import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots";
import {BBCodeChatMessage} from "tc-shared/MessageFormatter";
import {Countdown} from "tc-shared/ui/react-elements/Countdown";
import {
ChatEvent,
@ -23,10 +22,11 @@ import {
ConversationUIEvents
} from "tc-shared/ui/frames/side/ConversationDefinitions";
import {TimestampRenderer} from "tc-shared/ui/react-elements/TimestampRenderer";
import {BBCodeRenderer} from "tc-shared/text/bbcode";
const cssStyle = require("./ConversationUI.scss");
const CMTextRenderer = React.memo((props: { text: string }) => <BBCodeChatMessage message={props.text} />);
const CMTextRenderer = React.memo((props: { text: string }) => <BBCodeRenderer settings={{ convertSingleUrls: true }} message={props.text} />);
const ChatEventMessageRenderer = React.memo((props: {
message: ChatMessage,

View File

@ -5,7 +5,7 @@ import {formatMessage} from "tc-shared/ui/frames/chat";
export function spawnTeamSpeakIdentityImprove(identity: TeaSpeakIdentity, name: string): Modal {
let modal: Modal;
let elapsed_timer: NodeJS.Timer;
let elapsed_timer: number;
modal = createModal({
header: tr("Improve identity"),

View File

@ -26,10 +26,8 @@ import {spawnKeySelect} from "tc-shared/ui/modal/ModalKeySelect";
import {spawnTeamSpeakIdentityImport, spawnTeamSpeakIdentityImprove} from "tc-shared/ui/modal/ModalIdentity";
import {Device} from "tc-shared/audio/player";
import {LevelMeter} from "tc-shared/voice/RecorderBase";
import * as loader from "tc-loader";
import * as aplayer from "tc-backend/audio/player";
import * as arecorder from "tc-backend/audio/recorder";
import * as ppt from "tc-backend/ppt";
import {KeyMapSettings} from "tc-shared/ui/modal/settings/Keymap";
import * as React from "react";
import * as ReactDOM from "react-dom";
@ -394,22 +392,16 @@ function settings_general_chat(container: JQuery, modal: Modal) {
}).prop("checked", settings.static_global(Settings.KEY_CHAT_COLORED_EMOJIES));
}
const update_format_helper = () => server_connections.all_connections().map(e => e.side_bar).forEach(e => {
e.private_conversations().update_input_format_helper();
e.channel_conversations().update_input_format_helper();
});
{
const option = container.find(".option-support-markdown") as JQuery<HTMLInputElement>;
option.on('change', event => {
settings.changeGlobal(Settings.KEY_CHAT_ENABLE_MARKDOWN, option[0].checked);
update_format_helper();
}).prop("checked", settings.static_global(Settings.KEY_CHAT_ENABLE_MARKDOWN));
}
{
const option = container.find(".option-support-bbcode") as JQuery<HTMLInputElement>;
option.on('change', event => {
settings.changeGlobal(Settings.KEY_CHAT_ENABLE_BBCODE, option[0].checked);
update_format_helper();
}).prop("checked", settings.static_global(Settings.KEY_CHAT_ENABLE_BBCODE));
}
{

View File

@ -55,7 +55,7 @@ export class RecorderProfile {
record_supported: boolean;
private _ppt_hook: KeyHook;
private _ppt_timeout: NodeJS.Timer;
private _ppt_timeout: number;
private _ppt_hook_registered: boolean;
constructor(name: string, volatile?: boolean) {

View File

@ -26,6 +26,9 @@
"shared/generated",
"web/declarations/**/*.d.ts",
"web/generated/",
"web/environment/"
"web/environment/",
"loader/app/targets/certaccept.ts",
"tools/",
"vendor"
]
}

View File

@ -24,7 +24,7 @@ class ReturnListener<T> {
reject: (reason?: any) => void;
code: string;
timeout: NodeJS.Timer;
timeout: number;
}
export class ServerConnection extends AbstractServerConnection {
@ -36,7 +36,7 @@ export class ServerConnection extends AbstractServerConnection {
private _socket_connected: WebSocket;
private _connect_timeout_timer: NodeJS.Timer = undefined;
private _connect_timeout_timer: number = undefined;
private _connected: boolean = false;
@ -129,7 +129,7 @@ export class ServerConnection extends AbstractServerConnection {
let local_direct_socket: WebSocket;
let local_proxy_socket: WebSocket;
let connected_socket: WebSocket;
let local_timeout_timer: NodeJS.Timer;
let local_timeout_timer: number;
/* setting up an timeout */
local_timeout_timer = setTimeout(async () => {

View File

@ -19,7 +19,7 @@ export class VoiceClientController implements VoiceClient {
private _time_index: number = 0;
private _latency_buffer_length: number = 3;
private _buffer_timeout: NodeJS.Timer;
private _buffer_timeout: number;
private _buffered_samples: AudioBuffer[] = [];
private _playing_nodes: AudioBufferSourceNode[] = [];

View File

@ -15,6 +15,7 @@ import {settings} from "tc-shared/settings";
import {CallbackInputConsumer, InputConsumerType, NodeInputConsumer} from "tc-shared/voice/RecorderBase";
import AbstractVoiceConnection = voice.AbstractVoiceConnection;
import VoiceClient = voice.VoiceClient;
import {tr} from "tc-shared/i18n/localize";
export namespace codec {
class CacheEntry {
@ -153,7 +154,7 @@ export class VoiceConnection extends AbstractVoiceConnection {
private voice_packet_id: number = 0;
private chunkVPacketId: number = 0;
private send_task: NodeJS.Timer;
private send_task: number;
private _audio_source: RecorderProfile;
private _audio_clients: VoiceClientController[] = [];

View File

@ -133,8 +133,9 @@ export const config = async (target: "web" | "client") => { return {
{
loader: 'ts-loader',
options: {
transpileOnly: true,
getCustomTransformers: (prog: ts.Program) => {
context: __dirname,
colors: true,
getCustomTransformers(prog: ts.Program) {
return {
before: [trtransformer(prog, {
optimized: false,