UNPKG

zephyr-rspress-plugin

Version:

Rspress plugin for Zephyr

36 lines (35 loc) • 1.2 kB
import "node:module"; import { ze_log } from "zephyr-agent"; import { xpack_zephyr_agent } from "zephyr-xpack-internal"; import { buildStats } from "../stats/buildStats.mjs"; import { buildAssetMapFromFiles } from "./buildAssets.mjs"; async function setupZeDeploy({ deferEngine, outDir, files, hooks, mfConfig }) { if (!files.length) return void ze_log["package"]('ZeRspressPlugin: No files to process.'); const [assets, stats] = await Promise.all([ buildAssetMapFromFiles(outDir, files), Promise.resolve(buildStats(outDir, files)) ]); const zephyr_engine = await deferEngine; try { await zephyr_engine.start_new_build(); } catch (error) { if (false !== zephyr_engine.hasActiveBuild) zephyr_engine.build_failed(); throw error; } await xpack_zephyr_agent({ stats, stats_json: stats.toJson(), assets, pluginOptions: { pluginName: 'rspress-ssg', zephyr_engine, options: {}, hooks, ...void 0 === mfConfig ? {} : { mfConfig } } }); } export { setupZeDeploy }; //# sourceMappingURL=setupZeDeploy.mjs.map