babel-plugin-jsdoc-closure
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -123,2 +123,8 @@ const parseComment = require('comment-parser'); | ||
comment = babel.transform(`/*${newComment}*/`).ast.comments[0]; | ||
if (path.parent && path.parent.type == 'ReturnStatement') { | ||
const parenthesized = babel.types.parenthesizedExpression(node); | ||
parenthesized.comments = path.parent.argument.comments; | ||
delete path.parent.argument.comments; | ||
path.parent.argument = parenthesized; | ||
} | ||
comments[i] = comment; | ||
@@ -125,0 +131,0 @@ } else { |
{ | ||
"name": "babel-plugin-jsdoc-closure", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "Transpiles JSDoc types from namepaths to types for Closure Compiler", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -42,2 +42,20 @@ const babel = require('babel-core'); | ||
it('transforms a type cast with an imported module in a return statement', function() { | ||
// requires recast, and causes line break changes unfortunately | ||
const source = | ||
'/** @module module2/types */\n' + | ||
'function getFoo() {\n' + | ||
' return /** @type {module:module1/Bar} */ (bar.getBar());\n' + | ||
'}'; | ||
const expected = | ||
'/** @module module2/types */\n' + | ||
'function getFoo() {\n' + | ||
' return (\n /** @type {module1$Bar} */\n (bar.getBar())\n );\n' + | ||
'}\n' + | ||
'const module1$Bar = require(\'../module1/Bar\');'; | ||
const filename = './test/module2/types.js'; | ||
const got = babel.transform(source, Object.assign({filename}, recastOptions)); | ||
assert.equal(got.code, expected); | ||
}); | ||
it('transforms a type with an imported default export', function() { | ||
@@ -44,0 +62,0 @@ test( |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18693
376