rollup-plugin-visualizer
Version:
Visualize and analyze bundle sizes and module dependencies in Rollup, Rolldown, and Vite.
39 lines (38 loc) • 1.26 kB
JavaScript
import yargs from "yargs";
import TEMPLATE from "../template-types.js";
import { warn } from "../warn.js";
export const parseCliArgs = (args) => {
const argv = yargs(args)
.parserConfiguration({ "parse-positional-numbers": false })
.option("filename", {
describe: "Output file name",
type: "string",
default: "./stats.html",
})
.option("title", {
describe: "Output file title",
type: "string",
default: "Rollup Visualizer",
})
.option("template", {
describe: "Template type",
type: "string",
choices: TEMPLATE,
default: "treemap",
})
.option("sourcemap", {
describe: "Deprecated: has no effect; inputs must be plugin-generated raw-data JSON reports",
type: "boolean",
})
.option("open", {
describe: "Open generated tempate in default user agent",
type: "boolean",
default: false,
})
.help()
.parseSync();
if (argv.sourcemap !== undefined) {
warn("The CLI --sourcemap option is deprecated and has no effect. Inputs must be plugin-generated raw-data JSON reports. The plugin's sourcemap option remains supported.");
}
return argv;
};