Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-inline-import-graphql-ast

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-inline-import-graphql-ast - npm Package Compare versions

Comparing version 2.0.1-beta.4 to 2.0.1-rc.0

24

build/index.js

@@ -9,2 +9,4 @@ Object.defineProperty(exports, "__esModule", {

var _path2 = _interopRequireDefault(_path);
var _os = require('os');

@@ -26,5 +28,17 @@

var resolve = void 0;
exports.default = function (_ref) {
var t = _ref.types;
return {
manipulateOptions: function manipulateOptions(_ref2) {
var resolveModuleSource = _ref2.resolveModuleSource;
if (!resolve) {
resolve = resolveModuleSource || function (src, file) {
return _path2.default.resolve((0, _path.dirname)(file), src);
};
}
},
visitor: {

@@ -55,3 +69,3 @@ ImportDeclaration: {

function createQuery(queryPath, babelPath) {
var absPath = (0, _path.resolve)((0, _path.dirname)(babelPath), queryPath);
var absPath = resolve(queryPath, babelPath);
var source = (0, _fs.readFileSync)(absPath).toString();

@@ -63,3 +77,3 @@ var ast = null;

processFragments: function processFragments() {
processImports(getImportStatements(source), (0, _path.dirname)(absPath));
processImports(getImportStatements(source), absPath);

@@ -72,10 +86,10 @@ function getImportStatements(src) {

function processImports(imports, relDir) {
function processImports(imports, relFile) {
imports.forEach(function (statement) {
var fragmentPath = statement.split(' ')[1].slice(1, -1);
var absFragmentPath = (0, _path.resolve)(relDir, fragmentPath);
var absFragmentPath = resolve(fragmentPath, relFile);
var fragmentSource = (0, _fs.readFileSync)(absFragmentPath).toString();
var subFragments = getImportStatements(fragmentSource);
if (subFragments.length > 0) {
processImports(subFragments, (0, _path.dirname)(absFragmentPath));
processImports(subFragments, absFragmentPath);
}

@@ -82,0 +96,0 @@ fragmentDefs = [].concat(_toConsumableArray((0, _graphqlTag2.default)(_templateObject, fragmentSource).definitions), _toConsumableArray(fragmentDefs));

{
"name": "babel-plugin-inline-import-graphql-ast",
"version": "2.0.1-beta.4",
"version": "2.0.1-rc.0",
"description": "Babel plugin to make raw files importable",

@@ -5,0 +5,0 @@ "author": "Alexander Roberts <detrohutt@gmail.com>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc