New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@anders-nom/babel-plugin-import-graphql-string

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anders-nom/babel-plugin-import-graphql-string - npm Package Compare versions

Comparing version 2.8.1-9 to 2.8.1-10

30

build/customImport.js

@@ -44,15 +44,25 @@ "use strict";

function _getSources(filepath, resolve, acc) {
var path = filepath.replace(/'/g, '');
var importSrc = (0, _fs.readFileSync)(path).toString();
var nestedPaths = getFilepaths(importSrc, filepath, resolve);
var srcAndPath = {
src: importSrc,
path
};
var srcs = nestedPaths.length > 0 ? _toConsumableArray(nestedPaths.reduce(function (srcArr, fp) {
return _toConsumableArray(srcArr).concat(_toConsumableArray(getSources(fp, resolve, [])));
}, [])).concat([srcAndPath]) : [srcAndPath];
return _toConsumableArray(srcs).concat(_toConsumableArray(acc));
}
function getSources(filepath, resolve) {
var acc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
var previouslyImported = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
var importSrc = (0, _fs.readFileSync)(filepath.replace(/'/g, '')).toString();
var nestedPaths = getFilepaths(importSrc, filepath, resolve).filter(function (path) {
return !previouslyImported.some(function (prevPath) {
return path === prevPath;
});
return _getSources(filepath, resolve, acc).filter(function (srcAndPath, index, array) {
return array.findIndex(function (item) {
return item.path === srcAndPath.path;
}) === index;
}).map(function (srcAndPath) {
return srcAndPath.src;
});
var srcs = nestedPaths.length > 0 ? _toConsumableArray(nestedPaths.reduce(function (srcArr, fp) {
return _toConsumableArray(srcArr).concat(_toConsumableArray(getSources(fp, resolve, [], _toConsumableArray(nestedPaths).concat(_toConsumableArray(previouslyImported)))));
}, [])).concat([importSrc]) : [importSrc];
return _toConsumableArray(srcs).concat(_toConsumableArray(acc));
}

@@ -57,3 +57,3 @@ "use strict";

return imports.reduce(function (acc, fp) {
return _toConsumableArray(acc).concat(_toConsumableArray(customImport.getSources(fp, resolve, [], imports)));
return _toConsumableArray(acc).concat(_toConsumableArray(customImport.getSources(fp, resolve, [])));
}, []).map(stripImportStatements).join('') + stripImportStatements(source);

@@ -60,0 +60,0 @@ }

{
"name": "@anders-nom/babel-plugin-import-graphql-string",
"version": "2.8.1-9",
"version": "2.8.1-10",
"description": "Babel plugin to make .gql/.graphql files importable",

@@ -5,0 +5,0 @@ "author": "A.J. 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