babel-plugin-inline-import-graphql-ast
Advanced tools
Comparing version 2.0.1-rc.0 to 2.0.1-rc.1
@@ -52,9 +52,8 @@ Object.defineProperty(exports, "__esModule", { | ||
query.makeSourceEnumerable(); | ||
curPath.replaceWith(t.variableDeclaration('const', [buildInlineVariable(query.ast)])); | ||
curPath.replaceWith(buildInlineVariableAST(query.ast)); | ||
} | ||
function buildInlineVariable(graphqlAST) { | ||
var babelAST = (0, _babylon.parse)('(' + JSON.stringify(graphqlAST) + ')'); | ||
var objExp = babelAST.program.body[0].expression; | ||
return t.variableDeclarator(t.identifier(curPath.node.specifiers[0].local.name), t.objectExpression(objExp.properties)); | ||
function buildInlineVariableAST(graphqlAST) { | ||
var inlineVarName = curPath.node.specifiers[0].local.name; | ||
return (0, _babylon.parse)('const ' + inlineVarName + ' = ' + JSON.stringify(graphqlAST)).program.body[0]; | ||
} | ||
@@ -61,0 +60,0 @@ } |
{ | ||
"name": "babel-plugin-inline-import-graphql-ast", | ||
"version": "2.0.1-rc.0", | ||
"version": "2.0.1-rc.1", | ||
"description": "Babel plugin to make raw files importable", | ||
@@ -5,0 +5,0 @@ "author": "Alexander Roberts <detrohutt@gmail.com>", |
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
11150
94