diff options
Diffstat (limited to 'src/to-javascript.js')
-rw-r--r-- | src/to-javascript.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/to-javascript.js b/src/to-javascript.js index b402ad4..d0934d5 100644 --- a/src/to-javascript.js +++ b/src/to-javascript.js | |||
@@ -10,7 +10,11 @@ const jsStringEscape = require('js-string-escape'); | |||
10 | 10 | ||
11 | const difference = require('lodash.difference'); | 11 | const difference = require('lodash.difference'); |
12 | 12 | ||
13 | const debug = require('debug')('purs-loader'); | 13 | const debug_ = require('debug'); |
14 | |||
15 | const debug = debug_('purs-loader'); | ||
16 | |||
17 | const debugVerbose = debug_('purs-loader:verbose'); | ||
14 | 18 | ||
15 | const PsModuleMap = require('./PsModuleMap'); | 19 | const PsModuleMap = require('./PsModuleMap'); |
16 | 20 | ||
@@ -99,7 +103,7 @@ function makeJS(psModule, psModuleMap, js) { | |||
99 | const additionalImports = difference(imports, replacedImports); | 103 | const additionalImports = difference(imports, replacedImports); |
100 | 104 | ||
101 | if (additionalImports.length) { | 105 | if (additionalImports.length) { |
102 | debug('additional imports for %s: %o', name, additionalImports); | 106 | debugVerbose('additional imports for %s: %o', name, additionalImports); |
103 | } | 107 | } |
104 | 108 | ||
105 | const additionalImportsResult = additionalImports.map(import_ => { | 109 | const additionalImportsResult = additionalImports.map(import_ => { |
@@ -129,13 +133,13 @@ module.exports = function toJavaScript(psModule) { | |||
129 | 133 | ||
130 | const bundlePath = path.resolve(options.bundleOutput); | 134 | const bundlePath = path.resolve(options.bundleOutput); |
131 | 135 | ||
132 | const jsPath = cache.bundle ? bundlePath : psModule.jsPath; | 136 | const jsPath = options.bundle ? bundlePath : psModule.jsPath; |
133 | 137 | ||
134 | const js = fs.readFileAsync(jsPath, 'utf8').catch(() => ''); | 138 | const js = fs.readFileAsync(jsPath, 'utf8').catch(() => ''); |
135 | 139 | ||
136 | const psModuleMap = updatePsModuleMap(psModule); | 140 | const psModuleMap = updatePsModuleMap(psModule); |
137 | 141 | ||
138 | debug('loading JavaScript for %s', psModule.name); | 142 | debugVerbose('loading JavaScript for %s', psModule.name); |
139 | 143 | ||
140 | return Promise.props({js: js, psModuleMap: psModuleMap}).then(result => | 144 | return Promise.props({js: js, psModuleMap: psModuleMap}).then(result => |
141 | options.bundle ? | 145 | options.bundle ? |