Supporting async-only jstransformers; fixes #166 #167
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The core of this PR is to switch from calling jstransformer's
renderFile
function to instead callingrenderFileAsync
. Because of the sync fallback support in jstransformer (https://github.com/jstransformers/jstransformer/blob/69fd94c47500fe4d4c8d9f1ac2918c2a55075db0/index.js#L345), calling the async function should work for both async and sync template engines.The only additional change in this PR is to move code unrelated to the async operations out of the scope of the promise code.
I looked for a place to add tests to verify, but all of the test fixtures in the repository were more granular than this specific change. All current tests pass, though.