diff --git a/app/package.json b/app/package.json index b550232c..251e28c0 100644 --- a/app/package.json +++ b/app/package.json @@ -44,11 +44,11 @@ "windows-process-tree": "^0.3.4" }, "devDependencies": { + "@ngx-translate/core": "^14.0.0", "@types/mz": "2.7.4", - "@types/node": "18.7.23", + "@types/node": "18.11.19", "atomically": "^1.7.0", "filesize": "^9", - "@ngx-translate/core": "^14.0.0", "ngx-filesize": "^3.0.1" }, "peerDependencies": { diff --git a/app/src/app.module.ts b/app/src/app.module.ts index bea4cf2f..231fa58f 100644 --- a/app/src/app.module.ts +++ b/app/src/app.module.ts @@ -1,30 +1,12 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -import { CommonModule } from '@angular/common' -import { ApplicationRef, Component, NgModule, ViewContainerRef } from '@angular/core' +import { ApplicationRef, NgModule } from '@angular/core' import { BrowserModule } from '@angular/platform-browser' -import { NgbModule } from '@ng-bootstrap/ng-bootstrap' import { ToastrModule } from 'ngx-toastr' -@Component({ - standalone: true, - imports: [CommonModule], - selector: 'root', - template: '', -}) -export class RootComponent { - static bootstrapComponent: any - constructor (private viewContainerRef: ViewContainerRef) { } - ngAfterViewInit () { - this.viewContainerRef.createComponent(RootComponent.bootstrapComponent) - } -} - export function getRootModule (plugins: any[]) { const imports = [ BrowserModule, - // CommonModule, - // ...plugins, - NgbModule, + ...plugins, ToastrModule.forRoot({ positionClass: 'toast-bottom-center', toastClass: 'toast', @@ -43,24 +25,12 @@ export function getRootModule (plugins: any[]) { @NgModule({ imports, - declarations: [RootComponent], - // bootstrap, - // bootstrap: [RootComponent], }) class RootModule { ngDoBootstrap (appRef: ApplicationRef) { (window as any)['requestAnimationFrame'] = window[window['Zone'].__symbol__('requestAnimationFrame')] - bootstrap.forEach(componentDef => { - RootComponent.bootstrapComponent = componentDef - // const environmentInjector = appRef.injector - // createComponent(componentDef, { environmentInjector }) - // const component = this.resolver.resolveComponentFactory(componentDef) - // if (document.querySelector(factory.selector)) { - // appRef.bootstrap(component) - // } - }) - - appRef.bootstrap(RootComponent) + const componentDef = bootstrap[0] + appRef.bootstrap(componentDef) } } diff --git a/app/src/entry.ts b/app/src/entry.ts index 7c29bcee..108fe8e0 100644 --- a/app/src/entry.ts +++ b/app/src/entry.ts @@ -8,14 +8,13 @@ import './toastr.scss' // Importing before @angular/* import { findPlugins, initModuleLookup, loadPlugins } from './plugins' -import { enableProdMode, NgModuleRef, ApplicationRef, importProvidersFrom, CompilerFactory, COMPILER_OPTIONS } from '@angular/core' -import { bootstrapApplication, enableDebugTools } from '@angular/platform-browser' -import { JitCompilerFactory, platformBrowserDynamic } from '@angular/platform-browser-dynamic' +import { enableProdMode, NgModuleRef, ApplicationRef } from '@angular/core' +import { enableDebugTools } from '@angular/platform-browser' +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' import { ipcRenderer } from 'electron' -import { getRootModule, RootComponent } from './app.module' +import { getRootModule } from './app.module' import { BootstrapData, BOOTSTRAP_DATA, PluginInfo } from '../../tabby-core/src/api/mainProcess' -import { ToastrModule } from 'ngx-toastr' // Always land on the start view location.hash = '' @@ -43,30 +42,16 @@ async function bootstrap (bootstrapData: BootstrapData, plugins: PluginInfo[], s window['pluginModules'] = pluginModules - const providers = [ + const module = getRootModule(pluginModules) + const moduleRef = await platformBrowserDynamic([ { provide: BOOTSTRAP_DATA, useValue: bootstrapData }, - importProvidersFrom([ - ...pluginModules, - ToastrModule.forRoot({ - positionClass: 'toast-bottom-center', - toastClass: 'toast', - preventDuplicates: true, - extendedTimeOut: 1000, - }), - ]), - ] - RootComponent.bootstrapComponent = pluginModules.find(x => x.bootstrap)?.bootstrap - bootstrapApplication(RootComponent, { providers }) - // const module = getRootModule(pluginModules) - // const moduleRef = await platformBrowserDynamic([ - // { provide: BOOTSTRAP_DATA, useValue: bootstrapData }, - // ]).bootstrapModule(module) + ]).bootstrapModule(module) if (process.env.TABBY_DEV) { - // const applicationRef = moduleRef.injector.get(ApplicationRef) - // const componentRef = applicationRef.components[0] - // enableDebugTools(componentRef) + const applicationRef = moduleRef.injector.get(ApplicationRef) + const componentRef = applicationRef.components[0] + enableDebugTools(componentRef) } - // return moduleRef + return moduleRef } ipcRenderer.once('start', async (_$event, bootstrapData: BootstrapData) => { diff --git a/app/yarn.lock b/app/yarn.lock index 49dc1af7..63b66d57 100644 --- a/app/yarn.lock +++ b/app/yarn.lock @@ -147,11 +147,16 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@18.7.23": +"@types/node@*": version "18.7.23" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.23.tgz#75c580983846181ebe5f4abc40fe9dfb2d65665f" integrity sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg== +"@types/node@18.11.19": + version "18.11.19" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.19.tgz#35e26df9ec441ab99d73e99e9aca82935eea216d" + integrity sha512-YUgMWAQBWLObABqrvx8qKO1enAvBUdjZOAWQ5grBAkp5LQv45jBvYKZ3oFS9iKRCQyFjqw6iuEa1vmFqtxYLZw== + "@types/node@^10.12.18": version "10.17.60" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b" diff --git a/package.json b/package.json index 5a186f5a..01c3919c 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@ng-bootstrap/ng-bootstrap": "^14.0.1", "@ngtools/webpack": "^15.1.4", "@popperjs/core": "^2.11.6", + "rxjs": "^7.5.7", "@sentry/cli": "^1.74.3", "@sentry/electron": "^2.5.4", "@tabby-gang/to-string-loader": "^1.1.7-beta.2", diff --git a/tabby-core/src/components/appRoot.component.ts b/tabby-core/src/components/appRoot.component.ts index 5a5968a6..367ede79 100644 --- a/tabby-core/src/components/appRoot.component.ts +++ b/tabby-core/src/components/appRoot.component.ts @@ -90,7 +90,7 @@ export class AppRootComponent { ngbModal: NgbModal, _themes: ThemesService, ) { - document.querySelector('app-root')?.remove() + // document.querySelector('app-root')?.remove() this.logger = log.create('main') this.logger.info('v', platform.getAppVersion()) diff --git a/tabby-core/src/components/baseTab.component.ts b/tabby-core/src/components/baseTab.component.ts index ef72b47d..71d15cda 100644 --- a/tabby-core/src/components/baseTab.component.ts +++ b/tabby-core/src/components/baseTab.component.ts @@ -1,5 +1,5 @@ import { Observable, Subject, distinctUntilChanged, filter, debounceTime } from 'rxjs' -import { Component, EmbeddedViewRef, Injector, ViewContainerRef, ViewRef } from '@angular/core' +import { EmbeddedViewRef, Injector, ViewContainerRef, ViewRef } from '@angular/core' import { RecoveryToken } from '../api/tabRecovery' import { BaseComponent } from './base.component' import { ConfigService } from '../services/config.service' diff --git a/tabby-terminal/patches/ansi-color+0.2.1.patch b/tabby-terminal/patches/ansi-color+0.2.1.patch new file mode 100644 index 00000000..b20ce461 --- /dev/null +++ b/tabby-terminal/patches/ansi-color+0.2.1.patch @@ -0,0 +1,15 @@ +diff --git a/node_modules/ansi-color/lib/ansi-color.js b/node_modules/ansi-color/lib/ansi-color.js +index 1062c87..4fc2847 100644 +--- a/node_modules/ansi-color/lib/ansi-color.js ++++ b/node_modules/ansi-color/lib/ansi-color.js +@@ -32,8 +32,8 @@ exports.set = function(str, color) { + var color_attrs = color.split("+"); + var ansi_str = ""; + for(var i=0, attr; attr = color_attrs[i]; i++) { +- ansi_str += "\033[" + ANSI_CODES[attr] + "m"; ++ ansi_str += "\x1b[" + ANSI_CODES[attr] + "m"; + } +- ansi_str += str + "\033[" + ANSI_CODES["off"] + "m"; ++ ansi_str += str + "\x1b[" + ANSI_CODES["off"] + "m"; + return ansi_str; + }; diff --git a/yarn.lock b/yarn.lock index 27da6c0e..92224a36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7720,6 +7720,13 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" +rxjs@^7.5.7: + version "7.8.0" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4" + integrity sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg== + dependencies: + tslib "^2.1.0" + safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -8712,7 +8719,7 @@ tslib@^2.0.3, tslib@^2.2.0, tslib@^2.3.0, tslib@^2.4.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== -tslib@^2.5.0: +tslib@^2.1.0, tslib@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==