@@ -26,21 +26,21 @@ import { WalkthroughService } from './walkthroughService'
26
26
27
27
import { OffsetToLineColumnConverter , CompilerMetadata , CompilerArtefacts , FetchAndCompile , CompilerImports , GistHandler } from '@remix-project/core-plugin'
28
28
29
- import { Registry } from '@remix-project/remix-lib'
30
- import { ConfigPlugin } from './app/plugins/config'
31
- import { StoragePlugin } from './app/plugins/storage'
32
- import { Layout } from './app/panels/layout'
33
- import { NotificationPlugin } from './app/plugins/notification'
34
- import { Blockchain } from './blockchain/blockchain'
35
- import { MergeVMProvider , LondonVMProvider , BerlinVMProvider , ShanghaiVMProvider , CancunVMProvider } from './app/providers/vm-provider'
36
- import { MainnetForkVMProvider } from './app/providers/mainnet-vm-fork-provider'
37
- import { SepoliaForkVMProvider } from './app/providers/sepolia-vm-fork-provider'
38
- import { GoerliForkVMProvider } from './app/providers/goerli-vm-fork-provider'
39
- import { CustomForkVMProvider } from './app/providers/custom-vm-fork-provider'
40
- import { HardhatProvider } from './app/providers/hardhat-provider'
41
- import { GanacheProvider } from './app/providers/ganache-provider'
42
- import { FoundryProvider } from './app/providers/foundry-provider'
43
- import { ExternalHttpProvider } from './app/providers/external-http-provider'
29
+ import { Registry } from '@remix-project/remix-lib'
30
+ import { ConfigPlugin } from './app/plugins/config'
31
+ import { StoragePlugin } from './app/plugins/storage'
32
+ import { Layout } from './app/panels/layout'
33
+ import { NotificationPlugin } from './app/plugins/notification'
34
+ import { Blockchain } from './blockchain/blockchain'
35
+ import { MergeVMProvider , LondonVMProvider , BerlinVMProvider , ShanghaiVMProvider , CancunVMProvider } from './app/providers/vm-provider'
36
+ import { MainnetForkVMProvider } from './app/providers/mainnet-vm-fork-provider'
37
+ import { SepoliaForkVMProvider } from './app/providers/sepolia-vm-fork-provider'
38
+ import { GoerliForkVMProvider } from './app/providers/goerli-vm-fork-provider'
39
+ import { CustomForkVMProvider } from './app/providers/custom-vm-fork-provider'
40
+ import { HardhatProvider } from './app/providers/hardhat-provider'
41
+ import { GanacheProvider } from './app/providers/ganache-provider'
42
+ import { FoundryProvider } from './app/providers/foundry-provider'
43
+ import { ExternalHttpProvider } from './app/providers/external-http-provider'
44
44
import { EnvironmentExplorer } from './app/providers/environment-explorer'
45
45
import { FileDecorator } from './app/plugins/file-decorator'
46
46
import { CodeFormat } from './app/plugins/code-format'
@@ -58,7 +58,7 @@ import { xtermPlugin } from './app/plugins/electron/xtermPlugin'
58
58
import { ripgrepPlugin } from './app/plugins/electron/ripgrepPlugin'
59
59
import { compilerLoaderPlugin , compilerLoaderPluginDesktop } from './app/plugins/electron/compilerLoaderPlugin'
60
60
import { appUpdaterPlugin } from './app/plugins/electron/appUpdaterPlugin'
61
- import { remixAIDesktopPlugin } from './app/plugins/electron/remixAIDesktopPlugin'
61
+ import { remixAIDesktopPlugin } from './app/plugins/electron/remixAIDesktopPlugin'
62
62
import { RemixAIPlugin } from './app/plugins/remixAIPlugin'
63
63
import { SlitherHandleDesktop } from './app/plugins/electron/slitherPlugin'
64
64
import { SlitherHandle } from './app/files/slither-handle'
@@ -72,37 +72,37 @@ import { Matomo } from './app/plugins/matomo'
72
72
73
73
import { TemplatesSelectionPlugin } from './app/plugins/templates-selection/templates-selection-plugin'
74
74
75
- const isElectron = require ( 'is-electron' )
75
+ import isElectron from 'is-electron'
76
76
77
- const remixLib = require ( '@remix-project/remix-lib' )
77
+ import * as remixLib from '@remix-project/remix-lib'
78
78
79
79
import { QueryParams } from '@remix-project/remix-lib'
80
80
import { SearchPlugin } from './app/tabs/search'
81
81
import { ScriptRunnerUIPlugin } from './app/tabs/script-runner-ui'
82
82
import { ElectronProvider } from './app/files/electronProvider'
83
83
84
84
const Storage = remixLib . Storage
85
- const RemixDProvider = require ( './app/files/remixDProvider' )
86
- const Config = require ( './config' )
85
+ import RemixDProvider from './app/files/remixDProvider'
86
+ import Config from './config'
87
87
88
- const FileManager = require ( './app/files/fileManager' )
88
+ import FileManager from './app/files/fileManager'
89
89
import FileProvider from "./app/files/fileProvider"
90
90
import { appPlatformTypes } from '@remix-ui/app'
91
91
92
- const DGitProvider = require ( './app/files/dgitProvider' )
93
- const WorkspaceFileProvider = require ( './app/files/workspaceFileProvider' )
92
+ import DGitProvider from './app/files/dgitProvider'
93
+ import WorkspaceFileProvider from './app/files/workspaceFileProvider'
94
94
95
- const PluginManagerComponent = require ( './app/components/plugin-manager-component' )
95
+ import PluginManagerComponent from './app/components/plugin-manager-component'
96
96
97
- const CompileTab = require ( './app/tabs/compile-tab' )
98
- const SettingsTab = require ( './app/tabs/settings-tab' )
99
- const AnalysisTab = require ( './app/tabs/analysis-tab' )
100
- const { DebuggerTab } = require ( './app/tabs/debugger-tab' )
101
- const TestTab = require ( './app/tabs/test-tab' )
102
- const FilePanel = require ( './app/panels/file-panel' )
103
- const Editor = require ( './app/editor/editor' )
104
- const Terminal = require ( './app/panels/terminal' )
105
- const { TabProxy } = require ( './app/panels/tab-proxy.js' )
97
+ import CompileTab from './app/tabs/compile-tab'
98
+ import SettingsTab from './app/tabs/settings-tab'
99
+ import AnalysisTab from './app/tabs/analysis-tab'
100
+ import DebuggerTab from './app/tabs/debugger-tab'
101
+ import TestTab from './app/tabs/test-tab'
102
+ import Filepanel from './app/panels/file-panel'
103
+ import Editor from './app/editor/editor'
104
+ import Terminal from './app/panels/terminal'
105
+ import TabProxy from './app/panels/tab-proxy.js'
106
106
107
107
const _paq = ( window . _paq = window . _paq || [ ] )
108
108
@@ -115,16 +115,49 @@ export class platformApi {
115
115
}
116
116
}
117
117
118
+ type Components = {
119
+ filesProviders : {
120
+ browser ?: any
121
+ localhost ?: any
122
+ workspace ?: any
123
+ electron ?: any
124
+ }
125
+ }
126
+
118
127
class AppComponent {
128
+ appManager : RemixAppManager
129
+ queryParams : QueryParams
130
+ private _components : Components
131
+ panels : any
132
+ workspace : any
133
+ engine : RemixEngine
134
+ matomoConfAlreadySet : any
135
+ matomoCurrentSetting : any
136
+ showMatomo : boolean
137
+ walkthroughService : WalkthroughService
138
+ platform : 'desktop' | 'web'
139
+ gistHandler : GistHandler
140
+ themeModule : ThemeModule
141
+ localeModule : LocaleModule
142
+ notification : NotificationPlugin
143
+ layout : Layout
144
+ mainview : any
145
+ menuicons : VerticalIcons
146
+ sidePanel : SidePanel
147
+ hiddenPanel : HiddenPanel
148
+ pinnedPanel : PinnedPanel
149
+ popupPanel : PopupPanel
150
+ statusBar : StatusBar
151
+ settings : SettingsTab
119
152
constructor ( ) {
120
153
const PlatFormAPi = new platformApi ( )
121
154
Registry . getInstance ( ) . put ( {
122
155
api : PlatFormAPi ,
123
156
name : 'platform'
124
157
} )
125
- this . appManager = new RemixAppManager ( { } )
158
+ this . appManager = new RemixAppManager ( )
126
159
this . queryParams = new QueryParams ( )
127
- this . _components = { }
160
+ this . _components = { } as Components
128
161
// setup storage
129
162
const configStorage = new Storage ( 'config-v0.8:' )
130
163
@@ -161,7 +194,6 @@ class AppComponent {
161
194
name : 'fileproviders'
162
195
} )
163
196
164
-
165
197
}
166
198
167
199
async run ( ) {
@@ -184,7 +216,7 @@ class AppComponent {
184
216
this . matomoConfAlreadySet = Registry . getInstance ( ) . get ( 'config' ) . api . exists ( 'settings/matomo-analytics' )
185
217
this . matomoCurrentSetting = Registry . getInstance ( ) . get ( 'config' ) . api . get ( 'settings/matomo-analytics' )
186
218
187
- let electronTracking = window . electronAPI ? await window . electronAPI . canTrackMatomo ( ) : false
219
+ const electronTracking = ( window as any ) . electronAPI ? await ( window as any ) . electronAPI . canTrackMatomo ( ) : false
188
220
189
221
const lastMatomoCheck = window . localStorage . getItem ( 'matomo-analytics-consent' )
190
222
const sixMonthsAgo = new Date ( ) ;
@@ -193,11 +225,11 @@ class AppComponent {
193
225
const e2eforceMatomoToShow = window . localStorage . getItem ( 'showMatomo' ) && window . localStorage . getItem ( 'showMatomo' ) === 'true'
194
226
const contextShouldShowMatomo = matomoDomains [ window . location . hostname ] || e2eforceMatomoToShow || electronTracking
195
227
const shouldRenewConsent = this . matomoCurrentSetting === false && ( ! lastMatomoCheck || new Date ( Number ( lastMatomoCheck ) ) < sixMonthsAgo ) // it is set to false for more than 6 months.
196
- this . showMatomo = contextShouldShowMatomo && ( ! this . matomoConfAlreadySet || shouldRenewConsent )
228
+ this . showMatomo = contextShouldShowMatomo && ( ! this . matomoConfAlreadySet || shouldRenewConsent )
197
229
198
230
if ( this . showMatomo && shouldRenewConsent ) {
199
231
_paq . push ( [ 'trackEvent' , 'Matomo' , 'refreshMatomoPermissions' ] ) ;
200
- }
232
+ }
201
233
202
234
this . walkthroughService = new WalkthroughService ( appManager )
203
235
@@ -387,7 +419,7 @@ class AppComponent {
387
419
ganacheProvider ,
388
420
foundryProvider ,
389
421
externalHttpProvider ,
390
- environmentExplorer ,
422
+ environmentExplorer ,
391
423
this . walkthroughService ,
392
424
search ,
393
425
solidityumlgen ,
@@ -456,10 +488,10 @@ class AppComponent {
456
488
this . popupPanel = new PopupPanel ( )
457
489
458
490
const pluginManagerComponent = new PluginManagerComponent ( appManager , this . engine )
459
- const filePanel = new FilePanel ( appManager , contentImport )
491
+ const filePanel = new Filepanel ( appManager , contentImport )
460
492
this . statusBar = new StatusBar ( filePanel , this . menuicons )
461
493
const landingPage = new LandingPage ( appManager , this . menuicons , fileManager , filePanel , contentImport )
462
- this . settings = new SettingsTab ( Registry . getInstance ( ) . get ( 'config' ) . api , editor , appManager )
494
+ this . settings = new SettingsTab ( Registry . getInstance ( ) . get ( 'config' ) . api , editor ) // , appManager)
463
495
464
496
this . engine . register ( [ this . menuicons , landingPage , this . hiddenPanel , this . sidePanel , this . statusBar , filePanel , pluginManagerComponent , this . settings , this . pinnedPanel , this . popupPanel ] )
465
497
@@ -514,7 +546,7 @@ class AppComponent {
514
546
515
547
async activate ( ) {
516
548
const queryParams = new QueryParams ( )
517
- const params = queryParams . get ( )
549
+ const params : any = queryParams . get ( )
518
550
519
551
try {
520
552
this . engine . register ( await this . appManager . registeredPlugins ( ) )
@@ -610,10 +642,11 @@ class AppComponent {
610
642
}
611
643
612
644
if ( params . call ) {
613
- const callDetails = params . call . split ( '//' )
645
+ const callDetails : any = params . call . split ( '//' )
614
646
if ( callDetails . length > 1 ) {
615
647
this . appManager . call ( 'notification' , 'toast' , `initiating ${ callDetails [ 0 ] } and calling "${ callDetails [ 1 ] } " ...` )
616
648
// @todo (remove the timeout when activatePlugin is on 0.3.0)
649
+ //@ts -ignore
617
650
await this . appManager . call ( ...callDetails ) . catch ( console . error )
618
651
}
619
652
}
@@ -629,6 +662,7 @@ class AppComponent {
629
662
630
663
// @todo (remove the timeout when activatePlugin is on 0.3.0)
631
664
try {
665
+ //@ts -ignore
632
666
await this . appManager . call ( ...callDetails )
633
667
} catch ( e ) {
634
668
console . error ( e )
0 commit comments