MCPcopy
hub / github.com/lingodotdev/lingo.dev / getModuleExecutionMode

Function getModuleExecutionMode

packages/compiler/src/utils/index.ts:228–245  ·  view source on GitHub ↗
(
  ast: t.Node,
  rscEnabled: boolean,
)

Source from the content-addressed store, hash-verified

226}
227
228export function getModuleExecutionMode(
229 ast: t.Node,
230 rscEnabled: boolean,
231): "client" | "server" {
232 // if rscEnabled is true, then server mode is the default
233 // if rscEnabled is false, then client mode is the default
234 // default mode is when there is no directive
235
236 if (rscEnabled) {
237 if (hasClientDirective(ast)) {
238 return "client";
239 } else {
240 return "server";
241 }
242 } else {
243 return "client";
244 }
245}
246
247export { getJsxAttributeValue, setJsxAttributeValue };

Calls 1

hasClientDirectiveFunction · 0.85

Tested by

no test coverage detected