"use strict";const unplugin=require("unplugin"),bundlerPluginCore=require("@codecov/bundler-plugin-core"),vitePlugin=require("@codecov/vite-plugin");function getBundleName(e="",t="",n,u){let o=u?`${e}-${u}`:e;const s=t.includes("server")?"server":t.includes("client")?"client":void 0;return s&&(o=`${o}-${s}`),n=n==="es"?"esm":n,o=`${o}-${n}`,o}const l="@codecov/solidstart-plugin",i="1.4.0",solidstartBundleAnalysisPlugin=({output:e})=>({version:e.version,name:l,pluginVersion:i,vite:{generateBundle(t){if(!e.bundleName||e.bundleName===""){bundlerPluginCore.red("Bundle name is not present or empty. Skipping upload.");return}const n=getBundleName(e.originalBundleName,t.dir,t.format,t.name);e.unlockBundleName(),e.setBundleName(n),e.lockBundleName(),e.setPlugin(l,i)}}}),g=unplugin.createVitePlugin((e,t)=>{if(bundlerPluginCore.checkNodeVersion(t))return[];const n=bundlerPluginCore.normalizeOptions(e);if(!n.success){const{shouldExit:s}=bundlerPluginCore.handleErrors(n);return s&&process.exit(1),[]}const u=[],o=new bundlerPluginCore.Output(n.options);return n.options.enableBundleAnalysis&&u.push(solidstartBundleAnalysisPlugin({output:o}),vitePlugin._internal_viteBundleAnalysisPlugin({output:o})),u}),codecovSolidStartPlugin=g;exports.codecovSolidStartPlugin=codecovSolidStartPlugin; //# sourceMappingURL=index.cjs.map