mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +00:00
bumped angular & webpack
This commit is contained in:
@@ -1,24 +1,21 @@
|
||||
import * as fs from 'mz/fs'
|
||||
import * as path from 'path'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, ConfigService, HostAppService, ElectronService, Logger, LogService } from 'terminus-core'
|
||||
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, ConfigService, HostAppService, ElectronService } from 'terminus-core'
|
||||
|
||||
import { TerminalService } from './services/terminal.service'
|
||||
|
||||
@Injectable()
|
||||
export class ButtonProvider extends ToolbarButtonProvider {
|
||||
private logger: Logger
|
||||
|
||||
constructor (
|
||||
private terminal: TerminalService,
|
||||
private config: ConfigService,
|
||||
log: LogService,
|
||||
hostApp: HostAppService,
|
||||
electron: ElectronService,
|
||||
hotkeys: HotkeysService,
|
||||
) {
|
||||
super()
|
||||
this.logger = log.create('newTerminalButton')
|
||||
hotkeys.matchedHotkey.subscribe(async (hotkey) => {
|
||||
if (hotkey === 'new-tab') {
|
||||
this.openNewTab()
|
||||
@@ -47,7 +44,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
}
|
||||
|
||||
async openNewTab (cwd?: string): Promise<void> {
|
||||
let shells = await this.terminal.shells$.first().toPromise()
|
||||
let shells = await this.terminal.shells$.pipe(first()).toPromise()
|
||||
let shell = shells.find(x => x.id === this.config.store.terminal.shell)
|
||||
this.terminal.openTab(shell, cwd)
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { Observable } from 'rxjs'
|
||||
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators'
|
||||
import { exec } from 'mz/child_process'
|
||||
const equal = require('deep-equal')
|
||||
const fontManager = require('font-manager')
|
||||
@@ -51,11 +52,12 @@ export class TerminalSettingsTabComponent {
|
||||
}
|
||||
|
||||
fontAutocomplete = (text$: Observable<string>) => {
|
||||
return text$
|
||||
.debounceTime(200)
|
||||
.distinctUntilChanged()
|
||||
.map(query => this.fonts.filter(v => new RegExp(query, 'gi').test(v)))
|
||||
.map(list => Array.from(new Set(list)))
|
||||
return text$.pipe(
|
||||
debounceTime(200),
|
||||
distinctUntilChanged(),
|
||||
map(query => this.fonts.filter(v => new RegExp(query, 'gi').test(v))),
|
||||
map(list => Array.from(new Set(list))),
|
||||
)
|
||||
}
|
||||
|
||||
editScheme (scheme: ITerminalColorScheme) {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { BehaviorSubject, Subject, Subscription } from 'rxjs'
|
||||
import { Observable, BehaviorSubject, Subject, Subscription } from 'rxjs'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { ToastrService } from 'ngx-toastr'
|
||||
import { Component, NgZone, Inject, Optional, ViewChild, HostBinding, Input } from '@angular/core'
|
||||
import { AppService, ConfigService, BaseTabComponent, ElectronService, ThemesService, HostAppService, HotkeysService, Platform } from 'terminus-core'
|
||||
@@ -32,7 +33,8 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
hotkeysSubscription: Subscription
|
||||
bell$ = new Subject()
|
||||
size: ResizeEvent
|
||||
resize$ = new Subject<ResizeEvent>()
|
||||
resize$: Observable<ResizeEvent>
|
||||
private resize_ = new Subject<ResizeEvent>()
|
||||
input$ = new Subject<string>()
|
||||
output$ = new Subject<string>()
|
||||
contentUpdated$ = new Subject<void>()
|
||||
@@ -58,9 +60,10 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
@Optional() @Inject(TerminalDecorator) private decorators: TerminalDecorator[],
|
||||
) {
|
||||
super()
|
||||
this.resize$ = this.resize_.asObservable()
|
||||
this.decorators = this.decorators || []
|
||||
this.setTitle('Terminal')
|
||||
this.resize$.first().subscribe(async (resizeEvent) => {
|
||||
this.resize$.pipe(first()).subscribe(async resizeEvent => {
|
||||
if (!this.session) {
|
||||
this.session = this.sessions.addSession(
|
||||
Object.assign({}, this.sessionOptions, resizeEvent)
|
||||
@@ -330,7 +333,7 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
if (this.session) {
|
||||
this.session.resize(columns, rows)
|
||||
}
|
||||
this.resize$.next(this.size)
|
||||
this.resize_.next(this.size)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -452,7 +455,7 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
if (this.sessionCloseSubscription) {
|
||||
this.sessionCloseSubscription.unsubscribe()
|
||||
}
|
||||
this.resize$.complete()
|
||||
this.resize_.complete()
|
||||
this.input$.complete()
|
||||
this.output$.complete()
|
||||
this.contentUpdated$.complete()
|
||||
|
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'
|
||||
import { execFileSync } from 'child_process'
|
||||
import * as AsyncLock from 'async-lock'
|
||||
import { ConnectableObservable, AsyncSubject, Subject } from 'rxjs'
|
||||
import { first, publish } from 'rxjs/operators'
|
||||
import * as childProcess from 'child_process'
|
||||
|
||||
import { Logger } from 'terminus-core'
|
||||
@@ -102,7 +103,7 @@ export class TMuxCommandProcess {
|
||||
}
|
||||
})
|
||||
|
||||
this.response$ = this.block$.publish()
|
||||
this.response$ = this.block$.asObservable().pipe(publish()) as ConnectableObservable<TMuxBlock>
|
||||
this.response$.connect()
|
||||
|
||||
this.block$.subscribe(block => {
|
||||
@@ -116,7 +117,7 @@ export class TMuxCommandProcess {
|
||||
|
||||
command (command: string): Promise<TMuxBlock> {
|
||||
return this.lock.acquire('key', () => {
|
||||
let p = this.response$.take(1).toPromise()
|
||||
let p = this.response$.pipe(first()).toPromise()
|
||||
this.logger.debug('command:', command)
|
||||
this.process.stdin.write(command + '\n')
|
||||
return p
|
||||
|
@@ -1,7 +1,8 @@
|
||||
const psNode = require('ps-node')
|
||||
let nodePTY
|
||||
import * as fs from 'mz/fs'
|
||||
import { Subject } from 'rxjs'
|
||||
import { Observable, Subject } from 'rxjs'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { Injectable, Inject } from '@angular/core'
|
||||
import { Logger, LogService, ElectronService, ConfigService } from 'terminus-core'
|
||||
import { exec } from 'mz/child_process'
|
||||
@@ -17,25 +18,34 @@ export interface IChildProcess {
|
||||
export abstract class BaseSession {
|
||||
open: boolean
|
||||
name: string
|
||||
output$ = new Subject<string>()
|
||||
closed$ = new Subject<void>()
|
||||
destroyed$ = new Subject<void>()
|
||||
recoveryId: string
|
||||
truePID: number
|
||||
output$: Observable<string>
|
||||
closed$: Observable<void>
|
||||
destroyed$: Observable<void>
|
||||
protected output_ = new Subject<string>()
|
||||
protected closed_ = new Subject<void>()
|
||||
protected destroyed_ = new Subject<void>()
|
||||
private initialDataBuffer = ''
|
||||
private initialDataBufferReleased = false
|
||||
|
||||
constructor () {
|
||||
this.output$ = this.output_.asObservable()
|
||||
this.closed$ = this.closed_.asObservable()
|
||||
this.destroyed$ = this.destroyed_.asObservable()
|
||||
}
|
||||
|
||||
emitOutput (data: string) {
|
||||
if (!this.initialDataBufferReleased) {
|
||||
this.initialDataBuffer += data
|
||||
} else {
|
||||
this.output$.next(data)
|
||||
this.output_.next(data)
|
||||
}
|
||||
}
|
||||
|
||||
releaseInitialDataBuffer () {
|
||||
this.initialDataBufferReleased = true
|
||||
this.output$.next(this.initialDataBuffer)
|
||||
this.output_.next(this.initialDataBuffer)
|
||||
this.initialDataBuffer = null
|
||||
}
|
||||
|
||||
@@ -49,9 +59,9 @@ export abstract class BaseSession {
|
||||
async destroy (): Promise<void> {
|
||||
if (this.open) {
|
||||
this.open = false
|
||||
this.closed$.next()
|
||||
this.destroyed$.next()
|
||||
this.output$.complete()
|
||||
this.closed_.next()
|
||||
this.destroyed_.next()
|
||||
this.output_.complete()
|
||||
await this.gracefullyKillProcess()
|
||||
}
|
||||
}
|
||||
@@ -220,7 +230,7 @@ export class SessionsService {
|
||||
options.name = `session-${this.lastID}`
|
||||
let session = new Session(options)
|
||||
let persistence = this.getPersistence()
|
||||
session.destroyed$.first().subscribe(() => {
|
||||
session.destroyed$.pipe(first()).subscribe(() => {
|
||||
delete this.sessions[session.name]
|
||||
if (persistence) {
|
||||
persistence.terminateSession(session.recoveryId)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { AsyncSubject } from 'rxjs'
|
||||
import { Observable, AsyncSubject } from 'rxjs'
|
||||
import { Injectable, Inject } from '@angular/core'
|
||||
import { AppService, Logger, LogService, ConfigService } from 'terminus-core'
|
||||
import { IShell, ShellProvider } from '../api'
|
||||
@@ -7,7 +7,8 @@ import { TerminalTabComponent } from '../components/terminalTab.component'
|
||||
|
||||
@Injectable()
|
||||
export class TerminalService {
|
||||
shells$ = new AsyncSubject<IShell[]>()
|
||||
shells$: Observable<IShell[]>
|
||||
private shells_ = new AsyncSubject<IShell[]>()
|
||||
private logger: Logger
|
||||
|
||||
constructor (
|
||||
@@ -26,10 +27,11 @@ export class TerminalService {
|
||||
}
|
||||
|
||||
async reloadShells () {
|
||||
this.shells$ = new AsyncSubject<IShell[]>()
|
||||
this.shells_ = new AsyncSubject<IShell[]>()
|
||||
this.shells$ = this.shells_.asObservable()
|
||||
let shellLists = await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))
|
||||
this.shells$.next(shellLists.reduce((a, b) => a.concat(b)))
|
||||
this.shells$.complete()
|
||||
this.shells_.next(shellLists.reduce((a, b) => a.concat(b)))
|
||||
this.shells_.complete()
|
||||
}
|
||||
|
||||
async openTab (shell?: IShell, cwd?: string): Promise<TerminalTabComponent> {
|
||||
|
@@ -18,27 +18,31 @@ module.exports = {
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'awesome-typescript-loader',
|
||||
query: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
}
|
||||
}
|
||||
use: {
|
||||
loader: 'awesome-typescript-loader',
|
||||
query: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{ test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
|
||||
{ test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
|
||||
{ test: /\.css$/, use: ['to-string-loader', 'css-loader'] },
|
||||
{
|
||||
test: /\.(ttf|eot|otf|woff|woff2|ogg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: "url-loader",
|
||||
options: {
|
||||
limit: 999999999999,
|
||||
use: {
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 999999999999,
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
|
Reference in New Issue
Block a user