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

@graphql-toolkit/graphql-file-loader

Package Overview
Dependencies
Maintainers
2
Versions
686
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.6.1-alpha.0 to 0.6.1-alpha.1

1

dist/commonjs/load-from-gql-file.d.ts
import { Source, UniversalLoader, DocumentPointerSingle, SchemaPointerSingle } from '@graphql-toolkit/common';
export declare type GraphQLFileLoaderOptions = {
skipGraphQLImport: boolean;
cwd?: string;
};

@@ -5,0 +6,0 @@ export declare class GraphQLFileLoader implements UniversalLoader<GraphQLFileLoaderOptions> {

7

dist/commonjs/load-from-gql-file.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const graphql_1 = require("graphql");
const path_1 = require("path");
const graphql_1 = require("graphql");
const GQL_EXTENSIONS = ['.gql', '.graphql', '.graphqls'];

@@ -16,7 +16,8 @@ class GraphQLFileLoader {

const { readFileSync } = eval(`require('fs')`);
const content = readFileSync(pointer, 'utf-8').trim();
const normalizedFilePath = path_1.isAbsolute(pointer) ? pointer : path_1.resolve(options.cwd || process.cwd(), pointer);
const content = readFileSync(normalizedFilePath, 'utf-8').trim();
if (content && content !== '') {
if (!options.skipGraphQLImport && /^\#.*import /i.test(content.trimLeft())) {
const { importSchema } = eval(`require('graphql-import')`);
const importedSchema = importSchema(pointer);
const importedSchema = importSchema(normalizedFilePath);
return {

@@ -23,0 +24,0 @@ location: pointer,

import { Source, UniversalLoader, DocumentPointerSingle, SchemaPointerSingle } from '@graphql-toolkit/common';
export declare type GraphQLFileLoaderOptions = {
skipGraphQLImport: boolean;
cwd?: string;
};

@@ -5,0 +6,0 @@ export declare class GraphQLFileLoader implements UniversalLoader<GraphQLFileLoaderOptions> {

@@ -1,3 +0,3 @@

import { extname } from 'path';
import { parse, Source as GraphQLSource } from 'graphql';
import { extname, isAbsolute, resolve } from 'path';
const GQL_EXTENSIONS = ['.gql', '.graphql', '.graphqls'];

@@ -14,7 +14,8 @@ export class GraphQLFileLoader {

const { readFileSync } = eval(`require('fs')`);
const content = readFileSync(pointer, 'utf-8').trim();
const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd || process.cwd(), pointer);
const content = readFileSync(normalizedFilePath, 'utf-8').trim();
if (content && content !== '') {
if (!options.skipGraphQLImport && /^\#.*import /i.test(content.trimLeft())) {
const { importSchema } = eval(`require('graphql-import')`);
const importedSchema = importSchema(pointer);
const importedSchema = importSchema(normalizedFilePath);
return {

@@ -21,0 +22,0 @@ location: pointer,

{
"name": "@graphql-toolkit/graphql-file-loader",
"version": "0.6.1-alpha.0+3df87a4",
"version": "0.6.1-alpha.1+d6f9b6c",
"description": "A set of utils for faster development of GraphQL tools",

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

"dependencies": {
"@graphql-toolkit/common": "0.6.1-alpha.0+3df87a4",
"@graphql-toolkit/common": "0.6.1-alpha.1+d6f9b6c",
"graphql-import": "0.7.1"

@@ -35,3 +35,3 @@ },

},
"gitHead": "3df87a45d93be1264e0dcaf3c9c95bbb40849b1d"
"gitHead": "d6f9b6ca3afbd75dfc36870b3fdc5b1114f215b1"
}

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