veloce-ts 0.1.6 → 0.1.7
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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/src/cli/index.js +517 -0
- package/dist/cjs/src/cli/index.js.map +22 -0
- package/dist/cjs/src/docs/index.js +7 -0
- package/dist/cjs/src/docs/index.js.map +55 -0
- package/dist/cjs/src/errors/index.js +4 -0
- package/dist/cjs/src/errors/index.js.map +12 -0
- package/dist/cjs/src/graphql/index.js +83 -0
- package/dist/cjs/src/graphql/index.js.map +24 -0
- package/dist/cjs/src/index.js +124 -0
- package/dist/cjs/src/index.js.map +108 -0
- package/dist/cjs/src/middleware/index.js +3 -0
- package/dist/cjs/src/middleware/index.js.map +12 -0
- package/dist/cjs/src/plugins/index.js +123 -0
- package/dist/cjs/src/plugins/index.js.map +67 -0
- package/dist/cjs/src/testing/index.js +17 -0
- package/dist/cjs/src/testing/index.js.map +54 -0
- package/dist/cjs/src/types/index.js +3 -0
- package/dist/cjs/src/types/index.js.map +16 -0
- package/dist/cjs/src/validation/index.js +3 -0
- package/dist/cjs/src/validation/index.js.map +19 -0
- package/dist/cjs/src/websocket/index.js +3 -0
- package/dist/cjs/src/websocket/index.js.map +12 -0
- package/dist/esm/chunk-0zxhx5b8.js +7 -0
- package/dist/esm/chunk-0zxhx5b8.js.map +10 -0
- package/dist/esm/chunk-159eqj8q.js +5 -0
- package/dist/esm/chunk-159eqj8q.js.map +12 -0
- package/dist/esm/chunk-1hqjkm44.js +5 -0
- package/dist/esm/chunk-1hqjkm44.js.map +11 -0
- package/dist/esm/chunk-2q6s8v3j.js +6 -0
- package/dist/esm/chunk-2q6s8v3j.js.map +10 -0
- package/dist/esm/chunk-42h6trpf.js +5 -0
- package/dist/esm/chunk-42h6trpf.js.map +9 -0
- package/dist/esm/chunk-658zaz9f.js +430 -0
- package/dist/esm/chunk-658zaz9f.js.map +10 -0
- package/dist/esm/chunk-82f2j0k2.js +60 -0
- package/dist/esm/chunk-82f2j0k2.js.map +10 -0
- package/dist/esm/chunk-9p6d0t33.js +5 -0
- package/dist/esm/chunk-9p6d0t33.js.map +10 -0
- package/dist/esm/chunk-awven6dt.js +4 -0
- package/dist/esm/chunk-awven6dt.js.map +16 -0
- package/dist/esm/chunk-gv5n8ddb.js +18 -0
- package/dist/esm/chunk-gv5n8ddb.js.map +10 -0
- package/dist/esm/chunk-pn7z890c.js +72 -0
- package/dist/esm/chunk-pn7z890c.js.map +13 -0
- package/dist/esm/chunk-qfsjy9bg.js +7 -0
- package/dist/esm/chunk-qfsjy9bg.js.map +10 -0
- package/dist/esm/chunk-vkkzgaf7.js +5 -0
- package/dist/esm/chunk-vkkzgaf7.js.map +12 -0
- package/dist/esm/src/cli/index.js +30 -0
- package/dist/esm/src/cli/index.js.map +18 -0
- package/dist/esm/src/docs/index.js +8 -0
- package/dist/esm/src/docs/index.js.map +48 -0
- package/dist/esm/src/errors/index.js +4 -0
- package/dist/esm/src/errors/index.js.map +9 -0
- package/dist/esm/src/graphql/index.js +4 -0
- package/dist/esm/src/graphql/index.js.map +9 -0
- package/dist/esm/src/index.js +4 -0
- package/dist/esm/src/index.js.map +16 -0
- package/dist/esm/src/middleware/index.js +4 -0
- package/dist/esm/src/middleware/index.js.map +9 -0
- package/dist/esm/src/plugins/index.js +40 -0
- package/dist/esm/src/plugins/index.js.map +10 -0
- package/dist/esm/src/testing/index.js +4 -0
- package/dist/esm/src/testing/index.js.map +39 -0
- package/dist/esm/src/types/index.js +4 -0
- package/dist/esm/src/types/index.js.map +9 -0
- package/dist/esm/src/validation/index.js +4 -0
- package/dist/esm/src/validation/index.js.map +9 -0
- package/dist/esm/src/websocket/index.js +4 -0
- package/dist/esm/src/websocket/index.js.map +9 -0
- package/dist/types/adapters/base.d.ts +24 -0
- package/dist/types/adapters/base.d.ts.map +1 -0
- package/dist/types/adapters/express.d.ts +44 -0
- package/dist/types/adapters/express.d.ts.map +1 -0
- package/dist/types/adapters/hono.d.ts +44 -0
- package/dist/types/adapters/hono.d.ts.map +1 -0
- package/dist/types/cli/commands/build.d.ts +3 -0
- package/dist/types/cli/commands/build.d.ts.map +1 -0
- package/dist/types/cli/commands/dev.d.ts +3 -0
- package/dist/types/cli/commands/dev.d.ts.map +1 -0
- package/dist/types/cli/commands/generate.d.ts +3 -0
- package/dist/types/cli/commands/generate.d.ts.map +1 -0
- package/dist/types/cli/commands/new.d.ts +3 -0
- package/dist/types/cli/commands/new.d.ts.map +1 -0
- package/dist/types/cli/index.d.ts +3 -0
- package/dist/types/cli/index.d.ts.map +1 -0
- package/dist/types/cli/templates/public-interface.d.ts +2 -0
- package/dist/types/cli/templates/public-interface.d.ts.map +1 -0
- package/dist/types/core/application.d.ts +268 -0
- package/dist/types/core/application.d.ts.map +1 -0
- package/dist/types/core/compiled-metadata.d.ts +58 -0
- package/dist/types/core/compiled-metadata.d.ts.map +1 -0
- package/dist/types/core/metadata.d.ts +175 -0
- package/dist/types/core/metadata.d.ts.map +1 -0
- package/dist/types/core/plugin.d.ts +63 -0
- package/dist/types/core/plugin.d.ts.map +1 -0
- package/dist/types/core/router-compiler.d.ts +61 -0
- package/dist/types/core/router-compiler.d.ts.map +1 -0
- package/dist/types/decorators/dependencies.d.ts +28 -0
- package/dist/types/decorators/dependencies.d.ts.map +1 -0
- package/dist/types/decorators/docs.d.ts +38 -0
- package/dist/types/decorators/docs.d.ts.map +1 -0
- package/dist/types/decorators/graphql.d.ts +126 -0
- package/dist/types/decorators/graphql.d.ts.map +1 -0
- package/dist/types/decorators/http.d.ts +74 -0
- package/dist/types/decorators/http.d.ts.map +1 -0
- package/dist/types/decorators/middleware.d.ts +30 -0
- package/dist/types/decorators/middleware.d.ts.map +1 -0
- package/dist/types/decorators/params.d.ts +82 -0
- package/dist/types/decorators/params.d.ts.map +1 -0
- package/dist/types/decorators/websocket.d.ts +61 -0
- package/dist/types/decorators/websocket.d.ts.map +1 -0
- package/dist/types/dependencies/container.d.ts +93 -0
- package/dist/types/dependencies/container.d.ts.map +1 -0
- package/dist/types/docs/index.d.ts +3 -0
- package/dist/types/docs/index.d.ts.map +1 -0
- package/dist/types/docs/openapi-generator.d.ts +50 -0
- package/dist/types/docs/openapi-generator.d.ts.map +1 -0
- package/dist/types/docs/zod-to-json-schema.d.ts +46 -0
- package/dist/types/docs/zod-to-json-schema.d.ts.map +1 -0
- package/dist/types/errors/exceptions.d.ts +48 -0
- package/dist/types/errors/exceptions.d.ts.map +1 -0
- package/dist/types/errors/handler.d.ts +61 -0
- package/dist/types/errors/handler.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +7 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/graphql/index.d.ts +4 -0
- package/dist/types/graphql/index.d.ts.map +1 -0
- package/dist/types/graphql/plugin.d.ts +60 -0
- package/dist/types/graphql/plugin.d.ts.map +1 -0
- package/dist/types/graphql/schema-builder.d.ts +46 -0
- package/dist/types/graphql/schema-builder.d.ts.map +1 -0
- package/dist/types/graphql/zod-to-graphql.d.ts +22 -0
- package/dist/types/graphql/zod-to-graphql.d.ts.map +1 -0
- package/dist/types/index.d.ts +34 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/middleware/compression.d.ts +7 -0
- package/dist/types/middleware/compression.d.ts.map +1 -0
- package/dist/types/middleware/cors.d.ts +7 -0
- package/dist/types/middleware/cors.d.ts.map +1 -0
- package/dist/types/middleware/index.d.ts +4 -0
- package/dist/types/middleware/index.d.ts.map +1 -0
- package/dist/types/middleware/rate-limit.d.ts +7 -0
- package/dist/types/middleware/rate-limit.d.ts.map +1 -0
- package/dist/types/plugins/index.d.ts +4 -0
- package/dist/types/plugins/index.d.ts.map +1 -0
- package/dist/types/plugins/openapi.d.ts +23 -0
- package/dist/types/plugins/openapi.d.ts.map +1 -0
- package/dist/types/responses/response.d.ts +200 -0
- package/dist/types/responses/response.d.ts.map +1 -0
- package/dist/types/testing/helpers.d.ts +98 -0
- package/dist/types/testing/helpers.d.ts.map +1 -0
- package/dist/types/testing/index.d.ts +4 -0
- package/dist/types/testing/index.d.ts.map +1 -0
- package/dist/types/testing/test-client.d.ts +86 -0
- package/dist/types/testing/test-client.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +232 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/validation/exceptions.d.ts +25 -0
- package/dist/types/validation/exceptions.d.ts.map +1 -0
- package/dist/types/validation/index.d.ts +3 -0
- package/dist/types/validation/index.d.ts.map +1 -0
- package/dist/types/validation/validator.d.ts +54 -0
- package/dist/types/validation/validator.d.ts.map +1 -0
- package/dist/types/websocket/connection.d.ts +51 -0
- package/dist/types/websocket/connection.d.ts.map +1 -0
- package/dist/types/websocket/index.d.ts +4 -0
- package/dist/types/websocket/index.d.ts.map +1 -0
- package/dist/types/websocket/manager.d.ts +82 -0
- package/dist/types/websocket/manager.d.ts.map +1 -0
- package/dist/types/websocket/plugin.d.ts +51 -0
- package/dist/types/websocket/plugin.d.ts.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.7] - 2025-10-12
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Fixed syntax error in CLI new command that prevented build from completing
|
|
14
|
+
- Fixed README generation in CLI templates
|
|
15
|
+
|
|
10
16
|
## [0.1.6] - 2025-10-12
|
|
11
17
|
|
|
12
18
|
### Added
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
var w$=Object.create;var{getPrototypeOf:k$,defineProperty:D,getOwnPropertyNames:p,getOwnPropertyDescriptor:f$}=Object,n=Object.prototype.hasOwnProperty;var O$=($,z,q)=>{q=$!=null?w$(k$($)):{};let B=z||!$||!$.__esModule?D(q,"default",{value:$,enumerable:!0}):q;for(let X of p($))if(!n.call(B,X))D(B,X,{get:()=>$[X],enumerable:!0});return B},s=new WeakMap,Dz=($)=>{var z=s.get($),q;if(z)return z;if(z=D({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")p($).map((B)=>!n.call(z,B)&&D(z,B,{get:()=>$[B],enumerable:!(q=f$($,B))||q.enumerable}));return s.set($,z),z},E=($,z)=>()=>(z||$((z={exports:{}}).exports,z),z.exports);var F=($,z)=>{for(var q in z)D($,q,{get:z[q],enumerable:!0,configurable:!0,set:(B)=>z[q]=()=>B})};var A=($,z)=>()=>($&&(z=$($=0)),z);var N=E((k)=>{class w extends Error{constructor($,z,q){super(q);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=z,this.exitCode=$,this.nestedError=void 0}}class r extends w{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}k.CommanderError=w;k.InvalidArgumentError=r});var j=E((f)=>{var{InvalidArgumentError:C$}=N();class t{constructor($,z){switch(this.description=z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue($,z){if(z===this.defaultValue||!Array.isArray(z))return[$];return z.push($),z}default($,z){return this.defaultValue=$,this.defaultValueDescription=z,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(z,q)=>{if(!this.argChoices.includes(z))throw new C$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(z,q);return z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function b$($){let z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+z+">":"["+z+"]"}f.Argument=t;f.humanReadableArgName=b$});var C=E((O)=>{var{humanReadableArgName:x$}=j();class a{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let z=$.commands.filter((B)=>!B._hidden),q=$._getHelpCommand();if(q&&!q._hidden)z.push(q);if(this.sortSubcommands)z.sort((B,X)=>{return B.name().localeCompare(X.name())});return z}compareOptions($,z){let q=(B)=>{return B.short?B.short.replace(/^-/,""):B.long.replace(/^--/,"")};return q($).localeCompare(q(z))}visibleOptions($){let z=$.options.filter((B)=>!B.hidden),q=$._getHelpOption();if(q&&!q.hidden){let B=q.short&&$._findOption(q.short),X=q.long&&$._findOption(q.long);if(!B&&!X)z.push(q);else if(q.long&&!X)z.push($.createOption(q.long,q.description));else if(q.short&&!B)z.push($.createOption(q.short,q.description))}if(this.sortOptions)z.sort(this.compareOptions);return z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let z=[];for(let q=$.parent;q;q=q.parent){let B=q.options.filter((X)=>!X.hidden);z.push(...B)}if(this.sortOptions)z.sort(this.compareOptions);return z}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((z)=>{z.description=z.description||$._argsDescription[z.name()]||""});if($.registeredArguments.find((z)=>z.description))return $.registeredArguments;return[]}subcommandTerm($){let z=$.registeredArguments.map((q)=>x$(q)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(z?" "+z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,z){return z.visibleCommands($).reduce((q,B)=>{return Math.max(q,this.displayWidth(z.styleSubcommandTerm(z.subcommandTerm(B))))},0)}longestOptionTermLength($,z){return z.visibleOptions($).reduce((q,B)=>{return Math.max(q,this.displayWidth(z.styleOptionTerm(z.optionTerm(B))))},0)}longestGlobalOptionTermLength($,z){return z.visibleGlobalOptions($).reduce((q,B)=>{return Math.max(q,this.displayWidth(z.styleOptionTerm(z.optionTerm(B))))},0)}longestArgumentTermLength($,z){return z.visibleArguments($).reduce((q,B)=>{return Math.max(q,this.displayWidth(z.styleArgumentTerm(z.argumentTerm(B))))},0)}commandUsage($){let z=$._name;if($._aliases[0])z=z+"|"+$._aliases[0];let q="";for(let B=$.parent;B;B=B.parent)q=B.name()+" "+q;return q+z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let z=[];if($.argChoices)z.push(`choices: ${$.argChoices.map((q)=>JSON.stringify(q)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)z.push(`env: ${$.envVar}`);if(z.length>0){let q=`(${z.join(", ")})`;if($.description)return`${$.description} ${q}`;return q}return $.description}argumentDescription($){let z=[];if($.argChoices)z.push(`choices: ${$.argChoices.map((q)=>JSON.stringify(q)).join(", ")}`);if($.defaultValue!==void 0)z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(z.length>0){let q=`(${z.join(", ")})`;if($.description)return`${$.description} ${q}`;return q}return $.description}formatItemList($,z,q){if(z.length===0)return[];return[q.styleTitle($),...z,""]}groupItems($,z,q){let B=new Map;return $.forEach((X)=>{let Y=q(X);if(!B.has(Y))B.set(Y,[])}),z.forEach((X)=>{let Y=q(X);if(!B.has(Y))B.set(Y,[]);B.get(Y).push(X)}),B}formatHelp($,z){let q=z.padWidth($,z),B=z.helpWidth??80;function X(J,U){return z.formatItem(J,q,U,z)}let Y=[`${z.styleTitle("Usage:")} ${z.styleUsage(z.commandUsage($))}`,""],Z=z.commandDescription($);if(Z.length>0)Y=Y.concat([z.boxWrap(z.styleCommandDescription(Z),B),""]);let Q=z.visibleArguments($).map((J)=>{return X(z.styleArgumentTerm(z.argumentTerm(J)),z.styleArgumentDescription(z.argumentDescription(J)))});if(Y=Y.concat(this.formatItemList("Arguments:",Q,z)),this.groupItems($.options,z.visibleOptions($),(J)=>J.helpGroupHeading??"Options:").forEach((J,U)=>{let M=J.map((W)=>{return X(z.styleOptionTerm(z.optionTerm(W)),z.styleOptionDescription(z.optionDescription(W)))});Y=Y.concat(this.formatItemList(U,M,z))}),z.showGlobalOptions){let J=z.visibleGlobalOptions($).map((U)=>{return X(z.styleOptionTerm(z.optionTerm(U)),z.styleOptionDescription(z.optionDescription(U)))});Y=Y.concat(this.formatItemList("Global Options:",J,z))}return this.groupItems($.commands,z.visibleCommands($),(J)=>J.helpGroup()||"Commands:").forEach((J,U)=>{let M=J.map((W)=>{return X(z.styleSubcommandTerm(z.subcommandTerm(W)),z.styleSubcommandDescription(z.subcommandDescription(W)))});Y=Y.concat(this.formatItemList(U,M,z))}),Y.join(`
|
|
3
|
+
`)}displayWidth($){return o($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((z)=>{if(z==="[options]")return this.styleOptionText(z);if(z==="[command]")return this.styleSubcommandText(z);if(z[0]==="["||z[0]==="<")return this.styleArgumentText(z);return this.styleCommandText(z)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((z)=>{if(z==="[options]")return this.styleOptionText(z);if(z[0]==="["||z[0]==="<")return this.styleArgumentText(z);return this.styleSubcommandText(z)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,z){return Math.max(z.longestOptionTermLength($,z),z.longestGlobalOptionTermLength($,z),z.longestSubcommandTermLength($,z),z.longestArgumentTermLength($,z))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,z,q,B){let Y=" ".repeat(2);if(!q)return Y+$;let Z=$.padEnd(z+$.length-B.displayWidth($)),Q=2,_=(this.helpWidth??80)-z-Q-2,J;if(_<this.minWidthToWrap||B.preformatted(q))J=q;else J=B.boxWrap(q,_).replace(/\n/g,`
|
|
4
|
+
`+" ".repeat(z+Q));return Y+Z+" ".repeat(Q)+J.replace(/\n/g,`
|
|
5
|
+
${Y}`)}boxWrap($,z){if(z<this.minWidthToWrap)return $;let q=$.split(/\r\n|\n/),B=/[\s]*[^\s]+/g,X=[];return q.forEach((Y)=>{let Z=Y.match(B);if(Z===null){X.push("");return}let Q=[Z.shift()],R=this.displayWidth(Q[0]);Z.forEach((_)=>{let J=this.displayWidth(_);if(R+J<=z){Q.push(_),R+=J;return}X.push(Q.join(""));let U=_.trimStart();Q=[U],R=this.displayWidth(U)}),X.push(Q.join(""))}),X.join(`
|
|
6
|
+
`)}}function o($){let z=/\x1b\[\d*(;\d*)*m/g;return $.replace(z,"")}O.Help=a;O.stripColor=o});var x=E((b)=>{var{InvalidArgumentError:v$}=N();class $${constructor($,z){this.flags=$,this.description=z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let q=u$($);if(this.short=q.shortFlag,this.long=q.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default($,z){return this.defaultValue=$,this.defaultValueDescription=z,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let z=$;if(typeof $==="string")z={[$]:!0};return this.implied=Object.assign(this.implied||{},z),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,z){if(z===this.defaultValue||!Array.isArray(z))return[$];return z.push($),z}choices($){return this.argChoices=$.slice(),this.parseArg=(z,q)=>{if(!this.argChoices.includes(z))throw new v$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(z,q);return z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return e(this.name().replace(/^no-/,""));return e(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class z${constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((z)=>{if(z.negate)this.negativeOptions.set(z.attributeName(),z);else this.positiveOptions.set(z.attributeName(),z)}),this.negativeOptions.forEach((z,q)=>{if(this.positiveOptions.has(q))this.dualOptions.add(q)})}valueFromOption($,z){let q=z.attributeName();if(!this.dualOptions.has(q))return!0;let B=this.negativeOptions.get(q).presetArg,X=B!==void 0?B:!1;return z.negate===(X===$)}}function e($){return $.split("-").reduce((z,q)=>{return z+q[0].toUpperCase()+q.slice(1)})}function u$($){let z,q,B=/^-[^-]$/,X=/^--[^-]/,Y=$.split(/[ |,]+/).concat("guard");if(B.test(Y[0]))z=Y.shift();if(X.test(Y[0]))q=Y.shift();if(!z&&B.test(Y[0]))z=Y.shift();if(!z&&X.test(Y[0]))z=q,q=Y.shift();if(Y[0].startsWith("-")){let Z=Y[0],Q=`option creation failed due to '${Z}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Z))throw Error(`${Q}
|
|
7
|
+
- a short flag is a single dash and a single character
|
|
8
|
+
- either use a single dash and a single character (for a short flag)
|
|
9
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(B.test(Z))throw Error(`${Q}
|
|
10
|
+
- too many short flags`);if(X.test(Z))throw Error(`${Q}
|
|
11
|
+
- too many long flags`);throw Error(`${Q}
|
|
12
|
+
- unrecognised flag format`)}if(z===void 0&&q===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:z,longFlag:q}}b.Option=$$;b.DualOptions=z$});var B$=E((q$)=>{function h$($,z){if(Math.abs($.length-z.length)>3)return Math.max($.length,z.length);let q=[];for(let B=0;B<=$.length;B++)q[B]=[B];for(let B=0;B<=z.length;B++)q[0][B]=B;for(let B=1;B<=z.length;B++)for(let X=1;X<=$.length;X++){let Y=1;if($[X-1]===z[B-1])Y=0;else Y=1;if(q[X][B]=Math.min(q[X-1][B]+1,q[X][B-1]+1,q[X-1][B-1]+Y),X>1&&B>1&&$[X-1]===z[B-2]&&$[X-2]===z[B-1])q[X][B]=Math.min(q[X][B],q[X-2][B-2]+1)}return q[$.length][z.length]}function g$($,z){if(!z||z.length===0)return"";z=Array.from(new Set(z));let q=$.startsWith("--");if(q)$=$.slice(2),z=z.map((Z)=>Z.slice(2));let B=[],X=3,Y=0.4;if(z.forEach((Z)=>{if(Z.length<=1)return;let Q=h$($,Z),R=Math.max($.length,Z.length);if((R-Q)/R>Y){if(Q<X)X=Q,B=[Z];else if(Q===X)B.push(Z)}}),B.sort((Z,Q)=>Z.localeCompare(Q)),q)B=B.map((Z)=>`--${Z}`);if(B.length>1)return`
|
|
13
|
+
(Did you mean one of ${B.join(", ")}?)`;if(B.length===1)return`
|
|
14
|
+
(Did you mean ${B[0]}?)`;return""}q$.suggestSimilar=g$});var Q$=E((l)=>{var l$=require("node:events").EventEmitter,v=require("node:child_process"),K=require("node:path"),P=require("node:fs"),T=require("node:process"),{Argument:c$,humanReadableArgName:d$}=j(),{CommanderError:u}=N(),{Help:m$,stripColor:i$}=C(),{Option:X$,DualOptions:s$}=x(),{suggestSimilar:Y$}=B$();class g extends l${constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(z)=>T.stdout.write(z),writeErr:(z)=>T.stderr.write(z),outputError:(z,q)=>q(z),getOutHelpWidth:()=>T.stdout.isTTY?T.stdout.columns:void 0,getErrHelpWidth:()=>T.stderr.isTTY?T.stderr.columns:void 0,getOutHasColors:()=>h()??(T.stdout.isTTY&&T.stdout.hasColors?.()),getErrHasColors:()=>h()??(T.stderr.isTTY&&T.stderr.hasColors?.()),stripColor:(z)=>i$(z)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let z=this;z;z=z.parent)$.push(z);return $}command($,z,q){let B=z,X=q;if(typeof B==="object"&&B!==null)X=B,B=null;X=X||{};let[,Y,Z]=$.match(/([^ ]+) *(.*)/),Q=this.createCommand(Y);if(B)Q.description(B),Q._executableHandler=!0;if(X.isDefault)this._defaultCommandName=Q._name;if(Q._hidden=!!(X.noHelp||X.hidden),Q._executableFile=X.executableFile||null,Z)Q.arguments(Z);if(this._registerCommand(Q),Q.parent=this,Q.copyInheritedSettings(this),B)return this;return Q}createCommand($){return new g($)}createHelp(){return Object.assign(new m$,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,z){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
|
|
15
|
+
- specify the name in Command constructor or using .name()`);if(z=z||{},z.isDefault)this._defaultCommandName=$._name;if(z.noHelp||z.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,z){return new c$($,z)}argument($,z,q,B){let X=this.createArgument($,z);if(typeof q==="function")X.default(B).argParser(q);else X.default(q);return this.addArgument(X),this}arguments($){return $.trim().split(/ +/).forEach((z)=>{this.argument(z)}),this}addArgument($){let z=this.registeredArguments.slice(-1)[0];if(z?.variadic)throw Error(`only the last argument can be variadic '${z.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,z){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let q=$??"help [command]",[,B,X]=q.match(/([^ ]+) *(.*)/),Y=z??"display help for command",Z=this.createCommand(B);if(Z.helpOption(!1),X)Z.arguments(X);if(Y)Z.description(Y);if(this._addImplicitHelpCommand=!0,this._helpCommand=Z,$||z)this._initCommandGroup(Z);return this}addHelpCommand($,z){if(typeof $!=="object")return this.helpCommand($,z),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,z){let q=["preSubcommand","preAction","postAction"];if(!q.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
|
|
16
|
+
Expecting one of '${q.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(z);else this._lifeCycleHooks[$]=[z];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(z)=>{if(z.code!=="commander.executeSubCommandAsync")throw z};return this}_exit($,z,q){if(this._exitCallback)this._exitCallback(new u($,z,q));T.exit($)}action($){let z=(q)=>{let B=this.registeredArguments.length,X=q.slice(0,B);if(this._storeOptionsAsProperties)X[B]=this;else X[B]=this.opts();return X.push(this),$.apply(this,X)};return this._actionHandler=z,this}createOption($,z){return new X$($,z)}_callParseArg($,z,q,B){try{return $.parseArg(z,q)}catch(X){if(X.code==="commander.invalidArgument"){let Y=`${B} ${X.message}`;this.error(Y,{exitCode:X.exitCode,code:X.code})}throw X}}_registerOption($){let z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(z){let q=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${q}'
|
|
17
|
+
- already used by option '${z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let z=(B)=>{return[B.name()].concat(B.aliases())},q=z($).find((B)=>this._findCommand(B));if(q){let B=z(this._findCommand(q)).join("|"),X=z($).join("|");throw Error(`cannot add command '${X}' as already have command '${B}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let z=$.name(),q=$.attributeName();if($.negate){let X=$.long.replace(/^--no-/,"--");if(!this._findOption(X))this.setOptionValueWithSource(q,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(q,$.defaultValue,"default");let B=(X,Y,Z)=>{if(X==null&&$.presetArg!==void 0)X=$.presetArg;let Q=this.getOptionValue(q);if(X!==null&&$.parseArg)X=this._callParseArg($,X,Q,Y);else if(X!==null&&$.variadic)X=$._collectValue(X,Q);if(X==null)if($.negate)X=!1;else if($.isBoolean()||$.optional)X=!0;else X="";this.setOptionValueWithSource(q,X,Z)};if(this.on("option:"+z,(X)=>{let Y=`error: option '${$.flags}' argument '${X}' is invalid.`;B(X,Y,"cli")}),$.envVar)this.on("optionEnv:"+z,(X)=>{let Y=`error: option '${$.flags}' value '${X}' from env '${$.envVar}' is invalid.`;B(X,Y,"env")});return this}_optionEx($,z,q,B,X){if(typeof z==="object"&&z instanceof X$)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let Y=this.createOption(z,q);if(Y.makeOptionMandatory(!!$.mandatory),typeof B==="function")Y.default(X).argParser(B);else if(B instanceof RegExp){let Z=B;B=(Q,R)=>{let _=Z.exec(Q);return _?_[0]:R},Y.default(X).argParser(B)}else Y.default(B);return this.addOption(Y)}option($,z,q,B){return this._optionEx({},$,z,q,B)}requiredOption($,z,q,B){return this._optionEx({mandatory:!0},$,z,q,B)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,z){return this.setOptionValueWithSource($,z,void 0)}setOptionValueWithSource($,z,q){if(this._storeOptionsAsProperties)this[$]=z;else this._optionValues[$]=z;return this._optionValueSources[$]=q,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let z;return this._getCommandAndAncestors().forEach((q)=>{if(q.getOptionValueSource($)!==void 0)z=q.getOptionValueSource($)}),z}_prepareUserArgs($,z){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(z=z||{},$===void 0&&z.from===void 0){if(T.versions?.electron)z.from="electron";let B=T.execArgv??[];if(B.includes("-e")||B.includes("--eval")||B.includes("-p")||B.includes("--print"))z.from="eval"}if($===void 0)$=T.argv;this.rawArgs=$.slice();let q;switch(z.from){case void 0:case"node":this._scriptPath=$[1],q=$.slice(2);break;case"electron":if(T.defaultApp)this._scriptPath=$[1],q=$.slice(2);else q=$.slice(1);break;case"user":q=$.slice(0);break;case"eval":q=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",q}parse($,z){this._prepareForParse();let q=this._prepareUserArgs($,z);return this._parseCommand([],q),this}async parseAsync($,z){this._prepareForParse();let q=this._prepareUserArgs($,z);return await this._parseCommand([],q),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
18
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,z,q){if(P.existsSync($))return;let B=z?`searched for local subcommand relative to directory '${z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",X=`'${$}' does not exist
|
|
19
|
+
- if '${q}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
20
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
21
|
+
- ${B}`;throw Error(X)}_executeSubCommand($,z){z=z.slice();let q=!1,B=[".js",".ts",".tsx",".mjs",".cjs"];function X(_,J){let U=K.resolve(_,J);if(P.existsSync(U))return U;if(B.includes(K.extname(J)))return;let M=B.find((W)=>P.existsSync(`${U}${W}`));if(M)return`${U}${M}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Y=$._executableFile||`${this._name}-${$._name}`,Z=this._executableDir||"";if(this._scriptPath){let _;try{_=P.realpathSync(this._scriptPath)}catch{_=this._scriptPath}Z=K.resolve(K.dirname(_),Z)}if(Z){let _=X(Z,Y);if(!_&&!$._executableFile&&this._scriptPath){let J=K.basename(this._scriptPath,K.extname(this._scriptPath));if(J!==this._name)_=X(Z,`${J}-${$._name}`)}Y=_||Y}q=B.includes(K.extname(Y));let Q;if(T.platform!=="win32")if(q)z.unshift(Y),z=Z$(T.execArgv).concat(z),Q=v.spawn(T.argv[0],z,{stdio:"inherit"});else Q=v.spawn(Y,z,{stdio:"inherit"});else this._checkForMissingExecutable(Y,Z,$._name),z.unshift(Y),z=Z$(T.execArgv).concat(z),Q=v.spawn(T.execPath,z,{stdio:"inherit"});if(!Q.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((J)=>{T.on(J,()=>{if(Q.killed===!1&&Q.exitCode===null)Q.kill(J)})});let R=this._exitCallback;Q.on("close",(_)=>{if(_=_??1,!R)T.exit(_);else R(new u(_,"commander.executeSubCommandAsync","(close)"))}),Q.on("error",(_)=>{if(_.code==="ENOENT")this._checkForMissingExecutable(Y,Z,$._name);else if(_.code==="EACCES")throw Error(`'${Y}' not executable`);if(!R)T.exit(1);else{let J=new u(1,"commander.executeSubCommandAsync","(error)");J.nestedError=_,R(J)}}),this.runningCommand=Q}_dispatchSubcommand($,z,q){let B=this._findCommand($);if(!B)this.help({error:!0});B._prepareForParse();let X;return X=this._chainOrCallSubCommandHook(X,B,"preSubcommand"),X=this._chainOrCall(X,()=>{if(B._executableHandler)this._executeSubCommand(B,z.concat(q));else return B._parseCommand(z,q)}),X}_dispatchHelpCommand($){if(!$)this.help();let z=this._findCommand($);if(z&&!z._executableHandler)z.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,z)=>{if($.required&&this.args[z]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(q,B,X)=>{let Y=B;if(B!==null&&q.parseArg){let Z=`error: command-argument value '${B}' is invalid for argument '${q.name()}'.`;Y=this._callParseArg(q,B,X,Z)}return Y};this._checkNumberOfArguments();let z=[];this.registeredArguments.forEach((q,B)=>{let X=q.defaultValue;if(q.variadic){if(B<this.args.length){if(X=this.args.slice(B),q.parseArg)X=X.reduce((Y,Z)=>{return $(q,Z,Y)},q.defaultValue)}else if(X===void 0)X=[]}else if(B<this.args.length){if(X=this.args[B],q.parseArg)X=$(q,X,q.defaultValue)}z[B]=X}),this.processedArgs=z}_chainOrCall($,z){if($?.then&&typeof $.then==="function")return $.then(()=>z());return z()}_chainOrCallHooks($,z){let q=$,B=[];if(this._getCommandAndAncestors().reverse().filter((X)=>X._lifeCycleHooks[z]!==void 0).forEach((X)=>{X._lifeCycleHooks[z].forEach((Y)=>{B.push({hookedCommand:X,callback:Y})})}),z==="postAction")B.reverse();return B.forEach((X)=>{q=this._chainOrCall(q,()=>{return X.callback(X.hookedCommand,this)})}),q}_chainOrCallSubCommandHook($,z,q){let B=$;if(this._lifeCycleHooks[q]!==void 0)this._lifeCycleHooks[q].forEach((X)=>{B=this._chainOrCall(B,()=>{return X(this,z)})});return B}_parseCommand($,z){let q=this.parseOptions(z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(q.operands),z=q.unknown,this.args=$.concat(z),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),z);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(z),this._dispatchSubcommand(this._defaultCommandName,$,z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(q.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let B=()=>{if(q.unknown.length>0)this.unknownOption(q.unknown[0])},X=`command:${this.name()}`;if(this._actionHandler){B(),this._processArguments();let Y;if(Y=this._chainOrCallHooks(Y,"preAction"),Y=this._chainOrCall(Y,()=>this._actionHandler(this.processedArgs)),this.parent)Y=this._chainOrCall(Y,()=>{this.parent.emit(X,$,z)});return Y=this._chainOrCallHooks(Y,"postAction"),Y}if(this.parent?.listenerCount(X))B(),this._processArguments(),this.parent.emit(X,$,z);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,z);if(this.listenerCount("command:*"))this.emit("command:*",$,z);else if(this.commands.length)this.unknownCommand();else B(),this._processArguments()}else if(this.commands.length)B(),this.help({error:!0});else B(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((z)=>z._name===$||z._aliases.includes($))}_findOption($){return this.options.find((z)=>z.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((z)=>{if(z.mandatory&&$.getOptionValue(z.attributeName())===void 0)$.missingMandatoryOptionValue(z)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((q)=>{let B=q.attributeName();if(this.getOptionValue(B)===void 0)return!1;return this.getOptionValueSource(B)!=="default"});$.filter((q)=>q.conflictsWith.length>0).forEach((q)=>{let B=$.find((X)=>q.conflictsWith.includes(X.attributeName()));if(B)this._conflictingOption(q,B)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let z=[],q=[],B=z;function X(_){return _.length>1&&_[0]==="-"}let Y=(_)=>{if(!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(_))return!1;return!this._getCommandAndAncestors().some((J)=>J.options.map((U)=>U.short).some((U)=>/^-\d$/.test(U)))},Z=null,Q=null,R=0;while(R<$.length||Q){let _=Q??$[R++];if(Q=null,_==="--"){if(B===q)B.push(_);B.push(...$.slice(R));break}if(Z&&(!X(_)||Y(_))){this.emit(`option:${Z.name()}`,_);continue}if(Z=null,X(_)){let J=this._findOption(_);if(J){if(J.required){let U=$[R++];if(U===void 0)this.optionMissingArgument(J);this.emit(`option:${J.name()}`,U)}else if(J.optional){let U=null;if(R<$.length&&(!X($[R])||Y($[R])))U=$[R++];this.emit(`option:${J.name()}`,U)}else this.emit(`option:${J.name()}`);Z=J.variadic?J:null;continue}}if(_.length>2&&_[0]==="-"&&_[1]!=="-"){let J=this._findOption(`-${_[1]}`);if(J){if(J.required||J.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${J.name()}`,_.slice(2));else this.emit(`option:${J.name()}`),Q=`-${_.slice(2)}`;continue}}if(/^--[^=]+=/.test(_)){let J=_.indexOf("="),U=this._findOption(_.slice(0,J));if(U&&(U.required||U.optional)){this.emit(`option:${U.name()}`,_.slice(J+1));continue}}if(B===z&&X(_)&&!(this.commands.length===0&&Y(_)))B=q;if((this._enablePositionalOptions||this._passThroughOptions)&&z.length===0&&q.length===0){if(this._findCommand(_)){z.push(_),q.push(...$.slice(R));break}else if(this._getHelpCommand()&&_===this._getHelpCommand().name()){z.push(_,...$.slice(R));break}else if(this._defaultCommandName){q.push(_,...$.slice(R));break}}if(this._passThroughOptions){B.push(_,...$.slice(R));break}B.push(_)}return{operands:z,unknown:q}}opts(){if(this._storeOptionsAsProperties){let $={},z=this.options.length;for(let q=0;q<z;q++){let B=this.options[q].attributeName();$[B]=B===this._versionOptionName?this._version:this[B]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,z)=>Object.assign($,z.opts()),{})}error($,z){if(this._outputConfiguration.outputError(`${$}
|
|
22
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
23
|
+
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
24
|
+
`),this.outputHelp({error:!0});let q=z||{},B=q.exitCode||1,X=q.code||"commander.error";this._exit(B,X,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in T.env){let z=$.attributeName();if(this.getOptionValue(z)===void 0||["default","config","env"].includes(this.getOptionValueSource(z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,T.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new s$(this.options),z=(q)=>{return this.getOptionValue(q)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(q))};this.options.filter((q)=>q.implied!==void 0&&z(q.attributeName())&&$.valueFromOption(this.getOptionValue(q.attributeName()),q)).forEach((q)=>{Object.keys(q.implied).filter((B)=>!z(B)).forEach((B)=>{this.setOptionValueWithSource(B,q.implied[B],"implied")})})}missingArgument($){let z=`error: missing required argument '${$}'`;this.error(z,{code:"commander.missingArgument"})}optionMissingArgument($){let z=`error: option '${$.flags}' argument missing`;this.error(z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let z=`error: required option '${$.flags}' not specified`;this.error(z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,z){let q=(Y)=>{let Z=Y.attributeName(),Q=this.getOptionValue(Z),R=this.options.find((J)=>J.negate&&Z===J.attributeName()),_=this.options.find((J)=>!J.negate&&Z===J.attributeName());if(R&&(R.presetArg===void 0&&Q===!1||R.presetArg!==void 0&&Q===R.presetArg))return R;return _||Y},B=(Y)=>{let Z=q(Y),Q=Z.attributeName();if(this.getOptionValueSource(Q)==="env")return`environment variable '${Z.envVar}'`;return`option '${Z.flags}'`},X=`error: ${B($)} cannot be used with ${B(z)}`;this.error(X,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let z="";if($.startsWith("--")&&this._showSuggestionAfterError){let B=[],X=this;do{let Y=X.createHelp().visibleOptions(X).filter((Z)=>Z.long).map((Z)=>Z.long);B=B.concat(Y),X=X.parent}while(X&&!X._enablePositionalOptions);z=Y$($,B)}let q=`error: unknown option '${$}'${z}`;this.error(q,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let z=this.registeredArguments.length,q=z===1?"":"s",X=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${z} argument${q} but got ${$.length}.`;this.error(X,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],z="";if(this._showSuggestionAfterError){let B=[];this.createHelp().visibleCommands(this).forEach((X)=>{if(B.push(X.name()),X.alias())B.push(X.alias())}),z=Y$($,B)}let q=`error: unknown command '${$}'${z}`;this.error(q,{code:"commander.unknownCommand"})}version($,z,q){if($===void 0)return this._version;this._version=$,z=z||"-V, --version",q=q||"output the version number";let B=this.createOption(z,q);return this._versionOptionName=B.attributeName(),this._registerOption(B),this.on("option:"+B.name(),()=>{this._outputConfiguration.writeOut(`${$}
|
|
25
|
+
`),this._exit(0,"commander.version",$)}),this}description($,z){if($===void 0&&z===void 0)return this._description;if(this._description=$,z)this._argsDescription=z;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)z=this.commands[this.commands.length-1];if($===z._name)throw Error("Command alias can't be the same as its name");let q=this.parent?._findCommand($);if(q){let B=[q.name()].concat(q.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${B}'`)}return z._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((z)=>this.alias(z)),this}usage($){if($===void 0){if(this._usage)return this._usage;let z=this.registeredArguments.map((q)=>{return d$(q)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=K.basename($,K.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let z=this.createHelp(),q=this._getOutputContext($);z.prepareContext({error:q.error,helpWidth:q.helpWidth,outputHasColors:q.hasColors});let B=z.formatHelp(this,z);if(q.hasColors)return B;return this._outputConfiguration.stripColor(B)}_getOutputContext($){$=$||{};let z=!!$.error,q,B,X;if(z)q=(Z)=>this._outputConfiguration.writeErr(Z),B=this._outputConfiguration.getErrHasColors(),X=this._outputConfiguration.getErrHelpWidth();else q=(Z)=>this._outputConfiguration.writeOut(Z),B=this._outputConfiguration.getOutHasColors(),X=this._outputConfiguration.getOutHelpWidth();return{error:z,write:(Z)=>{if(!B)Z=this._outputConfiguration.stripColor(Z);return q(Z)},hasColors:B,helpWidth:X}}outputHelp($){let z;if(typeof $==="function")z=$,$=void 0;let q=this._getOutputContext($),B={error:q.error,write:q.write,command:this};this._getCommandAndAncestors().reverse().forEach((Y)=>Y.emit("beforeAllHelp",B)),this.emit("beforeHelp",B);let X=this.helpInformation({error:q.error});if(z){if(X=z(X),typeof X!=="string"&&!Buffer.isBuffer(X))throw Error("outputHelp callback must return a string or a Buffer")}if(q.write(X),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",B),this._getCommandAndAncestors().forEach((Y)=>Y.emit("afterAllHelp",B))}helpOption($,z){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",z??"display help for command"),$||z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let z=Number(T.exitCode??0);if(z===0&&$&&typeof $!=="function"&&$.error)z=1;this._exit(z,"commander.help","(outputHelp)")}addHelpText($,z){let q=["beforeAll","before","after","afterAll"];if(!q.includes($))throw Error(`Unexpected value for position to addHelpText.
|
|
26
|
+
Expecting one of '${q.join("', '")}'`);let B=`${$}Help`;return this.on(B,(X)=>{let Y;if(typeof z==="function")Y=z({error:X.error,command:X.command});else Y=z;if(Y)X.write(`${Y}
|
|
27
|
+
`)}),this}_outputHelpIfRequested($){let z=this._getHelpOption();if(z&&$.find((B)=>z.is(B)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function Z$($){return $.map((z)=>{if(!z.startsWith("--inspect"))return z;let q,B="127.0.0.1",X="9229",Y;if((Y=z.match(/^(--inspect(-brk)?)$/))!==null)q=Y[1];else if((Y=z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(q=Y[1],/^\d+$/.test(Y[3]))X=Y[3];else B=Y[3];else if((Y=z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)q=Y[1],B=Y[3],X=Y[4];if(q&&X!=="0")return`${q}=${B}:${parseInt(X)+1}`;return z})}function h(){if(T.env.NO_COLOR||T.env.FORCE_COLOR==="0"||T.env.FORCE_COLOR==="false")return!1;if(T.env.FORCE_COLOR||T.env.CLICOLOR_FORCE!==void 0)return!0;return}l.Command=g;l.useColor=h});var U$=E((G)=>{var{Argument:_$}=j(),{Command:c}=Q$(),{CommanderError:p$,InvalidArgumentError:J$}=N(),{Help:n$}=C(),{Option:R$}=x();G.program=new c;G.createCommand=($)=>new c($);G.createOption=($,z)=>new R$($,z);G.createArgument=($,z)=>new _$($,z);G.Command=c;G.Option=R$;G.Argument=_$;G.Help=n$;G.CommanderError=p$;G.InvalidArgumentError=J$;G.InvalidOptionArgumentError=J$});var M$={};F(M$,{registerNewCommand:()=>t$});async function r$($){await H.writeFile(L.join($,"public","docs.html"),`<!DOCTYPE html>
|
|
28
|
+
<html lang="en">
|
|
29
|
+
<head>
|
|
30
|
+
<meta charset="utf-8" />
|
|
31
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
32
|
+
<title>API Documentation</title>
|
|
33
|
+
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui.css" />
|
|
34
|
+
<style>
|
|
35
|
+
body { margin: 0; padding: 0; }
|
|
36
|
+
</style>
|
|
37
|
+
</head>
|
|
38
|
+
<body>
|
|
39
|
+
<div id="swagger-ui"></div>
|
|
40
|
+
<script src="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-bundle.js" crossorigin></script>
|
|
41
|
+
<script src="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-standalone-preset.js" crossorigin></script>
|
|
42
|
+
<script>
|
|
43
|
+
window.onload = () => {
|
|
44
|
+
window.ui = SwaggerUIBundle({
|
|
45
|
+
url: 'http://localhost:3000/openapi.json',
|
|
46
|
+
dom_id: '#swagger-ui',
|
|
47
|
+
deepLinking: true,
|
|
48
|
+
presets: [
|
|
49
|
+
SwaggerUIBundle.presets.apis,
|
|
50
|
+
SwaggerUIStandalonePreset
|
|
51
|
+
],
|
|
52
|
+
layout: "StandaloneLayout"
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
</script>
|
|
56
|
+
</body>
|
|
57
|
+
</html>`)}function t$($){$.command("new").description("Create a new VeloceTS project").argument("<name>","Project name").option("-t, --template <template>","Project template (rest, graphql, websocket, fullstack)","rest").action(async(z,q)=>{await a$(z,q)})}async function a$($,z){let q=L.join(process.cwd(),$);if(L$.existsSync(q))console.error(`Error: Directory "${$}" already exists`),process.exit(1);console.log(`Creating new VeloceTS project: ${$}`),console.log(`Template: ${z.template}`);try{switch(await H.mkdir(q,{recursive:!0}),await H.mkdir(L.join(q,"src"),{recursive:!0}),await H.mkdir(L.join(q,"src","controllers"),{recursive:!0}),await o$(q,$),await e$(q),await $z(q),await zz(q,$,z.template),z.template){case"rest":await qz(q);break;case"graphql":await Bz(q);break;case"websocket":await Xz(q);break;case"fullstack":await Yz(q);break}await H.mkdir(L.join(q,"public"),{recursive:!0}),await r$(q),console.log(`
|
|
58
|
+
✓ Project created successfully!`),console.log(`
|
|
59
|
+
Next steps:`),console.log(` cd ${$}`),console.log(" bun install"),console.log(" bun run dev")}catch(B){console.error("Error creating project:",B),process.exit(1)}}async function o$($,z){let q={name:z,version:"0.1.0",description:"A Veloce-TS application",type:"module",main:"./dist/index.js",scripts:{dev:"bun --watch src/index.ts",build:"bun build src/index.ts --outdir dist --target bun",start:"bun run dist/index.js","generate:openapi":"bun run node_modules/veloce-ts/bin/veloce.ts generate openapi","generate:client":"bun run node_modules/veloce-ts/bin/veloce.ts generate client"},dependencies:{"veloce-ts":"^0.1.0",hono:"^4.0.0","reflect-metadata":"^0.2.0",zod:"^3.22.0"},devDependencies:{"@types/bun":"latest",typescript:"^5.3.0"}};await H.writeFile(L.join($,"package.json"),JSON.stringify(q,null,2))}async function e$($){let z={compilerOptions:{target:"ES2022",module:"ESNext",lib:["ES2022"],moduleResolution:"bundler",experimentalDecorators:!0,emitDecoratorMetadata:!0,strict:!0,esModuleInterop:!0,skipLibCheck:!0,forceConsistentCasingInFileNames:!0,resolveJsonModule:!0,outDir:"./dist",rootDir:"./src"},include:["src/**/*"],exclude:["node_modules","dist"]};await H.writeFile(L.join($,"tsconfig.json"),JSON.stringify(z,null,2))}async function $z($){await H.writeFile(L.join($,".gitignore"),`node_modules/
|
|
60
|
+
dist/
|
|
61
|
+
*.log
|
|
62
|
+
.env
|
|
63
|
+
.DS_Store
|
|
64
|
+
`)}async function zz($,z,q){let B=`# ${z}
|
|
65
|
+
|
|
66
|
+
A modern TypeScript API built with [Veloce-TS](https://github.com/AlfredoMejia3001/veloce-ts) using the **${q}** template.
|
|
67
|
+
|
|
68
|
+
## Getting Started
|
|
69
|
+
|
|
70
|
+
### Install Dependencies
|
|
71
|
+
|
|
72
|
+
\`\`\`bash
|
|
73
|
+
bun install
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
### Development
|
|
77
|
+
|
|
78
|
+
Run the development server with hot reload:
|
|
79
|
+
|
|
80
|
+
\`\`\`bash
|
|
81
|
+
bun run dev
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
Your API will be available at http://localhost:3000
|
|
85
|
+
|
|
86
|
+
### Production
|
|
87
|
+
|
|
88
|
+
Build and start the production server:
|
|
89
|
+
|
|
90
|
+
\`\`\`bash
|
|
91
|
+
bun run build
|
|
92
|
+
bun run start
|
|
93
|
+
\`\`\`
|
|
94
|
+
|
|
95
|
+
## Documentation
|
|
96
|
+
|
|
97
|
+
- **API Documentation**: Visit http://localhost:3000/docs.html for interactive Swagger UI
|
|
98
|
+
- **Veloce-TS Docs**: Check out the [official documentation](https://docs.veloce-ts.com)
|
|
99
|
+
|
|
100
|
+
## Project Structure
|
|
101
|
+
|
|
102
|
+
\`\`\`
|
|
103
|
+
${z}/
|
|
104
|
+
├── src/
|
|
105
|
+
│ └── index.ts # Application entry point
|
|
106
|
+
├── package.json
|
|
107
|
+
├── tsconfig.json
|
|
108
|
+
└── README.md
|
|
109
|
+
\`\`\`
|
|
110
|
+
|
|
111
|
+
## Learn More
|
|
112
|
+
|
|
113
|
+
- [Veloce-TS GitHub](https://github.com/AlfredoMejia3001/veloce-ts)
|
|
114
|
+
- [TypeScript Documentation](https://www.typescriptlang.org/docs/)
|
|
115
|
+
- [Bun Documentation](https://bun.sh/docs)
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
Built with Veloce-TS
|
|
120
|
+
`;await H.writeFile(L.join($,"README.md"),B)}async function qz($){await H.writeFile(L.join($,"src","index.ts"),`import 'reflect-metadata';
|
|
121
|
+
import { Veloce } from 'veloce-ts';
|
|
122
|
+
import { OpenAPIPlugin } from 'veloce-ts/plugins';
|
|
123
|
+
import { UserController } from './controllers/user.controller';
|
|
124
|
+
import { cors } from 'hono/cors';
|
|
125
|
+
import { serveStatic } from 'hono/bun';
|
|
126
|
+
|
|
127
|
+
const app = new Veloce({
|
|
128
|
+
title: 'My REST API',
|
|
129
|
+
version: '1.0.0',
|
|
130
|
+
docs: true,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Enable CORS
|
|
134
|
+
app.use(cors());
|
|
135
|
+
|
|
136
|
+
// Serve static files (for Swagger UI)
|
|
137
|
+
app.use(serveStatic({ root: './public' }));
|
|
138
|
+
|
|
139
|
+
// Enable OpenAPI documentation
|
|
140
|
+
app.usePlugin(new OpenAPIPlugin({
|
|
141
|
+
path: '/openapi.json',
|
|
142
|
+
docsPath: '/docs',
|
|
143
|
+
}));
|
|
144
|
+
|
|
145
|
+
// Register controllers
|
|
146
|
+
app.include(UserController);
|
|
147
|
+
|
|
148
|
+
// Compile routes
|
|
149
|
+
await app.compile();
|
|
150
|
+
|
|
151
|
+
// Start server
|
|
152
|
+
app.listen(3000, () => {
|
|
153
|
+
console.log('Server running on http://localhost:3000');
|
|
154
|
+
console.log('API Docs available at http://localhost:3000/docs.html');
|
|
155
|
+
console.log('OpenAPI Spec at http://localhost:3000/openapi.json');
|
|
156
|
+
});
|
|
157
|
+
`);let q=`import { Controller, Get, Post, Body, Param } from 'veloce-ts';
|
|
158
|
+
import { z } from 'zod';
|
|
159
|
+
|
|
160
|
+
const UserSchema = z.object({
|
|
161
|
+
name: z.string(),
|
|
162
|
+
email: z.string().email(),
|
|
163
|
+
age: z.number().min(0).optional(),
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
type User = z.infer<typeof UserSchema>;
|
|
167
|
+
|
|
168
|
+
@Controller('/users')
|
|
169
|
+
export class UserController {
|
|
170
|
+
private users: User[] = [];
|
|
171
|
+
|
|
172
|
+
@Get('/')
|
|
173
|
+
async getUsers() {
|
|
174
|
+
return { users: this.users };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@Get('/:id')
|
|
178
|
+
async getUser(@Param('id') id: string) {
|
|
179
|
+
const user = this.users[parseInt(id)];
|
|
180
|
+
if (!user) {
|
|
181
|
+
throw new Error('User not found');
|
|
182
|
+
}
|
|
183
|
+
return user;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@Post('/')
|
|
187
|
+
async createUser(@Body(UserSchema) user: User) {
|
|
188
|
+
this.users.push(user);
|
|
189
|
+
return { message: 'User created', user };
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
`;await H.writeFile(L.join($,"src","controllers","user.controller.ts"),q)}async function Bz($){await H.mkdir(L.join($,"src","resolvers"),{recursive:!0});let z=`import 'reflect-metadata';
|
|
193
|
+
import { Veloce } from 'veloce-ts';
|
|
194
|
+
import { GraphQLPlugin } from 'veloce-ts/plugins';
|
|
195
|
+
import { UserResolver } from './resolvers/user.resolver';
|
|
196
|
+
|
|
197
|
+
const app = new Veloce({
|
|
198
|
+
title: 'My GraphQL API',
|
|
199
|
+
version: '1.0.0',
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// Enable GraphQL
|
|
203
|
+
app.usePlugin(new GraphQLPlugin({
|
|
204
|
+
resolvers: [UserResolver],
|
|
205
|
+
}));
|
|
206
|
+
|
|
207
|
+
// Compile routes
|
|
208
|
+
await app.compile();
|
|
209
|
+
|
|
210
|
+
app.listen(3000, () => {
|
|
211
|
+
console.log('Server running on http://localhost:3000');
|
|
212
|
+
console.log('GraphQL Playground at http://localhost:3000/graphql');
|
|
213
|
+
});
|
|
214
|
+
`;await H.writeFile(L.join($,"src","index.ts"),z);let q=`import { Resolver, Query, Mutation, Arg } from 'veloce-ts/graphql';
|
|
215
|
+
import { z } from 'zod';
|
|
216
|
+
|
|
217
|
+
const UserSchema = z.object({
|
|
218
|
+
id: z.string(),
|
|
219
|
+
name: z.string(),
|
|
220
|
+
email: z.string().email(),
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
type User = z.infer<typeof UserSchema>;
|
|
224
|
+
|
|
225
|
+
@Resolver()
|
|
226
|
+
export class UserResolver {
|
|
227
|
+
private users: User[] = [];
|
|
228
|
+
|
|
229
|
+
@Query()
|
|
230
|
+
async users(): Promise<User[]> {
|
|
231
|
+
return this.users;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@Query()
|
|
235
|
+
async user(@Arg('id', z.string()) id: string): Promise<User | null> {
|
|
236
|
+
return this.users.find(u => u.id === id) || null;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@Mutation()
|
|
240
|
+
async createUser(
|
|
241
|
+
@Arg('name', z.string()) name: string,
|
|
242
|
+
@Arg('email', z.string().email()) email: string
|
|
243
|
+
): Promise<User> {
|
|
244
|
+
const user = { id: Date.now().toString(), name, email };
|
|
245
|
+
this.users.push(user);
|
|
246
|
+
return user;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
`;await H.writeFile(L.join($,"src","resolvers","user.resolver.ts"),q)}async function Xz($){await H.mkdir(L.join($,"src","websockets"),{recursive:!0});let z=`import 'reflect-metadata';
|
|
250
|
+
import { Veloce } from 'veloce-ts';
|
|
251
|
+
import { WebSocketPlugin } from 'veloce-ts/plugins';
|
|
252
|
+
import { ChatWebSocket } from './websockets/chat.websocket';
|
|
253
|
+
|
|
254
|
+
const app = new Veloce({
|
|
255
|
+
title: 'My WebSocket API',
|
|
256
|
+
version: '1.0.0',
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// Enable WebSocket
|
|
260
|
+
app.usePlugin(new WebSocketPlugin({
|
|
261
|
+
handlers: [ChatWebSocket],
|
|
262
|
+
}));
|
|
263
|
+
|
|
264
|
+
// Compile routes
|
|
265
|
+
await app.compile();
|
|
266
|
+
|
|
267
|
+
app.listen(3000, () => {
|
|
268
|
+
console.log('Server running on http://localhost:3000');
|
|
269
|
+
console.log('WebSocket endpoint at ws://localhost:3000/ws/chat');
|
|
270
|
+
});
|
|
271
|
+
`;await H.writeFile(L.join($,"src","index.ts"),z);let q=`import { WebSocket, OnConnect, OnMessage, OnDisconnect } from 'veloce-ts/websocket';
|
|
272
|
+
import { z } from 'zod';
|
|
273
|
+
import type { WebSocketConnection } from 'veloce-ts/websocket';
|
|
274
|
+
|
|
275
|
+
const MessageSchema = z.object({
|
|
276
|
+
type: z.enum(['message', 'join', 'leave']),
|
|
277
|
+
content: z.string(),
|
|
278
|
+
username: z.string(),
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
@WebSocket('/ws/chat')
|
|
282
|
+
export class ChatWebSocket {
|
|
283
|
+
@OnConnect()
|
|
284
|
+
handleConnect(connection: WebSocketConnection) {
|
|
285
|
+
console.log('Client connected:', connection.id);
|
|
286
|
+
connection.send({ type: 'system', content: 'Welcome to the chat!' });
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
@OnMessage(MessageSchema)
|
|
290
|
+
async handleMessage(connection: WebSocketConnection, message: z.infer<typeof MessageSchema>) {
|
|
291
|
+
console.log('Received message:', message);
|
|
292
|
+
|
|
293
|
+
// Broadcast to all clients
|
|
294
|
+
connection.broadcast({
|
|
295
|
+
type: 'message',
|
|
296
|
+
username: message.username,
|
|
297
|
+
content: message.content,
|
|
298
|
+
timestamp: new Date().toISOString(),
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
@OnDisconnect()
|
|
303
|
+
handleDisconnect(connection: WebSocketConnection) {
|
|
304
|
+
console.log('Client disconnected:', connection.id);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
`;await H.writeFile(L.join($,"src","websockets","chat.websocket.ts"),q)}async function Yz($){await H.mkdir(L.join($,"src","controllers"),{recursive:!0}),await H.mkdir(L.join($,"src","resolvers"),{recursive:!0}),await H.mkdir(L.join($,"src","websockets"),{recursive:!0});let z=`import 'reflect-metadata';
|
|
308
|
+
import { Veloce } from 'veloce-ts';
|
|
309
|
+
import { OpenAPIPlugin, GraphQLPlugin, WebSocketPlugin } from 'veloce-ts/plugins';
|
|
310
|
+
import { UserController } from './controllers/user.controller';
|
|
311
|
+
import { UserResolver } from './resolvers/user.resolver';
|
|
312
|
+
import { ChatWebSocket } from './websockets/chat.websocket';
|
|
313
|
+
|
|
314
|
+
const app = new Veloce({
|
|
315
|
+
title: 'My Fullstack API',
|
|
316
|
+
version: '1.0.0',
|
|
317
|
+
docs: true,
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// Enable OpenAPI documentation
|
|
321
|
+
app.usePlugin(new OpenAPIPlugin({
|
|
322
|
+
path: '/docs',
|
|
323
|
+
}));
|
|
324
|
+
|
|
325
|
+
// REST API
|
|
326
|
+
app.include(UserController);
|
|
327
|
+
|
|
328
|
+
// GraphQL
|
|
329
|
+
app.usePlugin(new GraphQLPlugin({
|
|
330
|
+
resolvers: [UserResolver],
|
|
331
|
+
}));
|
|
332
|
+
|
|
333
|
+
// WebSocket
|
|
334
|
+
app.usePlugin(new WebSocketPlugin({
|
|
335
|
+
handlers: [ChatWebSocket],
|
|
336
|
+
}));
|
|
337
|
+
|
|
338
|
+
// Compile routes
|
|
339
|
+
await app.compile();
|
|
340
|
+
|
|
341
|
+
app.listen(3000, () => {
|
|
342
|
+
console.log('Server running on http://localhost:3000');
|
|
343
|
+
console.log('REST API docs at http://localhost:3000/docs');
|
|
344
|
+
console.log('GraphQL Playground at http://localhost:3000/graphql');
|
|
345
|
+
console.log('WebSocket endpoint at ws://localhost:3000/ws/chat');
|
|
346
|
+
});
|
|
347
|
+
`;await H.writeFile(L.join($,"src","index.ts"),z);let q=`import { Controller, Get, Post, Body, Param } from 'veloce-ts';
|
|
348
|
+
import { z } from 'zod';
|
|
349
|
+
|
|
350
|
+
const UserSchema = z.object({
|
|
351
|
+
name: z.string(),
|
|
352
|
+
email: z.string().email(),
|
|
353
|
+
age: z.number().min(0).optional(),
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
type User = z.infer<typeof UserSchema>;
|
|
357
|
+
|
|
358
|
+
@Controller('/users')
|
|
359
|
+
export class UserController {
|
|
360
|
+
private users: User[] = [];
|
|
361
|
+
|
|
362
|
+
@Get('/')
|
|
363
|
+
async getUsers() {
|
|
364
|
+
return { users: this.users };
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
@Get('/:id')
|
|
368
|
+
async getUser(@Param('id') id: string) {
|
|
369
|
+
const user = this.users[parseInt(id)];
|
|
370
|
+
if (!user) {
|
|
371
|
+
throw new Error('User not found');
|
|
372
|
+
}
|
|
373
|
+
return user;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
@Post('/')
|
|
377
|
+
async createUser(@Body(UserSchema) user: User) {
|
|
378
|
+
this.users.push(user);
|
|
379
|
+
return { message: 'User created', user };
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
`;await H.writeFile(L.join($,"src","controllers","user.controller.ts"),q);let B=`import { Resolver, Query, Mutation, Arg } from 'veloce-ts/graphql';
|
|
383
|
+
import { z } from 'zod';
|
|
384
|
+
|
|
385
|
+
const UserSchema = z.object({
|
|
386
|
+
id: z.string(),
|
|
387
|
+
name: z.string(),
|
|
388
|
+
email: z.string().email(),
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
type User = z.infer<typeof UserSchema>;
|
|
392
|
+
|
|
393
|
+
@Resolver()
|
|
394
|
+
export class UserResolver {
|
|
395
|
+
private users: User[] = [];
|
|
396
|
+
|
|
397
|
+
@Query()
|
|
398
|
+
async users(): Promise<User[]> {
|
|
399
|
+
return this.users;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
@Query()
|
|
403
|
+
async user(@Arg('id', z.string()) id: string): Promise<User | null> {
|
|
404
|
+
return this.users.find(u => u.id === id) || null;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
@Mutation()
|
|
408
|
+
async createUser(
|
|
409
|
+
@Arg('name', z.string()) name: string,
|
|
410
|
+
@Arg('email', z.string().email()) email: string
|
|
411
|
+
): Promise<User> {
|
|
412
|
+
const user = { id: Date.now().toString(), name, email };
|
|
413
|
+
this.users.push(user);
|
|
414
|
+
return user;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
`;await H.writeFile(L.join($,"src","resolvers","user.resolver.ts"),B);let X=`import { WebSocket, OnConnect, OnMessage, OnDisconnect } from 'veloce-ts/websocket';
|
|
418
|
+
import { z } from 'zod';
|
|
419
|
+
import type { WebSocketConnection } from 'veloce-ts/websocket';
|
|
420
|
+
|
|
421
|
+
const MessageSchema = z.object({
|
|
422
|
+
type: z.enum(['message', 'join', 'leave']),
|
|
423
|
+
content: z.string(),
|
|
424
|
+
username: z.string(),
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
@WebSocket('/ws/chat')
|
|
428
|
+
export class ChatWebSocket {
|
|
429
|
+
@OnConnect()
|
|
430
|
+
handleConnect(connection: WebSocketConnection) {
|
|
431
|
+
console.log('Client connected:', connection.id);
|
|
432
|
+
connection.send({ type: 'system', content: 'Welcome to the chat!' });
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
@OnMessage(MessageSchema)
|
|
436
|
+
async handleMessage(connection: WebSocketConnection, message: z.infer<typeof MessageSchema>) {
|
|
437
|
+
console.log('Received message:', message);
|
|
438
|
+
|
|
439
|
+
// Broadcast to all clients
|
|
440
|
+
connection.broadcast({
|
|
441
|
+
type: 'message',
|
|
442
|
+
username: message.username,
|
|
443
|
+
content: message.content,
|
|
444
|
+
timestamp: new Date().toISOString(),
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
@OnDisconnect()
|
|
449
|
+
handleDisconnect(connection: WebSocketConnection) {
|
|
450
|
+
console.log('Client disconnected:', connection.id);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
`;await H.writeFile(L.join($,"src","websockets","chat.websocket.ts"),X)}var H,L,L$;var G$=A(()=>{H=require("fs/promises"),L=require("path"),L$=require("fs")});var S$={};F(S$,{registerDevCommand:()=>Zz});function Zz($){$.command("dev").description("Start development server with hot reload").option("-p, --port <port>","Port to run the server on","3000").option("-w, --watch <path>","Additional paths to watch","src").action(async(z)=>{await Qz(z)})}async function Qz($){let z=E$.join(process.cwd(),"src","index.ts");if(!W$.existsSync(z))console.error("Error: src/index.ts not found"),console.error("Make sure you are in a VeloceTS project directory"),process.exit(1);console.log("Starting development server..."),console.log(`Watching: ${$.watch||"src"}`),console.log(`Port: ${$.port||3000}`),console.log(`
|
|
454
|
+
Press Ctrl+C to stop
|
|
455
|
+
`);let q=["--watch","--hot",z],B={...process.env,NODE_ENV:"development",PORT:$.port?.toString()||"3000"},X=K$.spawn("bun",q,{stdio:"inherit",env:B,shell:!0}),Y=()=>{console.log(`
|
|
456
|
+
Shutting down development server...`),X.kill("SIGTERM"),process.exit(0)};process.on("SIGINT",Y),process.on("SIGTERM",Y),X.on("error",(Z)=>{console.error("Failed to start development server:",Z),process.exit(1)}),X.on("exit",(Z)=>{if(Z!==0&&Z!==null)console.error(`Development server exited with code ${Z}`),process.exit(Z)})}var K$,W$,E$;var I$=A(()=>{K$=require("child_process"),W$=require("fs"),E$=require("path")});var V$={};F(V$,{registerBuildCommand:()=>_z});function _z($){$.command("build").description("Build project for production").option("-m, --minify","Minify output",!1).option("-s, --sourcemap","Generate sourcemaps",!0).option("-o, --outdir <dir>","Output directory","dist").option("-f, --format <format>","Output format (esm, cjs, both)","both").action(async(z)=>{await Jz(z)})}async function Jz($){let z=m.join(process.cwd(),"src","index.ts");if(!d.existsSync(z))console.error("Error: src/index.ts not found"),console.error("Make sure you are in a VeloceTS project directory"),process.exit(1);console.log("Building project for production..."),console.log(`Format: ${$.format||"both"}`),console.log(`Minify: ${$.minify?"yes":"no"}`),console.log(`Sourcemap: ${$.sourcemap?"yes":"no"}`);let q=$.outdir||"dist";try{if(d.existsSync(q))await y.rm(q,{recursive:!0,force:!0});await y.mkdir(q,{recursive:!0});let B=$.format||"both",X=B==="both"?["esm","cjs"]:[B];for(let Y of X)console.log(`
|
|
457
|
+
Building ${Y.toUpperCase()}...`),await Rz(z,q,Y,$);console.log(`
|
|
458
|
+
✓ Build completed successfully!`),console.log(`
|
|
459
|
+
Output directory: ${q}`)}catch(B){console.error("Build failed:",B),process.exit(1)}}async function Rz($,z,q,B){let X=m.join(z,q);await y.mkdir(X,{recursive:!0});let Y=await Bun.build({entrypoints:[$],outdir:X,target:"bun",format:q==="esm"?"esm":"cjs",minify:B.minify||!1,sourcemap:B.sourcemap!==!1?"external":"none",splitting:q==="esm",external:["hono","zod","reflect-metadata","commander","zod-to-json-schema"]});if(!Y.success){console.error(`Failed to build ${q}:`);for(let Q of Y.logs)console.error(Q);throw Error(`Build failed for ${q}`)}console.log(` ✓ ${q.toUpperCase()} build complete`),console.log(` Files: ${Y.outputs.length}`);let Z=Y.outputs.reduce((Q,R)=>Q+R.size,0);console.log(` Size: ${(Z/1024).toFixed(2)} KB`)}var d,m,y;var D$=A(()=>{d=require("fs"),m=require("path"),y=require("fs/promises")});var F$={};F(F$,{registerGenerateCommand:()=>Uz});function Uz($){let z=$.command("generate").description("Generate code and documentation").alias("g");z.command("openapi").description("Generate OpenAPI specification").option("-o, --output <file>","Output file path","openapi.json").action(async(q)=>{await Tz(q)}),z.command("client").description("Generate TypeScript client from OpenAPI spec").option("-i, --input <file>","OpenAPI spec file","openapi.json").option("-o, --output <dir>","Output directory","src/client").action(async(q)=>{await Gz(q)})}async function Tz($){console.log("Generating OpenAPI specification...");try{let z=S.join(process.cwd(),"src","index.ts");if(!i.existsSync(z))console.error("Error: src/index.ts not found"),console.error("Make sure you are in a FastAPI-TS project directory"),process.exit(1);let q=await import(z),B=q.default||q.app;if(!B||typeof B.getMetadata!=="function")console.error("Error: Could not find VeloceTS app instance"),console.error("Make sure your src/index.ts exports the app or sets it as default"),process.exit(1);let X=B.getMetadata(),Y=Hz(X,B),Z=S.join(process.cwd(),$.output);await I.writeFile(Z,JSON.stringify(Y,null,2)),console.log(`✓ OpenAPI spec generated: ${$.output}`)}catch(z){console.error("Failed to generate OpenAPI spec:",z),process.exit(1)}}function Hz($,z){let q=$.getRoutes(),B={openapi:"3.0.0",info:{title:z.config?.title||"Veloce API",version:z.config?.version||"1.0.0",description:z.config?.description||"API built with Veloce"},paths:{},components:{schemas:{}}};for(let X of q){let Y=X.path,Z=X.method.toLowerCase();if(!B.paths[Y])B.paths[Y]={};B.paths[Y][Z]={summary:X.docs?.summary||`${Z.toUpperCase()} ${Y}`,description:X.docs?.description,tags:X.docs?.tags||[],parameters:Lz(X),requestBody:Mz(X),responses:{"200":{description:"Successful response",content:{"application/json":{schema:{type:"object"}}}}}}}return B}function Lz($){let z=[];for(let q of $.parameters||[])if(q.type==="query"||q.type==="param"||q.type==="header")z.push({name:q.name||"unknown",in:q.type==="param"?"path":q.type,required:q.required||!1,schema:{type:"string"}});return z}function Mz($){if(!$.parameters?.find((q)=>q.type==="body"))return;return{required:!0,content:{"application/json":{schema:{type:"object"}}}}}async function Gz($){console.log("Generating TypeScript client...");try{let z=S.join(process.cwd(),$.input);if(!i.existsSync(z))console.error(`Error: OpenAPI spec not found at ${$.input}`),console.error('Run "veloce generate openapi" first'),process.exit(1);let q=await Bun.file(z).text(),B=JSON.parse(q),X=S.join(process.cwd(),$.output);await I.mkdir(X,{recursive:!0});let Y=Kz(B),Z=S.join(X,"client.ts");await I.writeFile(Z,Y);let Q=Ez(B),R=S.join(X,"types.ts");await I.writeFile(R,Q),console.log(`✓ TypeScript client generated in ${$.output}`),console.log(` - ${$.output}/client.ts`),console.log(` - ${$.output}/types.ts`)}catch(z){console.error("Failed to generate client:",z),process.exit(1)}}function Kz($){let z=$.servers?.[0]?.url||"http://localhost:3000",q=`// Generated TypeScript client for ${$.info.title}
|
|
460
|
+
// Version: ${$.info.version}
|
|
461
|
+
|
|
462
|
+
import type * as Types from './types';
|
|
463
|
+
|
|
464
|
+
export class APIClient {
|
|
465
|
+
constructor(private baseUrl: string = '${z}') {}
|
|
466
|
+
|
|
467
|
+
private async request<T>(
|
|
468
|
+
method: string,
|
|
469
|
+
path: string,
|
|
470
|
+
options?: {
|
|
471
|
+
params?: Record<string, any>;
|
|
472
|
+
body?: any;
|
|
473
|
+
headers?: Record<string, string>;
|
|
474
|
+
}
|
|
475
|
+
): Promise<T> {
|
|
476
|
+
const url = new URL(path, this.baseUrl);
|
|
477
|
+
|
|
478
|
+
if (options?.params) {
|
|
479
|
+
Object.entries(options.params).forEach(([key, value]) => {
|
|
480
|
+
url.searchParams.append(key, String(value));
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const response = await fetch(url.toString(), {
|
|
485
|
+
method,
|
|
486
|
+
headers: {
|
|
487
|
+
'Content-Type': 'application/json',
|
|
488
|
+
...options?.headers,
|
|
489
|
+
},
|
|
490
|
+
body: options?.body ? JSON.stringify(options.body) : undefined,
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
if (!response.ok) {
|
|
494
|
+
throw new Error(\`API request failed: \${response.statusText}\`);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return response.json();
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
`;for(let[B,X]of Object.entries($.paths||{}))for(let[Y,Z]of Object.entries(X)){let Q=N$(Y,B,Z),R=Wz(Y,B,Z);q+=R+`
|
|
501
|
+
`}return q+=`}
|
|
502
|
+
`,q}function N$($,z,q){if(q.operationId)return q.operationId;let B=z.replace(/\{|\}/g,"").replace(/\//g,"_").replace(/^_/,"").replace(/_([a-z])/g,(X,Y)=>Y.toUpperCase());return`${$}${B.charAt(0).toUpperCase()+B.slice(1)}`}function Wz($,z,q){let B=N$($,z,q),X=$==="post"||$==="put"||$==="patch",Y=q.parameters?.some((U)=>U.in==="query"),Z=q.parameters?.some((U)=>U.in==="path"),Q=[],R=[];if(Z){let U=q.parameters.filter((M)=>M.in==="path");R=U.map((M)=>M.name),Q.push(...U.map((M)=>`${M.name}: string`))}if(X)Q.push("body: any");if(Y)Q.push("params?: Record<string, any>");let _=Q.length>0?Q.join(", "):"",J=z;for(let U of R)J=J.replace(`{${U}}`,`\${${U}}`);return` async ${B}(${_}): Promise<any> {
|
|
503
|
+
return this.request('${$.toUpperCase()}', \`${J}\`, {
|
|
504
|
+
${X?"body,":""}
|
|
505
|
+
${Y?"params,":""}
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
`}function Ez($){let z=`// Generated types for ${$.info.title}
|
|
509
|
+
// Version: ${$.info.version}
|
|
510
|
+
|
|
511
|
+
`;if($.components?.schemas)for(let[q,B]of Object.entries($.components.schemas))z+=`export interface ${q} {
|
|
512
|
+
`,z+=Sz(B),z+=`}
|
|
513
|
+
|
|
514
|
+
`;return z}function Sz($,z=" "){let q="";if($.properties)for(let[B,X]of Object.entries($.properties)){let Y=X,Z=!$.required?.includes(B),Q=y$(Y);q+=`${z}${B}${Z?"?":""}: ${Q};
|
|
515
|
+
`}return q}function y$($){if($.type==="string")return"string";if($.type==="number"||$.type==="integer")return"number";if($.type==="boolean")return"boolean";if($.type==="array")return`${$.items?y$($.items):"any"}[]`;if($.type==="object")return"Record<string, any>";return"any"}var I,S,i;var A$=A(()=>{I=require("fs/promises"),S=require("path"),i=require("fs")});var T$=O$(U$()),{program:fz,createCommand:Oz,createArgument:Cz,createOption:bz,CommanderError:xz,InvalidArgumentError:vz,InvalidOptionArgumentError:uz,Command:H$,Argument:hz,Option:gz,Help:lz}=T$.default;var j$=require("fs"),P$=require("path"),Iz=()=>{try{let $=P$.join(process.cwd(),"package.json");return JSON.parse(j$.readFileSync($,"utf-8")).version||"0.1.0"}catch{return"0.1.0"}},V=new H$;V.name("veloce").description("A modern, fast web framework for TypeScript inspired by FastAPI").version(Iz(),"-v, --version","Display version number").helpOption("-h, --help","Display help for command");async function Vz(){let{registerNewCommand:$}=await Promise.resolve().then(() => (G$(),M$)),{registerDevCommand:z}=await Promise.resolve().then(() => (I$(),S$)),{registerBuildCommand:q}=await Promise.resolve().then(() => (D$(),V$)),{registerGenerateCommand:B}=await Promise.resolve().then(() => (A$(),F$));$(V),z(V),q(V),B(V),V.parse(process.argv)}Vz().catch(($)=>{console.error("CLI error:",$),process.exit(1)});
|
|
516
|
+
|
|
517
|
+
//# debugId=237EF975157B788264756E2164756E21
|