@isograph/babel-plugin 0.0.0-main-e981e49a → 0.0.0-main-2a2d5556

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.
Files changed (2) hide show
  1. package/compileTag.js +10 -2
  2. package/package.json +1 -1
package/compileTag.js CHANGED
@@ -17,8 +17,16 @@ function compileTag(t, path, config) {
17
17
  // This throws if the tag is invalid
18
18
  compileImportStatement(t, path, type, field, 'entrypoint', config);
19
19
  } else if (keyword === 'field') {
20
- // No-op
21
- return false;
20
+ if (
21
+ t.isCallExpression(path.parentPath.node) &&
22
+ path.parentPath.node.arguments.length === 1
23
+ ) {
24
+ path.parentPath.replaceWith(path.parentPath.node.arguments[0]);
25
+ } else {
26
+ path.replaceWith(
27
+ t.arrowFunctionExpression([t.identifier('x')], t.identifier('x')),
28
+ );
29
+ }
22
30
  } else {
23
31
  throw new Error(
24
32
  "Invalid iso tag usage. Expected 'entrypoint' or 'field'.",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@isograph/babel-plugin",
3
3
  "description": "A Babel plugin for use with Isograph applications.",
4
4
  "homepage": "https://isograph.dev",
5
- "version": "0.0.0-main-e981e49a",
5
+ "version": "0.0.0-main-2a2d5556",
6
6
  "keywords": [
7
7
  "graphql",
8
8
  "isograph",