babel-plugin-inline-import-graphql-ast
Advanced tools
Comparing version 2.0.3-beta.1 to 2.0.3-beta.2
@@ -15,2 +15,6 @@ Object.defineProperty(exports, "__esModule", { | ||
var _babelTemplate = require('babel-template'); | ||
var _babelTemplate2 = _interopRequireDefault(_babelTemplate); | ||
var _babylon = require('babylon'); | ||
@@ -53,9 +57,12 @@ | ||
query.makeSourceEnumerable(); | ||
curPath.replaceWithMultiple(buildInlineVariableAST(query.ast)); | ||
curPath.replaceWith(buildInlineVariableAST(query.ast)); | ||
} | ||
function buildInlineVariableAST(graphqlAST) { | ||
var inlineVarName = curPath.node.specifiers[0].local.name; | ||
var inlineVarStatement = 'const ' + inlineVarName + ' = ' + JSON.stringify(graphqlAST) + ';' + _os.EOL; | ||
return (0, _babylon.parse)(inlineVarStatement).program.body; | ||
var buildAST = (0, _babelTemplate2.default)('\n const QUERY_NAME = GQL_AST;\n '); | ||
return buildAST({ | ||
QUERY_NAME: t.identifier(curPath.node.specifiers[0].local.name), | ||
GQL_AST: (0, _babylon.parseExpression)(JSON.stringify(graphqlAST)) | ||
}); | ||
} | ||
@@ -62,0 +69,0 @@ } |
{ | ||
"name": "babel-plugin-inline-import-graphql-ast", | ||
"version": "2.0.3-beta.1", | ||
"version": "2.0.3-beta.2", | ||
"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
2
11422
5
99