rakkasjs
Version:
Bleeding-edge React framework powered by Vite
75 lines (72 loc) • 3.72 kB
JavaScript
import {
version
} from "./chunk-NPN2JRYM.js";
// src/cli/index.ts
import { cac } from "cac";
import { performance } from "perf_hooks";
var startTime = performance.now();
var cli = cac("rakkas");
function cleanOptions(options) {
const ret = { ...options };
delete ret["--"];
delete ret.c;
delete ret.config;
delete ret.base;
delete ret.l;
delete ret.logLevel;
delete ret.clearScreen;
delete ret.d;
delete ret.debug;
delete ret.f;
delete ret.filter;
delete ret.m;
delete ret.mode;
return ret;
}
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
cli.command("[root]", "Start a dev server").alias("dev").alias("serve").option("--host [host]", `[string] specify hostname`).option("--port <port>", `[number] specify port`).option("--https", `[boolean] use TLS + HTTP/2`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).option("--strictPort", `[boolean] exit if specified port is already in use`).option(
"--force",
`[boolean] force the optimizer to ignore the cache and re-bundle`
).action(
async (root, options) => import("./serve-R5IF45VW.js").then(({ serve }) => serve(root, options))
);
cli.command("build [root]", "Build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option(
"--assetsDir <dir>",
`[string] directory under outDir to place assets in (default: _assets)`
).option(
"--assetsInlineLimit <number>",
`[number] static asset base64 inline threshold in bytes (default: 4096)`
).option(
"--ssr [entry]",
`[string] build specified entry for server-side rendering`
).option(
"--sourcemap",
`[boolean] output source maps for build (default: false)`
).option(
"--minify [minifier]",
`[boolean | "terser" | "esbuild"] enable/disable minification, or specify minifier to use (default: esbuild)`
).option("--manifest", `[boolean] emit build manifest json`).option("--ssrManifest", `[boolean] emit ssr manifest json`).option(
"--emptyOutDir",
`[boolean] force empty outDir when it's outside of root`
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).action(
(root, options) => import("./build-7NSZBHVX.js").then(({ build }) => build(root, options))
);
cli.command("preview [root]", "Start a preview server using production build").option("--host [host]", `[string] specify hostname`).option("--port <port>", `[number] specify port`).option("--https", `[boolean] use TLS + HTTP/2`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).option("--strictPort", `[boolean] exit if specified port is already in use`).action(
async (root, options) => import("./preview-T7RJ27MA.js").then(({ preview }) => preview(root, options))
);
cli.command(
"prerender [...paths]",
"Prerender static pages of an already built app"
).option("-r, --root <root>", "Project root").option(
"-C, --crawl",
"[boolean] Crawl links on pages to find more pages to prerender"
).action(
(paths, options) => import("./prerender-MPAFLJXO.js").then(({ prerender }) => prerender(paths, options))
);
cli.help();
cli.version(version);
cli.parse();
export {
startTime,
cleanOptions
};