@aventusjs/cli 0.0.39 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/lib/Aventus@I18n.package.avt +1 -1
  2. package/lib/Aventus@Main.package.avt +46 -28
  3. package/lib/Aventus@Php.package.avt +85 -87
  4. package/lib/Aventus@Sharp.package.avt +1099 -961
  5. package/lib/Aventus@UI.package.avt +790 -538
  6. package/lib/aventusjs-rules.md +791 -750
  7. package/lib/templateScript/AventusTemplate.d.ts +2 -0
  8. package/lib/templateScript/AventusTemplate.ts +88 -69
  9. package/out/RealInteraction.js +1 -1
  10. package/out/RealServer.js +289 -241
  11. package/out/cli.js +1 -1
  12. package/package.json +1 -1
  13. package/templates/projects/Default/!aventus.conf.avt +26 -0
  14. package/templates/projects/Default/src/components/.empty +0 -0
  15. package/templates/projects/Default/src/data/.empty +0 -0
  16. package/templates/projects/Default/src/lib/.empty +0 -0
  17. package/templates/projects/Default/src/ram/.empty +0 -0
  18. package/templates/projects/Default/src/states/.empty +0 -0
  19. package/templates/projects/Default/static/_theme.gs.avt +3 -0
  20. package/templates/projects/Default/static/default.gs.avt +9 -0
  21. package/templates/projects/Default/static/index.html +13 -0
  22. package/templates/projects/Default/template.avt.ts +51 -0
  23. package/templates/projects/Empty/!aventus.conf.avt +15 -0
  24. package/templates/projects/Empty/src/.empty +0 -0
  25. package/templates/projects/Empty/template.avt.ts +47 -0
  26. package/templates/projects/Tailwind/!aventus.conf.avt +22 -0
  27. package/templates/projects/Tailwind/.aventus/templates/TailwindTemplate/${{componentName}}/${{componentName}}.wcl.avt +27 -0
  28. package/templates/projects/Tailwind/.aventus/templates/TailwindTemplate/${{componentName}}/${{componentName}}.wcs.avt +3 -0
  29. package/templates/projects/Tailwind/.aventus/templates/TailwindTemplate/${{componentName}}/${{componentName}}.wcv.avt +1 -0
  30. package/templates/projects/Tailwind/.aventus/templates/TailwindTemplate/template.avt.ts +29 -0
  31. package/templates/projects/Tailwind/package.json +13 -0
  32. package/templates/projects/Tailwind/src/components/@TailwindCss.wcs.avt +0 -0
  33. package/templates/projects/Tailwind/src/components/TailwindBase/TailwindBase.wcl.avt +29 -0
  34. package/templates/projects/Tailwind/src/components/TailwindBase/TailwindBase.wcs.avt +0 -0
  35. package/templates/projects/Tailwind/src/components/TailwindBase/TailwindBase.wcv.avt +1 -0
  36. package/templates/projects/Tailwind/static/index.html +13 -0
  37. package/templates/projects/Tailwind/tailwind.config.js +8 -0
  38. package/templates/projects/Tailwind/tailwind.css +3 -0
  39. package/templates/projects/Tailwind/template.avt.ts +51 -0
  40. package/templates/storybook/Default/Home.mdx +90 -0
  41. package/templates/storybook/Default/Home.scss +118 -0
  42. package/templates/storybook/Default/assets/chart.jpeg +0 -0
  43. package/templates/storybook/Default/assets/custom.jpeg +0 -0
  44. package/templates/storybook/Default/assets/discord.svg +15 -0
  45. package/templates/storybook/Default/assets/generated.jpeg +0 -0
  46. package/templates/storybook/Default/assets/github.svg +3 -0
  47. package/templates/storybook/Default/assets/tutorials.svg +12 -0
  48. package/templates/storybook/Default/assets/youtube.svg +4 -0
  49. package/templates/storybook/Default/package.json +33 -0
  50. package/templates/templates/component/${{componentName}}/${{componentName}}.wcl.avt +29 -0
  51. package/templates/templates/component/${{componentName}}/${{componentName}}.wcs.avt +3 -0
  52. package/templates/templates/component/${{componentName}}/${{componentName}}.wcv.avt +1 -0
  53. package/templates/templates/component/${{componentName}}.wc.avt +17 -0
  54. package/templates/templates/component/template.avt.ts +48 -0
  55. package/templates/templates/data/${{dataName}}.data.avt +5 -0
  56. package/templates/templates/data/template.avt.ts +25 -0
  57. package/templates/templates/library/${{libName}}.lib.avt +5 -0
  58. package/templates/templates/library/template.avt.ts +24 -0
  59. package/templates/templates/ramBasic/${{objectName}}.ram.avt +24 -0
  60. package/templates/templates/ramBasic/template.avt.ts +24 -0
  61. package/templates/templates/ramCustom/${{objectName}}.ram.avt +50 -0
  62. package/templates/templates/ramCustom/template.avt.ts +22 -0
  63. package/templates/templates/state/${{name}}.state.avt +13 -0
  64. package/templates/templates/state/template.avt.ts +22 -0
  65. package/templates/templates/stateManager/${{name}}.state.avt +11 -0
  66. package/templates/templates/stateManager/template.avt.ts +27 -0
package/out/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- let e=require("commander"),t=require("path"),n=require("vscode-languageserver"),r=require("child_process"),i=require("fs");var a=class{static realInteraction;static async load(e){let t=eval;this.realInteraction=(await t(`import("./RealInteraction.js")`)).default.RealInteraction,this.realInteraction._server=o,e&&(this.realInteraction.config=e)}static async init(){this.clear(),console.log(`Welcome inside Aventus CLI`)}static clear(){this.realInteraction.clear()}static async select(e,t){return this.realInteraction?.select(e,t)||null}static async selectMultiple(e,t){return this.realInteraction?.selectMultiple(e,t)||null}static async input(e,t,n){return this.realInteraction?.input(e,t,n)||null}static async password(e,t){return this.realInteraction?.password(e,t)||null}static async tree(e,t,n){return this.realInteraction?.tree(e,t,n)||null}static async log(){return this.realInteraction?.log()||null}},o=class{static realServer;static get notifications(){return this.realServer?.notifications}static async load(){let e=eval;this.realServer=(await e(`import("./RealServer.js")`)).default.RealServer,this.realServer._interaction=a}static subscribeErrors(e){return this.realServer?.subscribeErrors(e)}static unsubscribeErrors(e){return this.realServer?.unsubscribeErrors(e)}static executeCommand(e,...t){return this.realServer?.executeCommand(e,...t)}static getErrors(){return this.realServer?.getErrors()}static start(e){return this.realServer?.start(e)}static create(){return this.realServer?.create()}static getStatistics(){return this.realServer?.getStatistics()}static async Input(e){return this.realServer?.Input(e)}},s=class e{static actions={};argsNb=0;register(t){let n=this.name.trim().split(` `),r=``,i=t;for(let t of n)r+=t,e.actions[r]||(e.actions[r]=i.command(t)),i=e.actions[r],r+=` `;i=i.description(this.description),i=this._registerArgs(i),i=this._registerOptions(i),i.action(async(...e)=>{let t=[];for(let n=0;n<this.argsNb;n++)t.push(e[n]);let n=e[this.argsNb];await this.run(t,n),process.exit(0)})}_registerArgs(e){return this.registerArgs(t=>{let n=``;if(t.type){let e=`<`,r=`>`;t.typeIsRequired!==void 0&&!t.typeIsRequired&&(e=`[`,r=`]`),t.typeIsArray&&(r=`...`+r),n+=`${e}${t.type}${r}`}this.argsNb++,e=e.argument(n,t.description,t.defaultValue)}),e}_registerOptions(e){return this.registerOptions(t=>{let n=[];if(t.shortName){Array.isArray(t.shortName)||(t.shortName=[t.shortName]);for(let e of t.shortName)n.push(`-`+e)}n.push(`--`+t.name);let r=n.join(`, `);if(t.type){let e=`<`,n=`>`;t.typeIsRequired!==void 0&&!t.typeIsRequired&&(e=`[`,n=`]`),t.typeIsArray&&(n=`...`+n),r+=` ${e}${t.type}${n}`}e=t.required?e.requiredOption(r,t.description,t.defaultValue):e.option(r,t.description,t.defaultValue)}),e}},c=class{register(e){let t=this.name.trim().split(` `),n=``,r=e;for(let e of t)n+=e,s.actions[n]||(s.actions[n]=r.command(e)),r=s.actions[n],n+=` `;r=r.description(this.description)}};function l(e){return t.sep===`/`?decodeURIComponent(e.replace(`file://`,``)):decodeURIComponent(e.replace(`file:///`,``))}function u(e){if(e.startsWith(`file://`))return e;let n=e[0].toLowerCase()+e.substring(1);return n=d(encodeURI(n.replace(/\\/g,`/`))),t.sep===`/`?`file://`+n:`file:///`+n}function d(e){return e.replace(/:/g,`%3A`).replace(/@/g,`%40`)}function f(e){let t=1024,n=[`Bytes`,`KiB`,`MiB`,`GiB`,`TiB`,`PiB`,`EiB`,`ZiB`,`YiB`],r=e==0?0:Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/t**r).toFixed(2))} ${n[r]}`}const p={Error:n.DiagnosticSeverity.Error,Warning:n.DiagnosticSeverity.Warning,Information:n.DiagnosticSeverity.Information,Hint:n.DiagnosticSeverity.Hint};var m=class extends s{get name(){return`build`}get description(){return`Build an aventus project`}registerArgs(e){e({description:`aventus.conf.avt path`,type:`string`,typeIsRequired:!1})}registerOptions(e){e({name:`builds`,description:`Define the build name`,type:`string`,typeIsRequired:!0,typeIsArray:!0}),e({name:`no-builds`,description:`No builds`,type:`boolean`,typeIsRequired:!1}),e({name:`statics`,description:`Define the static files to export`,type:`string`,typeIsRequired:!0,typeIsArray:!0}),e({name:`no-statics`,description:`No statics`,type:`boolean`,typeIsRequired:!1}),e({name:`verbose`,shortName:`v`,description:`Debug your compilation`}),e({name:`silent`,shortName:`s`,description:`No output`}),e({name:`json`,type:`boolean`,typeIsRequired:!1,description:`Result as json`})}async run(e,n){let r=e[0];r&&=(0,t.resolve)(r),await o.load(),n.builds===!1&&(n.builds=[]),n.statics===!1&&(n.statics=[]),await o.start({configPath:r,loadFiles:!0,buildOnly:n[`no-statics`],noBuild:n[`no-builds`],builds:n.builds,statics:n.statics,logLevel:n.verbose?0:3,errorByBuild:!0,useStats:!n.silent}),n.json?this.handleResultJson(n):this.handleResult(n)}handleResult(e){let t=o.getStatistics(),n=e.silent?e=>{}:console.log;n(),n(`Loading all files : Done in `+t.loadFileTime+`ms`),n(),n(`----`),n();let r=o.getErrors(),i=!1,a={},s={};for(let e in t.files){let n=t.files[e];if(n.type==`build`&&n.typeName){a[n.typeName]||(a[n.typeName]=[]);let e=` ${n.path} - ${f(n.size)}`;a[n.typeName].push(e)}else if(n.type==`static`&&n.typeName){s[n.typeName]||(s[n.typeName]=[]);let e=` ${n.path} - ${f(n.size)}`;s[n.typeName].push(e)}}let c=Object.keys(t.builds).length,u=Object.keys(t.statics).length,d=0;for(let o in t.builds){n(`Building `+o),n();let s=!1,f=r[o],m=t.builds[o],h=a[o];if(h){for(let e of h)n(e);n()}if(f){let t=!1;for(let n in f)for(let r of f[n]){let i=``,a;if(r.severity==p.Error)i=`\x1B[31m[error]\x1B[0m`,s=!0,a=console.error;else if(r.severity==p.Warning)i=`\x1B[33m[warning]\x1B[0m`,a=console.warn;else if(r.severity==p.Information)i=`\x1B[34m[info]\x1B[0m`,a=console.info;else if(r.severity==p.Hint){i=`\x1B[90m[hint]\x1B[0m`;continue}e.silent||(a(` ${i} ${l(n).replace(/\\/g,`/`)}:${r.range.start.line+1} : ${r.message}`),t=!0)}t&&n()}s?(n(` Build failed in `+m.buildTime+`ms`),i=!0):n(` Build success in `+m.buildTime+`ms`),d++,d==c&&u==0?n():(n(),n(`----`),n())}d=0;for(let e in t.statics){n(`Export static `+e),n();let r=t.statics[e],i=s[e];if(i){for(let e of i)n(e);n()}n(` Exported in `+r.buildTime+`ms`),d++,d==u?n():(n(),n(`----`),n())}i&&process.exit(1)}handleResultJson(e){let t=o.getStatistics(),n={success:!0,builds:{},statics:{}},r=o.getErrors(),i=!1,a=e=>{n.builds[e]||(n.builds[e]={diagnostics:{},outputSize:{},success:!0})},s=e=>{n.statics[e]||(n.statics[e]={outputSize:{}})},c=e=>{let t=1024,n=[`Bytes`,`KiB`,`MiB`,`GiB`,`TiB`,`PiB`,`EiB`,`ZiB`,`YiB`],r=e==0?0:Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/t**r).toFixed(2))} ${n[r]}`};for(let e in t.files){let r=t.files[e];if(r.type==`build`&&r.typeName){let e=r.typeName,t=l(r.path).replace(/\\/g,`/`);a(e),n.builds[e].outputSize[t]=c(r.size)}else if(r.type==`static`&&r.typeName){let e=l(r.path).replace(/\\/g,`/`);s(r.typeName),n.statics[r.typeName].outputSize[e]=c(r.size)}}for(let e in t.builds){a(e);let t=r[e];if(t)for(let r in t){let a=l(r).replace(/\\/g,`/`),o=[];n.builds[e].diagnostics[a]=o;for(let a of t[r]){let t;a.severity==p.Error?(n.builds[e].success=!1,n.success=!1,i=!0,t=`error`):a.severity==p.Warning?t=`warning`:a.severity==p.Information?t=`info`:a.severity==p.Hint&&(t=`hint`),o.push({content:a.message,start:a.range.start.line+1+`:`+a.range.start.character,end:a.range.end.line+1+`:`+a.range.end.character,type:t})}}}console.log(JSON.stringify(n,void 0,4)),i&&process.exit(1)}},h=class extends s{get name(){return`dev`}get description(){return`Start an interactive cli to dev with your aventus project`}registerArgs(e){e({description:`aventus.conf.avt path`,type:`string`,typeIsRequired:!1})}registerOptions(e){}async run(e,t){await a.load({clear:!0,printLogo:!0}),await o.load(),console.clear(),await a.init(),await o.start({loadFiles:!0,watchFiles:!0,useCompilators:!0,useTemplates:!0});let n=[{value:`create`,name:`Create...`},{value:`log`,name:`Show logs`},{value:`quit`,name:`Quit`}];for(a.clear();;){let e=await a.select(`Which action shoud I perform?`,n);e==`create`?await o.create():e==`log`?await a.log():e==`quit`?process.exit(0):console.log(`WIP`),a.clear()}}},g=class extends s{get name(){return`check`}get description(){return`Check an aventus project`}registerArgs(e){e({description:`aventus.conf.avt path`,type:`string`,typeIsRequired:!1})}registerOptions(e){e({name:`builds`,description:`Define the build name`,type:`string`,typeIsRequired:!0,typeIsArray:!0}),e({name:`json`,type:`boolean`,typeIsRequired:!1,description:`Result as json`})}async run(e,n){let r=e[0];r&&=(0,t.resolve)(r),n.builds===!1&&(n.builds=[]),await o.load(),await o.start({noBuild:!0,loadFiles:!0,buildOnly:!0,configPath:r,builds:n.builds,statics:void 0,logLevel:3,errorByBuild:!0,useStats:!1}),n.json?this.handleResultJson(n):this.handleResult(n)}handleResult(e){let t=o.getStatistics(),n=console.log;n(),n(`Loading all files : Done in `+t.loadFileTime+`ms`),n(),n(`----`),n();let r=o.getErrors();for(let e in r){let t=!1,i=r[e];if(i){let e=!1;for(let n in i)for(let r of i[n]){let i=``,a;if(r.severity==p.Error)i=`\x1B[31m[error]\x1B[0m`,t=!0,a=console.error;else if(r.severity==p.Warning)i=`\x1B[33m[warning]\x1B[0m`,a=console.warn;else if(r.severity==p.Information)i=`\x1B[34m[info]\x1B[0m`,a=console.info;else if(r.severity==p.Hint){i=`\x1B[90m[hint]\x1B[0m`;continue}a(` ${i} ${l(n).replace(/\\/g,`/`)}:${r.range.start.line+1} : ${r.message}`),e=!0}e&&n()}t||n(` Build has no error`)}}handleResultJson(e){let t={success:!0,builds:{}},n=o.getErrors(),r=!1,i=e=>{t.builds[e]||(t.builds[e]={diagnostics:{},success:!0})};for(let e in n){i(e);let a=n[e];if(a)for(let n in a){let i=l(n).replace(/\\/g,`/`),o=[];t.builds[e].diagnostics[i]=o;for(let i of a[n]){let n;i.severity==p.Error?(t.builds[e].success=!1,t.success=!1,r=!0,n=`error`):i.severity==p.Warning?n=`warning`:i.severity==p.Information?n=`info`:i.severity==p.Hint&&(n=`hint`),o.push({content:i.message,start:i.range.start.line+1+`:`+i.range.start.character,end:i.range.end.line+1+`:`+i.range.end.character,type:n})}}}console.log(JSON.stringify(t,void 0,4)),r&&process.exit(1)}},_=class extends s{get name(){return`format`}get description(){return`Format your project`}registerArgs(e){e({description:`aventus.conf.avt path`,type:`string`,typeIsRequired:!1})}registerOptions(e){}async run(e,n){let r=e[0];r&&=(0,t.resolve)(r),await o.load(),await o.start({noBuild:!0,configPath:r}),await o.executeCommand(`aventus.format`)}},v=class extends s{get name(){return`store login`}get description(){return`Login to the store`}registerArgs(e){}registerOptions(e){e({name:`username`,shortName:`u`,description:`Username for connection`,type:`string`,typeIsRequired:!0}),e({name:`password`,shortName:`p`,description:`Password for connection`,type:`string`,typeIsRequired:!0})}async run(e,t){try{await a.load(),await o.load(),await o.start({noStart:!0}),await o.executeCommand(`aventus.store.connect`,t.username,t.password)}catch(e){console.log(e)}}},y=class extends s{get name(){return`store logout`}get description(){return`Logout from the store`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noStart:!0}),await o.executeCommand(`aventus.store.disconnect`)}catch(e){console.log(e)}}},b=class extends s{get name(){return`store publish`}get description(){return`Publish to the store`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noStart:!0}),await o.executeCommand(`aventus.store.publish_package`)}catch(e){console.log(e)}}},x=class extends s{get name(){return`create`}get description(){return`Create new project / files from a template`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noBuild:!0,useTemplates:!0,loadFiles:!0}),await o.executeCommand(`aventus.create`,u(process.cwd()))}catch(e){console.log(e)}}},S=class extends s{get name(){return`template install`}get description(){return`Import template to create aventus element`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noBuild:!0,useTemplates:!0}),await o.executeCommand(`aventus.template.import`)}catch(e){console.log(e)}}},C=class extends s{get name(){return`project install`}get description(){return`Import project to init aventus`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noBuild:!0,useTemplates:!0}),await o.executeCommand(`aventus.template.import_project`)}catch(e){console.log(e)}}},w=class{static cmd=`aventus/server/start`;static callbacks=[];static action(e){let t=[...this.callbacks];for(let n of t)n(e)}},T=class extends s{get name(){return`serve`}get description(){return`Start live server`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({loadFiles:!0,watchFiles:!0}),await o.executeCommand(`aventus.liveserver.start`),await this.waitStart(),await o.Input({title:`Press enter to stop server`})}catch(e){console.log(e)}}getAction(){return o.notifications.allNotifications[w.cmd]}waitStart(){return new Promise(e=>{let t=n=>{console.log(`Server started : `+n);let r=this.getAction().callbacks.indexOf(t);r!=-1&&this.getAction().callbacks.splice(r,1),e()};this.getAction().callbacks.push(t)})}},E=class extends s{get name(){return`dependencies help-llm`}get description(){return`Write dependencies to help llm`}registerArgs(e){}registerOptions(e){}async run(e,n){try{let n=e[0];n&&=(0,t.resolve)(n),await o.load(),await o.start({noBuild:!0,loadFiles:!1,configPath:n}),await o.executeCommand(`aventus.ai.dependencies`)}catch(e){console.log(e)}}},D=class extends s{get name(){return`project uninstall`}get description(){return`Uninstall project`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noBuild:!0,useTemplates:!0}),await o.executeCommand(`aventus.template.uninstall_project`)}catch(e){console.log(e)}}},O=class extends s{get name(){return`template uninstall`}get description(){return`Uninstall project`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noBuild:!0,useTemplates:!0}),await o.executeCommand(`aventus.template.uninstall`)}catch(e){console.log(e)}}},k=class extends c{get name(){return`project`}get description(){return`Manage project's templates`}},A=class extends c{get name(){return`template`}get description(){return`Manage templates`}},j=class extends c{get name(){return`dependencies`}get description(){return`Manage project's dependencies`}},M=class extends c{get name(){return`store`}get description(){return`Manage store`}},N=class extends s{get name(){return`watch`}get description(){return`Start the compiler in watch mode`}registerArgs(e){e({description:`aventus.conf.avt path`,type:`string`,typeIsRequired:!1})}registerOptions(e){e({name:`builds`,description:`Define the build name`,type:`string`,typeIsRequired:!0,typeIsArray:!0}),e({name:`json`,type:`boolean`,typeIsRequired:!1,description:`Result as json`})}async run(e,n){let r=e[0];r&&=(0,t.resolve)(r),n.builds===!1&&(n.builds=[]),await o.load(),console.clear(),await o.start({loadFiles:!0,watchFiles:!0,useCompilators:!0,useTemplates:!1,configPath:r,builds:n.builds,useStats:!1}),await this.sleep(2e3);let i=o.getErrors(),a=n.json?this.renderLogJson:this.renderLog;a(i),o.subscribeErrors((e,t)=>{i[t]=e,a(i)}),await new Promise(()=>{process.on(`SIGINT`,()=>{process.exit(0)})})}sleep(e){return new Promise(t=>setTimeout(t,e))}renderLog(e){console.clear();let t=console.log;for(let n in e){let r=!1;t(`Build : `+(n??`default`));let i=e[n];if(i){let e=!1;for(let t in i)for(let n of i[t]){let i=``,a;if(n.severity==p.Error)i=`\x1B[31m[error]\x1B[0m`,r=!0,a=console.error;else if(n.severity==p.Warning)i=`\x1B[33m[warning]\x1B[0m`,a=console.warn;else if(n.severity==p.Information)i=`\x1B[34m[info]\x1B[0m`,a=console.info;else if(n.severity==p.Hint){i=`\x1B[90m[hint]\x1B[0m`;continue}a(` ${i} ${l(t).replace(/\\/g,`/`)}:${n.range.start.line+1} : ${n.message}`),e=!0}e&&t()}r||t(` No error detected`)}}renderLogJson(e){console.clear();let t={success:!0,builds:{}},n=e=>{t.builds[e]||(t.builds[e]={diagnostics:{},success:!0})};for(let r in e){let i=e[r];if(r=r==``?`default`:r,n(r),i)for(let e in i){let n=l(e).replace(/\\/g,`/`),a=[];t.builds[r].diagnostics[n]=a;for(let n of i[e]){let e;if(n.severity==p.Error)t.builds[r].success=!1,t.success=!1,e=`error`;else if(n.severity==p.Warning)e=`warning`;else if(n.severity==p.Information)e=`info`;else if(n.severity==p.Hint){e=`hint`;continue}a.push({content:n.message,start:n.range.start.line+1+`:`+n.range.start.character,end:n.range.end.line+1+`:`+n.range.end.character,type:e})}t.builds[r].diagnostics[n].length==0&&delete t.builds[r].diagnostics[n]}}console.log(JSON.stringify(t,void 0,4))}},P=class extends c{get name(){return`ai`}get description(){return`Manage ai helpers`}},F=class extends s{get name(){return`ai prepare`}get description(){return`Prepare file to help AI`}registerArgs(e){}registerOptions(e){}async run(e,n){try{let n=e[0];n&&=(0,t.resolve)(n),await o.load(),await o.start({noBuild:!0,loadFiles:!1,configPath:n}),await o.executeCommand(`aventus.ai.dependencies`),await o.executeCommand(`aventus.ai.rules`)}catch(e){console.log(e)}}},I=`0.0.39`;const L=`@aventusjs/cli`,R=[x,h,N,T,m,g,_,class extends s{get name(){return`update`}get description(){return`Update the cli`}registerArgs(e){}registerOptions(e){}async run(e,n){let r=(await this.runNpm([`view`,L,`version`])).trim();if(!r)throw Error(`npm did not return a version for ${L}.`);if(r===I){console.log(`${L} is already up to date (${I}).`);return}let a=(0,i.realpathSync)((await this.runNpm([`root`,`--global`])).trim()),o=(0,i.realpathSync)((0,t.resolve)(require.resolve(`../../package.json`),`..`)),s;try{s=(0,i.realpathSync)((0,t.resolve)(a,L))}catch{}let c=s===o?[`install`,`--global`,`${L}@${r}`]:[`install`,`--save-dev`,`${L}@${r}`];await this.runNpm(c,!0),console.log(`${L} was updated to ${r}.`)}runNpm(e,t=!1){return new Promise((n,i)=>{let a=process.platform===`win32`?{command:process.env.ComSpec||`cmd.exe`,args:[`/d`,`/s`,`/c`,`npm.cmd`,...e]}:{command:`npm`,args:e},o=(0,r.spawn)(a.command,a.args,{cwd:process.cwd(),stdio:t?`inherit`:[`ignore`,`pipe`,`pipe`]}),s=``,c=``;t||(o.stdout?.on(`data`,e=>s+=e.toString()),o.stderr?.on(`data`,e=>c+=e.toString())),o.on(`error`,i),o.on(`close`,t=>{if(t===0){n(s);return}let r=c.trim();i(Error(`npm ${e.join(` `)} failed with exit code ${t}${r?`: ${r}`:`.`}`))})})}},j,E,P,F,k,C,D,A,S,O,M,v,y,b];function z(e){for(let t of R)new t().register(e)}e.program.version(I).name(`aventus`).description(`Aventus CLI`),z(e.program),e.program.parse(process.argv);
2
+ let e=require("commander"),t=require("path"),n=require("vscode-languageserver"),r=require("child_process"),i=require("fs");var a=class{static realInteraction;static async load(e){let t=eval;this.realInteraction=(await t(`import("./RealInteraction.js")`)).default.RealInteraction,this.realInteraction._server=o,e&&(this.realInteraction.config=e)}static async init(){this.clear(),console.log(`Welcome inside Aventus CLI`)}static clear(){this.realInteraction.clear()}static async select(e,t){return this.realInteraction?.select(e,t)||null}static async selectMultiple(e,t){return this.realInteraction?.selectMultiple(e,t)||null}static async input(e,t,n){return this.realInteraction?.input(e,t,n)||null}static async password(e,t){return this.realInteraction?.password(e,t)||null}static async tree(e,t,n){return this.realInteraction?.tree(e,t,n)||null}static async log(){return this.realInteraction?.log()||null}},o=class{static realServer;static get notifications(){return this.realServer?.notifications}static async load(){let e=eval;this.realServer=(await e(`import("./RealServer.js")`)).default.RealServer,this.realServer._interaction=a}static subscribeErrors(e){return this.realServer?.subscribeErrors(e)}static unsubscribeErrors(e){return this.realServer?.unsubscribeErrors(e)}static executeCommand(e,...t){return this.realServer?.executeCommand(e,...t)}static getErrors(){return this.realServer?.getErrors()}static start(e){return this.realServer?.start(e)}static create(){return this.realServer?.create()}static getStatistics(){return this.realServer?.getStatistics()}static async Input(e){return this.realServer?.Input(e)}},s=class e{static actions={};argsNb=0;register(t){let n=this.name.trim().split(` `),r=``,i=t;for(let t of n)r+=t,e.actions[r]||(e.actions[r]=i.command(t)),i=e.actions[r],r+=` `;i=i.description(this.description),i=this._registerArgs(i),i=this._registerOptions(i),i.action(async(...e)=>{let t=[];for(let n=0;n<this.argsNb;n++)t.push(e[n]);let n=e[this.argsNb];await this.run(t,n),process.exit(0)})}_registerArgs(e){return this.registerArgs(t=>{let n=``;if(t.type){let e=`<`,r=`>`;t.typeIsRequired!==void 0&&!t.typeIsRequired&&(e=`[`,r=`]`),t.typeIsArray&&(r=`...`+r),n+=`${e}${t.type}${r}`}this.argsNb++,e=e.argument(n,t.description,t.defaultValue)}),e}_registerOptions(e){let t=new Set,n=[];return this.registerOptions(r=>{let i=r.name;e.on(`option:${i}`,()=>t.add(i));for(let e of r.conflicts?[].concat(r.conflicts):[])n.push([i,e]);let a=[];if(r.shortName){Array.isArray(r.shortName)||(r.shortName=[r.shortName]);for(let e of r.shortName)a.push(`-`+e)}a.push(`--`+r.name);let o=a.join(`, `);if(r.type){let e=`<`,t=`>`;r.typeIsRequired!==void 0&&!r.typeIsRequired&&(e=`[`,t=`]`),r.typeIsArray&&(t=`...`+t),o+=` ${e}${r.type}${t}`}e=r.required?e.requiredOption(o,r.description,r.defaultValue):e.option(o,r.description,r.defaultValue)}),e.hook(`preAction`,()=>{let r=n.find(([e,n])=>t.has(e)&&t.has(n));t.clear(),r&&e.error(`options '--${r[0]}' and '--${r[1]}' cannot be used together`,{code:`commander.conflictingOption`})}),e}},c=class{register(e){let t=this.name.trim().split(` `),n=``,r=e;for(let e of t)n+=e,s.actions[n]||(s.actions[n]=r.command(e)),r=s.actions[n],n+=` `;r=r.description(this.description)}};function l(e){return t.sep===`/`?decodeURIComponent(e.replace(`file://`,``)):decodeURIComponent(e.replace(`file:///`,``))}function u(e){if(e.startsWith(`file://`))return e;let n=e[0].toLowerCase()+e.substring(1);return n=d(encodeURI(n.replace(/\\/g,`/`))),t.sep===`/`?`file://`+n:`file:///`+n}function d(e){return e.replace(/:/g,`%3A`).replace(/@/g,`%40`)}function f(e){let t=1024,n=[`Bytes`,`KiB`,`MiB`,`GiB`,`TiB`,`PiB`,`EiB`,`ZiB`,`YiB`],r=e==0?0:Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/t**r).toFixed(2))} ${n[r]}`}const p={Error:n.DiagnosticSeverity.Error,Warning:n.DiagnosticSeverity.Warning,Information:n.DiagnosticSeverity.Information,Hint:n.DiagnosticSeverity.Hint};var m=class extends s{get name(){return`build`}get description(){return`Build an aventus project`}registerArgs(e){e({description:`aventus.conf.avt path`,type:`string`,typeIsRequired:!1})}registerOptions(e){e({name:`builds`,conflicts:`no-builds`,description:`Define the build name`,type:`string`,typeIsRequired:!0,typeIsArray:!0}),e({name:`no-builds`,description:`No builds`,type:`boolean`,typeIsRequired:!1}),e({name:`statics`,conflicts:`no-statics`,description:`Define the static files to export`,type:`string`,typeIsRequired:!0,typeIsArray:!0}),e({name:`no-statics`,description:`No statics`,type:`boolean`,typeIsRequired:!1}),e({name:`verbose`,conflicts:`silent`,shortName:`v`,description:`Debug your compilation`}),e({name:`silent`,shortName:`s`,description:`No output`}),e({name:`json`,type:`boolean`,typeIsRequired:!1,description:`Result as json`})}async run(e,n){let r=e[0];r&&=(0,t.resolve)(r),await o.load(),n.builds===!1&&(n.builds=[]),n.statics===!1&&(n.statics=[]),await o.start({configPath:r,loadFiles:!0,buildOnly:n[`no-statics`],noBuild:n[`no-builds`],builds:n.builds,statics:n.statics,logLevel:n.verbose?0:3,errorByBuild:!0,useStats:!n.silent}),n.json?this.handleResultJson(n):this.handleResult(n)}handleResult(e){let t=o.getStatistics(),n=e.silent?e=>{}:console.log;n(),n(`Loading all files : Done in `+t.loadFileTime+`ms`),n(),n(`----`),n();let r=o.getErrors(),i=!1;if(r[``])for(let t in r[``])for(let n of r[``][t])n.severity===p.Error&&(i=!0),e.silent||console.error(`${l(t)}:${n.range.start.line+1} : ${n.message}`);let a={},s={};for(let e in t.files){let n=t.files[e];if(n.type==`build`&&n.typeName){a[n.typeName]||(a[n.typeName]=[]);let e=` ${n.path} - ${f(n.size)}`;a[n.typeName].push(e)}else if(n.type==`static`&&n.typeName){s[n.typeName]||(s[n.typeName]=[]);let e=` ${n.path} - ${f(n.size)}`;s[n.typeName].push(e)}}let c=Object.keys(t.builds).length,u=Object.keys(t.statics).length,d=0;for(let o in t.builds){n(`Building `+o),n();let s=!1,f=r[o],m=t.builds[o],h=a[o];if(h){for(let e of h)n(e);n()}if(f){let t=!1;for(let n in f)for(let r of f[n]){let i=``,a;if(r.severity==p.Error)i=`\x1B[31m[error]\x1B[0m`,s=!0,a=console.error;else if(r.severity==p.Warning)i=`\x1B[33m[warning]\x1B[0m`,a=console.warn;else if(r.severity==p.Information)i=`\x1B[34m[info]\x1B[0m`,a=console.info;else if(r.severity==p.Hint){i=`\x1B[90m[hint]\x1B[0m`;continue}e.silent||(a(` ${i} ${l(n).replace(/\\/g,`/`)}:${r.range.start.line+1} : ${r.message}`),t=!0)}t&&n()}s?(n(` Build failed in `+m.buildTime+`ms`),i=!0):n(` Build success in `+m.buildTime+`ms`),d++,d==c&&u==0?n():(n(),n(`----`),n())}d=0;for(let e in t.statics){n(`Export static `+e),n();let r=t.statics[e],i=s[e];if(i){for(let e of i)n(e);n()}n(` Exported in `+r.buildTime+`ms`),d++,d==u?n():(n(),n(`----`),n())}i&&process.exit(1)}handleResultJson(e){let t=o.getStatistics(),n={success:!0,builds:{},statics:{}},r=o.getErrors(),i=!1;if(r[``])for(let e in r[``]){let t=l(e).replace(/\\/g,`/`);n.diagnostics||={},n.diagnostics[t]=[];for(let a of r[``][e])a.severity===p.Error&&(n.success=!1,i=!0),n.diagnostics[t].push({content:a.message,type:a.severity===p.Error?`error`:a.severity===p.Warning?`warning`:a.severity===p.Information?`info`:`hint`,start:`${a.range.start.line+1}:${a.range.start.character}`,end:`${a.range.end.line+1}:${a.range.end.character}`})}let a=e=>{n.builds[e]||(n.builds[e]={diagnostics:{},outputSize:{},success:!0})},s=e=>{n.statics[e]||(n.statics[e]={outputSize:{}})},c=e=>{let t=1024,n=[`Bytes`,`KiB`,`MiB`,`GiB`,`TiB`,`PiB`,`EiB`,`ZiB`,`YiB`],r=e==0?0:Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/t**r).toFixed(2))} ${n[r]}`};for(let e in t.files){let r=t.files[e];if(r.type==`build`&&r.typeName){let e=r.typeName,t=l(r.path).replace(/\\/g,`/`);a(e),n.builds[e].outputSize[t]=c(r.size)}else if(r.type==`static`&&r.typeName){let e=l(r.path).replace(/\\/g,`/`);s(r.typeName),n.statics[r.typeName].outputSize[e]=c(r.size)}}for(let e in t.builds){a(e);let t=r[e];if(t)for(let r in t){let a=l(r).replace(/\\/g,`/`),o=[];n.builds[e].diagnostics[a]=o;for(let a of t[r]){let t;a.severity==p.Error?(n.builds[e].success=!1,n.success=!1,i=!0,t=`error`):a.severity==p.Warning?t=`warning`:a.severity==p.Information?t=`info`:a.severity==p.Hint&&(t=`hint`),o.push({content:a.message,start:a.range.start.line+1+`:`+a.range.start.character,end:a.range.end.line+1+`:`+a.range.end.character,type:t})}}}console.log(JSON.stringify(n,void 0,4)),i&&process.exit(1)}},h=class extends s{get name(){return`dev`}get description(){return`Start an interactive cli to dev with your aventus project`}registerArgs(e){e({description:`aventus.conf.avt path`,type:`string`,typeIsRequired:!1})}registerOptions(e){}async run(e,t){await a.load({clear:!0,printLogo:!0}),await o.load(),console.clear(),await a.init(),await o.start({loadFiles:!0,watchFiles:!0,useCompilators:!0,useTemplates:!0});let n=[{value:`create`,name:`Create...`},{value:`log`,name:`Show logs`},{value:`quit`,name:`Quit`}];for(a.clear();;){let e=await a.select(`Which action shoud I perform?`,n);e==`create`?await o.create():e==`log`?await a.log():e==`quit`?process.exit(0):console.log(`WIP`),a.clear()}}},g=class extends s{get name(){return`check`}get description(){return`Check an aventus project`}registerArgs(e){e({description:`aventus.conf.avt path`,type:`string`,typeIsRequired:!1})}registerOptions(e){e({name:`builds`,description:`Define the build name`,type:`string`,typeIsRequired:!0,typeIsArray:!0}),e({name:`json`,type:`boolean`,typeIsRequired:!1,description:`Result as json`})}async run(e,n){let r=e[0];r&&=(0,t.resolve)(r),n.builds===!1&&(n.builds=[]),await o.load(),await o.start({noBuild:!0,loadFiles:!0,buildOnly:!0,configPath:r,builds:n.builds,statics:void 0,logLevel:3,errorByBuild:!0,useStats:!1}),n.json?this.handleResultJson(n):this.handleResult(n)}handleResult(e){let t=o.getStatistics(),n=console.log;n(),n(`Loading all files : Done in `+t.loadFileTime+`ms`),n(),n(`----`),n();let r=o.getErrors(),i=!1;for(let e in r){let t=!1,a=r[e];if(a){let e=!1;for(let n in a)for(let r of a[n]){let a=``,o;if(r.severity==p.Error)a=`\x1B[31m[error]\x1B[0m`,t=!0,i=!0,o=console.error;else if(r.severity==p.Warning)a=`\x1B[33m[warning]\x1B[0m`,o=console.warn;else if(r.severity==p.Information)a=`\x1B[34m[info]\x1B[0m`,o=console.info;else if(r.severity==p.Hint){a=`\x1B[90m[hint]\x1B[0m`;continue}o(` ${a} ${l(n).replace(/\\/g,`/`)}:${r.range.start.line+1} : ${r.message}`),e=!0}e&&n()}t||n(` Build has no error`)}i&&process.exit(1)}handleResultJson(e){let t={success:!0,builds:{}},n=o.getErrors(),r=!1,i=e=>{t.builds[e]||(t.builds[e]={diagnostics:{},success:!0})};for(let e in n){i(e);let a=n[e];if(a)for(let n in a){let i=l(n).replace(/\\/g,`/`),o=[];t.builds[e].diagnostics[i]=o;for(let i of a[n]){let n;i.severity==p.Error?(t.builds[e].success=!1,t.success=!1,r=!0,n=`error`):i.severity==p.Warning?n=`warning`:i.severity==p.Information?n=`info`:i.severity==p.Hint&&(n=`hint`),o.push({content:i.message,start:i.range.start.line+1+`:`+i.range.start.character,end:i.range.end.line+1+`:`+i.range.end.character,type:n})}}}console.log(JSON.stringify(t,void 0,4)),r&&process.exit(1)}},_=class extends s{get name(){return`format`}get description(){return`Format your project`}registerArgs(e){e({description:`aventus.conf.avt path`,type:`string`,typeIsRequired:!1})}registerOptions(e){}async run(e,n){let r=e[0];r&&=(0,t.resolve)(r),await o.load(),await o.start({noBuild:!0,configPath:r}),await o.executeCommand(`aventus.format`)}},v=class extends s{get name(){return`store login`}get description(){return`Login to the store`}registerArgs(e){}registerOptions(e){e({name:`username`,shortName:`u`,description:`Username for connection`,type:`string`,typeIsRequired:!0}),e({name:`password`,shortName:`p`,description:`Password for connection`,type:`string`,typeIsRequired:!0})}async run(e,t){try{await a.load(),await o.load(),await o.start({noStart:!0}),await o.executeCommand(`aventus.store.connect`,t.username,t.password)}catch(e){console.log(e),process.exit(1)}}},y=class extends s{get name(){return`store logout`}get description(){return`Logout from the store`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noStart:!0}),await o.executeCommand(`aventus.store.disconnect`)}catch(e){console.log(e),process.exit(1)}}},b=class extends s{get name(){return`store publish`}get description(){return`Publish to the store`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noStart:!0}),await o.executeCommand(`aventus.store.publish_package`)}catch(e){console.log(e),process.exit(1)}}},x=class extends s{get name(){return`create`}get description(){return`Create new project / files from a template`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noBuild:!0,useTemplates:!0,loadFiles:!0}),await o.executeCommand(`aventus.create`,u(process.cwd()))}catch(e){console.log(e)}}},S=class extends s{get name(){return`template install`}get description(){return`Import template to create aventus element`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noBuild:!0,useTemplates:!0}),await o.executeCommand(`aventus.template.import`)}catch(e){console.log(e),process.exit(1)}}},C=class extends s{get name(){return`project install`}get description(){return`Import project to init aventus`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noBuild:!0,useTemplates:!0}),await o.executeCommand(`aventus.template.import_project`)}catch(e){console.log(e),process.exit(1)}}},w=class{static cmd=`aventus/server/start`;static callbacks=[];static action(e){let t=[...this.callbacks];for(let n of t)n(e)}},T=class extends s{get name(){return`serve`}get description(){return`Start live server`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({loadFiles:!0,watchFiles:!0}),await o.executeCommand(`aventus.liveserver.start`),await this.waitStart(),await o.Input({title:`Press enter to stop server`})}catch(e){console.log(e)}}getAction(){return o.notifications.allNotifications[w.cmd]}waitStart(){return new Promise(e=>{let t=n=>{console.log(`Server started : `+n);let r=this.getAction().callbacks.indexOf(t);r!=-1&&this.getAction().callbacks.splice(r,1),e()};this.getAction().callbacks.push(t)})}},E=class extends s{get name(){return`dependencies help-llm`}get description(){return`Write dependencies to help llm`}registerArgs(e){}registerOptions(e){}async run(e,n){try{let n=e[0];n&&=(0,t.resolve)(n),await o.load(),await o.start({noBuild:!0,loadFiles:!1,configPath:n}),await o.executeCommand(`aventus.ai.dependencies`)}catch(e){console.log(e)}}},D=class extends s{get name(){return`project uninstall`}get description(){return`Uninstall project`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noBuild:!0,useTemplates:!0}),await o.executeCommand(`aventus.template.uninstall_project`)}catch(e){console.log(e),process.exit(1)}}},O=class extends s{get name(){return`template uninstall`}get description(){return`Uninstall project`}registerArgs(e){}registerOptions(e){}async run(e,t){try{await a.load(),await o.load(),await o.start({noBuild:!0,useTemplates:!0}),await o.executeCommand(`aventus.template.uninstall`)}catch(e){console.log(e),process.exit(1)}}},k=class extends c{get name(){return`project`}get description(){return`Manage project's templates`}},A=class extends c{get name(){return`template`}get description(){return`Manage templates`}},j=class extends c{get name(){return`dependencies`}get description(){return`Manage project's dependencies`}},M=class extends c{get name(){return`store`}get description(){return`Manage store`}},N=class extends s{get name(){return`watch`}get description(){return`Start the compiler in watch mode`}registerArgs(e){e({description:`aventus.conf.avt path`,type:`string`,typeIsRequired:!1})}registerOptions(e){e({name:`builds`,description:`Define the build name`,type:`string`,typeIsRequired:!0,typeIsArray:!0}),e({name:`json`,type:`boolean`,typeIsRequired:!1,description:`Result as json`})}async run(e,n){let r=e[0];r&&=(0,t.resolve)(r),n.builds===!1&&(n.builds=[]),await o.load(),console.clear(),await o.start({loadFiles:!0,watchFiles:!0,useCompilators:!0,useTemplates:!1,configPath:r,builds:n.builds,useStats:!1}),await this.sleep(2e3);let i=o.getErrors(),a=n.json?this.renderLogJson:this.renderLog;a(i);let s=(e,t)=>{i[t]=e,a(i)};o.subscribeErrors(s),await new Promise(e=>{process.once(`SIGINT`,e)}),o.unsubscribeErrors(s),process.exit(0)}sleep(e){return new Promise(t=>setTimeout(t,e))}renderLog(e){console.clear();let t=console.log;for(let n in e){let r=!1;t(`Build : `+(n??`default`));let i=e[n];if(i){let e=!1;for(let t in i)for(let n of i[t]){let i=``,a;if(n.severity==p.Error)i=`\x1B[31m[error]\x1B[0m`,r=!0,a=console.error;else if(n.severity==p.Warning)i=`\x1B[33m[warning]\x1B[0m`,a=console.warn;else if(n.severity==p.Information)i=`\x1B[34m[info]\x1B[0m`,a=console.info;else if(n.severity==p.Hint){i=`\x1B[90m[hint]\x1B[0m`;continue}a(` ${i} ${l(t).replace(/\\/g,`/`)}:${n.range.start.line+1} : ${n.message}`),e=!0}e&&t()}r||t(` No error detected`)}}renderLogJson(e){console.clear();let t={success:!0,builds:{}},n=e=>{t.builds[e]||(t.builds[e]={diagnostics:{},success:!0})};for(let r in e){let i=e[r];if(r=r==``?`default`:r,n(r),i)for(let e in i){let n=l(e).replace(/\\/g,`/`),a=[];t.builds[r].diagnostics[n]=a;for(let n of i[e]){let e;if(n.severity==p.Error)t.builds[r].success=!1,t.success=!1,e=`error`;else if(n.severity==p.Warning)e=`warning`;else if(n.severity==p.Information)e=`info`;else if(n.severity==p.Hint){e=`hint`;continue}a.push({content:n.message,start:n.range.start.line+1+`:`+n.range.start.character,end:n.range.end.line+1+`:`+n.range.end.character,type:e})}t.builds[r].diagnostics[n].length==0&&delete t.builds[r].diagnostics[n]}}console.log(JSON.stringify(t,void 0,4))}},P=class extends c{get name(){return`ai`}get description(){return`Manage ai helpers`}},F=class extends s{get name(){return`ai prepare`}get description(){return`Prepare file to help AI`}registerArgs(e){}registerOptions(e){}async run(e,n){try{let n=e[0];n&&=(0,t.resolve)(n),await o.load(),await o.start({noBuild:!0,loadFiles:!1,configPath:n}),await o.executeCommand(`aventus.ai.dependencies`),await o.executeCommand(`aventus.ai.rules`)}catch(e){console.log(e)}}},I=`0.0.41`;const L=`@aventusjs/cli`,R=[x,h,N,T,m,g,_,class extends s{get name(){return`update`}get description(){return`Update the cli`}registerArgs(e){}registerOptions(e){}async run(e,n){let r=(await this.runNpm([`view`,L,`version`])).trim();if(!r)throw Error(`npm did not return a version for ${L}.`);if(r===I){console.log(`${L} is already up to date (${I}).`);return}let a=(0,i.realpathSync)((await this.runNpm([`root`,`--global`])).trim()),o=(0,i.realpathSync)((0,t.resolve)(require.resolve(`../../package.json`),`..`)),s;try{s=(0,i.realpathSync)((0,t.resolve)(a,L))}catch{}let c=s===o?[`install`,`--global`,`${L}@${r}`]:[`install`,`--save-dev`,`${L}@${r}`];await this.runNpm(c,!0),console.log(`${L} was updated to ${r}.`)}runNpm(e,t=!1){return new Promise((n,i)=>{let a=process.platform===`win32`?{command:process.env.ComSpec||`cmd.exe`,args:[`/d`,`/s`,`/c`,`npm.cmd`,...e]}:{command:`npm`,args:e},o=(0,r.spawn)(a.command,a.args,{cwd:process.cwd(),stdio:t?`inherit`:[`ignore`,`pipe`,`pipe`]}),s=``,c=``;t||(o.stdout?.on(`data`,e=>s+=e.toString()),o.stderr?.on(`data`,e=>c+=e.toString())),o.on(`error`,i),o.on(`close`,t=>{if(t===0){n(s);return}let r=c.trim();i(Error(`npm ${e.join(` `)} failed with exit code ${t}${r?`: ${r}`:`.`}`))})})}},j,E,P,F,k,C,D,A,S,O,M,v,y,b];function z(e){for(let t of R)new t().register(e)}e.program.version(I).name(`aventus`).description(`Aventus CLI`),z(e.program),e.program.parse(process.argv);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@aventusjs/cli",
3
3
  "displayName": "Aventus CLI",
4
4
  "description": "This official CLI to compile Aventus Framework",
5
- "version": "0.0.39",
5
+ "version": "0.0.41",
6
6
  "icon": "icons/logo.png",
7
7
  "bin": {
8
8
  "aventus": "./out/cli.js",
@@ -0,0 +1,26 @@
1
+ {
2
+ "module": "${{name}}",
3
+ "componentPrefix": "${{componentPrefix}}",
4
+ "build": [
5
+ {
6
+ "name": "Main",
7
+ "src": [
8
+ "./src/components/*",
9
+ "./src/data/*",
10
+ "./src/lib/*",
11
+ "./src/ram/*",
12
+ "./src/states/*"
13
+ ],
14
+ "compile": [{
15
+ "output": "./dist/${{name}}.js"
16
+ }]
17
+ }
18
+ ],
19
+ "static": [
20
+ {
21
+ "name": "Main",
22
+ "input": "./static/*",
23
+ "output": "./dist/"
24
+ }
25
+ ]
26
+ }
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ :host {
2
+ --primary-color: #e5540e;
3
+ }
@@ -0,0 +1,9 @@
1
+ @import './_theme.gs.avt';
2
+
3
+ html,
4
+ body {
5
+ height: 100%;
6
+ margin: auto;
7
+ overflow: hidden;
8
+ width: 100%;
9
+ }
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>${{name}}</title>
7
+ <script src="/${{name}}.js"></script>
8
+ <link rel="stylesheet" href="/default.css">
9
+ </head>
10
+ <body>
11
+
12
+ </body>
13
+ </html>
@@ -0,0 +1,51 @@
1
+ import { sep } from 'path';
2
+
3
+
4
+ export class Template extends AventusTemplate {
5
+ protected override meta(): TemplateInfo {
6
+ return {
7
+ name: "Default",
8
+ description: "A basic template (Recommended)",
9
+ version: "1.0.0",
10
+ isProject: true,
11
+ installationFolder: "Aventus/Default"
12
+ };
13
+ }
14
+ protected override async run(destination: string): Promise<void> {
15
+
16
+ let defaultValue = destination.split(sep).pop();
17
+ if(defaultValue) {
18
+ defaultValue = defaultValue.replace(/ /g, "_").replace(/-/g, "_").replace(/\$/g, "_").replace(/\./g, "_")
19
+ }
20
+ const name = await this.input({
21
+ title: "Provide a name for your project",
22
+ value: defaultValue,
23
+ validations: [{
24
+ message: "Provide a valid name. Must match : ^[a-zA-Z0-9_]+$",
25
+ regex: "^[a-zA-Z0-9_]+$"
26
+ }]
27
+ });
28
+ if(!name) return;
29
+
30
+ this.registerVar("name", name);
31
+
32
+ let prefix = await this.input({
33
+ title: "Provide a component prefix : (default is av)",
34
+ validations: [{
35
+ message: "Provide a valid prefix",
36
+ regex: "^(?:[a-z]{2,})?$"
37
+ }]
38
+ });
39
+ if(prefix == null) return;
40
+ if(!prefix) {
41
+ prefix = "av";
42
+ }
43
+
44
+ this.registerVar("componentPrefix", prefix);
45
+
46
+
47
+ await this.writeFile();
48
+ this.openFile("aventus.conf.avt")
49
+ }
50
+
51
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "module": "${{name}}",
3
+ "componentPrefix": "${{componentPrefix}}",
4
+ "build": [
5
+ {
6
+ "name": "Main",
7
+ "src": [
8
+ "./src/*"
9
+ ],
10
+ "compile": [{
11
+ "output": "./dist/${{name}}.js"
12
+ }]
13
+ }
14
+ ]
15
+ }
File without changes
@@ -0,0 +1,47 @@
1
+ import { sep } from 'path';
2
+
3
+
4
+ export class Template extends AventusTemplate {
5
+ protected override meta(): TemplateInfo {
6
+ return {
7
+ name: "Empty",
8
+ description: "Empty Aventus Project",
9
+ version: "1.0.0",
10
+ isProject: true,
11
+ installationFolder: "Aventus/Empty"
12
+ };
13
+ }
14
+ protected override async run(destination: string): Promise<void> {
15
+
16
+ const name = await this.input({
17
+ title: "Provide a name for your project",
18
+ value: destination.split(sep).pop(),
19
+ validations: [{
20
+ message: "Provide a valid name",
21
+ regex: "^[a-zA-Z0-9_]+$"
22
+ }]
23
+ });
24
+ if(!name) return;
25
+
26
+ this.registerVar("name", name);
27
+
28
+ let prefix = await this.input({
29
+ title: "Provide a component prefix : (default is av)",
30
+ validations: [{
31
+ message: "Provide a valid prefix",
32
+ regex: "^(?:[a-z]{2,})?$"
33
+ }]
34
+ });
35
+ if(prefix == null) return;
36
+ if(!prefix) {
37
+ prefix = "av";
38
+ }
39
+
40
+ this.registerVar("componentPrefix", prefix);
41
+
42
+
43
+ await this.writeFile();
44
+ this.openFile("aventus.conf.avt");
45
+ }
46
+
47
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "module": "${{name}}",
3
+ "componentPrefix": "${{componentPrefix}}",
4
+ "build": [
5
+ {
6
+ "name": "Main",
7
+ "src": [
8
+ "./src/components/*"
9
+ ],
10
+ "compile": [{
11
+ "output": "./dist/${{name}}.js"
12
+ }]
13
+ }
14
+ ],
15
+ "static": [
16
+ {
17
+ "name": "Main",
18
+ "input": "./static/",
19
+ "output": "./dist/"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,27 @@
1
+ export class ${{componentName}} extends TailwindBase implements Aventus.DefaultComponent {
2
+
3
+ //#region static
4
+
5
+ //#endregion
6
+
7
+
8
+ //#region props
9
+
10
+ //#endregion
11
+
12
+
13
+ //#region variables
14
+
15
+ //#endregion
16
+
17
+
18
+ //#region constructor
19
+
20
+ //#endregion
21
+
22
+
23
+ //#region methods
24
+
25
+ //#endregion
26
+
27
+ }
@@ -0,0 +1,29 @@
1
+
2
+ export class Template extends AventusTemplate {
3
+ protected override meta(): TemplateInfo {
4
+ return {
5
+ name: "Tailwind Template",
6
+ description: "Create a tailwind component",
7
+ version: "1.0.0"
8
+ };
9
+ }
10
+ protected override async run(destination: string): Promise<void> {
11
+ // ask user the name of the component
12
+ const name = await this.input({
13
+ title: "Provide a name for your component",
14
+ value: "",
15
+ validations: [{
16
+ message: "Provide a valide component name",
17
+ regex: "[A-Z][A-Za-z0-9]+"
18
+ }]
19
+ });
20
+ if(!name) return;
21
+ // register var ${{componentName}}
22
+ this.registerVar("componentName", name);
23
+ // write all files
24
+ await this.writeFile();
25
+ // open file in the editor
26
+ await this.openFile(name + "/" + name + ".wcl.avt");
27
+ }
28
+
29
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "${{name}}",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "scripts": {
6
+ "tailwind": "npx tailwindcss -i ./tailwind.css -o ./src/components/@TailwindCss.gwcs.avt --watch"
7
+ },
8
+ "devDependencies": {
9
+ "tailwindcss": "^3.3.2"
10
+ },
11
+ "author": "",
12
+ "license": "ISC"
13
+ }
@@ -0,0 +1,29 @@
1
+ export class TailwindBase extends Aventus.WebComponent implements Aventus.DefaultComponent {
2
+
3
+ //#region static
4
+
5
+ //#endregion
6
+
7
+
8
+ //#region props
9
+
10
+ //#endregion
11
+
12
+
13
+ //#region variables
14
+
15
+ //#endregion
16
+
17
+
18
+ //#region constructor
19
+
20
+ //#endregion
21
+
22
+
23
+ //#region methods
24
+ protected override styleAfter(addStyle: (name: string) => void): void {
25
+ addStyle("@TailwindCss");
26
+ }
27
+ //#endregion
28
+
29
+ }
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>${{name}}</title>
8
+ <script src="/${{name}}.js"></script>
9
+ </head>
10
+ <body>
11
+
12
+ </body>
13
+ </html>
@@ -0,0 +1,8 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: ["./src/**/*.{wcv.avt,wcl.avt,wc.avt}"],
4
+ theme: {
5
+ extend: {},
6
+ },
7
+ plugins: [],
8
+ }
@@ -0,0 +1,3 @@
1
+ :host {
2
+ @tailwind utilities;
3
+ }
@@ -0,0 +1,51 @@
1
+ import { sep } from 'path';
2
+
3
+
4
+ export class Template extends AventusTemplate {
5
+ protected override meta(): TemplateInfo {
6
+ return {
7
+ name: "Tailwind",
8
+ description: "Aventus Project with Tailwind support",
9
+ version: "1.0.0",
10
+ isProject: true,
11
+ installationFolder: "Aventus/Tailwind"
12
+ };
13
+ }
14
+ protected override async run(destination: string): Promise<void> {
15
+
16
+ const name = await this.input({
17
+ title: "Provide a name for your project",
18
+ value: destination.split(sep).pop(),
19
+ validations: [{
20
+ message: "Provide a valid name",
21
+ regex: "^[a-zA-Z0-9_]+$"
22
+ }]
23
+ });
24
+ if(!name) return;
25
+
26
+ this.registerVar("name", name);
27
+
28
+ let prefix = await this.input({
29
+ title: "Provide a component prefix : (default is av)",
30
+ validations: [{
31
+ message: "Provide a valid prefix",
32
+ regex: "^(?:[a-z]{2,})?$"
33
+ }]
34
+ });
35
+ if(prefix == null) return;
36
+ if(!prefix) {
37
+ prefix = "av";
38
+ }
39
+
40
+ this.registerVar("componentPrefix", prefix);
41
+
42
+
43
+ await this.writeFile();
44
+ this.openFile("aventus.conf.avt");
45
+
46
+ const uuid = await this.showProgress("Installing package");
47
+ await this.exec("npm i");
48
+ await this.hideProgress(uuid);
49
+ }
50
+
51
+ }
@@ -0,0 +1,90 @@
1
+ import { Meta, Description } from "@storybook/blocks";
2
+
3
+ import Custom from "./assets/custom.jpeg";
4
+ import Generated from "./assets/generated.jpeg";
5
+ import Chart from "./assets/chart.jpeg";
6
+
7
+ import Github from "./assets/github.svg";
8
+ import Discord from "./assets/discord.svg";
9
+ import Youtube from "./assets/youtube.svg";
10
+ import Tutorials from "./assets/tutorials.svg";
11
+
12
+ import './Home.scss';
13
+
14
+ <Meta title="Home" />
15
+
16
+ <div className="sb-container">
17
+ <div className="sb-section-title">
18
+ # Storybook Main
19
+
20
+ Welcome to the **Storybook Main** documentation. This project will be awesome because it's written with AventusJs.
21
+ </div>
22
+ <div className="sb-section">
23
+ <div className="sb-section-item">
24
+ <img
25
+ src={Generated}
26
+ />
27
+ <h4 className="sb-section-item-heading">Generate any code from your aventus code</h4>
28
+ <p>You can generate storie from you aventus code by settings the configuration **build[].stories.all** to true or by using the decorator **@Storybook**</p>
29
+ </div>
30
+ <div className="sb-section-item">
31
+ <img
32
+ src={Custom}
33
+ />
34
+ <h4 className="sb-section-item-heading">Write custom stories</h4>
35
+ <p>You can also write your own stories as **.mdx** or **.stories.ts** files to enhance your documentation</p>
36
+ </div>
37
+ <div className="sb-section-item">
38
+ <img
39
+ src={Chart}
40
+ />
41
+ <h4 className="sb-section-item-heading">Add graph</h4>
42
+ <p>To complete your doc and data-flow, you can add graph though mermaid js (use tag &lt;av-diagram&gt;) or by creating image with the vscode extension <a href="https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio" target="_blank">draw.io</a></p>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ <div className="sb-container">
48
+ <div className="sb-section sb-socials">
49
+ <div className="sb-section-item">
50
+ <img src={Github} alt="Github logo" className="sb-explore-image"/>
51
+ Join our contributors building the future of UI development.
52
+
53
+ <a
54
+ href="https://github.com/Cobwebsite/Aventus"
55
+ target="_blank"
56
+ >Star on GitHub</a>
57
+ </div>
58
+ <div className="sb-section-item">
59
+ <img src={Discord} alt="Discord logo" className="sb-explore-image"/>
60
+ <div>
61
+ Get support and chat with frontend developers.
62
+
63
+ <a
64
+ href="https://discord.gg/rzgtDNkZhd"
65
+ target="_blank"
66
+ >Join Discord server</a>
67
+ </div>
68
+ </div>
69
+ {/* <div className="sb-section-item">
70
+ <img src={Youtube} alt="Youtube logo" className="sb-explore-image"/>
71
+ <div>
72
+ Watch tutorials, feature previews and interviews.
73
+
74
+ <a
75
+ href="https://www.youtube.com/@chromaticui"
76
+ target="_blank"
77
+ >Watch on YouTube</a>
78
+ </div>
79
+ </div> */}
80
+ <div className="sb-section-item">
81
+ <img src={Tutorials} alt="A book" className="sb-explore-image"/>
82
+ <p>Follow guided walkthroughs on for key workflows.</p>
83
+
84
+ <a
85
+ href="https://aventusjs.com/docs/introduction"
86
+ target="_blank"
87
+ >Discover tutorials</a>
88
+ </div>
89
+ </div>
90
+ </div>