@mmapp/react-compiler 0.1.0-alpha.19 → 0.1.0-alpha.21

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.
@@ -1268,7 +1268,14 @@ function jsxToExperienceNode(node) {
1268
1268
  }
1269
1269
  } else if (t6.isIdentifier(expr)) {
1270
1270
  const snakeName = localFieldMap.get(expr.name);
1271
- bindings[attrName] = snakeName ? `$local.${snakeName}` : `$instance.${expr.name}`;
1271
+ const setterField = setterToFieldMap.get(expr.name);
1272
+ if (snakeName) {
1273
+ bindings[attrName] = `$local.${snakeName}`;
1274
+ } else if (setterField) {
1275
+ bindings[attrName] = `$action.setLocal("${setterField}")`;
1276
+ } else {
1277
+ bindings[attrName] = `$instance.${expr.name}`;
1278
+ }
1272
1279
  } else if (isEventHandlerProp(attrName) && (t6.isArrowFunctionExpression(expr) || t6.isFunctionExpression(expr))) {
1273
1280
  const decomposed = decomposeHandlerToSeq(expr);
1274
1281
  if (decomposed) {
@@ -7305,6 +7312,26 @@ function createVisitor(options = {}) {
7305
7312
  const id = path.node.id;
7306
7313
  const init = path.node.init;
7307
7314
  if (t21.isArrayPattern(id)) return;
7315
+ if (t21.isObjectPattern(id) && init && t21.isCallExpression(init) && t21.isIdentifier(init.callee) && init.callee.name === "useQuery") {
7316
+ const slug = resolveSlugArg(init.arguments, state);
7317
+ if (slug) {
7318
+ for (const prop of id.properties) {
7319
+ if (t21.isObjectProperty(prop) && t21.isIdentifier(prop.key) && prop.key.name === "data") {
7320
+ const alias = t21.isIdentifier(prop.value) ? prop.value.name : null;
7321
+ if (alias) {
7322
+ const meta = compilerState.metadata;
7323
+ const dataSources = meta.dataSources;
7324
+ if (dataSources) {
7325
+ const ds = dataSources.find((d) => d.name === slug);
7326
+ if (ds) ds.name = alias;
7327
+ }
7328
+ }
7329
+ break;
7330
+ }
7331
+ }
7332
+ }
7333
+ return;
7334
+ }
7308
7335
  if (!t21.isIdentifier(id) || !init || !t21.isExpression(init)) return;
7309
7336
  const parentFn = path.getFunctionParent();
7310
7337
  if (!parentFn) return;
@@ -7332,10 +7359,7 @@ function createVisitor(options = {}) {
7332
7359
  return;
7333
7360
  }
7334
7361
  if (callee === "useMutation") {
7335
- registerDerivedVar(id.name, t21.memberExpression(
7336
- t21.identifier("$action"),
7337
- t21.identifier("transition")
7338
- ));
7362
+ registerDerivedVar(id.name, t21.identifier("$action"));
7339
7363
  return;
7340
7364
  }
7341
7365
  if (callee === "useServerAction") {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  babelPlugin
3
- } from "../chunk-TXONBY6A.mjs";
3
+ } from "../chunk-NJNAQF5I.mjs";
4
4
  import {
5
5
  __require
6
6
  } from "../chunk-CIESM3BP.mjs";