pull/5370/head
filip mertens 1 year ago
parent 50d98f0812
commit 39f146be9a
  1. 5
      apps/remix-ide/src/app.js
  2. 10
      apps/remix-ide/src/app/components/preload.tsx
  3. 3
      apps/remix-ide/src/app/files/electronProvider.ts
  4. 6
      apps/remixdesktop/src/plugins/ripgrepPlugin.ts
  5. 2
      apps/remixdesktop/src/preload.ts
  6. 1
      libs/remix-ui/app/src/lib/remix-app/remix-app.tsx

@ -424,6 +424,9 @@ class AppComponent {
} catch (e) {
console.log("couldn't register iframe plugins", e.message)
}
if(isElectron()){
await this.appManager.activatePlugin(['fs'])
}
await this.appManager.activatePlugin(['layout'])
await this.appManager.activatePlugin(['notification'])
await this.appManager.activatePlugin(['editor'])
@ -460,7 +463,7 @@ class AppComponent {
await this.appManager.activatePlugin(['solidity-script', 'remix-templates'])
if(isElectron()){
await this.appManager.activatePlugin(['fs', 'isogit', 'electronconfig', 'electronTemplates', 'xterm', 'ripgrep'])
await this.appManager.activatePlugin(['isogit', 'electronconfig', 'electronTemplates', 'xterm', 'ripgrep'])
}
this.appManager.on(

@ -7,6 +7,7 @@ import {indexedDBFileSystem} from '../files/filesystems/indexedDB'
import {localStorageFS} from '../files/filesystems/localStorage'
import {fileSystemUtility, migrationTestData} from '../files/filesystems/fileSystemUtility'
import './styles/preload.css'
import isElectron from 'is-electron'
const _paq = (window._paq = window._paq || [])
export const Preload = () => {
@ -28,10 +29,14 @@ export const Preload = () => {
)
function loadAppComponent() {
console.log('app import', new Date().toLocaleString())
import('../../app')
.then((AppComponent) => {
console.log('app loaded', new Date().toLocaleString())
const appComponent = new AppComponent.default()
console.log('app run', new Date().toLocaleString())
appComponent.run().then(() => {
console.log('Remix loaded', new Date().toLocaleString())
render(
<>
<RemixApp app={appComponent} />
@ -68,7 +73,6 @@ export const Preload = () => {
testBlockStorage.current ? null : localStorageFileSystem.current
])
if (fsLoaded) {
console.log(fsLoaded.name + ' activated')
_paq.push(['trackEvent', 'Storage', 'activate', fsLoaded.name])
loadAppComponent()
} else {
@ -85,6 +89,10 @@ export const Preload = () => {
}
useEffect(() => {
if(isElectron()){
loadAppComponent()
return
}
async function loadStorage() {
;(await remixFileSystems.current.addFileSystem(remixIndexedDB.current)) || _paq.push(['trackEvent', 'Storage', 'error', 'indexedDB not supported'])
;(await remixFileSystems.current.addFileSystem(localStorageFileSystem.current)) || _paq.push(['trackEvent', 'Storage', 'error', 'localstorage not supported'])

@ -44,6 +44,8 @@ export class ElectronProvider extends FileProvider {
// isDirectory is already included
// this is a more efficient version of the default implementation
async resolveDirectory(path, cb) {
console.log('resolveDirectory', path)
console.log('start', new Date(new Date().getTime()).toLocaleTimeString())
path = this.removePrefix(path)
if (path.indexOf('/') !== 0) path = '/' + path
try {
@ -59,6 +61,7 @@ export class ElectronProvider extends FileProvider {
}
}
//console.log(ret, 'ret resolveDirectory ELECTRON')
console.log('end', new Date(new Date().getTime()).toLocaleTimeString())
if (cb) cb(null, ret)
return ret
} catch (error) {

@ -20,7 +20,6 @@ const convertPathToPosix = (pathName: string): string => {
export class RipgrepPlugin extends ElectronBasePlugin {
clients: RipgrepPluginClient[] = []
constructor() {
console.log('constructor ripgrepPlugin')
super(profile, clientProfile, RipgrepPluginClient)
this.methods = [...super.methods]
}
@ -37,10 +36,8 @@ export class RipgrepPluginClient extends ElectronBasePluginClient {
workingDir: string = ''
constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile)
console.log('constructor ripgrepPluginClient')
this.onload(() => {
console.log('onload ripgrepPluginClient')
this.on('fs' as any, 'workingDirChanged', async (path: string) => {
this.workingDir = path
})
@ -52,7 +49,6 @@ export class RipgrepPluginClient extends ElectronBasePluginClient {
path = convertPathToPosix(this.fixPath(path))
return new Promise((c, e) => {
console.log('PATH rg', path)
const rg = spawn(rgPath, ['.', '-l', path])
@ -60,7 +56,6 @@ export class RipgrepPluginClient extends ElectronBasePluginClient {
const stream = byline(rg.stdout.setEncoding('utf8'))
stream.on('data', (rgresult: string) => {
console.log(this.workingDir)
let pathWithoutWorkingDir = rgresult.replace(this.workingDir, '')
if (pathWithoutWorkingDir.endsWith('/')) {
pathWithoutWorkingDir = pathWithoutWorkingDir.slice(0, -1)
@ -77,7 +72,6 @@ export class RipgrepPluginClient extends ElectronBasePluginClient {
})
})
stream.on('end', () => {
console.log('rg', resultrg)
c(resultrg)
})
})

@ -2,7 +2,7 @@
import { Message } from '@remixproject/plugin-utils'
import { contextBridge, ipcRenderer } from 'electron'
console.log('preload.ts')
console.log('preload.ts', new Date().toLocaleTimeString())
/* preload script needs statically defined API for each plugin */

@ -37,6 +37,7 @@ const RemixApp = (props: IRemixAppUi) => {
setLocale(props.app.localeModule.currentLocale())
}
if (props.app) {
console.log('app activate', new Date().toLocaleString())
activateApp()
}
}, [])

Loading…
Cancel
Save