Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@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,953,606 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 3 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.