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
e7218573
Commit
e7218573
authored
Feb 20, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cache previously added import
parent
8af12855
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
compiler-imports.js
src/app/compiler/compiler-imports.js
+11
-1
No files found.
src/app/compiler/compiler-imports.js
View file @
e7218573
...
@@ -4,6 +4,7 @@ var swarmgw = require('swarmgw')
...
@@ -4,6 +4,7 @@ var swarmgw = require('swarmgw')
var
request
=
require
(
'request'
)
var
request
=
require
(
'request'
)
module
.
exports
=
{
module
.
exports
=
{
previouslyHandled
:
{},
// cache import so we don't make the request at each compilation.
handleGithubCall
:
function
(
root
,
path
,
cb
)
{
handleGithubCall
:
function
(
root
,
path
,
cb
)
{
return
request
.
get
(
return
request
.
get
(
{
{
...
@@ -61,6 +62,11 @@ module.exports = {
...
@@ -61,6 +62,11 @@ module.exports = {
},
},
import
:
function
(
url
,
loadingCb
,
cb
)
{
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
handlers
=
this
.
handlers
()
var
found
=
false
var
found
=
false
...
@@ -79,7 +85,11 @@ module.exports = {
...
@@ -79,7 +85,11 @@ module.exports = {
cb
(
'Unable to import "'
+
cleanUrl
+
'": '
+
err
)
cb
(
'Unable to import "'
+
cleanUrl
+
'": '
+
err
)
return
return
}
}
self
.
previouslyHandled
[
url
]
=
{
content
:
content
,
cleanUrl
:
cleanUrl
,
type
:
handler
.
type
}
cb
(
null
,
content
,
cleanUrl
,
handler
.
type
,
url
)
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