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
7f3d0619
Commit
7f3d0619
authored
Jun 27, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
importFileCb
parent
377a2f8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
31 deletions
+31
-31
app.js
src/app.js
+30
-30
test-tab.js
src/app/tabs/test-tab.js
+1
-1
No files found.
src/app.js
View file @
7f3d0619
...
@@ -313,6 +313,35 @@ class App {
...
@@ -313,6 +313,35 @@ class App {
}
}
})
})
}
}
importFileCb
(
url
,
filecb
)
{
const
self
=
this
if
(
url
.
indexOf
(
'/remix_tests.sol'
)
!==
-
1
)
{
return
filecb
(
null
,
remixTests
.
assertLibCode
)
}
var
provider
=
self
.
_components
.
fileManager
.
fileProviderOf
(
url
)
if
(
provider
)
{
provider
.
exists
(
url
,
(
error
,
exist
)
=>
{
if
(
error
)
return
filecb
(
error
)
if
(
exist
)
{
return
provider
.
get
(
url
,
filecb
)
}
else
{
self
.
importExternal
(
url
,
filecb
)
}
})
}
else
if
(
self
.
_components
.
compilerImport
.
isRelativeImport
(
url
))
{
// try to resolve localhost modules (aka truffle imports)
var
splitted
=
/
([^/]
+
)\/(
.*
)
$/g
.
exec
(
url
)
async
.
tryEach
([
(
cb
)
=>
{
self
.
importFileCb
(
'localhost/installed_contracts/'
+
url
,
cb
)
},
(
cb
)
=>
{
if
(
!
splitted
)
{
cb
(
'url not parseable'
+
url
)
}
else
{
self
.
importFileCb
(
'localhost/installed_contracts/'
+
splitted
[
1
]
+
'/contracts/'
+
splitted
[
2
],
cb
)
}
},
(
cb
)
=>
{
self
.
importFileCb
(
'localhost/node_modules/'
+
url
,
cb
)
},
(
cb
)
=>
{
if
(
!
splitted
)
{
cb
(
'url not parseable'
+
url
)
}
else
{
self
.
importFileCb
(
'localhost/node_modules/'
+
splitted
[
1
]
+
'/contracts/'
+
splitted
[
2
],
cb
)
}
}],
(
error
,
result
)
=>
{
filecb
(
error
,
result
)
}
)
}
else
{
self
.
importExternal
(
url
,
filecb
)
}
}
}
}
module
.
exports
=
App
module
.
exports
=
App
...
@@ -352,37 +381,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -352,37 +381,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}
}
})
})
function
importFileCb
(
url
,
filecb
)
{
if
(
url
.
indexOf
(
'/remix_tests.sol'
)
!==
-
1
)
{
return
filecb
(
null
,
remixTests
.
assertLibCode
)
}
var
provider
=
fileManager
.
fileProviderOf
(
url
)
if
(
provider
)
{
provider
.
exists
(
url
,
(
error
,
exist
)
=>
{
if
(
error
)
return
filecb
(
error
)
if
(
exist
)
{
return
provider
.
get
(
url
,
filecb
)
}
else
{
self
.
importExternal
(
url
,
filecb
)
}
})
}
else
if
(
self
.
_components
.
compilerImport
.
isRelativeImport
(
url
))
{
// try to resolve localhost modules (aka truffle imports)
var
splitted
=
/
([^/]
+
)\/(
.*
)
$/g
.
exec
(
url
)
async
.
tryEach
([
(
cb
)
=>
{
importFileCb
(
'localhost/installed_contracts/'
+
url
,
cb
)
},
(
cb
)
=>
{
if
(
!
splitted
)
{
cb
(
'url not parseable'
+
url
)
}
else
{
importFileCb
(
'localhost/installed_contracts/'
+
splitted
[
1
]
+
'/contracts/'
+
splitted
[
2
],
cb
)
}
},
(
cb
)
=>
{
importFileCb
(
'localhost/node_modules/'
+
url
,
cb
)
},
(
cb
)
=>
{
if
(
!
splitted
)
{
cb
(
'url not parseable'
+
url
)
}
else
{
importFileCb
(
'localhost/node_modules/'
+
splitted
[
1
]
+
'/contracts/'
+
splitted
[
2
],
cb
)
}
}],
(
error
,
result
)
=>
{
filecb
(
error
,
result
)
}
)
}
else
{
self
.
importExternal
(
url
,
filecb
)
}
}
// ----------------- Compiler -----------------
// ----------------- Compiler -----------------
self
.
_components
.
compiler
=
new
Compiler
(
importFileCb
)
self
.
_components
.
compiler
=
new
Compiler
(
self
.
importFileCb
)
var
compiler
=
self
.
_components
.
compiler
var
compiler
=
self
.
_components
.
compiler
registry
.
put
({
api
:
compiler
,
name
:
'compiler'
})
registry
.
put
({
api
:
compiler
,
name
:
'compiler'
})
...
...
src/app/tabs/test-tab.js
View file @
7f3d0619
...
@@ -77,7 +77,7 @@ module.exports = class TestTab {
...
@@ -77,7 +77,7 @@ module.exports = class TestTab {
remixTests
.
runTestSources
(
runningTest
,
testCallback
,
resultsCallback
,
(
error
,
result
)
=>
{
remixTests
.
runTestSources
(
runningTest
,
testCallback
,
resultsCallback
,
(
error
,
result
)
=>
{
updateFinalResult
(
error
,
result
)
updateFinalResult
(
error
,
result
)
callback
(
error
)
callback
(
error
)
},
this
.
_deps
.
fileManager
.
importFileCb
)
},
this
.
_deps
.
app
.
importFileCb
)
}
}
})
})
}
}
...
...
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