MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / writeViewModule

Function writeViewModule

packages/node/src/__tests__/hotStateReload.test.ts:29–44  ·  view source on GitHub ↗
(root: string)

Source from the content-addressed store, hash-verified

27}
28
29function writeViewModule(root: string): string {
30 mkdirSync(root, { recursive: true });
31 const viewFile = join(root, "view.mjs");
32 writeFileSync(
33 viewFile,
34 [
35 'import { widgetLabel } from "./widget.mjs";',
36 "export function view(state) {",
37 ' return { kind: "text", text: `${widgetLabel()}:${String(state.count)}`, props: {} };',
38 "}",
39 "",
40 ].join("\n"),
41 "utf8",
42 );
43 return viewFile;
44}
45
46function writeViewModuleWithBareImport(root: string): string {
47 mkdirSync(root, { recursive: true });

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected