@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.
@@ -1254,7 +1254,14 @@ function jsxToExperienceNode(node) {
1254
1254
  }
1255
1255
  } else if (t6.isIdentifier(expr)) {
1256
1256
  const snakeName = localFieldMap.get(expr.name);
1257
- bindings[attrName] = snakeName ? `$local.${snakeName}` : `$instance.${expr.name}`;
1257
+ const setterField = setterToFieldMap.get(expr.name);
1258
+ if (snakeName) {
1259
+ bindings[attrName] = `$local.${snakeName}`;
1260
+ } else if (setterField) {
1261
+ bindings[attrName] = `$action.setLocal("${setterField}")`;
1262
+ } else {
1263
+ bindings[attrName] = `$instance.${expr.name}`;
1264
+ }
1258
1265
  } else if (isEventHandlerProp(attrName) && (t6.isArrowFunctionExpression(expr) || t6.isFunctionExpression(expr))) {
1259
1266
  const decomposed = decomposeHandlerToSeq(expr);
1260
1267
  if (decomposed) {
@@ -7291,6 +7298,26 @@ function createVisitor(options = {}) {
7291
7298
  const id = path.node.id;
7292
7299
  const init = path.node.init;
7293
7300
  if (t21.isArrayPattern(id)) return;
7301
+ if (t21.isObjectPattern(id) && init && t21.isCallExpression(init) && t21.isIdentifier(init.callee) && init.callee.name === "useQuery") {
7302
+ const slug = resolveSlugArg(init.arguments, state);
7303
+ if (slug) {
7304
+ for (const prop of id.properties) {
7305
+ if (t21.isObjectProperty(prop) && t21.isIdentifier(prop.key) && prop.key.name === "data") {
7306
+ const alias = t21.isIdentifier(prop.value) ? prop.value.name : null;
7307
+ if (alias) {
7308
+ const meta = compilerState.metadata;
7309
+ const dataSources = meta.dataSources;
7310
+ if (dataSources) {
7311
+ const ds = dataSources.find((d) => d.name === slug);
7312
+ if (ds) ds.name = alias;
7313
+ }
7314
+ }
7315
+ break;
7316
+ }
7317
+ }
7318
+ }
7319
+ return;
7320
+ }
7294
7321
  if (!t21.isIdentifier(id) || !init || !t21.isExpression(init)) return;
7295
7322
  const parentFn = path.getFunctionParent();
7296
7323
  if (!parentFn) return;
@@ -7318,10 +7345,7 @@ function createVisitor(options = {}) {
7318
7345
  return;
7319
7346
  }
7320
7347
  if (callee === "useMutation") {
7321
- registerDerivedVar(id.name, t21.memberExpression(
7322
- t21.identifier("$action"),
7323
- t21.identifier("transition")
7324
- ));
7348
+ registerDerivedVar(id.name, t21.identifier("$action"));
7325
7349
  return;
7326
7350
  }
7327
7351
  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 "../chunk-CIESM3BP.mjs";
5
5
  export {
6
6
  babelPlugin as default