Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-tag

Package Overview
Dependencies
Maintainers
6
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-tag - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

yarn.lock

1

CHANGELOG.md
# Change log
### vNEXT
- Add support for calling `gql` as a function [matthewerwin](https://github.com/matthewerwin) in [PR #66](https://github.com/apollographql/graphql-tag/pull/66)

@@ -4,0 +5,0 @@ ### v2.0.0

2

lib/graphql-tag.umd.js

@@ -155,3 +155,3 @@ (function (global, factory) {

// We always get literals[0] and then matching post literals for each arg given
var result = literals[0];
var result = (typeof(literals) === "string") ? literals : literals[0];

@@ -158,0 +158,0 @@ for (var i = 1; i < args.length; i++) {

@@ -10,3 +10,19 @@ "use strict";

const lines = source.split('\n');
let outputCode = "";
let outputCode = `
var names = {};
function unique(defs) {
return defs.filter(
function(def) {
if (def.kind !== 'FragmentDefinition') return true;
var name = def.name.value
if (names[name]) {
return false;
} else {
names[name] = true;
return true;
}
}
)
}
`;

@@ -17,3 +33,3 @@ lines.some((line) => {

const parseDocument = `require(${importFile})`;
const appendDef = `doc.definitions = doc.definitions.concat(${parseDocument}.definitions);`;
const appendDef = `doc.definitions = doc.definitions.concat(unique(${parseDocument}.definitions));`;
outputCode += appendDef + "\n";

@@ -30,3 +46,6 @@ }

const doc = gql`${source}`;
const outputCode = `var doc = ${JSON.stringify(doc)};`;
const outputCode = `
var doc = ${JSON.stringify(doc)};
doc.loc.source = ${JSON.stringify(doc.loc.source)};
`;
const importOutputCode = expandImports(source, doc);

@@ -33,0 +52,0 @@

{
"name": "graphql-tag",
"version": "2.0.0",
"version": "2.1.0",
"description": "A JavaScript template literal tag that parses GraphQL queries",

@@ -5,0 +5,0 @@ "main": "./lib/graphql-tag.umd.js",

@@ -9,4 +9,2 @@ # graphql-tag

- `gql` A JavaScript template literal tag that parses GraphQL query strings into the standard GraphQL AST.
- `/parser` A bundled version of `graphql/language/parser`, that builds correctly in React Native.
- `/printer` A bundled version of `graphql/language/printer`, that builds correctly in React Native.
- `/loader` A webpack loader to preprocess queries

@@ -94,15 +92,1 @@

Testing environments that don't support Webpack require additional configuration. For [Jest](https://facebook.github.io/jest/) use [jest-transform-graphql](https://github.com/remind101/jest-transform-graphql).
### Parser and printer
This package also includes two submodules: `graphql-tag/printer` and `graphql-tag/parser`, which are bundled versions of the corresponding modules from the standard `graphql` package. These are included because the `graphql` package currently doesn't build in **React Native**. Use them the same way you would use the relevant modules from `graphql`:
```js
import { parse } from 'graphql-tag/parser';
import { print } from 'graphql-tag/printer';
```
#### Why are these included in the source on GitHub?
We generate the bundles for the printer and parser with Webpack from the `graphql` package. You might notice the bundles are included in the package source on GitHub. This is to enable easy installation from a Git URL in cases where that is helpful. In the case of updates to `graphql` printing or parsing (which should be very rare since the syntax is stable at this point), we will be able to easily run the build script and republish.

@@ -149,3 +149,3 @@ var parser = require('graphql/language/parser');

// We always get literals[0] and then matching post literals for each arg given
var result = literals[0];
var result = (typeof(literals) === "string") ? literals : literals[0];

@@ -152,0 +152,0 @@ for (var i = 1; i < args.length; i++) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc