fix(javascript): preserve final RPC property and source-body ownership

Normalize exact template and bigint keys at the shared AST boundary. Keep overwritten GraphQL body literals owned by their source object so they cannot resurface as standalone operations.

Reviewed-PR: #3244
Co-authored-by: Vaishnavi220506 <vaishnaviharish2006@gmail.com>
This commit is contained in:
morlutoandVaishnavi220506 committed 2026-10-14 16:10:46 +08:00
1 parent eef4a0bfb4
commit 12b3cdb804
3 files changed
+111 -10

No files matched your search

@@ -81,6 +81,20 @@ export const semanticStaticPropertyKey = (
property = unwrapJavaScriptExpression(property).node;
if (t.isStringLiteral(property) || t.isNumericLiteral(property))
return String(property.value);
if (t.isBigIntLiteral(property)) return String(property.value);
if (
t.isUnaryExpression(property, { operator: "-" }) &&
t.isBigIntLiteral(property.argument)
)
return String(-BigInt(property.argument.value));
if (
t.isTemplateLiteral(property) &&
property.expressions.length === 0 &&
property.quasis.length === 1
) {
const cooked = property.quasis[0]?.value.cooked;
return cooked === null || cooked === undefined ? null : cooked;
}
return !computed && t.isIdentifier(property) ? property.name : null;
};