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
7013ed1e
Unverified
Commit
7013ed1e
authored
Feb 20, 2018
by
yann300
Committed by
GitHub
Feb 20, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1094 from ethereum/fixImportGithub
Fix import external (github, swarm, ipfs)
parents
ef105746
e7218573
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
14 deletions
+28
-14
app.js
src/app.js
+17
-13
compiler-imports.js
src/app/compiler/compiler-imports.js
+11
-1
No files found.
src/app.js
View file @
7013ed1e
...
...
@@ -217,6 +217,21 @@ This instance of Remix you are visiting WILL NOT BE UPDATED.\n
Please make a backup of your contracts and start using http://remix.ethereum.org`
)
}
function
importExternal
(
url
,
cb
)
{
handleImports
.
import
(
url
,
(
loadingMsg
)
=>
{
toolTip
(
loadingMsg
)
},
(
error
,
content
,
cleanUrl
,
type
,
url
)
=>
{
if
(
!
error
)
{
filesProviders
[
type
].
addReadOnly
(
cleanUrl
,
content
,
url
)
cb
(
null
,
content
)
}
else
{
cb
(
error
)
}
})
}
// ----------------- Compiler -----------------
var
compiler
=
new
Compiler
((
url
,
cb
)
=>
{
var
provider
=
fileManager
.
fileProviderOf
(
url
)
...
...
@@ -226,22 +241,11 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
if
(
exist
)
{
return
provider
.
get
(
url
,
cb
)
}
else
{
return
cb
(
'Unable to import "'
+
url
+
'": File not found'
)
importExternal
(
url
,
cb
)
}
})
}
else
{
handleImports
.
import
(
url
,
(
loadingMsg
)
=>
{
$
(
'#output'
).
append
(
$
(
'<div/>'
).
append
(
$
(
'<pre/>'
).
text
(
loadingMsg
)))
},
(
error
,
content
,
cleanUrl
,
type
,
url
)
=>
{
if
(
!
error
)
{
filesProviders
[
type
].
addReadOnly
(
cleanUrl
,
content
,
url
)
cb
(
null
,
content
)
}
else
{
cb
(
error
)
}
})
importExternal
(
url
,
cb
)
}
})
var
offsetToLineColumnConverter
=
new
OffsetToLineColumnConverter
(
compiler
.
event
)
...
...
src/app/compiler/compiler-imports.js
View file @
7013ed1e
...
...
@@ -4,6 +4,7 @@ var swarmgw = require('swarmgw')
var
request
=
require
(
'request'
)
module
.
exports
=
{
previouslyHandled
:
{},
// cache import so we don't make the request at each compilation.
handleGithubCall
:
function
(
root
,
path
,
cb
)
{
return
request
.
get
(
{
...
...
@@ -61,6 +62,11 @@ module.exports = {
},
import
:
function
(
url
,
loadingCb
,
cb
)
{
var
self
=
this
var
imported
=
this
.
previouslyHandled
[
url
]
if
(
imported
)
{
return
cb
(
null
,
imported
.
content
,
imported
.
cleanUrl
,
imported
.
type
,
url
)
}
var
handlers
=
this
.
handlers
()
var
found
=
false
...
...
@@ -79,7 +85,11 @@ module.exports = {
cb
(
'Unable to import "'
+
cleanUrl
+
'": '
+
err
)
return
}
self
.
previouslyHandled
[
url
]
=
{
content
:
content
,
cleanUrl
:
cleanUrl
,
type
:
handler
.
type
}
cb
(
null
,
content
,
cleanUrl
,
handler
.
type
,
url
)
})
}
...
...
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