Skip to content

Commit

Permalink
Move macro export to babel-plugin-relay
Browse files Browse the repository at this point in the history
  • Loading branch information
kassens committed Aug 8, 2018
1 parent d74c37e commit d7321f9
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 40 deletions.
3 changes: 2 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const babelOptions = require('./scripts/getBabelOptions')({
'@babel/parser': '@babel/parser',
'@babel/types': '@babel/types',
'babel-core': 'babel-core',
'babel-plugin-macros': 'babel-plugin-macros',
'babel-generator': 'babel-generator',
'babel-generator/lib/printer': 'babel-generator/lib/printer',
'babel-polyfill': 'babel-polyfill',
Expand Down Expand Up @@ -153,6 +154,7 @@ const builds = [
package: 'babel-plugin-relay',
exports: {
index: 'BabelPluginRelay.js',
macro: 'BabelPluginRelay.macro.js',
},
bundles: [
{
Expand All @@ -170,7 +172,6 @@ const builds = [
classic: 'ReactRelayClassicExports.js',
compat: 'ReactRelayCompatPublic.js',
index: 'ReactRelayPublic.js',
macro: 'ReactRelayGraphQL.macro.js'
},
bundles: [
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"babel-cli": "6.24.1",
"babel-core": "6.25.0",
"babel-eslint": "9.0.0-beta.2",
"babel-plugin-macros": "2.0.0",
"babel-plugin-macros": "^2.0.0",
"babel-plugin-tester": "^5.0.0",
"babel-plugin-transform-async-to-generator": "6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "6.24.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule BabelPluginRelayMacro
* @flow
* @format
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ pluginTester({
works: `
'use strict';
const {graphql} = require('../../react-relay/modern/ReactRelayGraphQL.macro');
const CompatProfilePic = require('CompatProfilePic');
const {graphql} = require('../BabelPluginRelay.macro');
const ProfilePic = require('ProfilePic');
const CompatViewerQuery = graphql\`
query CompatViewerQuery($id: ID!, $scale: Float = 1.5) {
const ViewerQuery = graphql\`
query ViewerQuery($id: ID!, $scale: Float = 1.5) {
node(id: $id) {
... on User {
id
...CompatProfilePic_user
...ProfilePic_user
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ exports[`BabelPluginRelayMacro works: works 1`] = `
"
'use strict';
const {graphql} = require('../../react-relay/modern/ReactRelayGraphQL.macro');
const CompatProfilePic = require('CompatProfilePic');
const {graphql} = require('../BabelPluginRelay.macro');
const ProfilePic = require('ProfilePic');
const CompatViewerQuery = graphql\`
query CompatViewerQuery($id: ID!, $scale: Float = 1.5) {
const ViewerQuery = graphql\`
query ViewerQuery($id: ID!, $scale: Float = 1.5) {
node(id: $id) {
... on User {
id
...CompatProfilePic_user
...ProfilePic_user
}
}
}
Expand All @@ -22,16 +22,16 @@ const CompatViewerQuery = graphql\`
'use strict';
const CompatProfilePic = require('CompatProfilePic');
const ProfilePic = require('ProfilePic');
const CompatViewerQuery = function () {
const node = require('./__generated__/CompatViewerQuery.graphql');
const ViewerQuery = function () {
const node = require('./__generated__/ViewerQuery.graphql');
if (node.hash && node.hash !== '42a62b166f34144936e64b3c65e42c4d') {
console.error('The definition of \\\\'CompatViewerQuery\\\\' appears to have changed. Run \`relay-compiler\` to update the generated files to receive the expected data.');
if (node.hash && node.hash !== 'b046a97b7823510c05083ebb114377f4') {
console.error('The definition of \\\\'ViewerQuery\\\\' appears to have changed. Run \`relay-compiler\` to update the generated files to receive the expected data.');
}
return require('./__generated__/CompatViewerQuery.graphql');
return require('./__generated__/ViewerQuery.graphql');
};
"
`;
1 change: 1 addition & 0 deletions packages/babel-plugin-relay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"bugs": "https://github.com/facebook/relay/issues",
"repository": "facebook/relay",
"dependencies": {
"babel-plugin-macros": "^2.0.0",
"babel-runtime": "^6.23.0",
"babel-types": "^6.24.1"
},
Expand Down
5 changes: 0 additions & 5 deletions packages/react-relay/modern/ReactRelayGraphQL.macro.js

This file was deleted.

32 changes: 16 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,11 @@ babel-plugin-jest-hoist@^23.0.1:
version "23.0.1"
resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-23.0.1.tgz#eaa11c964563aea9c21becef2bdf7853f7f3c148"

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.0.0.tgz#fd3aee135f7dec0b82898b7c8f1aed6fa75f9af9"
babel-plugin-macros@^2.0.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.4.0.tgz#6c5f9836e1f6c0a9743b3bab4af29f73e437e544"
dependencies:
cosmiconfig "3.1.0"
cosmiconfig "^5.0.5"

babel-plugin-syntax-async-functions@^6.8.0:
version "6.13.0"
Expand Down Expand Up @@ -1445,14 +1445,13 @@ [email protected], core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"

cosmiconfig@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-3.1.0.tgz#640a94bf9847f321800403cd273af60665c73397"
cosmiconfig@^5.0.5:
version "5.0.5"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.5.tgz#a809e3c2306891ce17ab70359dc8bdf661fe2cd0"
dependencies:
is-directory "^0.3.1"
js-yaml "^3.9.0"
parse-json "^3.0.0"
require-from-string "^2.0.1"
parse-json "^4.0.0"

create-react-class@^15.6.0:
version "15.6.3"
Expand Down Expand Up @@ -3592,6 +3591,10 @@ jsesc@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe"

json-parse-better-errors@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"

json-schema-traverse@^0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340"
Expand Down Expand Up @@ -4440,11 +4443,12 @@ parse-json@^2.2.0:
dependencies:
error-ex "^1.2.0"

parse-json@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-3.0.0.tgz#fa6f47b18e23826ead32f263e744d0e1e847fb13"
parse-json@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0"
dependencies:
error-ex "^1.3.1"
json-parse-better-errors "^1.0.1"

parse-passwd@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -4905,10 +4909,6 @@ require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"

require-from-string@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.1.tgz#c545233e9d7da6616e9d59adfb39fc9f588676ff"

require-main-filename@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1"
Expand Down

0 comments on commit d7321f9

Please sign in to comment.