Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
graphql-tag.macro
Advanced tools
Readme
Babel Macro for the graphql-tag library.
It inlines the result of parsing the GraphQL queries with graphql-tag
.
Converts this:
const query = gql`
query {
hello {
world
}
}
`;
To this:
const query = {
'kind': 'Document',
'definitions': [{
'kind': 'OperationDefinition',
'operation': 'query',
'variableDefinitions': [],
'directives': [],
'selectionSet': {
'kind': 'SelectionSet',
'selections': [{
'kind': 'Field',
'alias': null,
'name': {
'kind': 'Name',
'value': 'hello'
},
'arguments': [],
'directives': [],
'selectionSet': {
'kind': 'SelectionSet',
'selections': [{
'kind': 'Field',
'alias': null,
'name': {
'kind': 'Name',
'value': 'world'
},
'arguments': [],
'directives': [],
'selectionSet': null
}]
}
}]
}
}],
'loc': {
'start': 0,
'end': 45,
'source': {
'body': '\\\\n query {\\\\n hello {\\\\n world\\\\n }\\\\n }\\\\n',
'name': 'GraphQL request',
'locationOffset': {
'line': 1,
'column': 1
}
}
}
};
It also supports adding interpolated fragments:
const frag = gql`
fragment Frag on Hello {
world
}
`;
const query = gql`
query {
hello {
universe
...Frag
}
}
${frag}
`;
To avoid the runtime overhead of parsing a string into a GraphQL AST.
Install and configure babel-macros if you haven't already.
Then install this package:
# with yarn
yarn add -D graphql-tag.macro
# with npm
npm install -D graphql-tag.macro
The usage is the same as using graphql-tag directly, the only difference is that you have to import gql
from the macro now:
import gql from 'graphql-tag.macro';
const query = gql`
query {
hello {
world
}
}
`;
FAQs
graphql-tag as a babel-macro
The npm package graphql-tag.macro receives a total of 5,658 weekly downloads. As such, graphql-tag.macro popularity was classified as popular.
We found that graphql-tag.macro 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.