piral-cli
Version:
The standard CLI for creating and building a Piral instance or a Pilet.
61 lines • 1.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = require("path");
const envs_1 = require("../common/envs");
let handler;
function run(root, outFile, outDir, piralInstances, hmr, externals, publicUrl, entryFiles, logLevel, args) {
(0, envs_1.setStandardEnvs)({
piralInstances,
dependencies: externals,
publicPath: publicUrl,
production: false,
debugPiral: true,
debugPilet: true,
root,
});
return handler.create({
root,
entryFiles,
outFile,
outDir,
externals,
emulator: true,
sourceMaps: true,
contentHash: false,
minify: false,
publicUrl,
hmr,
logLevel,
watch: true,
args,
});
}
process.on('message', async (msg) => {
try {
switch (msg.type) {
case 'init':
handler = require(msg.path);
break;
case 'start':
const root = process.cwd();
const outDir = (0, path_1.resolve)(root, 'dist');
const bundler = await run(root, msg.outFile, outDir, msg.piralInstances, true, msg.externals, msg.publicUrl, msg.entryFiles, msg.logLevel, msg);
const result = await bundler.bundle();
if (result) {
process.send({
type: 'done',
outDir: result.outDir,
outFile: result.outFile,
});
}
break;
}
}
catch (error) {
process.send({
type: 'fail',
error: error?.message,
});
}
});
//# sourceMappingURL=run-debug-mono-piral.js.map