Merge pull request #7223 from tschaub/transform-updates

Transform updates
This commit is contained in:
Tim Schaub
2017-09-06 04:06:32 -06:00
committed by GitHub

View File

@@ -61,7 +61,7 @@ function resolve(fromName, toName) {
if (relative.endsWith('/')) {
relative += 'index';
}
return relative;
return relative + '.js';
}
function getUnprovided(path) {
@@ -259,5 +259,17 @@ module.exports = function(info, api) {
// replace any initial comments
root.get().node.comments = comments;
// add @module annotation for src modules
if (info.path.startsWith('src')) {
const name = info.path.replace(/^src\//, '').replace(/\.js$/, '');
const comment = j.commentBlock(`*\n * @module ${name}\n `);
const node = root.get().node;
if (!node.comments) {
node.comments = [comment];
} else {
node.comments.unshift(comment);
}
}
return root.toSource({quote: 'single'});
};