zephyr-xpack-internal
Version:
Xpack internals for Zephyr
24 lines (23 loc) • 1.26 kB
JavaScript
import "node:module";
import { ZEPHYR_MANIFEST_FILENAME, createManifestContent, ze_log } from "zephyr-agent";
function setupManifestEmission(pluginOptions, compiler) {
const { pluginName, zephyr_engine } = pluginOptions;
const { RawSource } = compiler.webpack.sources;
compiler.hooks.thisCompilation.tap(pluginName, (compilation)=>{
compilation.hooks.processAssets.tapPromise({
name: `${pluginName}:EmitManifest`,
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
}, async ()=>{
if (compilation.getAsset?.(ZEPHYR_MANIFEST_FILENAME)) return void ze_log.manifest(`[Zephyr Manifest] Preserving pre-emitted ${ZEPHYR_MANIFEST_FILENAME}.`);
const dependencies = zephyr_engine.federated_dependencies || [];
const manifestContent = createManifestContent(dependencies, true);
compilation.emitAsset(ZEPHYR_MANIFEST_FILENAME, new RawSource(manifestContent));
ze_log.manifest('[Zephyr Manifest] Emitted with:', {
dependencies: dependencies.length,
hasEnvVars: manifestContent.includes('zeVars')
});
});
});
}
export { setupManifestEmission };
//# sourceMappingURL=ze-emit-manifest.mjs.map