Skip to content

Commit

Permalink
Return full result from babel.transform.
Browse files Browse the repository at this point in the history
Previous code only returns an object of the shape `{ code, map, metadata }` which prevents accessing things like the AST when `babel` is configured to output it. This change allows access to whatever `babel` spits back out.
  • Loading branch information
izaakschroeder committed Jun 22, 2018
1 parent 1a7a440 commit d60cce3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/transform.js
Expand Up @@ -14,13 +14,13 @@ module.exports = async function(source, options) {

if (!result) return null;

const { code, map, metadata } = result;
const { map } = result;

if (map && (!map.sourcesContent || !map.sourcesContent.length)) {
map.sourcesContent = [source];
}

return { code, map, metadata };
return result;
};

module.exports.version = babel.version;

0 comments on commit d60cce3

Please sign in to comment.