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

Function createNodeApp

packages/node/src/index.ts:237–277  ·  view source on GitHub ↗
(opts: CreateNodeAppOptions<S>)

Source from the content-addressed store, hash-verified

235}
236
237export function createNodeApp<S>(opts: CreateNodeAppOptions<S>): NodeApp<S> {
238 const appConfig = toAppConfig(opts.config);
239 const backend = createNodeBackend(toBackendConfig(opts.config));
240 const isNoColor = hasNoColorEnv(readProcessEnv());
241 const theme = isNoColor ? createNoColorTheme(opts.theme) : opts.theme;
242
243 const app = createApp({
244 backend,
245 initialState: opts.initialState,
246 ...(opts.routes !== undefined ? { routes: opts.routes } : {}),
247 ...(opts.initialRoute !== undefined ? { initialRoute: opts.initialRoute } : {}),
248 ...(appConfig !== undefined ? { config: appConfig } : {}),
249 ...(theme !== undefined ? { theme } : {}),
250 });
251 const hotReload =
252 opts.hotReload === undefined ? null : createNodeAppHotReloadController(app, opts.hotReload);
253 if (hotReload) {
254 attachNodeAppHotReloadLifecycle(app, hotReload);
255 }
256
257 Object.defineProperty(app, "hotReload", {
258 value: hotReload,
259 enumerable: true,
260 configurable: false,
261 writable: false,
262 });
263
264 Object.defineProperty(app, "backend", {
265 value: backend,
266 enumerable: true,
267 configurable: false,
268 writable: false,
269 });
270
271 return Object.defineProperty(app, "isNoColor", {
272 value: isNoColor,
273 enumerable: true,
274 configurable: false,
275 writable: false,
276 }) as NodeApp<S>;
277}
278
279/**
280 * Low-level Node/Bun backend constructor.

Callers 13

main.tsFile · 0.90
main.tsFile · 0.90
main.tsFile · 0.90
terminal-app.tsFile · 0.90
widget-app.mjsFile · 0.90
router-app.mjsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
main.tsFile · 0.90
index.tsFile · 0.90

Calls 9

createAppFunction · 0.90
toAppConfigFunction · 0.85
createNodeBackendFunction · 0.85
toBackendConfigFunction · 0.85
hasNoColorEnvFunction · 0.85
readProcessEnvFunction · 0.85
createNoColorThemeFunction · 0.85

Tested by

no test coverage detected