Skip to content

Commit dfb1287

Browse files
hi-ogawaclaude
andcommitted
feat(rsc): unify all runtime calls to $runtime for consistency
- Change server environment $$register calls to $runtime - Maintain consistent runtime interface across all transforms - All server and client transforms now use unified $runtime pattern 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 92f9822 commit dfb1287

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

packages/plugin-rsc/src/transforms/waku.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('internal transform function for server environment', () => {
3131
const ast = await parseAstAsync(input)
3232
const result = transformServerActionServer(input, ast, {
3333
runtime: (value, name) =>
34-
`$$register(${value}, "<id>", ${JSON.stringify(name)})`,
34+
`$runtime(${value}, "<id>", ${JSON.stringify(name)})`,
3535
})
3636

3737
if (!('output' in result) || !result.output.hasChanged()) {
@@ -178,12 +178,12 @@ export default async function() {
178178
const $$default = async function() {
179179
return Date.now();
180180
}
181-
log = /* #__PURE__ */ $$register(log, "<id>", "log");
181+
log = /* #__PURE__ */ $runtime(log, "<id>", "log");
182182
export { log };
183-
greet = /* #__PURE__ */ $$register(greet, "<id>", "greet");
183+
greet = /* #__PURE__ */ $runtime(greet, "<id>", "greet");
184184
export { greet };
185185
;
186-
const $$wrap_$$default = /* #__PURE__ */ $$register($$default, "<id>", "default");
186+
const $$wrap_$$default = /* #__PURE__ */ $runtime($$default, "<id>", "default");
187187
export { $$wrap_$$default as default };
188188
"
189189
`)
@@ -208,7 +208,7 @@ export function ServerProvider() {
208208
"
209209
const AI = {
210210
actions: {
211-
foo: /* #__PURE__ */ $$register($$hoist_0_anonymous_server_function, "<id>", "$$hoist_0_anonymous_server_function"),
211+
foo: /* #__PURE__ */ $runtime($$hoist_0_anonymous_server_function, "<id>", "$$hoist_0_anonymous_server_function"),
212212
},
213213
};
214214
@@ -264,10 +264,10 @@ export default async () => null;
264264
}
265265
266266
const $$default = async () => null;
267-
exportedAction = /* #__PURE__ */ $$register(exportedAction, "<id>", "exportedAction");
267+
exportedAction = /* #__PURE__ */ $runtime(exportedAction, "<id>", "exportedAction");
268268
export { exportedAction };
269269
;
270-
const $$wrap_$$default = /* #__PURE__ */ $$register($$default, "<id>", "default");
270+
const $$wrap_$$default = /* #__PURE__ */ $runtime($$default, "<id>", "default");
271271
export { $$wrap_$$default as default };
272272
"
273273
`)
@@ -288,7 +288,7 @@ export default function App() {
288288
"
289289
export default function App() {
290290
const a = 'test';
291-
const log = /* #__PURE__ */ $$register($$hoist_0_log, "<id>", "$$hoist_0_log").bind(null, a);
291+
const log = /* #__PURE__ */ $runtime($$hoist_0_log, "<id>", "$$hoist_0_log").bind(null, a);
292292
return log;
293293
}
294294
@@ -316,7 +316,7 @@ export default function App() {
316316
"
317317
export default function App() {
318318
const rand = Math.random();
319-
const log = /* #__PURE__ */ $$register($$hoist_0_log, "<id>", "$$hoist_0_log").bind(null, rand);
319+
const log = /* #__PURE__ */ $runtime($$hoist_0_log, "<id>", "$$hoist_0_log").bind(null, rand);
320320
return log;
321321
}
322322
@@ -344,7 +344,7 @@ export default function App() {
344344
"
345345
const now = Date.now();
346346
export default function App() {
347-
const log = /* #__PURE__ */ $$register($$hoist_0_log, "<id>", "$$hoist_0_log");
347+
const log = /* #__PURE__ */ $runtime($$hoist_0_log, "<id>", "$$hoist_0_log");
348348
return log;
349349
}
350350
@@ -371,7 +371,7 @@ export default function App() {
371371
"
372372
const now = Date.now();
373373
export default function App() {
374-
return /* #__PURE__ */ $$register($$hoist_0_anonymous_server_function, "<id>", "$$hoist_0_anonymous_server_function");
374+
return /* #__PURE__ */ $runtime($$hoist_0_anonymous_server_function, "<id>", "$$hoist_0_anonymous_server_function");
375375
}
376376
377377
;export function $$hoist_0_anonymous_server_function(mesg) {
@@ -417,16 +417,16 @@ export default defaultFn;
417417
expect(await testTransform(input)).toMatchInlineSnapshot(`
418418
"
419419
const actions = {
420-
log: /* #__PURE__ */ $$register($$hoist_0_anonymous_server_function, "<id>", "$$hoist_0_anonymous_server_function"),
420+
log: /* #__PURE__ */ $runtime($$hoist_0_anonymous_server_function, "<id>", "$$hoist_0_anonymous_server_function"),
421421
};
422422
423-
const log2 = /* #__PURE__ */ $$register($$hoist_1_log2, "<id>", "$$hoist_1_log2");
423+
const log2 = /* #__PURE__ */ $runtime($$hoist_1_log2, "<id>", "$$hoist_1_log2");
424424
425-
const log3 = /* #__PURE__ */ $$register($$hoist_2_log3, "<id>", "$$hoist_2_log3")
425+
const log3 = /* #__PURE__ */ $runtime($$hoist_2_log3, "<id>", "$$hoist_2_log3")
426426
427-
const log4 = /* #__PURE__ */ $$register($$hoist_3_log4, "<id>", "$$hoist_3_log4");
427+
const log4 = /* #__PURE__ */ $runtime($$hoist_3_log4, "<id>", "$$hoist_3_log4");
428428
429-
const defaultFn = /* #__PURE__ */ $$register($$hoist_4_defaultFn, "<id>", "$$hoist_4_defaultFn")
429+
const defaultFn = /* #__PURE__ */ $runtime($$hoist_4_defaultFn, "<id>", "$$hoist_4_defaultFn")
430430
431431
export default defaultFn;
432432

0 commit comments

Comments
 (0)