fix(javascript): preserve route flag values and lexical RPC names

This commit is contained in:
morluto committed 2026-10-24 02:35:36 +08:00
1 parent ee0ad17a1a
commit 38ecc0248e
7 files changed
+144 -12

No files matched your search

@@ -68,6 +68,36 @@ describe("RPC object property ownership", () => {
});
describe("tRPC procedure recognition", () => {
it("preserves lexical clients and router members with browser-global spellings", () => {
expect(
rpcEndpoints(`function scope() {
const history=createTRPCClient({links:[httpBatchLink({url:'/api/trpc'})]});
history.archive.query();
history.history.list.query();
history.endpoints.list.query();
navigator.permissions.query({name:'geolocation'});
api.endpoints.list.useQuery();
}`),
).toEqual([
{
kind: "network",
value: "/api/trpc",
mechanism: "trpc:link:httpBatchLink",
},
{ kind: "network", value: "archive", mechanism: "trpc:procedure:query" },
{
kind: "network",
value: "history.list",
mechanism: "trpc:procedure:query",
},
{
kind: "network",
value: "endpoints.list",
mechanism: "trpc:procedure:query",
},
]);
});
it("recognizes React hook procedures on a renamed proxy root", () => {
expect(
rpcEndpoints(`