Initial work on new framework

This commit is contained in:
Berkeley Martinez
2016-05-06 13:20:18 -07:00
parent b6f9cfdf71
commit 861f89683b
7 changed files with 220 additions and 3 deletions

View File

@@ -0,0 +1,21 @@
import loopProtect from 'loopProtect';
loopProtect.hit = function hit(line) {
var err = 'Error: Exiting potential infinite loop at line ' +
line +
'. To disable loop protection, write: \n\\/\\/ noprotect\nas the first' +
'line. Beware that if you do have an infinite loop in your code' +
'this will crash your browser.';
console.error(err);
};
// Observable[Observable[File]]::addLoopProtect() => Observable[String]
export default function addLoopProtect() {
const source = this;
return source.map(files$ => files$.map(file => {
if (file.extname === 'js') {
file.contents = loopProtect(file.contents);
}
return file;
}));
}