Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@ardatan/relay-compiler
Advanced tools
A compiler tool for building GraphQL-driven applications.
@ardatan/relay-compiler is a tool used to compile GraphQL queries, fragments, and mutations into optimized code for use with Relay, a JavaScript framework for building data-driven React applications. It helps in generating efficient and type-safe code, ensuring that the data requirements of your components are met.
Compiling GraphQL Queries
This feature allows you to compile GraphQL queries, fragments, and mutations into optimized code. The `compile` function takes in the schema, documents, and output directory as parameters and generates the necessary files.
const { compile } = require('@ardatan/relay-compiler');
const schema = 'path/to/schema.graphql';
const documents = 'path/to/documents.graphql';
const outputDir = 'path/to/output';
compile({ schema, documents, outputDir }).then(() => {
console.log('Compilation successful!');
}).catch(error => {
console.error('Compilation failed:', error);
});
Generating TypeScript Definitions
This feature allows you to generate TypeScript definitions for your GraphQL queries, fragments, and mutations. By specifying the `language` parameter as 'typescript', the compiler will produce type-safe code.
const { compile } = require('@ardatan/relay-compiler');
const schema = 'path/to/schema.graphql';
const documents = 'path/to/documents.graphql';
const outputDir = 'path/to/output';
const language = 'typescript';
compile({ schema, documents, outputDir, language }).then(() => {
console.log('TypeScript definitions generated!');
}).catch(error => {
console.error('Generation failed:', error);
});
Custom Plugin Support
This feature allows you to extend the functionality of the compiler by using custom plugins. By passing an array of plugins to the `compile` function, you can customize the compilation process to suit your needs.
const { compile } = require('@ardatan/relay-compiler');
const schema = 'path/to/schema.graphql';
const documents = 'path/to/documents.graphql';
const outputDir = 'path/to/output';
const plugins = [require('my-custom-plugin')];
compile({ schema, documents, outputDir, plugins }).then(() => {
console.log('Compilation with custom plugins successful!');
}).catch(error => {
console.error('Compilation failed:', error);
});
The official Relay compiler provided by Facebook. It offers similar functionalities such as compiling GraphQL queries and generating type-safe code. However, @ardatan/relay-compiler may provide additional features or improvements over the official compiler.
A powerful tool for generating code from your GraphQL schema and operations. It supports multiple languages and frameworks, including TypeScript and React. Compared to @ardatan/relay-compiler, it offers a broader range of customization options and plugins.
A tool for generating type-safe code from your GraphQL queries and schema, specifically designed for use with Apollo Client. While it provides similar functionalities, it is more tightly integrated with the Apollo ecosystem compared to @ardatan/relay-compiler.
FAQs
A compiler tool for building GraphQL-driven applications.
The npm package @ardatan/relay-compiler receives a total of 2,753,281 weekly downloads. As such, @ardatan/relay-compiler popularity was classified as popular.
We found that @ardatan/relay-compiler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.