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-23bbb51.1 to 0.6.8-alpha-2cde5e8.4

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'];

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

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

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

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

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

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

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

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

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

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

@@ -145,3 +147,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(() => require(path));
const require$ = (path) => Promise.resolve().then(() => eval(`require('${path}')`));
return Promise.all(relevantPaths

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

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

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

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

@@ -183,3 +187,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(() => require(path));
const require$ = (path) => Promise.resolve().then(() => eval(`require('${path}')`));
return Promise.all(relevantPaths.map(async (path) => {

@@ -186,0 +190,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'];

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

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

@@ -61,5 +60,6 @@ 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 : require)(path);
const fileExports = (execOptions.requireMethod ? execOptions.requireMethod : eval('require'))(path);
const extractedExport = extractExports(fileExports, execOptions.exportNames);

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

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

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

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

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

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

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

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

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

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

@@ -163,2 +166,3 @@ 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) => {

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

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

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

{
"name": "@graphql-toolkit/file-loading",
"version": "0.6.8-alpha-23bbb51.1+23bbb51",
"version": "0.6.8-alpha-2cde5e8.4+2cde5e8",
"description": "A set of utils for faster development of GraphQL tools",

@@ -25,3 +25,3 @@ "repository": "git@github.com:dotansimha/graphql-toolkit.git",

"@types/glob": "7.1.1",
"@types/jest": "24.0.21",
"@types/jest": "24.0.22",
"@types/node": "12.12.5",

@@ -31,6 +31,6 @@ "graphql": "14.5.8",

"ts-jest": "24.1.0",
"typescript": "3.6.3"
"typescript": "3.7.2"
},
"dependencies": {
"@graphql-toolkit/common": "0.6.8-alpha-23bbb51.1+23bbb51",
"@graphql-toolkit/common": "0.6.8-alpha-2cde5e8.4+2cde5e8",
"@kamilkisiela/graphql-tools": "4.0.6",

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

},
"gitHead": "23bbb512598c95e67ba4476ca410e7049655db02"
"gitHead": "2cde5e8f3f6632320d783b2bebf7b57e7274a778"
}

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