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
a6aa9f80
Commit
a6aa9f80
authored
Jan 10, 2019
by
0mkar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'remix-resolve' of github.com:ethereum/remix into remix-resolve
parents
88a8988a
141bef40
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
170 additions
and
21 deletions
+170
-21
resolve.ts
remix-resolve/src/resolve.ts
+24
-11
test.ts
remix-resolve/tests/test.ts
+146
-10
No files found.
remix-resolve/src/resolve.ts
View file @
a6aa9f80
import
axios
from
'axios'
import
axios
,
{
AxiosResponse
}
from
'axios'
import
{
Api
,
ModuleProfile
,
API
}
from
'remix-plugin'
import
{
Api
,
ModuleProfile
,
API
}
from
'remix-plugin'
...
@@ -42,24 +42,40 @@ export class RemixResolveApi implements API<RemixResolve> {
...
@@ -42,24 +42,40 @@ export class RemixResolveApi implements API<RemixResolve> {
* @params root The root of the github import statement
* @params root The root of the github import statement
* @params filePath path of the file in github
* @params filePath path of the file in github
*/
*/
handleGithubCall
(
root
:
string
,
filePath
:
string
)
{
async
handleGithubCall
(
root
:
string
,
filePath
:
string
)
{
return
try
{
let
req
:
string
=
'https://api.github.com/repos/'
+
root
+
'/contents/'
+
filePath
const
response
:
AxiosResponse
=
await
axios
.
get
(
req
)
return
Buffer
.
from
(
response
.
data
.
content
,
'base64'
).
toString
()
}
catch
(
e
)
{
throw
e
}
}
}
/**
/**
* Handle an import statement based on http
* Handle an import statement based on http
* @params url The url of the import statement
* @params url The url of the import statement
* @params cleanURL
* @params cleanURL
*/
*/
handleHttp
(
url
:
string
,
cleanURL
:
string
)
{
async
handleHttp
(
url
:
string
,
_
:
string
)
{
return
try
{
const
response
:
AxiosResponse
=
await
axios
.
get
(
url
)
return
response
.
data
}
catch
(
e
)
{
throw
e
}
}
}
/**
/**
* Handle an import statement based on https
* Handle an import statement based on https
* @params url The url of the import statement
* @params url The url of the import statement
* @params cleanURL
* @params cleanURL
*/
*/
handleHttps
(
url
:
string
,
cleanURL
:
string
)
{
async
handleHttps
(
url
:
string
,
_
:
string
)
{
return
try
{
const
response
:
AxiosResponse
=
await
axios
.
get
(
url
)
return
response
.
data
}
catch
(
e
)
{
throw
e
}
}
}
handleSwarm
(
url
:
string
,
cleanURL
:
string
)
{
handleSwarm
(
url
:
string
,
cleanURL
:
string
)
{
return
return
...
@@ -75,15 +91,12 @@ export class RemixResolveApi implements API<RemixResolve> {
...
@@ -75,15 +91,12 @@ export class RemixResolveApi implements API<RemixResolve> {
const
req
=
'https://gateway.ipfs.io/'
+
url
const
req
=
'https://gateway.ipfs.io/'
+
url
// If you don't find greeter.sol on ipfs gateway use local
// If you don't find greeter.sol on ipfs gateway use local
// const req = 'http://localhost:8080/' + url
// const req = 'http://localhost:8080/' + url
const
response
=
await
axios
.
get
(
req
)
const
response
:
AxiosResponse
=
await
axios
.
get
(
req
)
return
response
.
data
return
response
.
data
}
catch
(
e
)
{
}
catch
(
e
)
{
throw
e
throw
e
}
}
}
}
handleLocal
(
root
:
string
,
filePath
:
string
)
{
return
}
getHandlers
():
Handler
[]
{
getHandlers
():
Handler
[]
{
return
[
return
[
{
{
...
...
remix-resolve/tests/test.ts
View file @
a6aa9f80
This diff is collapsed.
Click to expand it.
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