@servant/servant
Version:
Servant builder for node modules.
1 lines • 276 kB
JavaScript
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("child_process"),require("chokidar"),require("devlink-core"),require("eslint"),require("events"),require("fs"),require("glob"),require("less"),require("minimatch"),require("os"),require("path"),require("prettier"),require("sass"),require("semver"),require("simple-git"),require("typed-css-modules"),require("typescript"),require("url"),require("xml2js"),require("@servant/servant-data"),require("@servant/servant-discovery"),require("@servant/servant-files"),require("@servant/servant-generators"),require("@servant/servant-jasmine-browser"),require("@servant/servant-jasmine-node"),require("@servant/servant-stats"),require("trancorder-cli")):"function"==typeof define&&define.amd?define("@servant/servant",["child_process","chokidar","devlink-core","eslint","events","fs","glob","less","minimatch","os","path","prettier","sass","semver","simple-git","typed-css-modules","typescript","url","xml2js","@servant/servant-data","@servant/servant-discovery","@servant/servant-files","@servant/servant-generators","@servant/servant-jasmine-browser","@servant/servant-jasmine-node","@servant/servant-stats","trancorder-cli"],n):"object"==typeof exports?exports["@servant/servant"]=n(require("child_process"),require("chokidar"),require("devlink-core"),require("eslint"),require("events"),require("fs"),require("glob"),require("less"),require("minimatch"),require("os"),require("path"),require("prettier"),require("sass"),require("semver"),require("simple-git"),require("typed-css-modules"),require("typescript"),require("url"),require("xml2js"),require("@servant/servant-data"),require("@servant/servant-discovery"),require("@servant/servant-files"),require("@servant/servant-generators"),require("@servant/servant-jasmine-browser"),require("@servant/servant-jasmine-node"),require("@servant/servant-stats"),require("trancorder-cli")):e["@servant/servant"]=n(e.child_process,e.chokidar,e["devlink-core"],e.eslint,e.events,e.fs,e.glob,e.less,e.minimatch,e.os,e.path,e.prettier,e.sass,e.semver,e["simple-git"],e["typed-css-modules"],e.typescript,e.url,e.xml2js,e["@servant/servant-data"],e["@servant/servant-discovery"],e["@servant/servant-files"],e["@servant/servant-generators"],e["@servant/servant-jasmine-browser"],e["@servant/servant-jasmine-node"],e["@servant/servant-stats"],e["trancorder-cli"])}(this,((e,n,t,r,s,o,a,i,l,c,u,d,A,f,p,m,v,g,y,h,P,b,S,E,I,w,D)=>(()=>{"use strict";var O={8285:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.css=n.cssEntry=n.mapCss=n.filterCss=n.CssState=void 0;const r=t(3763),s=t(6485),o=t(502),a=t(2283),i=t(7546);var l;function c(e){return e.replace("export = styles","export default styles")}!function(e){e.OK="ok",e.Error="error"}(l=n.CssState||(n.CssState={})),n.filterCss=function(e){return s.CSS.only(e)},n.mapCss=function(e){return e.map((e=>s.CSS.toCSS(e)))},n.cssEntry=function(e,n){var t;return r.ServantJson.entries(null===(t=n.module)||void 0===t?void 0:t.servantJson).css},n.css=function(e,n,t){return new Promise(((r,u)=>{(0,a.invariant)(n.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const d=process.hrtime(),A=n.module.servantJson,f={errors:[],where:s.Path.join(A.cwd,[s.Extensions.patterns.all(s.CSS.MAIN)])[0],files:t,status:l.Error,time:"0s 0ms"};if(0===t.length)return f.status=l.OK,f.time=(0,i.createTime)(d),void r(f);const p=new o.default({rootDir:e.cwd,searchDir:"./"}),m=[];t.forEach((e=>{m.push(function(e,n){return new Promise((t=>{const r=function(e){return{from:e,to:null,error:null}}(n);e.create(n,void 0,!1).then((e=>e.writeFile(c))).then((()=>{r.to=s.Extensions.replace(n,s.TS.DECLARATION),t(r)})).catch((e=>{r.error=e,t(r)}))}))}(p,e))})),Promise.all(m).catch(u).then((e=>{const n=e.filter((e=>Boolean(e.error))).map((e=>e.error));f.status=n.length>0?l.Error:l.OK,f.errors=n,f.time=(0,i.createTime)(d),r(f)}))}))}},832:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.collect=n.filterJavascript=void 0;const r=t(6485);function s(e){return r.JS.only(e)}function o(e){const n=s(r.Extensions.collectJS(e));return[...new Set(n)]}n.filterJavascript=s,n.collect=function(e){var n;const t=null===(n=e.module)||void 0===n?void 0:n.servantJson;return{src:t?o(t.content.src):[],tests:t?o(t.content.tests):[]}}},1148:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.less=n.lessEntry=n.filterLess=n.LessState=void 0;const r=t(3763),s=t(6485),o=t(1492),a=t(3056),i=t(2089),l=t(2283),c=t(7546);var u;function d(e,n){return new Promise(((t,r)=>{i.mkdir(a.dirname(e),{recursive:!0},(s=>{i.writeFile(e,n,(e=>{s||e?r(s||e):t()}))}))}))}!function(e){e.OK="ok",e.Error="error"}(u=n.LessState||(n.LessState={})),n.filterLess=function(e){return s.LESS.only(e)},n.lessEntry=function(e,n){var t;return r.ServantJson.entries(null===(t=n.module)||void 0===t?void 0:t.servantJson).less},n.less=function(e,n,t){return new Promise(((e,r)=>{(0,l.invariant)(n.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const A=process.hrtime(),f={errors:[],files:[],status:u.OK,time:"0s 0ms"},p=n.module.packageJson.cwd;if(0===t.length)return f.time=(0,c.createTime)(A),void e(f);const m=[];t.forEach((e=>{m.push(function(e,n,t){return new Promise((e=>{const r=process.hrtime(),l=t,A=a.dirname(l),f=s.CSS.toCSS(t),p={error:null,source:a.relative(n,l),destination:a.relative(n,f),status:u.Error,time:"0s 0ms"};const m=Object.assign({},o.options);m.paths=[A,...m.paths||[]],m.filename=l,function(e,n){return new Promise((t=>{const r=function(e){return{less:e,error:null,css:"",imports:[]}}(e),a=e=>{r.error=e,t(r)};(function(e){return new Promise(((n,t)=>{i.readFile(e,((e,r)=>{e?t(e):n(r.toString())}))}))})(e).then((i=>{o.render(function(e){return e.toString().replace(/^\uFEFF/,"")}(i),n).then((n=>{r.css=n.css,r.imports=n.imports,d(s.CSS.toCSS(e),n.css).then((()=>t(r))).catch(a)})).catch(a)})).catch(a)}))}(l,m).then((n=>{p.status=n.error?u.Error:u.OK,p.error=n.error,p.time=(0,c.createTime)(r),e(p)}))}))}(0,p,e))})),Promise.all(m).then((n=>{f.files=n.filter((e=>e.status===u.OK)),f.errors=n.filter((e=>e.status===u.Error)),f.status=0===f.errors.length?u.OK:u.Error,f.time=(0,c.createTime)(A),e(f)})).catch(r)}))}},5492:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.resources=n.ResourcesState=void 0;const r=t(3056),s=t(2089),o=t(2283),a=t(7546);var i;!function(e){e.OK="ok",e.Warning="warning"}(i=n.ResourcesState||(n.ResourcesState={})),n.resources=function(e,n,t){return new Promise((e=>{(0,o.invariant)(n.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const l=process.hrtime(),c=n.module.packageJson,u=n.module.servantJson,d=c.cwd,A={status:i.OK,time:"0s 0ms",files:[],warnings:[]};if(0===t.length)return A.warnings=[],A.files=[],A.status=i.OK,A.time=(0,a.createTime)(l),void e(A);const f=r.join(d,u.content.output.directory),p=[];t.forEach((e=>{p.push(function(e,n,t){return new Promise((o=>{const a=r.basename(n),l=r.join(t,a);s.copyFile(n,l,(t=>{const s=t?i.Warning:i.OK,a=r.relative(e,n),c=r.relative(e,l);o(function(e,n,t){return{status:e,to:t,from:n}}(s,a,c))}))}))}(d,e,f))})),Promise.all(p).then((n=>{A.warnings=n.filter((e=>e.status!==i.OK)),A.files=n.filter((e=>e.status===i.OK)),A.status=0===A.warnings.length?i.OK:i.Warning,A.time=(0,a.createTime)(l),e(A)}))}))}},6405:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.sass=n.sassEntry=n.filterSass=n.SassState=void 0;const r=t(3763),s=t(6485),o=t(8735),a=t(3056),i=t(2089),l=t(2283),c=t(7546);var u;function d(e,n){return new Promise(((t,r)=>{i.mkdir(a.dirname(e),{recursive:!0},(s=>{i.writeFile(e,n,(e=>{s||e?r(s||e):t()}))}))}))}!function(e){e.OK="ok",e.Error="error"}(u=n.SassState||(n.SassState={})),n.filterSass=function(e){return s.SASS.only(e)},n.sassEntry=function(e,n){var t;return r.ServantJson.entries(null===(t=n.module)||void 0===t?void 0:t.servantJson).sass},n.sass=function(e,n,t){return new Promise(((e,r)=>{(0,l.invariant)(n.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const A=process.hrtime(),f={errors:[],files:[],status:u.OK,time:"0s 0ms"},p=n.module.packageJson.cwd;if(0===t.length)return f.time=(0,c.createTime)(A),void e(f);const m=[];t.forEach((e=>{m.push(function(e,n,t){return new Promise((e=>{const r=process.hrtime(),l=t,A=a.dirname(l),f=s.CSS.toCSS(t),p={error:null,source:a.relative(n,l),destination:a.relative(n,f),status:u.Error,time:"0s 0ms"};const m={};m.loadPaths=[A],m.url=new URL(l),function(e,n){return new Promise((t=>{const r=function(e){return{sass:e,error:null,css:"",imports:[]}}(e),a=e=>{r.error=e,t(r)};(function(e){return new Promise(((n,t)=>{i.readFile(e,((e,r)=>{e?t(e):n(r.toString())}))}))})(e).then((i=>{const l=o.compileString(function(e){return e.toString().replace(/^\uFEFF/,"")}(i),n);r.css=l.css,r.imports=l.loadedUrls.map((e=>e.toString())),d(s.CSS.toCSS(e),l.css).then((()=>t(r))).catch(a)})).catch(a)}))}(l,m).then((n=>{p.status=n.error?u.Error:u.OK,p.error=n.error,p.time=(0,c.createTime)(r),e(p)}))}))}(0,p,e))})),Promise.all(m).then((n=>{f.files=n.filter((e=>e.status===u.OK)),f.errors=n.filter((e=>e.status===u.Error)),f.status=0===f.errors.length?u.OK:u.Error,f.time=(0,c.createTime)(A),e(f)})).catch(r)}))}},5183:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.collect=n.translate=n.transpile=n.typescript=n.filterTypescript=n.TypescriptState=void 0;const r=t(3763),s=t(6485),o=t(9632),a=t(3056),i=t(2089),l=t(7198),c=t(3417),u=t(2283),d=t(7546),A=(0,c.resolveModulePath)("@servant/servant-build-webpack").path;var f;function p(e){return s.TS.only(e)}function m(e,n,t){return new Promise(((e,r)=>{const o=[];let l=Promise.resolve();l=l.then((()=>v(0,n,t).catch(r))),l=l.then((e=>(e&&o.push(e),function(e,n,t){return new Promise((e=>{(0,u.invariant)(n.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const r=n.module.servantJson,o=r.content.output,l=a.join(r.cwd,o.directory),c=[...new Set(t.map((e=>s.TS.toDTS(e))))],d=[],A=h([],c,[],[]);c.forEach((e=>{const n=e,t=a.join(l,a.relative(r.cwd,n));d.push(function(e,n){return new Promise((t=>{const r=a.dirname(n);i.mkdir(r,{recursive:!0},(r=>{i.copyFile(e,n,(s=>{t(function(e,n,t){return{ok:e,to:t,from:n}}(!(r||s),e,n))}))}))}))}(n,t))})),Promise.all(d).then((n=>{const t=n.filter((e=>!e.ok)).map((e=>new Error(`Can not copy d.ts file from "${e.from}" to "${e.to}".`)));A.errors=t,A.status=0===t.length?f.OK:f.Error,e(A)}))}))}(0,n,t).catch(r)))),l.then((n=>{n&&o.push(n),e(y(o))})).catch(r)}))}function v(e,n,t){return new Promise((e=>{(0,u.invariant)(n.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const i=process.hrtime(),l=n.module.servantJson,c=a.join(l.cwd,r.TsConfig.TSCONFIG_JSON),A=t.filter((e=>!s.TS.isDTS(e))),p=h([],[],A,[]);(function(e){return new Promise((n=>{r.TsConfig.load(e).then((e=>n(e))).catch((()=>n(r.TsConfig.create())))}))})(c).then((n=>{const t=o.createProgram(A,r.TsConfig.options(c,n)),s=t.emit(),a=o.getPreEmitDiagnostics(t).concat(s.diagnostics),u=function(e,n){const t=[];return n.forEach((e=>{let n=o.flattenDiagnosticMessageText(e.messageText,"\n");if(e.file&&void 0!==e.start){const{line:t,character:r}=e.file.getLineAndCharacterOfPosition(e.start);n=`${e.file.fileName} (${t+1},${r+1}): ${n}`}t.push(new Error(n))})),t}(l.cwd,a);p.errors=[],p.status=u.length>0?f.Error:f.OK,p.time=(0,d.createTime)(i),e(p)}))}))}function g(e){const n=p(s.Extensions.collectTS(e));return[...new Set(n)]}function y(e){const n=h([],[],[],[]);return e.forEach((e=>{n.errors.push(...e.errors),n.files=[...new Set([...n.files,...e.files])],n.css=[...new Set([...n.css,...e.css])],n.declarations=[...new Set([...n.declarations,...e.declarations])],n.transpilePatterns=[...new Set([...n.transpilePatterns,...e.transpilePatterns])],n.output=n.output||e.output})),n.status=0===n.errors.length?f.OK:f.Error,n}function h(e,n,t,r){return{files:e,declarations:n,css:r,transpilePatterns:t,errors:[],status:f.Error,time:"0s 0ms",output:""}}!function(e){e.OK="ok",e.Error="error"}(f=n.TypescriptState||(n.TypescriptState={})),n.filterTypescript=p,n.typescript=function(e,n,t,s,o,a){return new Promise(((i,c)=>{(0,u.invariant)(n.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const p=process.hrtime(),v=n.module.servantJson,g=t.length+s.length;if(!1===v.content.entry||0===g){const e=function(){const e=h([],[],[],[]);return e.errors=[],e.status=f.OK,e}();return e.time=(0,d.createTime)(p),void i(e)}const P=[];!a&&P.push(m(0,n,t)),P.push(function(e,n,t,s,o,a){return new Promise(((i,c)=>{(0,u.invariant)(n.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const d=(0,l.fork)(A,[]),p=h(t,[],[],s),m=e.cwd,v=n.module.servantJson.cwd,g=r.WebpackJson.create(m,v);g.module=n.module,g.production=o,g.transpile=a,d.send(g),d.on("message",(e=>{d.kill(),p.output=e.output,p.errors=e.errors.map((e=>function(e){const n=new Error(e.message);return n.name=e.name,n.stack=e.stack,n}(e))),p.status=0===p.errors.length?f.OK:f.Error})),d.on("error",(e=>{c(e)})),d.on("exit",(function(){i(p)}))}))}(e,n,t,s,o,a)),Promise.all(P).then((e=>{const n=y(e);n.time=(0,d.createTime)(p),i(n)})).catch(c)}))},n.transpile=m,n.translate=v,n.collect=function(e){var n;const t=null===(n=e.module)||void 0===n?void 0:n.servantJson;return{src:t?g(t.content.src):[],tests:t?g(t.content.tests):[]}}},8346:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.analyze=void 0;const r=t(8866),s=t(7546);function o(e){const n=e.map((({module:e})=>e)),t=e.reduce(((e,n)=>n.data?Object.assign(Object.assign({},e),{[n.module]:n.data}):e),{});return{modules:t,sorted:n,analyze:a(t)}}function a(e){const n={},t=[];return function(e,n=[]){return e.forEach((e=>{-1===n.indexOf(e)&&(n.push(e),n.push(...e.dependencies))})),n}(Object.keys(e).map((n=>e[n]))).forEach((e=>{e.versions.ranges.length>1&&(n[e.name]=[...new Set([...n[e.name]||[],...e.versions.ranges])]),e.missing&&-1===t.indexOf(e.name)&&t.push(e.name)})),{missing:t,versions:n}}n.analyze=function(e,n,t){return new Promise(((a,i)=>{const l={},c=(0,s.createCommandResult)(o([])),u=process.hrtime();r.scheduleSorted(n.sorted,(o=>r.analyze(e,n,n.modules[o],l).then((e=>(0,s.withProgress)(e,t))))).then((e=>{c.time=(0,s.createTime)(u),c.data=o(e),a(c)})).catch(i)}))}},4331:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.build=void 0;const r=t(8866),s=t(7546);n.build=function(e,n,t,o,a){return new Promise(((i,l)=>{const c=(0,s.createCommandResult)([]),u=process.hrtime();r.scheduleSorted(n.sorted,(i=>r.build(e,n.modules[i],o,a).then((e=>(0,s.withProgress)(e,t))))).then((e=>{c.time=(0,s.createTime)(u),c.data=[...e],i(c)})).catch(l)}))}},9162:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clean=void 0;const r=t(8866),s=t(7546);n.clean=function(e,n,t,o,a){return new Promise(((i,l)=>{const c=(0,s.createCommandResult)([]),u=[],d=process.hrtime();r.iterateSorted(n.sorted).forEach((i=>{const l=n.modules[i];u.push(r.clean(e,l,o,a).then((e=>(0,s.withProgress)(e,t))))})),Promise.all(u).then((e=>{c.time=(0,s.createTime)(d),c.data=[...e],i(c)})).catch(l)}))}},8622:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.answersUnify=n.convertUnify=n.initialize=n.command=void 0;const r=t(3060),s=t(9162),o=t(9985),a=t(1841),i=t(4331),l=t(1809);Object.defineProperty(n,"answersUnify",{enumerable:!0,get:function(){return l.answersUnify}}),Object.defineProperty(n,"convertUnify",{enumerable:!0,get:function(){return l.convertUnify}});const c=t(2815),u=t(726),d=t(7518),A=t(4657),f=t(8346),p=t(2283),m=t(113);n.command=function(e,n,t,r){return new Promise(((v,g)=>{const y=e=>v(e),h=r.production||!1,P=r.progress||(()=>{}),b=r.modules||{},S=r.freeze||!1,E=r.transpile||!1,I=r.prune||!1,w=r.noaudit||!1,D=r.browsers||[],O=r.devices||[],j=r.tag,T=r.gui,x=r.commit,C=r.fix||!1,M=r.latest||!1,B=r.link||!1,k=r.unlink||!1,R=r.increment,z=e.packageJson,J=n.graph;if((0,p.invariant)(z,"Servant package json is not defined in command() call."),(0,p.invariant)(J,"Servant dependencies graph is not defined in command() call."),"clean"!==t)if("install"!==t)if("update"!==t)if("validate"!==t)if("build"!==t)if("unify"!==t)if("publish"!==t)if("tests"!==t)if("analyze"!==t)if("shared"!==t)g(new Error(`Command '${t}' not exists. Try to look on help for available commands.`));else{const e=B?"link":k?"unlink":void 0;(0,A.shared)(z,J,P,e).then(y).catch(g)}else(0,f.analyze)(z,J,P).then(y).catch(g);else(0,u.tests)(z,J,P,D,O,T).then(y).catch(g);else(0,c.publish)(z,J,P,h,j,S,x,R).then(y).catch(g);else(0,l.unify)(z,J,P,b,M).then(y).catch(g);else(0,i.build)(z,J,P,h,E).then(y).catch(g);else(0,d.validate)(z,J,P,C).then(y).catch(g);else(0,a.update)(z,J,P).then(y).catch(g);else(0,o.install)(z,J,P,w).then(y).catch(g);else{const t=(0,m.resolveEntries)(e,n);(0,s.clean)(z,J,P,I,t).then(y).catch(g)}}))},n.initialize=function(e,n,t){return new Promise(((s,o)=>{(0,r.init)(e,n,t).then(s).catch(o)}))}},3060:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.init=void 0;const r=t(8866),s=t(7546);n.init=function(e,n,t){return new Promise(((o,a)=>{const i=(0,s.createCommandResult)({}),l=process.hrtime();r.init(e,n,t).then((e=>{i.time=(0,s.createTime)(l),i.data=e,o(i)})).catch(a)}))}},9985:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.install=void 0;const r=t(8866),s=t(7546);n.install=function(e,n,t,o){return new Promise(((a,i)=>{const l=(0,s.createCommandResult)([]),c=process.hrtime(),u=[];let d=Promise.resolve();r.iterateSorted(n.sorted).forEach((a=>{const i=n.modules[a];d=d.then((()=>r.install(e,i,o).then((e=>(0,s.withProgress)(e,t))).then((e=>u.push(e)))))})),d.then((()=>{l.time=(0,s.createTime)(c),l.data=[...u],a(l)})).catch(i)}))}},2815:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.publish=void 0;const r=t(8866),s=t(7546);n.publish=function(e,n,t,o,a,i,l,c){return new Promise(((u,d)=>{const A=(0,s.createCommandResult)([]),f=process.hrtime();r.scheduleSorted(n.sorted,(u=>r.publish(e,n.modules[u],n,o,a,i,l,c).then((e=>(0,s.withProgress)(e,t))))).then((e=>{A.time=(0,s.createTime)(f),A.data=[...e],u(A)})).catch(d)}))}},4657:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.shared=void 0;const r=t(8866),s=t(7546);n.shared=function(e,n,t,o){return new Promise(((a,i)=>{const l=(0,s.createCommandResult)([]),c=process.hrtime(),u=[];r.scheduleSorted(n.sorted,(a=>{const i=n.modules[a];return r.shared(e,i,{mode:o}).then((e=>(0,s.withProgress)(e,t))).then((e=>u.push(e)))})).then((()=>{l.time=(0,s.createTime)(c),l.data=[...u],a(l)})).catch(i)}))}},726:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tests=void 0;const r=t(8866),s=t(7546);n.tests=function(e,n,t,o,a,i){return new Promise(((l,c)=>{const u=(0,s.createCommandResult)([]),d=process.hrtime(),A=[];r.iterateSorted(n.sorted).forEach((s=>{const l=n.modules[s];A.push(r.tests(e,l,t,o,a,i))})),Promise.all(A).then((e=>{u.time=(0,s.createTime)(d),u.data=[...e],l(u)})).catch(c)}))}},1809:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.answersUnify=n.convertUnify=n.unify=void 0;const r=t(8866),s=t(8866),o=t(7546);function a(e,n){const t=(0,o.createCommandResult)({}),{modules:r}=e;return t.time=(0,o.createTime)(n),t.data=r.reduce(((e,n)=>(n.data&&n.data.unified.forEach((n=>{n.type===s.DoneType.OK&&(e[n.package]=n.version)})),e)),{}),t}n.unify=function(e,n,t,o={},i=!0){return new Promise(((l,c)=>{const u=process.hrtime(),d=i?s.ServantUnifyType.Latest:s.ServantUnifyType.Provided;r.unify(e,n,{unified:o,type:d}).then((e=>{e.errors.length?c(e.errors[0]):(e.modules.forEach(t),l(a(e,u)))})).catch(c)}))},n.convertUnify=function(e,n){const t=e.customData||{results:[]},r=(0,s.createUnifyResults)(t,e.errors),o=r.modules.reduce(((e,n)=>(e[n.module]=n,e)),{});return Object.assign(Object.assign({},a(r,n||process.hrtime())),{modules:o})},n.answersUnify=function({modules:e={},latest:n=!1}){const t=[],r=Object.keys(e);return(n||r.length>0)&&t.push({id:s.ServantUnifyProperty.Type,value:n?s.ServantUnifyType.Latest:s.ServantUnifyType.Provided}),r.length>0&&r.forEach((n=>{const r=(0,s.getUnifyId)(n);t.push({id:r,value:e[n]})})),t}},1841:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.update=void 0;const r=t(8866),s=t(7546);n.update=function(e,n,t){return new Promise(((o,a)=>{const i=(0,s.createCommandResult)([]),l=process.hrtime(),c=[];let u=Promise.resolve();r.iterateSorted(n.sorted).forEach((o=>{const a=n.modules[o];u=u.then((()=>r.update(e,a).then((e=>(0,s.withProgress)(e,t))).then((e=>c.push(e)))))})),u.then((()=>{i.time=(0,s.createTime)(l),i.data=[...c],o(i)})).catch(a)}))}},7518:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validate=void 0;const r=t(8866),s=t(7546);n.validate=function(e,n,t,o){return new Promise(((a,i)=>{const l=(0,s.createCommandResult)([]),c=process.hrtime(),u=[];r.iterateSorted(n.sorted).forEach((a=>{const i=n.modules[a];u.push(r.validate(e,i,o).then((e=>(0,s.withProgress)(e,t))))})),Promise.all(u).then((e=>{l.time=(0,s.createTime)(c),l.data=[...e],a(l)})).catch(i)}))}},113:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.resolveEntries=void 0;const r=t(6485),s=t(3763),o=t(3056),a=t(6874),i=t(2283);function l(e,n,t){return e.file?{file:u(n,t.cwd,e.file)}:{}}function c(e,n,t){return Object.keys(n).reduce(((r,o)=>{var a,i;const l=null!==(i=null===(a=e.modules[o].module)||void 0===a?void 0:a.servantJson.content.target)&&void 0!==i?i:s.ServantJson.ServantJsonDefaults.target;return l&&t.includes(l)&&(r[o]=n[o]),r}),{})}function u(e,n,t){if(o.isAbsolute(t)||d(t))return t;const s=o.relative(e,n);return r.Path.normalize(o.join(s,t))}function d(e){try{return new a.URL(e),!0}catch(e){return!1}}n.resolveEntries=function(e,n){(0,i.invariant)(e.servantJson,"Servant json is not defined in InitData. This is probably error in Servant."),(0,i.invariant)(n.graph,"Servant dependencies graph is not defined in command() call.");const t=e.entry,r={entries:e.servantJson.content.server.entries};var a;const A=function(e,n){return Object.keys(e).reduce(((t,r)=>{const s=e[r];return t[r]={entries:Object.keys(s.server.entries).reduce(((e,t)=>{const r=s.server.entries[t];return e[t]=Object.assign(Object.assign(Object.assign(Object.assign({},function(e){return e.title?{title:e.title}:{}}(r)),function(e,n,t){return e.template?{template:u(n,t.cwd,e.template)}:{}}(r,n,s)),function(e,n,t){return e.command?{command:Object.assign(Object.assign({},e.command),l(e.command,n,t))}:{}}(r,n,s)),function(e,n,t){return e.shared?{shared:Object.keys(e.shared).reduce(((r,s)=>{const a=e.shared&&e.shared[s];if(!o.isAbsolute(s)&&!d(s))return a&&(r[u(n,t.cwd,s)]=a),r}),{})}:{}}(r,n,s)),e}),{})},t}),{})}((a=n.graph).all.reduce(((e,n)=>{const t=a.modules[n];return t.module&&(e[t.name]={server:t.module.servantJson.content.server,cwd:t.module.servantJson.cwd}),e}),{}),t),f=function(e,n){return Object.keys(n).reduce(((e,t)=>{const r=n[t];return{entries:(s=e.entries,o=r.entries,Object.keys(o).reduce(((e,n)=>{const t=e[n]||{};return e[n]=Object.assign(Object.assign({},t),o[n]),e}),s))};var s,o}),e)}(r,A);return function(e,n){return{server:{entries:c(e,n.entries,[s.ServantJson.ModuleTarget.node])},client:{entries:c(e,n.entries,[s.ServantJson.ModuleTarget.web,s.ServantJson.ModuleTarget.web_page])}}}(n.graph,f)}},2283:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.invariant=void 0,n.invariant=function(e,n){if(!e)throw new Error(n)}},8299:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parse=void 0;const t=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;n.parse=function(e){let n=e.replace(t,"").replace(/[\r]/g,"").split(/[\n]/g);return n=n.map((e=>e.trim())).filter((e=>Boolean(e))),n}},4270:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.extract=n.createNpmResult=n.publish=n.pack=n.update=n.install=n.NpmStatus=void 0;const r=t(9044),s=t(7198),o=t(8299),a=t(3417),i=t(3056),l=t(7546);var c;function u(e){const n=[];return e?(e.registry&&n.push("--registry",`"${e.registry}"`),Object.keys(e.scopes).forEach((t=>{n.push(`--${t}:registry`,`"${e.scopes[t]}"`)})),n):n}function d(e,n){return new Promise((t=>{var a,i;const u=process.hrtime(),d=function(e,n){const t="win32"===r.platform()?"npm.cmd":"npm";return(0,s.spawn)(t,n,{cwd:e.cwd})}(e,n),b=A(`npm ${n.join(" ")}`);let S="",E="";null===(a=d.stdout)||void 0===a||a.on("data",(e=>{S+=e.toString()})),null===(i=d.stderr)||void 0===i||i.on("data",(e=>{E+=e.toString()})),d.on("close",(e=>{0===e?(b.status=c.OK,b.data=function(e){let n="0",t="0",r="0",s="0",o=null,a=null;return e.forEach((e=>{let i;i=m.exec(e),i&&(n=(i||[])[1]||"0"),i=v.exec(e),i&&(t=(i||[])[1]||"0"),i=g.exec(e),i&&(r=(i||[])[1]||"0"),i=y.exec(e),i&&(s=(i||[])[1]||"0"),i=h.exec(e),i&&(o=(i||[])[1]||null),i=P.exec(e),i&&(a=(i||[])[1]||null),m.lastIndex=0,v.lastIndex=0,g.lastIndex=0,y.lastIndex=0,h.lastIndex=0,P.lastIndex=0})),{package:o,published:a,audited:parseInt(n,10),added:parseInt(t,10),removed:parseInt(r,10),vulnerabilities:parseInt(s,10)}}((0,o.parse)(S))):(b.status=c.Error,b.error=function(e){let n="",t="";return e.forEach((e=>{const r=f.exec(e),s=p.exec(e);r?n=r[1]:s&&(t+=s[1]+" "),f.lastIndex=0,p.lastIndex=0})),new Error(`${n}: ${t}`)}((0,o.parse)(E))),b.time=(0,l.createTime)(u),t(b)}))}))}function A(e){return{error:null,data:null,command:e,status:c.Error,time:"0s 0ms"}}!function(e){e.OK="ok",e.Error="error"}(c=n.NpmStatus||(n.NpmStatus={})),n.install=function(e,n=null){const t=["install"];return t.push(...u(n)),d(e,t)},n.update=function(e,n=null){const t=["update"];return t.push(...u(n)),d(e,t)},n.pack=function(e){return d(e,["pack"])},n.publish=function(e,n="latest",t="public",r=null){const s=["publish"];return s.push("--tag",n),s.push("--access",t),s.push(...u(r)),d(e,s)},n.createNpmResult=A;const f=/npm ERR! code ([A-Za-z]{0,})/g,p=/npm ERR! [A-Za-z]{0,} (.*)/g,m=/audited ([0-9]{0,})/g,v=/added ([0-9]{0,})/g,g=/removed ([0-9]{0,})/g,y=/found ([0-9]{0,}) vulnerabilities/g,h=/(.*\.tgz)/g,P=/\+ (.*@.*)/g,b="npm:";n.extract=function(e){const n=[],t=e.filter((e=>!!function(e){return 0===e.indexOf(b)}(e)||(n.push(e),!1))).map((e=>function(e){const n=e.split("//"),t=(n[0]||"").replace(b,""),r=i.join("./",n[1]||"");return(0,a.resolveModule)(__dirname,t,r,!0).path||null}(e)||e));return[n,t]}},7951:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.loadLibrary=n.watch=n.create=n.command=n.modules=n.init=void 0;const r=t(3763),s=t(6485),o=t(3056),a=t(8866),i=t(8622),l=t(1883),c=t(3417),u=t(2283);function d(e,n={}){return new Promise(((t,r)=>{(0,u.invariant)(e.servantJson,"Servant json is not defined in InitData. This is probably error in Servant.");const s=e.servantJson;a.loadsModules(s,n.init).then((e=>a.dependencies(s,e,n.only||[],n.changed||[],n.dependencies||!1))).then((e=>{t({graph:e,validation:a.validateDependencies(e)})})).catch(r)}))}function A(){const e=function(){let e=__dirname;for(;e&&o.basename(e)!==m;)e=o.dirname(e);return e}(),n=o.join(e,r.PackageJson.PACKAGE_JSON);return r.PackageJson.load(n,!0)}function f(e){const n=o.join(e,r.PackageJson.PACKAGE_JSON),t=o.join(e,r.ServantJson.SERVANT_JSON);return r.PackageJson.load(n,!0).then((e=>r.ServantJson.load(t,e)))}function p(e){return new Promise((n=>{f(o.join(e,"../")).then((t=>function(e,n){return new Promise((t=>{const o=e.content.modules||[],a=s.Path.join(n,[r.PackageJson.PACKAGE_JSON])[0],i=o.map((e=>s.Path.patterns.all(s.Path.patterns.everywhere(e))));s.Path.matchedOne(a,i)?r.PackageJson.load(a,!1).then((n=>{t({entry:e.cwd,servantJson:e,module:n.content.name})})).catch((()=>t(void 0))):t(void 0)}))}(t,e).then(n))).catch((()=>n(void 0)))}))}n.init=function(e){return new Promise(((n,t)=>{(function(e){return new Promise(((n,t)=>{const r=[p(e),A(),f(e)];Promise.all(r).then((([t,r,s])=>{n(t?Object.assign(Object.assign({},t),{packageJson:r}):{packageJson:r,servantJson:s,entry:e})})).catch(t)}))})(e).then(n).catch(t)}))},n.modules=d,n.command=function(e,n,t,r){return i.command(e,n,t,r)},n.create=function(e,n,t){return i.initialize(e,n,t)},n.watch=function(e,n,{transpile:t=!0}={}){return new Promise(((r,s)=>{d(e).then((r=>l.watch(e,r,n,{transpile:t}))).catch(s)}))},n.loadLibrary=function(e,n){const t=r.ServantJson.library(e,n);return""===t?Object.assign(Object.assign({},(0,c.resolveModule)(e.cwd,n,t,!0)),{empty:!0}):null!==t?Object.assign(Object.assign({},(0,c.resolveModule)(e.cwd,n,t,!0)),{empty:!1}):null};const m="servant"},5306:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.analyze=void 0;const r=t(3763),s=t(6485),o=t(9733),a=t(6046),i=t(2283),l=t(4639),c=t(8866);function u(e,n,t){return new Promise(((i,c)=>{const f=t[n.name];if(f)return void i(f);const p=n.versions.filter(r.PackageJson.versionIsExternal),m=function(e,n,t){return{name:e,type:t,missing:!1,versions:{ranges:n,intersects:!0},sizes:{bundle:0,tests:0,sources:0,installation:0},lines:{sources:{css:0,sass:0,javascript:0,less:0,typescript:0},tests:{css:0,sass:0,javascript:0,less:0,typescript:0}},dependencies:[]}}(n.name,p,n.depType);t[n.name]=m,function(e,n,t,r){return Promise.all([...n.internals.map((e=>u(t,e,r))),...n.externals.map((e=>u(t,e,r)))]).then((n=>{e.dependencies=n}))}(m,n,e,t).then((()=>function(e){return new Promise((n=>{var t,r;const a=(0,l.loadPackageJsonFiles)(null===(t=e.module)||void 0===t?void 0:t.packageJson).then((({cwd:e,files:n})=>(0,o.stats)(s.Path.join(e,n),{countLines:!1}))),i=(0,l.loadServantJsonFiles)(null===(r=e.module)||void 0===r?void 0:r.servantJson).then((({cwd:e,sources:n,tests:t})=>Promise.all([(0,o.stats)(s.Path.join(e,n)),(0,o.stats)(s.Path.join(e,t))])));Promise.all([a,i]).then((([e,n])=>[e,...n])).then((([e,t,r])=>n({bundle:e,sources:t,tests:r})))}))}(n))).then((e=>function(e,n,t){return Promise.resolve().then((()=>{e.missing=n.missing,e.versions=function(e){const n=e.ranges.filter((e=>a.validRange(e)));return n.length>0?Object.assign(Object.assign({},e),{intersects:n.every((e=>n.every((n=>a.intersects(e,n)))))}):e}(e.versions),e.sizes=function(e,n,t){const s=d(t.bundle),o=d(t.sources),a=d(t.tests),i=function(e,n,t){var s;const o=n.module?r.PackageJson.bundledDependencies(null===(s=n.module)||void 0===s?void 0:s.packageJson):[];return e.filter((e=>-1===o.indexOf(e.name))).reduce(((e,n)=>e+n.sizes.bundle),0)+t}(e.dependencies,n,s);return{bundle:s,sources:o,tests:a,installation:i}}(e,n,t),e.lines=function(e,n,t){var r;if(!(null===(r=n.module)||void 0===r?void 0:r.internal))return{sources:{css:0,sass:0,javascript:0,less:0,typescript:0},tests:{css:0,sass:0,javascript:0,less:0,typescript:0}};return{sources:A(t.sources),tests:A(t.tests)}}(0,n,t)}))}(m,n,e))).then((()=>i(m))).catch(c)}))}function d(e){return Object.values(e.files).reduce(((e,n)=>e+n.stats.size),0)}function A(e){return Object.keys(e.lines).reduce(((n,t)=>{const r=e.lines[t],o="test"+t;return s.TS.isTypescript(o)&&(n.typescript+=r.meaningful),s.JS.isJavascript(o)&&(n.javascript+=r.meaningful),s.LESS.isLESS(o)&&(n.less+=r.meaningful),s.SASS.isSASS(o)&&(n.sass+=r.meaningful),s.CSS.isCSS(o)&&(n.css+=r.meaningful),n}),{css:0,sass:0,javascript:0,less:0,typescript:0})}n.analyze=function(e,n,t,r={}){return new Promise(((e,s)=>{(0,i.invariant)(t.module,"No module declaration found. Invalid data provided or is probably error in Servant."),u(n,t,r).then((n=>{e((0,c.createResult)("analyze",t.name,c.DoneType.OK,null,[],n))})).catch(s)}))}},2417:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.analyze=void 0;const r=t(5306);Object.defineProperty(n,"analyze",{enumerable:!0,get:function(){return r.analyze}})},4903:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.buildFiles=n.build=void 0;const r=t(6485),s=t(8866),o=t(4639),a=t(8285),i=t(1148),l=t(6405),c=t(5183),u=t(5492),d=t(2283);function A(e,n,t,o,d){return new Promise(((A,p)=>{const m=function(e){const n={};e.sources.some(r.LESS.isLESS)&&(n.less=!0,n.css=!0);e.sources.some(r.SASS.isSASS)&&(n.sass=!0,n.css=!0);e.sources.some(r.CSS.isCSS)&&(n.css=!0);return e.sources.some((e=>r.TS.isTypescript(e)||r.JS.isJavascript(e)))&&(n.typescript=!0,n.declarations=!0),e.resources.length>0&&(n.resources=!0),Object.keys(n)}(t),v=(0,i.filterLess)(t.sources),g=(0,l.filterSass)(t.sources),y=[...new Set([...(0,a.filterCss)(t.sources),...(0,a.mapCss)(v),...(0,a.mapCss)(g)])],h=(0,c.filterTypescript)(t.sources),P=function(e){return{module:e,less:null,css:null,sass:null,typescript:null,resources:null,type:s.DoneType.FAIL}}(n.name),b=(0,i.lessEntry)(e,n),S=(0,l.sassEntry)(e,n),E=(0,a.cssEntry)(e,n);let I=Promise.resolve();m.indexOf("less")>=0&&(f(b,v),I=function(e,n,t,r,s){return e.then((()=>(0,i.less)(n,t,r).then((e=>{s.less=e}))))}(I,e,n,v,P).catch(p)),m.indexOf("sass")>=0&&(f(S,g),I=function(e,n,t,r,s){return e.then((()=>(0,l.sass)(n,t,r).then((e=>{s.sass=e}))))}(I,e,n,g,P).catch(p)),m.indexOf("css")>=0&&(f(E,y),I=function(e,n,t,r,s){return e.then((()=>(0,a.css)(n,t,r))).then((e=>{s.css=e}))}(I,e,n,y,P).catch(p)),m.indexOf("declarations")>=0&&(I=function(e,n,t,r,s){return e.then((()=>(0,c.transpile)(n,t,r))).then((e=>{s.typescript=e}))}(I,e,n,h,P).catch(p)),(m.indexOf("typescript")>=0||m.indexOf("css")>=0)&&(I=function(e,n,t,r,s,o,a,i){return e.then((()=>(0,c.typescript)(n,t,r,s,o,a))).then((e=>{i.typescript=e}))}(I,e,n,h,y,o,d,P).catch(p)),m.indexOf("resources")>=0&&(I=function(e,n,t,r,s){return e.then((()=>(0,u.resources)(n,t,r))).then((e=>{s.resources=e}))}(I,e,n,t.resources,P).catch(p)),I.then((()=>{P.type=function(e){return e.less&&e.less.status===i.LessState.Error||e.sass&&e.sass.status===l.SassState.Error||e.css&&e.css.status===a.CssState.Error||e.typescript&&e.typescript.status===c.TypescriptState.Error?s.DoneType.FAIL:e.resources&&e.resources.status===u.ResourcesState.Warning?s.DoneType.WARNING:s.DoneType.OK}(P),A(P)}))}))}function f(e,n){e&&-1===n.indexOf(e.from)&&n.push(e.from)}n.build=function(e,n,t,r){return new Promise(((a,i)=>{(0,d.invariant)(n.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const l=n.module.servantJson,c=l.cwd,u=[].concat(l.content.src),f=[].concat(l.content.resources);Promise.all([(0,o.loadPatterns)(c,u),(0,o.loadResources)(c,f)]).then((([o,i])=>{A(e,n,{sources:o,resources:i},t,r).then((e=>{e.type===s.DoneType.OK?a((0,s.createResult)("build",n.name,e.type,null,[],e)):a((0,s.createResult)("build",n.name,e.type,new Error(`Build command failed in building of module "${n.name}"`),[],e))}))})).catch(i)}))},n.buildFiles=A},9888:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.buildFiles=n.build=void 0;const r=t(4903);Object.defineProperty(n,"build",{enumerable:!0,get:function(){return r.build}}),Object.defineProperty(n,"buildFiles",{enumerable:!0,get:function(){return r.buildFiles}})},2356:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clean=void 0;const r=t(6485),s=t(3056),o=t(2089),a=t(7928),i=t(8866),l=t(843),c=t(4639),u=t(2283),d=[r.Path.patterns.all("node_modules"),"package-lock.json"];n.clean=function(e,n,t,A){return new Promise(((e,f)=>{(0,u.invariant)(n.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const p=n.module,m=function(e){return{module:e,removed:[]}}(n.name),v=[];v.push(function(e){return new Promise(((n,t)=>{(0,u.invariant)(e.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const o=e.module.servantJson,a=[];var i;a.push((i=o,new Promise(((e,n)=>{l.git.versioned(i).then((n=>{e(n.map((e=>r.Path.normalize(s.join(i.cwd,e)))))})).catch(n)})))),a.push(function(e){return new Promise((n=>{const t=[];e.internals.forEach((e=>{const n=r.Path.patterns.everywhere(s.join("node_modules",e.name));t.push(r.Path.patterns.all(n)),t.push(n)})),n(t)}))}(e)),Promise.all(a).then((e=>{const t=[];e.forEach((e=>{t.push(...e)})),n(t)})).catch(t)}))}(n)),v.push(function(e,n,t){return new Promise(((o,a)=>{(0,u.invariant)(e.module,"No module declaration found. Invalid data provided or is probably error in Servant.");const i=[],l=e.module.packageJson,A=e.module.servantJson;if(t&&i.push((0,c.loadPatterns)(A.cwd,d)),l&&l.content.files&&l.content.files.length&&i.push((0,c.loadPatterns)(A.cwd,l.content.files)),!1!==A.content.entry){const e=r.Path.patterns.all(A.content.output.directory);i.push((0,c.loadPatterns)(A.cwd,[e]))}const f=r.Path.patterns.all(A.content.temp);var p;i.push((0,c.loadPatterns)(A.cwd,[f,A.content.temp])),l&&A&&i.push(function(e,n){const t=[];return n.content.clean.forEach((e=>{[...n.content.src,...n.content.tests].forEach((n=>{t.push(r.Extensions.replace(n,e))}))})),(0,c.loadPatterns)(n.cwd,t)}(0,A)),i.push(function(e,n,t){var o,a,i,l;const{client:u,server:d}=n,A=s.basename(e.cwd),f=[...Object.keys(null!==(a=null===(o=u.entries[t])||void 0===o?void 0:o.shared)&&void 0!==a?a:{}),...Object.keys(null!==(l=null===(i=d.entries[t])||void 0===i?void 0:i.shared)&&void 0!==l?l:{})].map((e=>r.Path.normalize(e).replace(`${A}/`,"")));return(0,c.loadPatterns)(e.cwd,f)}(A,n,e.name)),i.push((p=A,new Promise((e=>{const n=[...p.content.src,...p.content.tests];(0,c.loadPatterns)(p.cwd,n).then((n=>e((0,c.loadCleaned)(n))))})))),Promise.all(i).catch(a).then((e=>{const n=[];e.forEach((e=>{n.push(...e)})),o(n)}))}))}(n,A,t)),Promise.all(v).catch(f).then((t=>{const[r,s]=t,l=function(e,n){return n.filter((n=>!(e.indexOf(n)>=0)&&e.every((e=>!a(n,e,{dot:!0})))))}(r,s),c=function(e){const n=e.slice(0).sort(((e,n)=>n.length-e.length)),t=[],r=[];return n.forEach((e=>{try{o.statSync(e).isDirectory()?r.push(e):t.push(e)}catch(n){t.push(e)}})),{files:t,dirs:r}}(l);(function(e,n){return new Promise((e=>{const t=[n.files,...n.dirs.map((e=>[e]))],r=[];let s=Promise.resolve();t.forEach((e=>{s=s.then((()=>{const n=[];return e.forEach((e=>{n.push(function(e,n){return new Promise((e=>{o.stat(n,((t,r)=>{t?e(null):r.isDirectory()?o.rmdir(n,(()=>{e(n)})):o.unlink(n,(()=>{e(n)}))}))}))}(0,e))})),Promise.all(n).then((e=>{r.push(...e)}))}))})),s.then((()=>e(r.filter((e=>Boolean(e))))))}))})(p.servantJson,c).catch(f).then((t=>{m.removed=t,e((0,i.createResult)("clean",n.name,i.DoneType.OK,null,[],m))}))}))}))}},6443:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clean=void 0;const r=t(2356);Object.defineProperty(n,"clean",{enumerable:!0,get:function(){return r.clean}})},142:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validateVersions=n.validateDependencies=n.scheduleSorted=n.iterateSorted=n.dependencies=void 0;const r=t(3763),s=t(6485),o=t(843);function a(e,n,t,s=[]){if(e.modules[n])return e.modules[n];if(t&&t.internal)return r.Modules.create(n,t,!1);const o=s.some((e=>e.content.name===n));return r.Modules.create(n,t,!o)}function i(e,n){return n.needs.every((n=>e[n.name]))}function l(e,n){if(!n.module)return n.internals;const t=n.module.packageJson.cwd,o=Object.values(e),a=n.externals.map((e=>e.name)),i=r.PackageJson.dependencies(n.module.packageJson).filter((e=>e.local&&a.includes(e.module))).reduce(((e,n)=>{const a=function(e,n,t){const o=s.Path.normalize(r.PackageJson.resolveLocalVersion(n,t.version));return e.find((e=>!(!e.module||!e.module.internal)&&s.Path.join(e.module.packageJson.cwd,[`node_modules/${t.module}`])[0]===o))}(o,t,n);if(!a)throw new Error(`There is defined reference "${n.module}" to another module, but this module can not be found. This module needs to be internal and under Servant manage.`);return[...e,a]}),[]);return[...n.internals,...i]}function c(e,n,t=[]){return n.reduce(((n,r)=>t.includes(r)?(n.push([...t,r]),n):[...n,...c(e,e[r],[...t,r])]),[])}function u(e){let n=e.slice(0);return n=n.filter((e=>!r.PackageJson.versionIsLocal(e))),n.length<=1}function d(e,n,t){return n.length>0&&(n=function(e,n,t){if(!t)return n;const r=[];return Object.keys(e.modules).forEach((t=>{e.modules[t].internals.forEach((e=>{n.indexOf(e.name)>=0&&r.push(t)}))})),[...new Set([...n,...r])]}(e,n,t),function(e,n){e.sorted=e.sorted.map((e=>e.filter((e=>n.indexOf(e)>=0))))}(e,n),function(e){e.sorted=e.sorted.filter((e=>e.length>0))}(e)),e}n.dependencies=function(e,n,t,s,u){return new Promise((function(A,f){const p=function(e){const n={modules:{},sorted:[],all:[],changes:null};var t;(function(e,n,t){n.forEach((n=>{const s=n.packageJson,o=s.content.name,i=s.content.version,l=r.PackageJson.dependencies(s),c=a(t,o,n);n.internal&&(c.depType.push(r.Modules.DependencyType.Internal),c.depType=[...new Set(c.depType)],c.versions.push(i),c.versions=[...new Set(c.versions)],c.versions.sort()),c.missing=!1,t.modules[o]=c,l.forEach((r=>{const s=a(t,r.module,e[r.module]||null,n.dependencies);n.internal&&(s.depType.push(r.type),s.depType=[...new Set(s.depType)],s.versions.push(r.version),s.versions=[...new Set(s.versions)],s.versions.sort()),t.modules[r.module]=s}))}))})(e.reduce(((e,n)=>{const t=n.packageJson.content.name;return e[t]=e[t]||n,e}),{}),e,n),t=n,e.forEach((e=>{const n=t.modules[e.packageJson.content.name],s=e.packageJson;r.PackageJson.dependencies(s).forEach((e=>{const s=t.modules[e.module];s.depType.includes(r.Modules.DependencyType.Internal)?n.internals.includes(s)||n.internals.push(s):n.externals.includes(s)||n.externals.push(s)}))}));const s=function(e){const n=[],t=[];let r=[],s=[];Object.keys(e).forEach((n=>{var r;if(null===(r=e[n].module)||void 0===r?void 0:r.internal){const r=e[n];s.push({module:r,needs:l(e,r)}),t.push(n)}}));let o={};const a=s.length+2;for(let e=0;e<a;e++){const e=[],t={};if(s.forEach((n=>{0===n.needs.length||i(o,n)?(r.push(n.module.name),t[n.module.name]=!0):e.push(n)})),r.length>0&&n.push(r),s=e,r=[],o=Object.assign(Object.assign({},o),t),0===s.length)break}return function(e,n){if(0===n.length)return;const t=n.reduce(((n,{module:t,needs:r})=>(n[t.name]=r.filter((n=>!e[n.name])).map((e=>e.name)),n)),{}),r=c(t,Object.keys(t)).sort(((e,n)=>e.length-n.length));if(0===r.length)throw new Error("There is some cycle detected but servant can not determine cycle that cause it. Possible error in Servant.");const s=r[0],o=s[s.length-1];throw new Error(`There is possible circular references in modules "${s.join(" => ")}". Look into module "${o}", where is a problematic dependency.`)}(o,s),{all:t,sorted:n}}(n.modules);return n.all=s.all,n.sorted=s.sorted,n}(n);s.length>0&&e?(0,o.vcs)(e,p,s).then((e=>{!function(e,n){const t=function(e,n){const t=[],r=n.modules.filter((e=>e.changed)).map((e=>e.module));return e.all.forEach((n=>{e.modules[n].internals.forEach((e=>{r.indexOf(e.name)>=0&&t.push(n)}))})),[...new Set([...r,...t])]}(e,n);e.sorted=function(e,n){const t=[];return e.sorted.forEach((e=>{const r=e.filter((e=>n.indexOf(e)>=0));r.length>0&&t.push(r)})),t}(e,t),e.changes=n}(p,e),A(d(p,t,u))})).catch(f):A(d(p,t,u))}))},n.iterateSorted=function(e){const n=[];return e.forEach((e=>{e.forEach((e=>{n.push(e)}))})),n},n.scheduleSorted=function(e,n){return new Promise(((t,r)=>{const s=[];let o=Promise.resolve();e.forEach((e=>{o=o.then((()=>Promise.all(e.map((e=>n(e).then((e=>{s.push(e)}))))))).catch(r)})),o.then((()=>t(s)))}))},n.validateDependencies=function(e){const n={external:{},internal:{},missing:{}};return e.all.forEach((t=>{const r=e.modules[t];n.internal[t]=[...new Set(r.versions.concat(n.internal[t]||[]))],r.internals.forEach((e=>{n.internal[e.name]=[...new Set(e.versions.concat(n.internal[e.name]||[]))]})),r.externals.forEach((e=>{n.external[e.name]=[...new Set(e.versions.concat(n.external[e.name]||[]))]}));const s=r.module?r.externals.filter((({missing:e})=>e)):[];s.length>0&&(n.missing[t]=s.map((({name:e})=>e)))})),n},n.validateVersions=function(e){const n=Object.keys(e.internal).filter((n=>!u(e.internal[n])));return{externalInvalidVersions:Object.keys(e.external).filter((n=>!u(e.external[n]))),internalInvalidVersions:n,missing:e.missing}}},8866:function(e,n,t){var r=this&&this.__createBinding||(Object.create?function(e,n,t,r){void 0===r&&(r=t);var s=Object.getOwnPropertyDescriptor(n,t);s&&!("get"in s?!n.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,r,s)}:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]}),s=this&&this.__exportStar||function(e,n){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(n,t)||r(n,e,t)};Object.defineProperty(n,"__esModule",{value:!0}),n.DependencyType=n.ValidationEngine=n.ValidationUniversalSeverity=n.ValidationDoneType=n.ServantInitType=n.initGenerator=n.InitParamsDefault=n.ItemType=n.unifyGenerator=n.UnifyParamsDefault=n.ServantUnifyProperty=n.ServantUnifyType=n.createUnifyResults=n.getUnifyId=n.shared=n.analyze=n.validate=n.tests=n.prepareInit=n.init=n.publish=n.unify=n.build=n.update=n.install=n.clean=n.loadsModules=n.load=n.dependencies=n.validateDependencies=n.validateVersions=n.scheduleSorted=n.iterateSorted=n.createResult=n.DoneType=void 0;const o=t(3763),a=t(142);Object.defineProperty(n,"dependencies",{enumerable:!0,get:function(){return a.dependencies}}),Object.defineProperty(n,"validateDependencies",{enumerable:!0,get:function(){return a.validateDependencies}}),Object.defineProperty(n,"validateVersions",{enumerable:!0,get:function(){return a.validateVersions}}),Object.defineProperty(n,"scheduleSorted",{enumerable:!0,get:function(){return a.scheduleSorted}}),Object.defineProperty(n,"iterateSorted",{enumerable:!0,get:function(){return a.iterateSorted}});const i=t(3431);Object.defineProperty(n,"load",{enumerable:!0,get:function(){return i.load}}),Object.defineProperty(n,"loadsModules",{enumerable:!0,get:function(){return i.loadsModules}});const l=t(6443);Object.defineProperty(n,"clean",{enumerable:!0,get:function(){return l.clean}});const c=t(4792);Object.defineProperty(n,"install",{enumerable:!0,get:function(){return c.install}});const u=t(7366);Object.defineProperty(n,"update",{enumerable:!0,get:function(){return u.update}});const d=t(4138);Object.defineProperty(n,"validate",{enumerable:!0,get:function(){return d.validate}}),Object.defineProperty(n,"ValidationDoneType",{enumerable:!0,get:function(){return d.ValidationDoneType}}),Object.defineProperty(n,"ValidationUniversalSeverity",{enumerable:!0,get:function(){return d.ValidationUniversalSeverity}}),Object.defineProperty(n,"ValidationEngine",{enumerable:!0,get:function(){return d.ValidationEngine}});const A=t(6938);Object.defineProperty(n,"tests",{enumerable:!0,get:function(){return A.tests}}),Object.defineProperty(n,"ItemType",{enumerable:!0,get:function(){return A.ItemType}});const f=t(9888);Object.defineProperty(n,"build",{enumerable:!0,get:function(){return f.build}});const p=t(6234);Object.defineProperty(n,"unify",{enumerable:!0,get:function(){return p.unify}}),Object.defineProperty(n,"getUnifyId",{enumerable:!0,get:function(){return p.getUnifyId}}),Object.defineProperty(n,"createUnifyResults",{enumerable:!0,get:function(){return p.createUnifyResults}}),Object.defineProperty(n,"ServantUnifyType",{enumerable:!0,get:function(){return p.ServantUnifyType}}),Object.defineProperty(n,"ServantUnifyProperty",{enumerable:!0,get:function(){return p.ServantUnifyProperty}}),Object.defineProperty(n,"UnifyParamsDefault",{enumerable:!0,get:function(){return p.UnifyParamsDefault}}),Object.defineProperty(n,"unifyGenerator",{enumerable:!0,get:function(){return p.unifyGenerator}});const m=t(1409);Object.defineProperty(n,"publish",{enumerable:!0,get:function(){return m.publish}});const v=t(7371);Object.defineProperty(n,"init",{enumerable:!0,get:function(){return v.init}}),Object.defineProperty(n,"ServantInitType",{enumerable:!0,get:function(){return v.ServantInitType}}),Object.defineProperty(n,"InitParamsDefault",{enumerable:!0,get:function(){return v.InitParamsDefault}}),Object.defineProperty(n,"initGenerator",{enumerable:!0,get:function(){return v.initGenerator}}),Object.defineProperty(n,"prepareInit",{enumerable:!0,get:function(){return v.prepareInit}});const g=t(2417);Object.defineProperty(n,"analyze",{enumerable:!0,get:function(){return g.analyze}});const y=t(2983);Object.defineProperty(n,"shared",{enumerable:!0,get:function(){return y.shared}});var h,P=o.Modules.DependencyType;n.DependencyType=P,(h=n.DoneType||(n.DoneType={})).OK="OK",h.WARNING="WARNING",h.FAIL="FAIL",n.createResult=function(e,n,t,r,s,o){return{command:e,module:n,type:t,message:s||[],error:r,data:o||null}},s(t(4448),n)},382:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ASSETS_WEB_FILES=void 0;const r=t(59);n.ASSETS_WEB_FILES={"assets/logo":r.ServantLogoPng,"assets/favicon":r.FaviconPng}},59:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.FaviconPng=n.ServantLogoPng=void 0,n.ServantLogoPng="iVBORw0KGgoAAAANSUhEUgAAAyAAAAMgCAYAAADbcAZoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMy8yNi8xORBZeKQAAAAldEVYdFNvZnR3YXJlAE1hY3JvbWVkaWEgRmlyZXdvcmtzIE1YIDIwMDSHdqzPAAAFGXByVld4nO1bzY4cNRCusqsJEitISN6AC+LAgQ1I5IYIEYdwQAhxGQmRkCWRVmy0uxIcOaG8wnLmOTgRIaG9wIvkCBcY/Ntju223Z8YzXgmXtDNtb9lffVXlcv9M//7vLy/gKTxdLpeXl5cXFxdHR0eHh4cAcOMA4O/lN9cePBGNH968+dYJdAHhpyWJ7w/hDizgcziDR3AqPhfwGZzDV/AtfC0+F/CBdCrcFcfnqn0fTuChODoWx5/AE3F8KnrOxN+R0FjAF6JPjj2B79RsH8H3YvyxaJ8qhIUacyJ05CwP4bHo/RLegXfhPXhbjHvQ2jFdrpIgMsRm4JwGKcTSJsh19Aqs1lFFYcMoxFJK/jp6VBGeD64kDdiV+PB7N4ANoew3DSfwA2W0r0Nl66b09+uAMPrJDAj3o0pCEXxea/ICicBnEyAlpniKMrrqKllJlfBJO01G05QwRkWerON/0kbzVf5g4VQx/LUrEGmnCUxCwZtUl9hM+PxaqrH+uGHK1FD9qVhgAZcK4ecD53KUQAYJSmDwoQC/Rv1FIINvx2Ix/iQDNlr9Dn8t5fiBAZsVHzLx3wTfq8Eb7r7c5L8djjYgRfOhsYD4pluPXXRiCt0hoInWyGUmZIt9T/GXrMcUVJSocEoefK8taDzH+OhwxnnpdGj8RMOM4q5El0/aaOdbUxh5ggZflGsZPNXirsLGKRkVjBdbdWRboU5uCTFtnriAGe1EkwKMTy9nJvA6XWXeoqrEUmlySpY2gOl6xZzKJeeS3xSr5ZHdlmv+qK1L25iAl+PlCHkFxwz8oElM139ss5WTo0kDdE4iJjbG4SWo2nd09ir4AQCi9S8Gbydn9tIvopJYFipnuC0+6pOrPojX/yh9611uDIkqxfE5RwrwkRhL4sfhbd6YZI2dkKXLQogPZheM7f8J+j67qFIaXwFE8GP8U/BeesXop/yf4R85/4tdabnT60IS/f+M/2UVQDasEkjzYLqszNLXRur8SxiZ8T9fOQ0c/Mn5fzL6ZiQ3DluXP7O+tXs9M1XcORmZ0hfJjo5JNkojfUIvEZL49nYAOjfPEHDSFzo2cIkl6HS4+BW25YC+NjDscA0q5F8oPn3Dh4U95LQ9/Mw5ACP3lMtVREdi9L2UZKE9Zfx1mhg+6OQ7Zpa7DScL+shteuOT/Elvs9xOZ6dOLCSPvq+EXrOQP5r6O6547rplhr5fEliQ8UX8/SvugSx+xvl