var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.taskRnvStart=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _betterOpn=_interopRequireDefault(require("better-opn"));
var _platformManager=require("../core/platformManager");
var _logger=require("../core/systemManager/logger");
var _constants=require("../core/constants");




var _sdkWebpack=require("../sdk-webpack");
var _engineManager=require("../core/engineManager");

var taskRnvStart=function taskRnvStart(c,parentTask,originTask){var platform,port,hosted;return _regenerator.default.async(function taskRnvStart$(_context){while(1){switch(_context.prev=_context.next){case 0:
platform=c.platform;
port=c.runtime.port;
hosted=c.program.hosted;

(0,_logger.logTask)('taskRnvStart',"parent:"+parentTask+" port:"+c.runtime.port+" hosted:"+!!hosted);

if(hosted){
(0,_sdkWebpack.waitForWebpack)(c).
then(function(){return(0,_betterOpn.default)("http://"+c.runtime.localhost+":"+port+"/");}).
catch(_logger.logError);
}if(

parentTask){_context.next=8;break;}_context.next=8;return _regenerator.default.awrap(
(0,_engineManager.executeTask)(c,_constants.TASK_CONFIGURE,_constants.TASK_START,originTask));case 8:_context.t0=


platform;_context.next=_context.t0===
_constants.MACOS?11:_context.t0===
_constants.WINDOWS?11:12;break;case 11:return _context.abrupt("return",
(0,_sdkWebpack.runWebpackServer)(c));case 12:return _context.abrupt("return",

(0,_platformManager.logErrorPlatform)(c));case 13:case"end":return _context.stop();}}},null,null,null,Promise);};exports.taskRnvStart=taskRnvStart;var _default=



{
description:'Starts bundler / server',
fn:taskRnvStart,
task:'start',
params:_constants.PARAMS.withBase(_constants.PARAMS.withConfigure()),
platforms:[
_constants.MACOS,
_constants.WINDOWS]};exports.default=_default;
//# sourceMappingURL=task.rnv.start.js.map