Merge pull request #7223 from tschaub/transform-updates
Transform updates
This commit is contained in:
+13
-1
@@ -61,7 +61,7 @@ function resolve(fromName, toName) {
|
|||||||
if (relative.endsWith('/')) {
|
if (relative.endsWith('/')) {
|
||||||
relative += 'index';
|
relative += 'index';
|
||||||
}
|
}
|
||||||
return relative;
|
return relative + '.js';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUnprovided(path) {
|
function getUnprovided(path) {
|
||||||
@@ -259,5 +259,17 @@ module.exports = function(info, api) {
|
|||||||
// replace any initial comments
|
// replace any initial comments
|
||||||
root.get().node.comments = 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'});
|
return root.toSource({quote: 'single'});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user