Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@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 2,202,822 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 4 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.