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

@graphql-toolkit/file-loading

Package Overview
Dependencies
Maintainers
3
Versions
713
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-toolkit/file-loading - npm Package Compare versions

Comparing version 0.6.8-alpha-53e458f.3 to 0.6.8-alpha-8d0ed22.2

30

dist/commonjs/file-scanner.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const graphql_1 = require("graphql");
const fs_1 = require("fs");
const glob = require("glob");
const path_1 = require("path");
const DEFAULT_IGNORED_SCHEMA_EXTENSIONS = ['spec', 'test', 'd', 'map'];

@@ -11,8 +14,6 @@ const DEFAULT_SCHEMA_EXTENSIONS = ['gql', 'graphql', 'graphqls', 'ts', 'js'];

function isDirectory(path) {
const fs = eval(`require('fs')`);
return fs.existsSync(path) && fs.statSync(path).isDirectory();
return fs_1.existsSync(path) && fs_1.statSync(path).isDirectory();
}
function scanForFiles(globStr, globOptions = {}) {
const { sync } = eval(`require('glob')`);
return sync(globStr, { absolute: true, ...globOptions });
return glob.sync(globStr, { absolute: true, ...globOptions });
}

@@ -62,6 +63,5 @@ function buildGlob(basePath, extensions, ignoredExtensions = [], recursive) {

}
const { extname } = eval(`require('path')`);
const extension = extname(path);
const extension = path_1.extname(path);
if (extension.endsWith('.js') || extension.endsWith('.ts') || execOptions.useRequire) {
const fileExports = (execOptions.requireMethod ? execOptions.requireMethod : eval('require'))(path);
const fileExports = (execOptions.requireMethod ? execOptions.requireMethod : require)(path);
const extractedExport = extractExports(fileExports, execOptions.exportNames);

@@ -74,4 +74,3 @@ if (extractedExport && extractedExport.kind === 'Document') {

else {
const { readFileSync } = eval(`require('fs')`);
return readFileSync(path, { encoding: 'utf-8' });
return fs_1.readFileSync(path, { encoding: 'utf-8' });
}

@@ -103,3 +102,3 @@ })

try {
const fileExports = (execOptions.requireMethod ? execOptions.requireMethod : eval('require'))(path);
const fileExports = (execOptions.requireMethod ? execOptions.requireMethod : require)(path);
return extractExports(fileExports, execOptions.exportNames);

@@ -115,3 +114,2 @@ }

function scanForFilesAsync(globStr, globOptions = {}) {
const glob = eval(`require('glob')`);
return new Promise((resolve, reject) => glob(globStr, { absolute: true, ...globOptions }, (err, matches) => {

@@ -147,3 +145,3 @@ if (err) {

const relevantPaths = await scanForFilesAsync(isDirectory(path) ? buildGlob(path, execOptions.extensions, execOptions.ignoredExtensions, execOptions.recursive) : path, options.globOptions);
const require$ = (path) => Promise.resolve().then(() => eval(`require('${path}')`));
const require$ = (path) => Promise.resolve().then(() => require(path));
return Promise.all(relevantPaths

@@ -157,4 +155,3 @@ .map(async (path) => {

}
const { extname } = eval(`require('path')`);
const extension = extname(path);
const extension = path_1.extname(path);
if (extension.endsWith('.js') || extension.endsWith('.ts') || execOptions.useRequire) {

@@ -170,4 +167,3 @@ const fileExports = await (execOptions.requireMethod ? execOptions.requireMethod : require$)(path);

return new Promise((resolve, reject) => {
const { readFile } = eval(`require('fs')`);
readFile(path, { encoding: 'utf-8' }, (err, data) => {
fs_1.readFile(path, { encoding: 'utf-8' }, (err, data) => {
if (err) {

@@ -187,3 +183,3 @@ reject(err);

const relevantPaths = await scanForFilesAsync(isDirectory(path) ? buildGlob(path, execOptions.extensions, execOptions.ignoredExtensions, execOptions.recursive) : path, options.globOptions);
const require$ = (path) => Promise.resolve().then(() => eval(`require('${path}')`));
const require$ = (path) => Promise.resolve().then(() => require(path));
return Promise.all(relevantPaths.map(async (path) => {

@@ -190,0 +186,0 @@ if (!checkExtension(path, options)) {

import { print } from 'graphql';
import { existsSync, statSync, readFileSync, readFile } from 'fs';
import * as glob from 'glob';
import { extname } from 'path';
const DEFAULT_IGNORED_SCHEMA_EXTENSIONS = ['spec', 'test', 'd', 'map'];

@@ -9,8 +12,6 @@ const DEFAULT_SCHEMA_EXTENSIONS = ['gql', 'graphql', 'graphqls', 'ts', 'js'];

function isDirectory(path) {
const fs = eval(`require('fs')`);
return fs.existsSync(path) && fs.statSync(path).isDirectory();
return existsSync(path) && statSync(path).isDirectory();
}
function scanForFiles(globStr, globOptions = {}) {
const { sync } = eval(`require('glob')`);
return sync(globStr, { absolute: true, ...globOptions });
return glob.sync(globStr, { absolute: true, ...globOptions });
}

@@ -60,6 +61,5 @@ function buildGlob(basePath, extensions, ignoredExtensions = [], recursive) {

}
const { extname } = eval(`require('path')`);
const extension = extname(path);
if (extension.endsWith('.js') || extension.endsWith('.ts') || execOptions.useRequire) {
const fileExports = (execOptions.requireMethod ? execOptions.requireMethod : eval('require'))(path);
const fileExports = (execOptions.requireMethod ? execOptions.requireMethod : require)(path);
const extractedExport = extractExports(fileExports, execOptions.exportNames);

@@ -72,3 +72,2 @@ if (extractedExport && extractedExport.kind === 'Document') {

else {
const { readFileSync } = eval(`require('fs')`);
return readFileSync(path, { encoding: 'utf-8' });

@@ -100,3 +99,3 @@ }

try {
const fileExports = (execOptions.requireMethod ? execOptions.requireMethod : eval('require'))(path);
const fileExports = (execOptions.requireMethod ? execOptions.requireMethod : require)(path);
return extractExports(fileExports, execOptions.exportNames);

@@ -111,3 +110,2 @@ }

function scanForFilesAsync(globStr, globOptions = {}) {
const glob = eval(`require('glob')`);
return new Promise((resolve, reject) => glob(globStr, { absolute: true, ...globOptions }, (err, matches) => {

@@ -143,3 +141,3 @@ if (err) {

const relevantPaths = await scanForFilesAsync(isDirectory(path) ? buildGlob(path, execOptions.extensions, execOptions.ignoredExtensions, execOptions.recursive) : path, options.globOptions);
const require$ = (path) => Promise.resolve().then(() => eval(`require('${path}')`));
const require$ = (path) => import(path);
return Promise.all(relevantPaths

@@ -153,3 +151,2 @@ .map(async (path) => {

}
const { extname } = eval(`require('path')`);
const extension = extname(path);

@@ -166,3 +163,2 @@ if (extension.endsWith('.js') || extension.endsWith('.ts') || execOptions.useRequire) {

return new Promise((resolve, reject) => {
const { readFile } = eval(`require('fs')`);
readFile(path, { encoding: 'utf-8' }, (err, data) => {

@@ -182,3 +178,3 @@ if (err) {

const relevantPaths = await scanForFilesAsync(isDirectory(path) ? buildGlob(path, execOptions.extensions, execOptions.ignoredExtensions, execOptions.recursive) : path, options.globOptions);
const require$ = (path) => Promise.resolve().then(() => eval(`require('${path}')`));
const require$ = (path) => import(path);
return Promise.all(relevantPaths.map(async (path) => {

@@ -185,0 +181,0 @@ if (!checkExtension(path, options)) {

{
"name": "@graphql-toolkit/file-loading",
"version": "0.6.8-alpha-53e458f.3+53e458f",
"version": "0.6.8-alpha-8d0ed22.2+8d0ed22",
"description": "A set of utils for faster development of GraphQL tools",

@@ -30,6 +30,6 @@ "repository": "git@github.com:dotansimha/graphql-toolkit.git",

"ts-jest": "24.1.0",
"typescript": "3.7.2"
"typescript": "3.6.3"
},
"dependencies": {
"@graphql-toolkit/common": "0.6.8-alpha-53e458f.3+53e458f",
"@graphql-toolkit/common": "0.6.8-alpha-8d0ed22.2+8d0ed22",
"@kamilkisiela/graphql-tools": "4.0.6",

@@ -41,3 +41,3 @@ "glob": "7.1.5"

},
"gitHead": "53e458fec79c8c8142c60be8fceb9b033b37ffce"
"gitHead": "8d0ed22cd4d440d98f1819f2a45edfbd7003e252"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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