@nuxt/cli
Version:
Nuxt CLI
45 lines (44 loc) • 1.64 kB
JavaScript
// src/dev/tui/controller.ts
/** What the plain fallback answers to everything the UI would have shown. */
const NOOP_CONTROLLER = {
interactive: false,
setStatus: () => {},
settleRestart: () => {},
pushServerLog: () => {},
pushRequests: () => {},
pushSpans: () => {},
pushReport: () => {},
clearReport: () => {},
setRoutes: () => {},
setStack: () => {},
setRendering: () => {}
};
/**
* Take the terminal, if this one can host the UI.
*
* Nothing behind this module is loaded until a panel is actually going to be
* painted: `nuxt dev --help` never gets that far, and a plain session has no
* use for the panel, the views, the update check or the version lookup.
*/
async function beginDevUI(options = {}) {
const { resolveDevUISupport } = await import("./support-DGfQlyBw.mjs").then((n) => n.n);
if (options.enabled === false || !resolveDevUISupport(options).enabled) return;
const { beginDevUI } = await import("./session-t0sWyw1y.mjs");
return beginDevUI(options);
}
/** Give the terminal back, so something else can report on a clean screen. */
async function teardownDevUI() {
const { teardownDevUI } = await import("./session-t0sWyw1y.mjs");
teardownDevUI();
}
/** The interactive controller, or the line-based shortcuts and a no-op. */
async function setupDevUI(context, options = {}) {
if (options.enabled === false) {
const { setupShortcuts } = await import("./shortcuts-S3Oeu6M4.mjs");
setupShortcuts(context);
return NOOP_CONTROLLER;
}
const { setupDevUI } = await import("./tui-CLA10SSj.mjs");
return setupDevUI(context, options);
}
export { NOOP_CONTROLLER, beginDevUI, setupDevUI, teardownDevUI };