UNPKG

piral-cli

Version:

The standard CLI for creating and building a Piral instance or a Pilet.

56 lines 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const envs_1 = require("../common/envs"); let handler; function run(root, piralInstances, sourceMaps, watch, contentHash, minify, externals, importmap, targetDir, outDir, outFile, entryModule, version, logLevel, args) { (0, envs_1.setStandardEnvs)({ production: true, piralInstances, root, }); return handler.create({ root, piralInstances, entryModule, targetDir, outDir, outFile, externals, importmap, version, develop: false, sourceMaps, contentHash, minify, logLevel, watch, args, }); } process.on('message', async (msg) => { try { switch (msg.type) { case 'init': handler = require(msg.path); break; case 'start': const bundler = await run(process.cwd(), msg.piralInstances, msg.sourceMaps, msg.watch, msg.contentHash, msg.minify, msg.externals, msg.importmap, msg.targetDir, msg.outDir, msg.outFile, msg.entryModule, msg.version, msg.logLevel, msg); const result = await bundler.bundle(); if (result && !msg.watch) { process.send({ type: 'done', outDir: result.outDir, outFile: result.outFile, }); } break; } } catch (error) { process.send({ type: 'fail', error: error?.message, }); } }); //# sourceMappingURL=run-build-pilet.js.map