babel-plugin-relay 0.0.0-main-4b1b59eb → 0.0.0-main-d5becbc8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  /**
2
- * Relay v0.0.0-main-4b1b59eb
2
+ * Relay v0.0.0-main-d5becbc8
3
3
  */
4
- module.exports=function(e){var r={};function n(t){if(r[t])return r[t].exports;var i=r[t]={i:t,l:!1,exports:{}};return e[t].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)n.d(t,i,function(r){return e[r]}.bind(null,i));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=1)}([function(e,r){e.exports=require("graphql")},function(e,r,n){"use strict";var t,i=(0,n(2).default)(n(3)),o=n(4),a=n(7),s=n(8),l=s("relay",{searchPlaces:["relay.config.js","relay.config.json","package.json"],loaders:{".json":s.loadJson,".js":s.loadJs,noExt:s.loadYaml}}).searchSync();l&&(t=l.config),e.exports=function(e){var r=e.types;if(!r)throw new Error('BabelPluginRelay: Expected plugin context to include "types", but got:'+String(e));var n={TaggedTemplateExpression:function(e,n){var t=a(e);t&&o(r,e,n,t)}};return{visitor:{Program:function(e,r){e.traverse(n,(0,i.default)((0,i.default)({},r),{},{opts:(0,i.default)((0,i.default)({},t),r.opts)}))}}}}},function(e,r){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,r){e.exports=require("@babel/runtime/helpers/objectSpread2")},function(e,r,n){"use strict";var t=n(5),i=n(0).print,o=n(6),a=o.dirname,s=o.join,l=o.relative,u=o.resolve;e.exports=function(e,r,n,o){var p,d,f,c,g,v,m;if(1!==o.definitions.length)throw new Error("BabelPluginRelay: Expected exactly one definition per graphql tag.");var x=o.definitions[0];if("FragmentDefinition"!==x.kind&&"OperationDefinition"!==x.kind)throw new Error("BabelPluginRelay: Expected a fragment, mutation, query, or subscription, got `"+x.kind+"`.");var h=null!==(p=null===(d=n.opts)||void 0===d?void 0:d.eagerEsModules)&&void 0!==p&&p,b="haste"===(null===(f=n.opts)||void 0===f?void 0:f.jsModuleFormat),y=null===(c=n.opts)||void 0===c?void 0:c.isDevVariableName;return function(e,r,n,o,p){var d=o.name&&o.name.value;if(!d)throw new Error("GraphQL operations and fragments must contain names");var f=d+".graphql",c=p.isHasteMode?f:p.artifactDirectory?function(e,r,n){if(null==e.file)throw new Error("Babel state is missing expected file name");var t=e.file.opts.filename,i=l(a(t),u(r));return(0!==i.length&&i.startsWith(".")?"":"./")+s(i,n)}(r,p.artifactDirectory,f):"./__generated__/"+f,g=t.createHash("md5").update(i(o),"utf8").digest("hex"),v=n.scope;for(;v.parent;)v=v.parent;var m=v.generateUidIdentifier(d),x=e.MemberExpression(m,e.Identifier("hash")),h=function(e,r,n){return e.callExpression(e.memberExpression(e.identifier("console"),e.identifier("error")),[e.stringLiteral("The definition of '".concat(r,"' appears to have changed. Run ")+"`"+n+"` to update the generated files to receive the expected data.")])}(e,d,p.buildCommand),b=e.LogicalExpression("&&",x,e.LogicalExpression("&&",e.BinaryExpression("!==",x,e.StringLiteral(g)),h));if(p.eagerEsModules){var y=e.ImportDeclaration([e.ImportDefaultSpecifier(m)],e.StringLiteral(c));n.findParent((function(e){return e.isProgram()})).unshiftContainer("body",y);var E,q=e.SequenceExpression([b,m]);E=null!=p.isDevVariable?e.ConditionalExpression(e.Identifier(p.isDevVariable),q,m):p.isDevelopment?q:m,n.replaceWith(E)}else{v.push({id:m});var D,w=e.CallExpression(e.Identifier("require"),[e.StringLiteral(c)]),j=e.AssignmentExpression("=",m,w),S=e.SequenceExpression([j,b,m]);D=null!=p.isDevVariable?e.ConditionalExpression(e.Identifier(p.isDevVariable),S,j):p.isDevelopment?S:j;var P=e.UnaryExpression("void",e.NumericLiteral(0));n.replaceWith(e.ConditionalExpression(e.BinaryExpression("!==",m,P),m,D))}}(e,n,r,x,{artifactDirectory:null===(g=n.opts)||void 0===g?void 0:g.artifactDirectory,eagerEsModules:h,buildCommand:null!==(v=null===(m=n.opts)||void 0===m?void 0:m.codegenCommand)&&void 0!==v?v:"relay-compiler",isDevelopment:"production"!==(process.env.BABEL_ENV||"development"),isHasteMode:b,isDevVariable:y})}},function(e,r){e.exports=require("crypto")},function(e,r){e.exports=require("path")},function(e,r,n){"use strict";var t=n(0);e.exports=function(e){if(!e.get("tag").isIdentifier({name:"graphql"}))return null;var r=e.node.quasi.quasis;if(1!==r.length)throw new Error("BabelPluginRelay: Substitutions are not allowed in graphql fragments. Included fragments should be referenced as `...MyModule_propName`.");var n=r[0].value.raw,i=t.parse(n);if(0===i.definitions.length)throw new Error("BabelPluginRelay: Unexpected empty graphql tag.");return i}},function(e,r){e.exports=require("cosmiconfig")}]);
4
+ module.exports=function(e){var r={};function n(t){if(r[t])return r[t].exports;var i=r[t]={i:t,l:!1,exports:{}};return e[t].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)n.d(t,i,function(r){return e[r]}.bind(null,i));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=1)}([function(e,r){e.exports=require("graphql")},function(e,r,n){"use strict";var t,i=(0,n(2).default)(n(3)),o=n(4),a=n(7),l=n(8),s=l("relay",{searchPlaces:["relay.config.js","relay.config.json","package.json"],loaders:{".json":l.loadJson,".js":l.loadJs,noExt:l.loadYaml}}).searchSync();s&&(t=s.config),e.exports=function(e){var r=e.types;if(!r)throw new Error('BabelPluginRelay: Expected plugin context to include "types", but got:'+String(e));var n={TaggedTemplateExpression:function(e,n){var t=a(e);t&&o(r,e,n,t)}};return{visitor:{Program:function(e,r){e.traverse(n,(0,i.default)((0,i.default)({},r),{},{opts:(0,i.default)((0,i.default)({},t),r.opts)}))}}}}},function(e,r){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,r){e.exports=require("@babel/runtime/helpers/objectSpread2")},function(e,r,n){"use strict";var t=n(5),i=n(0).print,o=n(6),a=o.dirname,l=o.join,s=o.relative,u=o.resolve;e.exports=function(e,r,n,o){var d,c,p,f,g,v,m;if(1!==o.definitions.length)throw new Error("BabelPluginRelay: Expected exactly one definition per graphql tag.");var x=o.definitions[0];if("FragmentDefinition"!==x.kind&&"OperationDefinition"!==x.kind)throw new Error("BabelPluginRelay: Expected a fragment, mutation, query, or subscription, got `"+x.kind+"`.");var h=null!==(d=null===(c=n.opts)||void 0===c?void 0:c.eagerEsModules)&&void 0!==d&&d,b="haste"===(null===(p=n.opts)||void 0===p?void 0:p.jsModuleFormat),y=null===(f=n.opts)||void 0===f?void 0:f.isDevVariableName;return function(e,r,n,o,d){var c=o.name&&o.name.value;if(!c)throw new Error("GraphQL operations and fragments must contain names");var p=c+".graphql",f=d.isHasteMode?p:d.artifactDirectory?function(e,r,n){if(null==e.file)throw new Error("Babel state is missing expected file name");var t=e.file.opts.filename,i=s(a(t),u(r));return(0!==i.length&&i.startsWith(".")?"":"./")+l(i,n)}(r,d.artifactDirectory,p):"./__generated__/"+p,g=t.createHash("md5").update(i(o),"utf8").digest("hex"),v=n.scope;for(;v.parent;)v=v.parent;var m=v.generateUidIdentifier(c),x=e.MemberExpression(e.cloneNode(m),e.Identifier("hash")),h=function(e,r,n){return e.callExpression(e.memberExpression(e.identifier("console"),e.identifier("error")),[e.stringLiteral("The definition of '".concat(r,"' appears to have changed. Run ")+"`"+n+"` to update the generated files to receive the expected data.")])}(e,c,d.buildCommand),b=e.LogicalExpression("&&",e.cloneNode(x),e.LogicalExpression("&&",e.BinaryExpression("!==",x,e.StringLiteral(g)),h));if(d.eagerEsModules){var y=e.ImportDeclaration([e.ImportDefaultSpecifier(m)],e.StringLiteral(f));n.findParent((function(e){return e.isProgram()})).unshiftContainer("body",y);var E,q=e.SequenceExpression([b,e.cloneNode(m)]);E=null!=d.isDevVariable?e.ConditionalExpression(e.Identifier(d.isDevVariable),q,e.cloneNode(m)):d.isDevelopment?q:e.cloneNode(m),n.replaceWith(E)}else{v.push({id:e.cloneNode(m)});var D,w=e.CallExpression(e.Identifier("require"),[e.StringLiteral(f)]),j=e.AssignmentExpression("=",e.cloneNode(m),w),N=e.SequenceExpression([j,b,e.cloneNode(m)]);D=null!=d.isDevVariable?e.ConditionalExpression(e.Identifier(d.isDevVariable),N,j):d.isDevelopment?N:j;var S=e.UnaryExpression("void",e.NumericLiteral(0));n.replaceWith(e.ConditionalExpression(e.BinaryExpression("!==",e.cloneNode(m),S),e.cloneNode(m),e.cloneNode(D)))}}(e,n,r,x,{artifactDirectory:null===(g=n.opts)||void 0===g?void 0:g.artifactDirectory,eagerEsModules:h,buildCommand:null!==(v=null===(m=n.opts)||void 0===m?void 0:m.codegenCommand)&&void 0!==v?v:"relay-compiler",isDevelopment:"production"!==(process.env.BABEL_ENV||"development"),isHasteMode:b,isDevVariable:y})}},function(e,r){e.exports=require("crypto")},function(e,r){e.exports=require("path")},function(e,r,n){"use strict";var t=n(0);e.exports=function(e){if(!e.get("tag").isIdentifier({name:"graphql"}))return null;var r=e.node.quasi.quasis;if(1!==r.length)throw new Error("BabelPluginRelay: Substitutions are not allowed in graphql fragments. Included fragments should be referenced as `...MyModule_propName`.");var n=r[0].value.raw,i=t.parse(n);if(0===i.definitions.length)throw new Error("BabelPluginRelay: Unexpected empty graphql tag.");return i}},function(e,r){e.exports=require("cosmiconfig")}]);
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Relay v0.0.0-main-4b1b59eb
2
+ * Relay v0.0.0-main-d5becbc8
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- module.exports=function(e){var r={};function n(t){if(r[t])return r[t].exports;var i=r[t]={i:t,l:!1,exports:{}};return e[t].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)n.d(t,i,function(r){return e[r]}.bind(null,i));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=1)}([function(e,r){e.exports=require("graphql")},function(e,r,n){"use strict";var t,i=(0,n(2).default)(n(3)),o=n(4),a=n(7),s=n(8),l=s("relay",{searchPlaces:["relay.config.js","relay.config.json","package.json"],loaders:{".json":s.loadJson,".js":s.loadJs,noExt:s.loadYaml}}).searchSync();l&&(t=l.config),e.exports=function(e){var r=e.types;if(!r)throw new Error('BabelPluginRelay: Expected plugin context to include "types", but got:'+String(e));var n={TaggedTemplateExpression:function(e,n){var t=a(e);t&&o(r,e,n,t)}};return{visitor:{Program:function(e,r){e.traverse(n,(0,i.default)((0,i.default)({},r),{},{opts:(0,i.default)((0,i.default)({},t),r.opts)}))}}}}},function(e,r){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,r){e.exports=require("@babel/runtime/helpers/objectSpread2")},function(e,r,n){"use strict";var t=n(5),i=n(0).print,o=n(6),a=o.dirname,s=o.join,l=o.relative,u=o.resolve;e.exports=function(e,r,n,o){var p,d,f,c,g,v,m;if(1!==o.definitions.length)throw new Error("BabelPluginRelay: Expected exactly one definition per graphql tag.");var x=o.definitions[0];if("FragmentDefinition"!==x.kind&&"OperationDefinition"!==x.kind)throw new Error("BabelPluginRelay: Expected a fragment, mutation, query, or subscription, got `"+x.kind+"`.");var h=null!==(p=null===(d=n.opts)||void 0===d?void 0:d.eagerEsModules)&&void 0!==p&&p,b="haste"===(null===(f=n.opts)||void 0===f?void 0:f.jsModuleFormat),y=null===(c=n.opts)||void 0===c?void 0:c.isDevVariableName;return function(e,r,n,o,p){var d=o.name&&o.name.value;if(!d)throw new Error("GraphQL operations and fragments must contain names");var f=d+".graphql",c=p.isHasteMode?f:p.artifactDirectory?function(e,r,n){if(null==e.file)throw new Error("Babel state is missing expected file name");var t=e.file.opts.filename,i=l(a(t),u(r));return(0!==i.length&&i.startsWith(".")?"":"./")+s(i,n)}(r,p.artifactDirectory,f):"./__generated__/"+f,g=t.createHash("md5").update(i(o),"utf8").digest("hex"),v=n.scope;for(;v.parent;)v=v.parent;var m=v.generateUidIdentifier(d),x=e.MemberExpression(m,e.Identifier("hash")),h=function(e,r,n){return e.callExpression(e.memberExpression(e.identifier("console"),e.identifier("error")),[e.stringLiteral("The definition of '".concat(r,"' appears to have changed. Run ")+"`"+n+"` to update the generated files to receive the expected data.")])}(e,d,p.buildCommand),b=e.LogicalExpression("&&",x,e.LogicalExpression("&&",e.BinaryExpression("!==",x,e.StringLiteral(g)),h));if(p.eagerEsModules){var y=e.ImportDeclaration([e.ImportDefaultSpecifier(m)],e.StringLiteral(c));n.findParent((function(e){return e.isProgram()})).unshiftContainer("body",y);var E,q=e.SequenceExpression([b,m]);E=null!=p.isDevVariable?e.ConditionalExpression(e.Identifier(p.isDevVariable),q,m):p.isDevelopment?q:m,n.replaceWith(E)}else{v.push({id:m});var D,w=e.CallExpression(e.Identifier("require"),[e.StringLiteral(c)]),j=e.AssignmentExpression("=",m,w),S=e.SequenceExpression([j,b,m]);D=null!=p.isDevVariable?e.ConditionalExpression(e.Identifier(p.isDevVariable),S,j):p.isDevelopment?S:j;var P=e.UnaryExpression("void",e.NumericLiteral(0));n.replaceWith(e.ConditionalExpression(e.BinaryExpression("!==",m,P),m,D))}}(e,n,r,x,{artifactDirectory:null===(g=n.opts)||void 0===g?void 0:g.artifactDirectory,eagerEsModules:h,buildCommand:null!==(v=null===(m=n.opts)||void 0===m?void 0:m.codegenCommand)&&void 0!==v?v:"relay-compiler",isDevelopment:"production"!==(process.env.BABEL_ENV||"production"),isHasteMode:b,isDevVariable:y})}},function(e,r){e.exports=require("crypto")},function(e,r){e.exports=require("path")},function(e,r,n){"use strict";var t=n(0);e.exports=function(e){if(!e.get("tag").isIdentifier({name:"graphql"}))return null;var r=e.node.quasi.quasis;if(1!==r.length)throw new Error("BabelPluginRelay: Substitutions are not allowed in graphql fragments. Included fragments should be referenced as `...MyModule_propName`.");var n=r[0].value.raw,i=t.parse(n);if(0===i.definitions.length)throw new Error("BabelPluginRelay: Unexpected empty graphql tag.");return i}},function(e,r){e.exports=require("cosmiconfig")}]);
9
+ module.exports=function(e){var r={};function n(t){if(r[t])return r[t].exports;var i=r[t]={i:t,l:!1,exports:{}};return e[t].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)n.d(t,i,function(r){return e[r]}.bind(null,i));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=1)}([function(e,r){e.exports=require("graphql")},function(e,r,n){"use strict";var t,i=(0,n(2).default)(n(3)),o=n(4),a=n(7),l=n(8),s=l("relay",{searchPlaces:["relay.config.js","relay.config.json","package.json"],loaders:{".json":l.loadJson,".js":l.loadJs,noExt:l.loadYaml}}).searchSync();s&&(t=s.config),e.exports=function(e){var r=e.types;if(!r)throw new Error('BabelPluginRelay: Expected plugin context to include "types", but got:'+String(e));var n={TaggedTemplateExpression:function(e,n){var t=a(e);t&&o(r,e,n,t)}};return{visitor:{Program:function(e,r){e.traverse(n,(0,i.default)((0,i.default)({},r),{},{opts:(0,i.default)((0,i.default)({},t),r.opts)}))}}}}},function(e,r){e.exports=require("@babel/runtime/helpers/interopRequireDefault")},function(e,r){e.exports=require("@babel/runtime/helpers/objectSpread2")},function(e,r,n){"use strict";var t=n(5),i=n(0).print,o=n(6),a=o.dirname,l=o.join,s=o.relative,u=o.resolve;e.exports=function(e,r,n,o){var d,c,p,f,g,v,m;if(1!==o.definitions.length)throw new Error("BabelPluginRelay: Expected exactly one definition per graphql tag.");var x=o.definitions[0];if("FragmentDefinition"!==x.kind&&"OperationDefinition"!==x.kind)throw new Error("BabelPluginRelay: Expected a fragment, mutation, query, or subscription, got `"+x.kind+"`.");var h=null!==(d=null===(c=n.opts)||void 0===c?void 0:c.eagerEsModules)&&void 0!==d&&d,b="haste"===(null===(p=n.opts)||void 0===p?void 0:p.jsModuleFormat),y=null===(f=n.opts)||void 0===f?void 0:f.isDevVariableName;return function(e,r,n,o,d){var c=o.name&&o.name.value;if(!c)throw new Error("GraphQL operations and fragments must contain names");var p=c+".graphql",f=d.isHasteMode?p:d.artifactDirectory?function(e,r,n){if(null==e.file)throw new Error("Babel state is missing expected file name");var t=e.file.opts.filename,i=s(a(t),u(r));return(0!==i.length&&i.startsWith(".")?"":"./")+l(i,n)}(r,d.artifactDirectory,p):"./__generated__/"+p,g=t.createHash("md5").update(i(o),"utf8").digest("hex"),v=n.scope;for(;v.parent;)v=v.parent;var m=v.generateUidIdentifier(c),x=e.MemberExpression(e.cloneNode(m),e.Identifier("hash")),h=function(e,r,n){return e.callExpression(e.memberExpression(e.identifier("console"),e.identifier("error")),[e.stringLiteral("The definition of '".concat(r,"' appears to have changed. Run ")+"`"+n+"` to update the generated files to receive the expected data.")])}(e,c,d.buildCommand),b=e.LogicalExpression("&&",e.cloneNode(x),e.LogicalExpression("&&",e.BinaryExpression("!==",x,e.StringLiteral(g)),h));if(d.eagerEsModules){var y=e.ImportDeclaration([e.ImportDefaultSpecifier(m)],e.StringLiteral(f));n.findParent((function(e){return e.isProgram()})).unshiftContainer("body",y);var E,q=e.SequenceExpression([b,e.cloneNode(m)]);E=null!=d.isDevVariable?e.ConditionalExpression(e.Identifier(d.isDevVariable),q,e.cloneNode(m)):d.isDevelopment?q:e.cloneNode(m),n.replaceWith(E)}else{v.push({id:e.cloneNode(m)});var D,w=e.CallExpression(e.Identifier("require"),[e.StringLiteral(f)]),j=e.AssignmentExpression("=",e.cloneNode(m),w),N=e.SequenceExpression([j,b,e.cloneNode(m)]);D=null!=d.isDevVariable?e.ConditionalExpression(e.Identifier(d.isDevVariable),N,j):d.isDevelopment?N:j;var S=e.UnaryExpression("void",e.NumericLiteral(0));n.replaceWith(e.ConditionalExpression(e.BinaryExpression("!==",e.cloneNode(m),S),e.cloneNode(m),e.cloneNode(D)))}}(e,n,r,x,{artifactDirectory:null===(g=n.opts)||void 0===g?void 0:g.artifactDirectory,eagerEsModules:h,buildCommand:null!==(v=null===(m=n.opts)||void 0===m?void 0:m.codegenCommand)&&void 0!==v?v:"relay-compiler",isDevelopment:"production"!==(process.env.BABEL_ENV||"production"),isHasteMode:b,isDevVariable:y})}},function(e,r){e.exports=require("crypto")},function(e,r){e.exports=require("path")},function(e,r,n){"use strict";var t=n(0);e.exports=function(e){if(!e.get("tag").isIdentifier({name:"graphql"}))return null;var r=e.node.quasi.quasis;if(1!==r.length)throw new Error("BabelPluginRelay: Substitutions are not allowed in graphql fragments. Included fragments should be referenced as `...MyModule_propName`.");var n=r[0].value.raw,i=t.parse(n);if(0===i.definitions.length)throw new Error("BabelPluginRelay: Unexpected empty graphql tag.");return i}},function(e,r){e.exports=require("cosmiconfig")}]);
@@ -125,11 +125,11 @@ function createNode(
125
125
 
126
126
  const id = topScope.generateUidIdentifier(definitionName);
127
127
 
128
- const expHash = t.MemberExpression(id, t.Identifier('hash'));
128
+ const expHash = t.MemberExpression(t.cloneNode(id), t.Identifier('hash'));
129
129
  const expWarn = warnNeedsRebuild(t, definitionName, options.buildCommand);
130
130
  const expWarnIfOutdated = t.LogicalExpression(
131
131
  '&&',
132
- expHash,
132
+ t.cloneNode(expHash),
133
133
  t.LogicalExpression(
134
134
  '&&',
135
135
  t.BinaryExpression('!==', expHash, t.StringLiteral(hash)),
@@ -145,34 +145,41 @@ function createNode(
145
145
  const program = path.findParent(parent => parent.isProgram());
146
146
  program.unshiftContainer('body', importDeclaration);
147
147
 
148
- const expAssignAndCheck = t.SequenceExpression([expWarnIfOutdated, id]);
148
+ const expAssignAndCheck = t.SequenceExpression([
149
+ expWarnIfOutdated,
150
+ t.cloneNode(id),
151
+ ]);
149
152
 
150
153
  let expAssign;
151
154
  if (options.isDevVariable != null) {
152
155
  expAssign = t.ConditionalExpression(
153
156
  t.Identifier(options.isDevVariable),
154
157
  expAssignAndCheck,
155
- id,
158
+ t.cloneNode(id),
156
159
  );
157
160
  } else if (options.isDevelopment) {
158
161
  expAssign = expAssignAndCheck;
159
162
  } else {
160
- expAssign = id;
163
+ expAssign = t.cloneNode(id);
161
164
  }
162
165
 
163
166
  path.replaceWith(expAssign);
164
167
  } else {
165
- topScope.push({id});
168
+ topScope.push({id: t.cloneNode(id)});
166
169
 
167
170
  const requireGraphQLModule = t.CallExpression(t.Identifier('require'), [
168
171
  t.StringLiteral(requiredPath),
169
172
  ]);
170
173
 
171
- const expAssignProd = t.AssignmentExpression('=', id, requireGraphQLModule);
174
+ const expAssignProd = t.AssignmentExpression(
175
+ '=',
176
+ t.cloneNode(id),
177
+ requireGraphQLModule,
178
+ );
172
179
  const expAssignAndCheck = t.SequenceExpression([
173
180
  expAssignProd,
174
181
  expWarnIfOutdated,
175
- id,
182
+ t.cloneNode(id),
176
183
  ]);
177
184
 
178
185
  let expAssign;
@@ -191,9 +198,9 @@ function createNode(
191
198
  const expVoid0 = t.UnaryExpression('void', t.NumericLiteral(0));
192
199
  path.replaceWith(
193
200
  t.ConditionalExpression(
194
- t.BinaryExpression('!==', id, expVoid0),
195
- id,
196
- expAssign,
201
+ t.BinaryExpression('!==', t.cloneNode(id), expVoid0),
202
+ t.cloneNode(id),
203
+ t.cloneNode(expAssign),
197
204
  ),
198
205
  );
199
206
  }
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-4b1b59eb
2
+ * Relay v0.0.0-main-d5becbc8
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -70,32 +70,32 @@ function createNode(t, state, path, graphqlDefinition, options) {
70
70
  topScope = topScope.parent;
71
71
  }
72
72
  var id = topScope.generateUidIdentifier(definitionName);
73
- var expHash = t.MemberExpression(id, t.Identifier('hash'));
73
+ var expHash = t.MemberExpression(t.cloneNode(id), t.Identifier('hash'));
74
74
  var expWarn = warnNeedsRebuild(t, definitionName, options.buildCommand);
75
- var expWarnIfOutdated = t.LogicalExpression('&&', expHash, t.LogicalExpression('&&', t.BinaryExpression('!==', expHash, t.StringLiteral(hash)), expWarn));
75
+ var expWarnIfOutdated = t.LogicalExpression('&&', t.cloneNode(expHash), t.LogicalExpression('&&', t.BinaryExpression('!==', expHash, t.StringLiteral(hash)), expWarn));
76
76
  if (options.eagerEsModules) {
77
77
  var importDeclaration = t.ImportDeclaration([t.ImportDefaultSpecifier(id)], t.StringLiteral(requiredPath));
78
78
  var program = path.findParent(function (parent) {
79
79
  return parent.isProgram();
80
80
  });
81
81
  program.unshiftContainer('body', importDeclaration);
82
- var expAssignAndCheck = t.SequenceExpression([expWarnIfOutdated, id]);
82
+ var expAssignAndCheck = t.SequenceExpression([expWarnIfOutdated, t.cloneNode(id)]);
83
83
  var expAssign;
84
84
  if (options.isDevVariable != null) {
85
- expAssign = t.ConditionalExpression(t.Identifier(options.isDevVariable), expAssignAndCheck, id);
85
+ expAssign = t.ConditionalExpression(t.Identifier(options.isDevVariable), expAssignAndCheck, t.cloneNode(id));
86
86
  } else if (options.isDevelopment) {
87
87
  expAssign = expAssignAndCheck;
88
88
  } else {
89
- expAssign = id;
89
+ expAssign = t.cloneNode(id);
90
90
  }
91
91
  path.replaceWith(expAssign);
92
92
  } else {
93
93
  topScope.push({
94
- id: id
94
+ id: t.cloneNode(id)
95
95
  });
96
96
  var requireGraphQLModule = t.CallExpression(t.Identifier('require'), [t.StringLiteral(requiredPath)]);
97
- var expAssignProd = t.AssignmentExpression('=', id, requireGraphQLModule);
98
- var _expAssignAndCheck = t.SequenceExpression([expAssignProd, expWarnIfOutdated, id]);
97
+ var expAssignProd = t.AssignmentExpression('=', t.cloneNode(id), requireGraphQLModule);
98
+ var _expAssignAndCheck = t.SequenceExpression([expAssignProd, expWarnIfOutdated, t.cloneNode(id)]);
99
99
  var _expAssign;
100
100
  if (options.isDevVariable != null) {
101
101
  _expAssign = t.ConditionalExpression(t.Identifier(options.isDevVariable), _expAssignAndCheck, expAssignProd);
@@ -105,7 +105,7 @@ function createNode(t, state, path, graphqlDefinition, options) {
105
105
  _expAssign = expAssignProd;
106
106
  }
107
107
  var expVoid0 = t.UnaryExpression('void', t.NumericLiteral(0));
108
- path.replaceWith(t.ConditionalExpression(t.BinaryExpression('!==', id, expVoid0), id, _expAssign));
108
+ path.replaceWith(t.ConditionalExpression(t.BinaryExpression('!==', t.cloneNode(id), expVoid0), t.cloneNode(id), t.cloneNode(_expAssign)));
109
109
  }
110
110
  }
111
111
  function warnNeedsRebuild(t, definitionName, buildCommand) {
package/macro.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-4b1b59eb
2
+ * Relay v0.0.0-main-d5becbc8
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "babel-plugin-relay",
3
3
  "description": "A Babel Plugin for use with Relay applications.",
4
- "version": "0.0.0-main-4b1b59eb",
4
+ "version": "0.0.0-main-d5becbc8",
5
5
  "keywords": [
6
6
  "graphql",
7
7
  "relay",