@isograph/babel-plugin 0.0.0-main-feb39d09 → 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.
- package/compileTag.js +10 -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
|
-
|
21
|
-
|
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