jpettersson/lingon — pull request #80 by jpettersson (2014-09-01 12:35:42+00:00)
Title: Remove preProcessor cache

While building the `layoutStream` I noticed that pre-processor did not always render with the correct context object and realized that the built in file data cache in `processorStream` ensured that each file could only be rendered once.

As it was essentially premature optimization I tried removing the cache, but stumbled upon another realization: The cache was essential for the `directiveStream` to work properly. The `directiveStream` works by recursively reading file contents, parsing directives and reading more files, etc. It's also responsible for applying the pre-processors and the problem was that it was applying them after every directive operation. This meant that the same files would travel through multiple instances of pre-processors and the only thing keeping the output correct was the fact that the `processorStream` cache prevented multiple processing of the same files.

I refactored the `directiveStream` to only apply pre-processors after the `include_self` and `binary` cases, which means each file will go through exactly one pre-processor step.