Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
5dc5e292
Commit
5dc5e292
authored
Sep 02, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure path are windows compliant
parent
f1ec70a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
slitherClient.ts
libs/remixd/src/services/slitherClient.ts
+5
-4
No files found.
libs/remixd/src/services/slitherClient.ts
View file @
5dc5e292
...
...
@@ -4,6 +4,7 @@ import * as WS from 'ws' // eslint-disable-line
import
{
PluginClient
}
from
'@remixproject/plugin'
import
{
existsSync
,
readFileSync
,
readdirSync
,
unlink
}
from
'fs'
import
{
OutputStandard
}
from
'../types'
// eslint-disable-line
import
*
as
utils
from
'../utils'
const
{
spawn
,
execSync
}
=
require
(
'child_process'
)
export
class
SlitherClient
extends
PluginClient
{
...
...
@@ -25,8 +26,8 @@ export class SlitherClient extends PluginClient {
}
mapNpmDepsDir
(
list
)
{
const
remixNpmDepsPath
=
`
${
this
.
currentSharedFolder
}
/.deps/npm`
const
localNpmDepsPath
=
`
${
this
.
currentSharedFolder
}
/node_modules`
const
remixNpmDepsPath
=
utils
.
absolutePath
(
'.deps/npm'
,
this
.
currentSharedFolder
)
const
localNpmDepsPath
=
utils
.
absolutePath
(
'node_modules'
,
this
.
currentSharedFolder
)
const
npmDepsExists
=
existsSync
(
remixNpmDepsPath
)
const
nodeModulesExists
=
existsSync
(
localNpmDepsPath
)
let
isLocalDep
=
false
...
...
@@ -112,7 +113,7 @@ export class SlitherClient extends PluginClient {
}
else
console
.
log
(
'
\
x1b[32m%s
\
x1b[0m'
,
'[Slither Analysis]: Compiler version is same as installed solc version'
)
}
// Allow paths and set solc remapping for import URLs
const
fileContent
=
readFileSync
(
`
${
this
.
currentSharedFolder
}
/
${
filePath
}
`
,
'utf8'
)
const
fileContent
=
readFileSync
(
utils
.
absolutePath
(
filePath
,
this
.
currentSharedFolder
)
,
'utf8'
)
const
importsArr
=
fileContent
.
match
(
/import
[
'"
][^
.|..
](
.+
?)[
'"
]
;/g
)
let
remaps
=
''
if
(
importsArr
?.
length
)
{
...
...
@@ -143,7 +144,7 @@ export class SlitherClient extends PluginClient {
const
response
=
{}
child
.
on
(
'close'
,
()
=>
{
const
outputFileAbsPath
:
string
=
`
${
this
.
currentSharedFolder
}
/
${
outputFile
}
`
const
outputFileAbsPath
:
string
=
utils
.
absolutePath
(
outputFile
,
this
.
currentSharedFolder
)
// Check if slither report file exists
if
(
existsSync
(
outputFileAbsPath
))
{
let
report
=
readFileSync
(
outputFileAbsPath
,
'utf8'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment