'use strict';

var packager = require('./packager-d3af52d3.cjs.js');
var packageRoles = require('./packageRoles-898652fe.cjs.js');
var index = require('./index-09611511.cjs.js');
var buildBackend = require('./buildBackend-f01c2008.cjs.js');
require('fs-extra');
require('rollup');
require('chalk');
require('path');
require('@rollup/plugin-commonjs');
require('@rollup/plugin-node-resolve');
require('rollup-plugin-postcss');
require('rollup-plugin-esbuild');
require('@svgr/rollup');
require('rollup-plugin-dts');
require('@rollup/plugin-json');
require('@rollup/plugin-yaml');
require('rollup-pluginutils');
require('./svgrTemplate-550efce6.cjs.js');
require('./parallel-8286d3fa.cjs.js');
require('os');
require('worker_threads');
require('zod');
require('commander');
require('semver');
require('@backstage/cli-common');
require('@backstage/errors');
require('webpack');
require('fork-ts-checker-webpack-plugin');
require('html-webpack-plugin');
require('react-dev-utils/ModuleScopePlugin');
require('run-script-webpack-plugin');
require('webpack-node-externals');
require('@manypkg/get-packages');
require('./paths-5887046a.cjs.js');
require('mini-css-extract-plugin');
require('./run-a95417b1.cjs.js');
require('child_process');
require('util');
require('eslint-webpack-plugin');
require('lodash/pickBy');
require('./bundle-a259a726.cjs.js');
require('yn');
require('react-dev-utils/FileSizeReporter');
require('react-dev-utils/formatWebpackMessages');
require('webpack-dev-server');
require('react-dev-utils/openBrowser');
require('./config-42c55c02.cjs.js');
require('@backstage/config-loader');
require('@backstage/config');
require('./PackageGraph-5fbc300a.cjs.js');
require('tar');
require('./createDistWorkspace-ce6d5dae.cjs.js');
require('lodash/partition');
require('npm-packlist');

async function command(opts) {
  const role = await packageRoles.findRoleFromCommand(opts);
  if (role === "frontend") {
    return buildBackend.buildFrontend({
      targetDir: index.paths.targetDir,
      configPaths: opts.config,
      writeStats: Boolean(opts.stats)
    });
  }
  if (role === "backend") {
    return buildBackend.buildBackend({
      targetDir: index.paths.targetDir,
      skipBuildDependencies: Boolean(opts.skipBuildDependencies)
    });
  }
  const roleInfo = packageRoles.getRoleInfo(role);
  const outputs = /* @__PURE__ */ new Set();
  if (roleInfo.output.includes("cjs")) {
    outputs.add(packager.Output.cjs);
  }
  if (roleInfo.output.includes("esm")) {
    outputs.add(packager.Output.esm);
  }
  if (roleInfo.output.includes("types")) {
    outputs.add(packager.Output.types);
  }
  return packager.buildPackage({
    outputs,
    minify: Boolean(opts.minify),
    useApiExtractor: Boolean(opts.experimentalTypeBuild)
  });
}

exports.command = command;
//# sourceMappingURL=index-c56ed043.cjs.js.map
