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.7.2 to 0.7.3

5

lib/babelAdapter.js

@@ -18,7 +18,6 @@ // @generated

var babel = require('babel-core');
var path = require('path');
function babelAdapter(Plugin, t, name, visitorsBuilder) {
if (Plugin == null || /^6\./.test(babel.version)) {
function babelAdapter(Plugin, t, babelVersion, name, visitorsBuilder) {
if (Plugin == null || /^6\./.test(babelVersion)) {
// Babel 6.

@@ -25,0 +24,0 @@ return visitorsBuilder(t);

3

lib/getBabelRelayPlugin.js

@@ -49,4 +49,5 @@ // @generated

var types = _ref.types;
var version = _ref.version;
return babelAdapter(Plugin, types, 'relay-query', function (t) {
return babelAdapter(Plugin, types, version, 'relay-query', function (t) {
return {

@@ -53,0 +54,0 @@ visitor: {

@@ -27,2 +27,7 @@ // @generated

}, {
name: 'isStaticFragment',
description: 'Marks a fragment as static. A static fragment will share the same ' + 'identity regardless of how many times the expression is evaluated.',
type: types.GraphQLBoolean,
defaultValue: null
}, {
name: 'pattern',

@@ -29,0 +34,0 @@ description: 'Marks a fragment as intended for pattern matching (as opposed to ' + 'fetching).',

@@ -142,17 +142,28 @@ // @generated

var relayDirectiveArgs = {};
var relayDirective = (ast.directives || []).find(function (directive) {
return directive.name.value === 'relay';
});
if (relayDirective) {
(relayDirective.arguments || []).forEach(function (arg) {
relayDirectiveArgs[arg.name.value] = arg.value;
});
}
// @relay(pattern: true)
var isPattern = (ast.directives || []).some(function (directive) {
return directive.name.value === 'relay' && (directive.arguments || []).some(function (arg) {
return arg.name.value === 'pattern' && arg.value.kind === 'BooleanValue' && arg.value.value;
});
});
var isPattern = relayDirectiveArgs.pattern && relayDirectiveArgs.pattern.kind === 'BooleanValue' && relayDirectiveArgs.pattern.value;
// @relay(isStaticFragment: true)
var isStaticFragment = relayDirectiveArgs.isStaticFragment && relayDirectiveArgs.isStaticFragment.kind === 'BooleanValue' && relayDirectiveArgs.isStaticFragment.value;
_get(Object.getPrototypeOf(RelayQLFragment.prototype), 'constructor', this).call(this, _extends({}, context, { isPattern: isPattern }), ast);
this.fragmentID = null;
this.hasStaticFragmentID = isStaticFragment;
this.parentType = parentType;
this.staticFragmentID = null;
}
_createClass(RelayQLFragment, [{
key: 'getFragmentID',
value: function getFragmentID() {
if (this.fragmentID == null) {
key: 'getStaticFragmentID',
value: function getStaticFragmentID() {
if (this.hasStaticFragmentID && this.staticFragmentID == null) {
var suffix = this.context.generateID();

@@ -162,5 +173,5 @@ // The fragmentLocationID is the same for all inline/nested fragments

// suffix distinguishes these fragments from each other.
this.fragmentID = this.context.fragmentLocationID + ':' + suffix;
this.staticFragmentID = this.context.fragmentLocationID + ':' + suffix;
}
return this.fragmentID;
return this.staticFragmentID;
}

@@ -167,0 +178,0 @@ }, {

@@ -190,3 +190,3 @@ // @generated

directives: this.printDirectives(fragment.getDirectives()),
id: t.valueToNode(fragment.getFragmentID()),
id: this.printFragmentID(fragment),
kind: t.valueToNode('Fragment'),

@@ -199,2 +199,12 @@ metadata: metadata,

}, {
key: 'printFragmentID',
value: function printFragmentID(fragment) {
var staticFragmentID = fragment.getStaticFragmentID();
if (staticFragmentID == null) {
return t.callExpression(t.memberExpression(identify(this.tagName), t.identifier('__id')), []);
} else {
return t.valueToNode(staticFragmentID);
}
}
}, {
key: 'printMutation',

@@ -201,0 +211,0 @@ value: function printMutation(mutation) {

{
"name": "babel-relay-plugin",
"version": "0.7.2",
"version": "0.7.3",
"description": "Babel Relay Plugin for transpiling GraphQL queries for use with Relay.",

@@ -5,0 +5,0 @@ "license": "BSD-3-Clause",

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