-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Babel plugin no longer produces thunks
Summary: The babel plugin used to produce thunks to require the generated files. This was useful during the migration period where compat mode would generate classic and modern ASTs to avoid instantiating both versions of the AST. Now that everything is in the new style, no longer generating the closure should be slightly faster and importantly removes the risk of that closure to capture variables and prevent garbage collection of some values. Reviewed By: alunyov Differential Revision: D18694202 fbshipit-source-id: 5fcbeb8c6d695b2ae403596a1fae1b24db207571
- Loading branch information
1 parent
c4f4faa
commit 490c89d
Showing
7 changed files
with
243 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 36 additions & 34 deletions
70
packages/babel-plugin-relay/__tests__/__snapshots__/BabelPluginRelay-test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,57 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`\`development\` option does not test the hash when \`development\` is not set 1`] = ` | ||
"(function() { | ||
return require('./__generated__/TestFrag.graphql'); | ||
}); | ||
"var _TestFrag; | ||
_TestFrag !== void 0 | ||
? _TestFrag | ||
: (_TestFrag = require('./__generated__/TestFrag.graphql')); | ||
" | ||
`; | ||
|
||
exports[`\`development\` option tests the hash when \`development\` is set 1`] = ` | ||
"(function() { | ||
const node = require('./__generated__/TestFrag.graphql'); | ||
if (node.hash && node.hash !== '0bb6b7b29bc3e910921551c4ff5b6757') { | ||
console.error( | ||
\\"The definition of 'TestFrag' appears to have changed. Run \`relay-compiler\` to update the generated files to receive the expected data.\\", | ||
); | ||
} | ||
"var _TestFrag; | ||
return require('./__generated__/TestFrag.graphql'); | ||
}); | ||
_TestFrag !== void 0 | ||
? _TestFrag | ||
: ((_TestFrag = require('./__generated__/TestFrag.graphql')), | ||
_TestFrag.hash && | ||
_TestFrag.hash !== '0bb6b7b29bc3e910921551c4ff5b6757' && | ||
console.error( | ||
\\"The definition of 'TestFrag' appears to have changed. Run \`relay-compiler\` to update the generated files to receive the expected data.\\", | ||
), | ||
_TestFrag); | ||
" | ||
`; | ||
|
||
exports[`\`development\` option tests the hash when \`isDevVariable\` is set 1`] = ` | ||
"(function() { | ||
if (IS_DEV) { | ||
const node = require('./__generated__/TestFrag.graphql'); | ||
if (node.hash && node.hash !== '0bb6b7b29bc3e910921551c4ff5b6757') { | ||
"var _TestFrag; | ||
_TestFrag !== void 0 | ||
? _TestFrag | ||
: IS_DEV | ||
? ((_TestFrag = require('./__generated__/TestFrag.graphql')), | ||
_TestFrag.hash && | ||
_TestFrag.hash !== '0bb6b7b29bc3e910921551c4ff5b6757' && | ||
console.error( | ||
\\"The definition of 'TestFrag' appears to have changed. Run \`relay-compiler\` to update the generated files to receive the expected data.\\", | ||
); | ||
} | ||
} | ||
return require('./__generated__/TestFrag.graphql'); | ||
}); | ||
), | ||
_TestFrag) | ||
: (_TestFrag = require('./__generated__/TestFrag.graphql')); | ||
" | ||
`; | ||
|
||
exports[`\`development\` option uses a custom build command in message 1`] = ` | ||
"(function() { | ||
const node = require('./__generated__/TestFrag.graphql'); | ||
"var _TestFrag; | ||
if (node.hash && node.hash !== '0bb6b7b29bc3e910921551c4ff5b6757') { | ||
console.error( | ||
\\"The definition of 'TestFrag' appears to have changed. Run \`relay-build\` to update the generated files to receive the expected data.\\", | ||
); | ||
} | ||
return require('./__generated__/TestFrag.graphql'); | ||
}); | ||
_TestFrag !== void 0 | ||
? _TestFrag | ||
: ((_TestFrag = require('./__generated__/TestFrag.graphql')), | ||
_TestFrag.hash && | ||
_TestFrag.hash !== '0bb6b7b29bc3e910921551c4ff5b6757' && | ||
console.error( | ||
\\"The definition of 'TestFrag' appears to have changed. Run \`relay-build\` to update the generated files to receive the expected data.\\", | ||
), | ||
_TestFrag); | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.