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

babel-relay-plugin

Package Overview
Dependencies
Maintainers
8
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-relay-plugin - npm Package Compare versions

Comparing version 0.6.3 to 0.7.0-rc.2

lib/HASH

2

lib/babelAdapter.js
// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -5,0 +5,0 @@ *

// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -5,0 +5,0 @@ *

// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -100,5 +100,13 @@ *

var p = path;
var propName = null;
while (!propName && (p = p.parentPath)) {
if (p.isProperty()) {
propName = p.node.key.name;
}
}
var result = undefined;
try {
result = transformer.transform(t, node.quasi, documentName, tagName);
result = transformer.transform(t, node.quasi, documentName, tagName, propName);
} catch (error) {

@@ -105,0 +113,0 @@ // Print a console warning and replace the code with a function

// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -5,0 +5,0 @@ *

// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -20,6 +20,11 @@ *

name: 'relay',
description: 'The @relay directive on fragments.',
description: 'The @relay directive.',
args: [{
name: 'isConnectionWithoutNodeID',
description: 'Marks a connection field as containing nodes without `id` fields. ' + 'This is used to silence the warning when diffing connections.',
type: types.GraphQLBoolean,
defaultValue: null
}, {
name: 'pattern',
description: 'Marks a fragment as intended for pattern matching (as ' + 'opposed to fetching).',
description: 'Marks a fragment as intended for pattern matching (as opposed to ' + 'fetching).',
type: types.GraphQLBoolean,

@@ -35,3 +40,3 @@ defaultValue: null

onFragment: true,
onField: false
onField: true
};
// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -5,0 +5,0 @@ *

// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -101,2 +101,9 @@ *

}, {
key: 'hasDirective',
value: function hasDirective(name) {
return (this.ast.directives || []).some(function (d) {
return d.name.value === name;
});
}
}, {
key: 'isPattern',

@@ -455,2 +462,7 @@ value: function isPattern() {

_createClass(RelayQLType, [{
key: 'canHaveSubselections',
value: function canHaveSubselections() {
return !(this.schemaUnmodifiedType instanceof types.GraphQLScalarType || this.schemaUnmodifiedType instanceof types.GraphQLEnumType);
}
}, {
key: 'getName',

@@ -578,7 +590,2 @@ value: function getName(_ref) {

}, {
key: 'isScalar',
value: function isScalar() {
return this.schemaUnmodifiedType instanceof types.GraphQLScalarType;
}
}, {
key: 'isConnection',

@@ -590,11 +597,11 @@ value: function isConnection() {

var edges = this.getFieldDefinition('edges');
if (!edges || edges.getType().isScalar()) {
if (!edges || !edges.getType().canHaveSubselections()) {
return false;
}
var node = edges.getType().getFieldDefinition('node');
if (!node || node.getType().isScalar()) {
if (!node || !node.getType().canHaveSubselections()) {
return false;
}
var cursor = edges.getType().getFieldDefinition('cursor');
if (!cursor || !cursor.getType().isScalar()) {
if (!cursor || cursor.getType().canHaveSubselections()) {
return false;

@@ -601,0 +608,0 @@ }

// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -59,2 +59,3 @@ *

var EMPTY_ARRAY = t.arrayExpression([]);
var FIELDS = formatFields({

@@ -182,3 +183,3 @@ __typename: '__typename',

}
var selections = this.printSelections(fragment, requisiteFields, idFragment ? [idFragment] : null);
var selections = this.printSelections(fragment, requisiteFields, idFragment ? [idFragment] : null, fragment.hasDirective('generated'));
var metadata = this.printRelayDirectiveMetadata(fragment, {

@@ -266,4 +267,7 @@ isAbstract: fragmentType.isAbstract()

var isGeneratedQuery = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
var fields = [];
var printedFragments = [];
var didPrintFragmentReference = false;
parent.getSelections().forEach(function (selection) {

@@ -274,2 +278,3 @@ if (selection instanceof RelayQLFragmentSpread) {

printedFragments.push(_this.printFragmentReference(selection));
didPrintFragmentReference = true;
} else if (selection instanceof RelayQLInlineFragment) {

@@ -288,7 +293,8 @@ printedFragments.push(_this.printFragment(selection.getFragment()));

}
var printedFields = this.printFields(fields, parent, requisiteFields);
var printedFields = this.printFields(fields, parent, requisiteFields, isGeneratedQuery);
var selections = [].concat(_toConsumableArray(printedFields), printedFragments);
if (selections.length) {
return t.arrayExpression(selections);
var arrayExpressionOfSelections = t.arrayExpression(selections);
return didPrintFragmentReference ? shallowFlatten(arrayExpressionOfSelections) : arrayExpressionOfSelections;
}

@@ -302,2 +308,4 @@ return NULL;

var isGeneratedQuery = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
var parentType = parent.getType();

@@ -315,3 +323,3 @@ if (parentType.isConnection() && parentType.hasField(FIELDS.pageInfo) && fields.some(function (field) {

delete generatedFields[field.getName()];
printedFields.push(_this2.printField(field, parent, requisiteFields, generatedFields));
printedFields.push(_this2.printField(field, parent, requisiteFields, generatedFields, isGeneratedQuery));
});

@@ -321,3 +329,3 @@

var generatedField = parentType.generateField(fieldName);
printedFields.push(_this2.printField(generatedField, parent, requisiteFields, generatedFields));
printedFields.push(_this2.printField(generatedField, parent, requisiteFields, generatedFields, isGeneratedQuery));
});

@@ -331,2 +339,4 @@ return printedFields;

var isGeneratedQuery = arguments.length <= 4 || arguments[4] === undefined ? false : arguments[4];
var fieldType = field.getType();

@@ -343,4 +353,9 @@

validateField(field, parent.getType());
if (!isGeneratedQuery) {
validateField(field, parent.getType());
}
if (fieldType.canHaveSubselections()) {
metadata.canHaveSubselections = true;
}
// TODO: Generalize to non-`Node` types.

@@ -353,3 +368,5 @@ if (fieldType.alwaysImplements('Node')) {

if (field.hasDeclaredArgument('first') || field.hasDeclaredArgument('last')) {
validateConnectionField(field);
if (!isGeneratedQuery) {
validateConnectionField(field);
}
metadata.isConnection = true;

@@ -381,3 +398,3 @@ if (field.hasDeclaredArgument('find')) {

var selections = this.printSelections(field, requisiteFields, idFragment ? [idFragment] : null);
var selections = this.printSelections(field, requisiteFields, idFragment ? [idFragment] : null, isGeneratedQuery);
var fieldAlias = field.getAlias();

@@ -396,3 +413,3 @@ var args = field.getArguments();

kind: t.valueToNode('Field'),
metadata: objectify(metadata),
metadata: this.printRelayDirectiveMetadata(field, metadata),
type: t.valueToNode(fieldType.getName({ modifiers: false }))

@@ -467,3 +484,3 @@ });

}
printedDirectives.push(t.objectExpression([property('kind', t.valueToNode('Directive')), property('name', t.valueToNode(directive.getName())), property('arguments', t.arrayExpression(directive.getArguments().map(function (arg) {
printedDirectives.push(t.objectExpression([property('kind', t.valueToNode('Directive')), property('name', t.valueToNode(directive.getName())), property('args', t.arrayExpression(directive.getArguments().map(function (arg) {
return t.objectExpression([property('name', t.valueToNode(arg.getName())), property('value', _this5.printArgumentValue(arg))]);

@@ -616,3 +633,7 @@ })))]));

function shallowFlatten(arr) {
return t.callExpression(t.memberExpression(t.memberExpression(EMPTY_ARRAY, t.identifier('concat')), t.identifier('apply')), [EMPTY_ARRAY, arr]);
}
return RelayQLPrinter;
};
// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -59,3 +59,3 @@ *

value: function transform(t, // Babel
node, documentName, tagName) {
node, documentName, tagName, propName) {
var _processTemplateLiteral = this.processTemplateLiteral(node, documentName);

@@ -67,3 +67,3 @@

var documentText = this.processTemplateText(templateText, documentName);
var documentText = this.processTemplateText(templateText, documentName, propName);
var definition = this.processDocumentText(documentText, documentName);

@@ -112,3 +112,3 @@

key: 'processTemplateText',
value: function processTemplateText(templateText, documentName) {
value: function processTemplateText(templateText, documentName, propName) {
var pattern = /^(fragment|mutation|query|subscription)\s*(\w*)?([\s\S]*)/;

@@ -122,3 +122,3 @@ var matches = pattern.exec(templateText);

if (type === 'fragment' && name === 'on') {
name = documentName;
name = documentName + (propName ? '_' + capitalize(propName) : '') + 'RelayQL';
rest = 'on' + rest;

@@ -125,0 +125,0 @@ }

// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -5,0 +5,0 @@ *

// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -5,0 +5,0 @@ *

// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -5,0 +5,0 @@ *

// @generated
/**
* Copyright 2013-2015, Facebook, Inc.
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.

@@ -5,0 +5,0 @@ *

{
"name": "babel-relay-plugin",
"version": "0.6.3",
"version": "0.7.0-rc.2",
"description": "Babel Relay Plugin for transpiling GraphQL queries for use with Relay.",

@@ -23,8 +23,7 @@ "license": "BSD-3-Clause",

"devDependencies": {
"babel": "^5.8.23",
"babel-core": "^5.8.25",
"babel-core": "^5.8.35",
"babel-jest": "^5.3.0",
"flow-bin": "0.17.0",
"flow-bin": "0.21.0",
"glob": "^5.0.15",
"jest-cli": "^0.8.1",
"jest-cli": "^0.8.2",
"minimist": "^1.1.3",

@@ -35,3 +34,3 @@ "mkdirp": "^0.5.1",

"dependencies": {
"graphql": "0.4.13"
"graphql": "0.4.17"
},

@@ -38,0 +37,0 @@ "jest": {

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