cache: cache,
}
+ debug('loader called', psModule.name)
+
if (options.bundle) {
cache.bundleModules.push(psModule.name)
}
.catch(psModule.reject)
}
- if (cache.compilation && cache.compilation.length) {
+ if (cache.compilationFinished) {
return toJavaScript(psModule).then(psModule.load).catch(psModule.reject)
}
// references to compiled output are valid.
cache.deferred.push(psModule)
- if (!cache.compilation) {
+ if (!cache.compilationStarted) {
return compile(psModule)
.then(() => Promise.map(cache.deferred, psModule => {
if (typeof cache.ideServer === 'object') cache.ideServer.kill()
const bundlePath = path.resolve(options.bundleOutput)
const jsPath = cache.bundle ? bundlePath : psModule.jsPath
- debug('loading JavaScript for', psModule.srcPath)
+ debug('loading JavaScript for', psModule.name)
return Promise.props({
js: fs.readFileAsync(jsPath, 'utf8'),
const cache = psModule.cache
const stderr = []
- if (cache.compilation) return Promise.resolve(cache.compilation)
-
- cache.compilation = []
- cache.warnings = []
- cache.errors = []
+ if (cache.compilationStarted) return Promise.resolve(psModule)
+ cache.compilationStarted = true
const args = dargs(Object.assign({
_: options.src,
compilation.on('close', code => {
console.log('Finished compiling PureScript.')
+ cache.compilationFinished = true
if (code !== 0) {
cache.compilation = cache.errors = stderr
reject(true)