Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
@graphql-tools/graphql-file-loader
Advanced tools
A set of utils for faster development of GraphQL tools
The @graphql-tools/graphql-file-loader package is a utility that allows you to load GraphQL schema definitions and type definitions from .graphql and .gql files. It integrates with other GraphQL tools to enable you to construct your GraphQL schema in a modular and organized way using separate files for different parts of your schema.
Loading GraphQL schema files
This feature allows you to load a GraphQL schema from a .graphql or .gql file synchronously. The `loadSchemaSync` function is used in conjunction with the `GraphQLFileLoader` to read the schema file and construct a GraphQLSchema object.
const { loadSchemaSync } = require('@graphql-tools/load');
const { GraphQLFileLoader } = require('@graphql-tools/graphql-file-loader');
const schema = loadSchemaSync('path/to/schema.graphql', {
loaders: [new GraphQLFileLoader()]
});
Loading GraphQL type definitions
This feature allows you to load GraphQL type definitions from a file. The `loadTypedefsSync` function is used to read type definitions from a .graphql or .gql file and can be used to compose a schema programmatically.
const { loadTypedefsSync } = require('@graphql-tools/load');
const { GraphQLFileLoader } = require('@graphql-tools/graphql-file-loader');
const typeDefs = loadTypedefsSync('path/to/types.graphql', {
loaders: [new GraphQLFileLoader()]
});
The graphql-import package allows you to import and use .graphql files in your JavaScript and TypeScript projects. It provides functionality similar to @graphql-tools/graphql-file-loader but with a different API and additional features like importing specific types from a schema file.
graphql-tag is a package that provides a template literal tag to parse GraphQL queries. While it does not directly load schema files, it is commonly used to define GraphQL queries and fragments within JavaScript files, which can then be composed into a full schema.
FAQs
A set of utils for faster development of GraphQL tools
The npm package @graphql-tools/graphql-file-loader receives a total of 3,167,729 weekly downloads. As such, @graphql-tools/graphql-file-loader popularity was classified as popular.
We found that @graphql-tools/graphql-file-loader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.