Turn off BuildCache diagnostics, and do our own diagnostic only if file present
authorNick Downing <downing.nick@gmail.com>
Sun, 21 Oct 2018 09:39:53 +0000 (20:39 +1100)
committerNick Downing <nick@ndcode.org>
Tue, 30 Oct 2018 07:54:35 +0000 (18:54 +1100)
js_template.js

index d4c4923..4fd5244 100644 (file)
@@ -10,7 +10,7 @@ let _util = require('util')
 
 let _fs_readFile = _util.promisify(_fs.readFile)
 
-let _build_cache = new _BuildCache(true)
+let _build_cache = new _BuildCache()
 let _js_template = async (_root, _dir, _name) => {
   while (_name.charAt(0) === '/') {
     _dir = _root
@@ -20,6 +20,8 @@ let _js_template = async (_root, _dir, _name) => {
   return _build_cache.get(
     _name,
     async _result => {
+      _text = await _fs_readFile(_name, {encoding: 'utf-8'})
+      console.log('compiling', _name)
       let _dir = _path.posix.dirname(_name)
       let _req = async _name => _js_template(_root, _dir, _name)
       _result.value = await (
@@ -28,9 +30,7 @@ let _js_template = async (_root, _dir, _name) => {
             _transform.transform(
               _visitors,
               _acorn.parse(
-                '(async function() {' +
-                await _fs_readFile(_name, {encoding: 'utf-8'}) +
-                '})'
+                '(async function() {' + _text + '})'
               )
             ),
             {indent: ''}