@visulima/jsdoc-open-api 3.0.0-alpha.2 → 3.0.0-alpha.21

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 (59) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/LICENSE.md +35 -1
  3. package/dist/cli/commander/index.cjs +1 -0
  4. package/dist/cli/commander/index.d.cts +1000 -0
  5. package/dist/cli/commander/index.d.mts +996 -3
  6. package/dist/cli/commander/index.d.ts +996 -3
  7. package/dist/cli/commander/index.mjs +1 -30
  8. package/dist/cli/index.cjs +1 -0
  9. package/dist/cli/index.d.cts +8 -0
  10. package/dist/cli/index.d.mts +4 -6
  11. package/dist/cli/index.d.ts +4 -6
  12. package/dist/cli/index.mjs +1 -4
  13. package/dist/index.cjs +1 -0
  14. package/dist/index.d.cts +247 -0
  15. package/dist/index.d.mts +176 -177
  16. package/dist/index.d.ts +176 -177
  17. package/dist/index.mjs +1 -85
  18. package/dist/packem_shared/SpecBuilder-CR4EZk93.cjs +1 -0
  19. package/dist/packem_shared/SpecBuilder-DjnDJFpv.mjs +1 -0
  20. package/dist/packem_shared/SwaggerCompilerPlugin-CLoD91_H.mjs +1 -0
  21. package/dist/packem_shared/SwaggerCompilerPlugin-lwIg0m84.cjs +1 -0
  22. package/dist/packem_shared/customizer-COfd-Xr1.mjs +1 -0
  23. package/dist/packem_shared/customizer-DUz3nxAJ.cjs +1 -0
  24. package/dist/packem_shared/generateCommand-BQuj1FCe.cjs +1 -0
  25. package/dist/packem_shared/generateCommand-Bn19mSDL.mjs +1 -0
  26. package/dist/packem_shared/generateCommand-DLJ2Ac1D.mjs +4 -0
  27. package/dist/packem_shared/generateCommand-DPOEw62Z.cjs +4 -0
  28. package/dist/packem_shared/initCommand-Bm4veOwd.mjs +1 -0
  29. package/dist/packem_shared/initCommand-CiV7G3q4.cjs +35 -0
  30. package/dist/packem_shared/initCommand-CwoPwelm.mjs +35 -0
  31. package/dist/packem_shared/initCommand-DAcI_ilX.cjs +1 -0
  32. package/dist/packem_shared/jsDocumentCommentsToOpenApi-Bvfi25DQ.mjs +1 -0
  33. package/dist/packem_shared/jsDocumentCommentsToOpenApi-DBYlHL5i.cjs +1 -0
  34. package/dist/packem_shared/parseFile-C7tyTcIn.cjs +1 -0
  35. package/dist/packem_shared/parseFile-CtAVjmPd.mjs +1 -0
  36. package/dist/packem_shared/swaggerJsDocumentCommentsToOpenApi-Bo1geBuG.cjs +10 -0
  37. package/dist/packem_shared/swaggerJsDocumentCommentsToOpenApi-xKOqHvN2.mjs +10 -0
  38. package/dist/packem_shared/validate-_k84qawx.mjs +1 -0
  39. package/dist/packem_shared/validate-tZa-jyuN.cjs +1 -0
  40. package/dist/packem_shared/yamlLoc-C2tVIYaz.mjs +1 -0
  41. package/dist/packem_shared/yamlLoc-DyGcp8YC.cjs +1 -0
  42. package/package.json +66 -54
  43. package/dist/chunk-46IWFMQ2.mjs +0 -1205
  44. package/dist/chunk-46IWFMQ2.mjs.map +0 -1
  45. package/dist/chunk-KI63G47G.mjs +0 -142
  46. package/dist/chunk-KI63G47G.mjs.map +0 -1
  47. package/dist/chunk-QK4CXNUY.js +0 -149
  48. package/dist/chunk-QK4CXNUY.js.map +0 -1
  49. package/dist/chunk-WEX5DMNT.js +0 -1223
  50. package/dist/chunk-WEX5DMNT.js.map +0 -1
  51. package/dist/cli/commander/index.js +0 -33
  52. package/dist/cli/commander/index.js.map +0 -1
  53. package/dist/cli/commander/index.mjs.map +0 -1
  54. package/dist/cli/index.js +0 -17
  55. package/dist/cli/index.js.map +0 -1
  56. package/dist/cli/index.mjs.map +0 -1
  57. package/dist/index.js +0 -106
  58. package/dist/index.js.map +0 -1
  59. package/dist/index.mjs.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,248 +1,247 @@
1
- import { Compiler } from 'webpack';
2
-
1
+ import 'buffer';
2
+ import 'http';
3
+ import 'https';
4
+ import 'inspector';
5
+ import 'net';
6
+ import 'url';
7
+ import 'vm';
3
8
  interface BaseDefinition {
4
- components?: ComponentsObject;
5
- externalDocs?: ExternalDocumentationObject;
6
- info: InfoObject;
7
- openapi: string;
8
- paths?: PathsObject;
9
- security?: SecurityRequirementObject[];
10
- servers?: ServerObject[];
11
- tags?: TagObject[];
9
+ components?: ComponentsObject;
10
+ externalDocs?: ExternalDocumentationObject;
11
+ info: InfoObject;
12
+ openapi: string;
13
+ paths?: PathsObject;
14
+ security?: SecurityRequirementObject[];
15
+ servers?: ServerObject[];
16
+ tags?: TagObject[];
12
17
  }
13
18
  interface OpenApiObject extends BaseDefinition {
14
- paths?: PathsObject;
19
+ paths?: PathsObject;
15
20
  }
16
21
  interface InfoObject {
17
- contact?: ContactObject;
18
- description?: string;
19
- license?: LicenseObject;
20
- termsOfService?: string;
21
- title: string;
22
- version: string;
22
+ contact?: ContactObject;
23
+ description?: string;
24
+ license?: LicenseObject;
25
+ termsOfService?: string;
26
+ title: string;
27
+ version: string;
23
28
  }
24
29
  interface ContactObject {
25
- email?: string;
26
- name?: string;
27
- url?: string;
30
+ email?: string;
31
+ name?: string;
32
+ url?: string;
28
33
  }
29
34
  interface LicenseObject {
30
- name: string;
31
- url?: string;
35
+ name: string;
36
+ url?: string;
32
37
  }
33
38
  interface ServerObject {
34
- description?: string;
35
- url: string;
36
- variables?: Map<ServerVariable>;
39
+ description?: string;
40
+ url: string;
41
+ variables?: Map<ServerVariable>;
37
42
  }
38
43
  interface ServerVariable {
39
- default: string;
40
- description?: string;
41
- enum?: string[];
44
+ default: string;
45
+ description?: string;
46
+ enum?: string[];
42
47
  }
43
48
  interface ComponentsObject {
44
- callbacks?: Map<CallbackObject | ReferenceObject>;
45
- examples?: Map<ExampleObject | ReferenceObject>;
46
- headers?: Map<HeaderObject | ReferenceObject>;
47
- links?: Map<LinkObject | ReferenceObject>;
48
- parameters?: Map<ParameterObject | ReferenceObject>;
49
- requestBodies?: Map<ReferenceObject | RequestBodyObject>;
50
- responses?: Map<ReferenceObject | ResponseObject>;
51
- schemas?: Map<ReferenceObject | SchemaObject>;
52
- securitySchemes?: Map<ApiKeySecuritySchemeObject | HttpSecuritySchemeObject | Oauth2SecuritySchemeObject | OpenIdConnectSecuritySchemeObject | ReferenceObject>;
49
+ callbacks?: Map<CallbackObject | ReferenceObject>;
50
+ examples?: Map<ExampleObject | ReferenceObject>;
51
+ headers?: Map<HeaderObject | ReferenceObject>;
52
+ links?: Map<LinkObject | ReferenceObject>;
53
+ parameters?: Map<ParameterObject | ReferenceObject>;
54
+ requestBodies?: Map<ReferenceObject | RequestBodyObject>;
55
+ responses?: Map<ReferenceObject | ResponseObject>;
56
+ schemas?: Map<ReferenceObject | SchemaObject>;
57
+ securitySchemes?: Map<ApiKeySecuritySchemeObject | HttpSecuritySchemeObject | Oauth2SecuritySchemeObject | OpenIdConnectSecuritySchemeObject | ReferenceObject>;
53
58
  }
54
59
  type PathsObject = Record<string, PathItemObject>;
55
60
  interface PathItemObject {
56
- $ref?: string;
57
- delete?: OperationObject;
58
- description?: string;
59
- get?: OperationObject;
60
- head?: OperationObject;
61
- options?: OperationObject;
62
- parameters?: (ParameterObject | ReferenceObject)[];
63
- patch?: OperationObject;
64
- post?: OperationObject;
65
- put?: OperationObject;
66
- servers?: ServerObject[];
67
- summary?: string;
68
- trace?: OperationObject;
61
+ $ref?: string;
62
+ delete?: OperationObject;
63
+ description?: string;
64
+ get?: OperationObject;
65
+ head?: OperationObject;
66
+ options?: OperationObject;
67
+ parameters?: (ParameterObject | ReferenceObject)[];
68
+ patch?: OperationObject;
69
+ post?: OperationObject;
70
+ put?: OperationObject;
71
+ servers?: ServerObject[];
72
+ summary?: string;
73
+ trace?: OperationObject;
69
74
  }
70
75
  interface OperationObject {
71
- callbacks?: Map<CallbackObject | ReferenceObject>;
72
- deprecated?: boolean;
73
- description?: string;
74
- externalDocs?: ExternalDocumentationObject;
75
- operationId?: string;
76
- parameters?: (ParameterObject | ReferenceObject)[];
77
- requestBody?: ReferenceObject | RequestBodyObject;
78
- responses: ResponsesObject;
79
- security?: SecurityRequirementObject[];
80
- servers?: ServerObject[];
81
- summary?: string;
82
- tags?: string[];
76
+ callbacks?: Map<CallbackObject | ReferenceObject>;
77
+ deprecated?: boolean;
78
+ description?: string;
79
+ externalDocs?: ExternalDocumentationObject;
80
+ operationId?: string;
81
+ parameters?: (ParameterObject | ReferenceObject)[];
82
+ requestBody?: ReferenceObject | RequestBodyObject;
83
+ responses: ResponsesObject;
84
+ security?: SecurityRequirementObject[];
85
+ servers?: ServerObject[];
86
+ summary?: string;
87
+ tags?: string[];
83
88
  }
84
89
  interface ExternalDocumentationObject {
85
- description?: string;
86
- url: string;
90
+ description?: string;
91
+ url: string;
87
92
  }
88
93
  interface ParameterObject {
89
- allowEmptyValue?: boolean;
90
- allowReserved?: boolean;
91
- content?: Map<MediaTypeObject>;
92
- deprecated?: boolean;
93
- description?: string;
94
- example?: any;
95
- examples?: Map<ExampleObject | ReferenceObject>;
96
- explode?: string;
97
- in: string;
98
- name: string;
99
- required?: boolean;
100
- schema?: ReferenceObject | SchemaObject;
101
- style?: string;
94
+ allowEmptyValue?: boolean;
95
+ allowReserved?: boolean;
96
+ content?: Map<MediaTypeObject>;
97
+ deprecated?: boolean;
98
+ description?: string;
99
+ example?: any;
100
+ examples?: Map<ExampleObject | ReferenceObject>;
101
+ explode?: string;
102
+ in: string;
103
+ name: string;
104
+ required?: boolean;
105
+ schema?: ReferenceObject | SchemaObject;
106
+ style?: string;
102
107
  }
103
108
  interface RequestBodyObject {
104
- content: Map<MediaTypeObject>;
105
- description?: string;
106
- required?: boolean;
109
+ content: Map<MediaTypeObject>;
110
+ description?: string;
111
+ required?: boolean;
107
112
  }
108
113
  interface MediaTypeObject {
109
- encoding?: Map<EncodingObject>;
110
- example?: any;
111
- examples?: Map<ExampleObject | ReferenceObject>;
112
- schema?: ReferenceObject | SchemaObject;
114
+ encoding?: Map<EncodingObject>;
115
+ example?: any;
116
+ examples?: Map<ExampleObject | ReferenceObject>;
117
+ schema?: ReferenceObject | SchemaObject;
113
118
  }
114
119
  interface EncodingObject {
115
- allowReserved?: boolean;
116
- contentType?: string;
117
- explode?: boolean;
118
- headers?: Map<HeaderObject | ReferenceObject>;
119
- style?: string;
120
+ allowReserved?: boolean;
121
+ contentType?: string;
122
+ explode?: boolean;
123
+ headers?: Map<HeaderObject | ReferenceObject>;
124
+ style?: string;
120
125
  }
121
126
  type ResponsesObject = Record<string, ReferenceObject | ResponseObject>;
122
127
  interface ResponseObject {
123
- content?: Map<MediaTypeObject>;
124
- description: string;
125
- headers?: Map<HeaderObject | ReferenceObject>;
126
- links?: Map<LinkObject | ReferenceObject>;
128
+ content?: Map<MediaTypeObject>;
129
+ description: string;
130
+ headers?: Map<HeaderObject | ReferenceObject>;
131
+ links?: Map<LinkObject | ReferenceObject>;
127
132
  }
128
133
  type CallbackObject = Record<string, PathItemObject>;
129
134
  interface ExampleObject {
130
- description?: string;
131
- externalValue?: string;
132
- summary?: string;
133
- value?: any;
135
+ description?: string;
136
+ externalValue?: string;
137
+ summary?: string;
138
+ value?: any;
134
139
  }
135
140
  interface LinkObject {
136
- description?: string;
137
- operationId?: string;
138
- operationRef?: string;
139
- parameters?: Map<any>;
140
- requestBody?: any;
141
- server?: ServerObject;
141
+ description?: string;
142
+ operationId?: string;
143
+ operationRef?: string;
144
+ parameters?: Map<any>;
145
+ requestBody?: any;
146
+ server?: ServerObject;
142
147
  }
143
148
  interface HeaderObject {
144
- allowEmptyValue?: boolean;
145
- allowReserved?: boolean;
146
- content?: Map<MediaTypeObject>;
147
- deprecated?: boolean;
148
- description?: string;
149
- example?: any;
150
- examples?: Map<ExampleObject | ReferenceObject>;
151
- explode?: string;
152
- required?: boolean;
153
- schema?: ReferenceObject | SchemaObject;
154
- style?: string;
149
+ allowEmptyValue?: boolean;
150
+ allowReserved?: boolean;
151
+ content?: Map<MediaTypeObject>;
152
+ deprecated?: boolean;
153
+ description?: string;
154
+ example?: any;
155
+ examples?: Map<ExampleObject | ReferenceObject>;
156
+ explode?: string;
157
+ required?: boolean;
158
+ schema?: ReferenceObject | SchemaObject;
159
+ style?: string;
155
160
  }
156
161
  interface TagObject {
157
- description?: string;
158
- externalDocs?: ExternalDocumentationObject;
159
- name: string;
162
+ description?: string;
163
+ externalDocs?: ExternalDocumentationObject;
164
+ name: string;
160
165
  }
161
166
  interface ReferenceObject {
162
- $ref: string;
167
+ $ref: string;
163
168
  }
164
169
  type SchemaObject = Record<string, any>;
165
170
  interface ApiKeySecuritySchemeObject {
166
- description?: string;
167
- in: string;
168
- name: string;
169
- type: string;
171
+ description?: string;
172
+ in: string;
173
+ name: string;
174
+ type: string;
170
175
  }
171
176
  interface HttpSecuritySchemeObject {
172
- bearerFormat?: string;
173
- description?: string;
174
- scheme: string;
175
- type: string;
177
+ bearerFormat?: string;
178
+ description?: string;
179
+ scheme: string;
180
+ type: string;
176
181
  }
177
182
  interface Oauth2SecuritySchemeObject {
178
- description?: string;
179
- flows: OAuthFlowsObject;
180
- type: string;
183
+ description?: string;
184
+ flows: OAuthFlowsObject;
185
+ type: string;
181
186
  }
182
187
  interface OpenIdConnectSecuritySchemeObject {
183
- description?: string;
184
- openIdConnectUrl: string;
185
- type: string;
188
+ description?: string;
189
+ openIdConnectUrl: string;
190
+ type: string;
186
191
  }
187
192
  interface OAuthFlowsObject {
188
- authorizationCode?: OAuthFlowObject;
189
- clientCredentials?: OAuthFlowObject;
190
- implicit?: OAuthFlowObject;
191
- password?: OAuthFlowObject;
193
+ authorizationCode?: OAuthFlowObject;
194
+ clientCredentials?: OAuthFlowObject;
195
+ implicit?: OAuthFlowObject;
196
+ password?: OAuthFlowObject;
192
197
  }
193
198
  interface OAuthFlowObject {
194
- authorizationUrl?: string;
195
- refreshUrl: string;
196
- scopes: Map<string>;
197
- tokenUrl?: string;
199
+ authorizationUrl?: string;
200
+ refreshUrl: string;
201
+ scopes: Map<string>;
202
+ tokenUrl?: string;
198
203
  }
199
204
  type SecurityRequirementObject = Record<string, string[]>;
200
205
  type Map<T> = Record<string, T>;
201
-
202
206
  declare const commentsToOpenApi$1: (fileContents: string, verbose?: boolean) => {
203
- loc: number;
204
- spec: OpenApiObject;
207
+ loc: number;
208
+ spec: OpenApiObject;
205
209
  }[];
206
-
207
210
  declare const parseFile: (file: string, commentsToOpenApi: (fileContent: string, verbose?: boolean) => {
208
- loc: number;
209
- spec: OpenApiObject;
211
+ loc: number;
212
+ spec: OpenApiObject;
210
213
  }[], verbose?: boolean) => {
211
- loc: number;
212
- spec: OpenApiObject;
214
+ loc: number;
215
+ spec: OpenApiObject;
213
216
  }[];
214
-
215
217
  declare class SpecBuilder implements OpenApiObject {
216
- components?: ComponentsObject;
217
- externalDocs?: ExternalDocumentationObject;
218
- info: InfoObject;
219
- openapi: string;
220
- paths: PathsObject;
221
- security?: SecurityRequirementObject[];
222
- servers?: ServerObject[];
223
- tags?: TagObject[];
224
- constructor(baseDefinition: BaseDefinition);
225
- addData(parsedFile: OpenApiObject[]): void;
226
- }
227
-
218
+ components?: ComponentsObject;
219
+ externalDocs?: ExternalDocumentationObject;
220
+ info: InfoObject;
221
+ openapi: string;
222
+ paths: PathsObject;
223
+ security?: SecurityRequirementObject[];
224
+ servers?: ServerObject[];
225
+ tags?: TagObject[];
226
+ constructor(baseDefinition: BaseDefinition);
227
+ addData(parsedFile: OpenApiObject[]): void;
228
+ }
228
229
  declare const commentsToOpenApi: (fileContents: string, verbose?: boolean) => {
229
- loc: number;
230
- spec: OpenApiObject;
230
+ loc: number;
231
+ spec: OpenApiObject;
231
232
  }[];
232
-
233
233
  declare const yamlLoc: (string: string) => number;
234
-
234
+ type WebpackCompiler = undefined;
235
235
  declare class SwaggerCompilerPlugin {
236
- private readonly assetsPath;
237
- private readonly ignore;
238
- private readonly sources;
239
- private readonly swaggerDefinition;
240
- private readonly verbose;
241
- constructor(assetsPath: string, sources: string[], swaggerDefinition: BaseDefinition, options: {
242
- ignore?: (RegExp | string)[];
243
- verbose?: boolean;
244
- });
245
- apply(compiler: Compiler): void;
246
- }
247
-
236
+ private readonly assetsPath;
237
+ private readonly ignore;
238
+ private readonly sources;
239
+ private readonly swaggerDefinition;
240
+ private readonly verbose;
241
+ constructor(assetsPath: string, sources: string[], swaggerDefinition: BaseDefinition, options: {
242
+ ignore?: (RegExp | string)[];
243
+ verbose?: boolean;
244
+ });
245
+ apply(compiler: WebpackCompiler): void;
246
+ }
248
247
  export { type BaseDefinition, type OpenApiObject, SpecBuilder, SwaggerCompilerPlugin, commentsToOpenApi$1 as jsDocumentCommentsToOpenApi, parseFile, commentsToOpenApi as swaggerJsDocumentCommentsToOpenApi, yamlLoc };
package/dist/index.mjs CHANGED
@@ -1,85 +1 @@
1
- import { DEFAULT_EXCLUDE, spec_builder_default, collect, parse_file_default, comments_to_open_api_default, comments_to_open_api_default2, validate_default } from './chunk-46IWFMQ2.mjs';
2
- export { spec_builder_default as SpecBuilder, comments_to_open_api_default as jsDocumentCommentsToOpenApi, parse_file_default as parseFile, comments_to_open_api_default2 as swaggerJsDocumentCommentsToOpenApi, yaml_loc_default as yamlLoc } from './chunk-46IWFMQ2.mjs';
3
- import { mkdir, writeFile } from 'fs';
4
- import { dirname } from 'path';
5
- import { exit } from 'process';
6
-
7
- var errorHandler = (error) => {
8
- if (error) {
9
- console.error(error);
10
- exit(1);
11
- }
12
- };
13
- var SwaggerCompilerPlugin = class {
14
- assetsPath;
15
- ignore;
16
- sources;
17
- swaggerDefinition;
18
- verbose;
19
- constructor(assetsPath, sources, swaggerDefinition, options) {
20
- this.assetsPath = assetsPath;
21
- this.swaggerDefinition = swaggerDefinition;
22
- this.sources = sources;
23
- this.verbose = options.verbose ?? false;
24
- this.ignore = options.ignore ?? [];
25
- }
26
- apply(compiler) {
27
- const skip = /* @__PURE__ */ new Set([...DEFAULT_EXCLUDE, ...this.ignore]);
28
- compiler.hooks.make.tapAsync("SwaggerCompilerPlugin", async (_, callback) => {
29
- console.log("Build paused, switching to swagger build");
30
- const spec = new spec_builder_default(this.swaggerDefinition);
31
- for await (const dir of this.sources) {
32
- const files = await collect(dir, {
33
- extensions: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".yaml", ".yml"],
34
- includeDirs: false,
35
- skip: [...skip]
36
- });
37
- if (this.verbose) {
38
- console.log(`Found ${String(files.length)} files in ${dir}`);
39
- console.log(files);
40
- }
41
- files.forEach((file) => {
42
- if (this.verbose) {
43
- console.log(`Parsing file ${file}`);
44
- }
45
- try {
46
- const parsedJsDocumentFile = parse_file_default(file, comments_to_open_api_default, this.verbose);
47
- spec.addData(parsedJsDocumentFile.map((item) => item.spec));
48
- const parsedSwaggerJsDocumentFile = parse_file_default(file, comments_to_open_api_default2, this.verbose);
49
- spec.addData(parsedSwaggerJsDocumentFile.map((item) => item.spec));
50
- } catch (error) {
51
- console.error(error);
52
- exit(1);
53
- }
54
- });
55
- }
56
- try {
57
- if (this.verbose) {
58
- console.log("Validating swagger spec");
59
- console.log(JSON.stringify(spec, null, 2));
60
- }
61
- await validate_default(JSON.parse(JSON.stringify(spec)));
62
- } catch (error) {
63
- console.error(error.toJSON());
64
- exit(1);
65
- }
66
- const { assetsPath } = this;
67
- mkdir(dirname(assetsPath), { recursive: true }, (error) => {
68
- if (error) {
69
- errorHandler(error);
70
- }
71
- writeFile(assetsPath, JSON.stringify(spec, null, 2), errorHandler);
72
- });
73
- if (this.verbose) {
74
- console.log(`Written swagger spec to "${this.assetsPath}" file`);
75
- }
76
- console.log("switching back to normal build");
77
- callback();
78
- });
79
- }
80
- };
81
- var swagger_compiler_plugin_default = SwaggerCompilerPlugin;
82
-
83
- export { swagger_compiler_plugin_default as SwaggerCompilerPlugin };
84
- //# sourceMappingURL=index.mjs.map
85
- //# sourceMappingURL=index.mjs.map
1
+ import{default as r}from"./packem_shared/jsDocumentCommentsToOpenApi-Bvfi25DQ.mjs";import{default as t}from"./packem_shared/parseFile-CtAVjmPd.mjs";import{default as p}from"./packem_shared/SpecBuilder-DjnDJFpv.mjs";import{default as s}from"./packem_shared/swaggerJsDocumentCommentsToOpenApi-xKOqHvN2.mjs";import{default as u}from"./packem_shared/yamlLoc-C2tVIYaz.mjs";import{default as n}from"./packem_shared/SwaggerCompilerPlugin-CLoD91_H.mjs";export{p as SpecBuilder,n as SwaggerCompilerPlugin,r as jsDocumentCommentsToOpenApi,t as parseFile,s as swaggerJsDocumentCommentsToOpenApi,u as yamlLoc};
@@ -0,0 +1 @@
1
+ "use strict";var p=Object.defineProperty;var a=(s,e)=>p(s,"name",{value:e,configurable:!0});var h=Object.defineProperty,u=a((s,e)=>h(s,"name",{value:e,configurable:!0}),"s");const v=u((s,e)=>{Object.keys(e).forEach(r=>{s[r]===void 0?s[r]={...e[r]}:Object.keys(e[r]).forEach(t=>{s[r][t]={...s[r][t],...e[r][t]}})})},"objectMerge");var l=Object.defineProperty,f=a((s,e)=>l(s,"name",{value:e,configurable:!0}),"c");class b{static{a(this,"u")}static{f(this,"SpecBuilder")}components;externalDocs;info;openapi;paths;security;servers;tags;constructor(e){this.openapi=e.openapi,this.info=e.info,this.paths=e.paths??{},e.servers&&(this.servers=e.servers),e.components&&(this.components=e.components),e.security&&(this.security=e.security),e.tags&&(this.tags=e.tags),e.externalDocs&&(this.externalDocs=e.externalDocs)}addData(e){e.forEach(r=>{const{components:t,paths:c,...n}=r;v(this,{components:t??{},paths:c??{}}),Object.entries(n).forEach(([o,i])=>{this[o]=i})})}}module.exports=b;
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var t=(s,e)=>p(s,"name",{value:e,configurable:!0});var h=Object.defineProperty,u=t((s,e)=>h(s,"name",{value:e,configurable:!0}),"s");const l=u((s,e)=>{Object.keys(e).forEach(a=>{s[a]===void 0?s[a]={...e[a]}:Object.keys(e[a]).forEach(r=>{s[a][r]={...s[a][r],...e[a][r]}})})},"objectMerge");var v=Object.defineProperty,f=t((s,e)=>v(s,"name",{value:e,configurable:!0}),"c");class m{static{t(this,"u")}static{f(this,"SpecBuilder")}components;externalDocs;info;openapi;paths;security;servers;tags;constructor(e){this.openapi=e.openapi,this.info=e.info,this.paths=e.paths??{},e.servers&&(this.servers=e.servers),e.components&&(this.components=e.components),e.security&&(this.security=e.security),e.tags&&(this.tags=e.tags),e.externalDocs&&(this.externalDocs=e.externalDocs)}addData(e){e.forEach(a=>{const{components:r,paths:c,...n}=a;l(this,{components:r??{},paths:c??{}}),Object.entries(n).forEach(([o,i])=>{this[o]=i})})}}export{m as default};
@@ -0,0 +1 @@
1
+ var v=Object.defineProperty;var g=(s,o)=>v(s,"name",{value:o,configurable:!0});import{mkdir as w,writeFile as y}from"node:fs";import{dirname as D}from"node:path";import{exit as m}from"node:process";import{collect as P}from"@visulima/fs";import{r as S,D as $}from"./validate-_k84qawx.mjs";import j from"./jsDocumentCommentsToOpenApi-Bvfi25DQ.mjs";import p from"./parseFile-CtAVjmPd.mjs";import k from"./SpecBuilder-DjnDJFpv.mjs";import x from"./swaggerJsDocumentCommentsToOpenApi-xKOqHvN2.mjs";var E=Object.defineProperty,d=g((s,o)=>E(s,"name",{value:o,configurable:!0}),"g");const u=d(s=>{s&&(console.error(s),m(1))},"errorHandler");class T{static{g(this,"E")}static{d(this,"SwaggerCompilerPlugin")}assetsPath;ignore;sources;swaggerDefinition;verbose;constructor(o,i,h,r){this.assetsPath=o,this.swaggerDefinition=h,this.sources=i,this.verbose=r.verbose??!1,this.ignore=r.ignore??[]}apply(o){const i=new Set([...$,...this.ignore]);o.hooks.make.tapAsync("SwaggerCompilerPlugin",async(h,r)=>{console.log("Build paused, switching to swagger build");const t=new k(this.swaggerDefinition);for(const e of this.sources){const n=await P(e,{extensions:[".js",".cjs",".mjs",".ts",".tsx",".jsx",".yaml",".yml"],includeDirs:!1,skip:[...i]});this.verbose&&(console.log(`Found ${String(n.length)} files in ${e}`),console.log(n)),n.forEach(a=>{this.verbose&&console.log(`Parsing file ${a}`);try{const l=p(a,j,this.verbose);t.addData(l.map(c=>c.spec));const b=p(a,x,this.verbose);t.addData(b.map(c=>c.spec))}catch(l){console.error(l),m(1)}})}try{this.verbose&&(console.log("Validating swagger spec"),console.log(JSON.stringify(t,void 0,2))),await S(structuredClone(t))}catch(e){console.error(e.toJSON()),m(1)}const{assetsPath:f}=this;w(D(f),{recursive:!0},e=>{e&&u(e),y(f,JSON.stringify(t,void 0,2),u)}),this.verbose&&console.log(`Written swagger spec to "${this.assetsPath}" file`),console.log("switching back to normal build"),r()})}}export{T as default};
@@ -0,0 +1 @@
1
+ "use strict";var y=Object.defineProperty;var g=(e,s)=>y(e,"name",{value:s,configurable:!0});const p=require("node:fs"),q=require("node:path"),u=require("node:process"),D=require("@visulima/fs"),m=require("./validate-tZa-jyuN.cjs"),P=require("./jsDocumentCommentsToOpenApi-DBYlHL5i.cjs"),f=require("./parseFile-C7tyTcIn.cjs"),S=require("./SpecBuilder-CR4EZk93.cjs"),x=require("./swaggerJsDocumentCommentsToOpenApi-Bo1geBuG.cjs");var j=Object.defineProperty,w=g((e,s)=>j(e,"name",{value:s,configurable:!0}),"g");const v=w(e=>{e&&(console.error(e),u.exit(1))},"errorHandler");class O{static{g(this,"E")}static{w(this,"SwaggerCompilerPlugin")}assetsPath;ignore;sources;swaggerDefinition;verbose;constructor(s,t,h,i){this.assetsPath=s,this.swaggerDefinition=h,this.sources=t,this.verbose=i.verbose??!1,this.ignore=i.ignore??[]}apply(s){const t=new Set([...m.D,...this.ignore]);s.hooks.make.tapAsync("SwaggerCompilerPlugin",async(h,i)=>{console.log("Build paused, switching to swagger build");const r=new S(this.swaggerDefinition);for(const o of this.sources){const n=await D.collect(o,{extensions:[".js",".cjs",".mjs",".ts",".tsx",".jsx",".yaml",".yml"],includeDirs:!1,skip:[...t]});this.verbose&&(console.log(`Found ${String(n.length)} files in ${o}`),console.log(n)),n.forEach(a=>{this.verbose&&console.log(`Parsing file ${a}`);try{const c=f(a,P,this.verbose);r.addData(c.map(l=>l.spec));const b=f(a,x,this.verbose);r.addData(b.map(l=>l.spec))}catch(c){console.error(c),u.exit(1)}})}try{this.verbose&&(console.log("Validating swagger spec"),console.log(JSON.stringify(r,void 0,2))),await m.r(structuredClone(r))}catch(o){console.error(o.toJSON()),u.exit(1)}const{assetsPath:d}=this;p.mkdir(q.dirname(d),{recursive:!0},o=>{o&&v(o),p.writeFile(d,JSON.stringify(r,void 0,2),v)}),this.verbose&&console.log(`Written swagger spec to "${this.assetsPath}" file`),console.log("switching back to normal build"),i()})}}module.exports=O;
@@ -0,0 +1 @@
1
+ var t=Object.defineProperty;var a=(r,e)=>t(r,"name",{value:e,configurable:!0});var o=Object.defineProperty,u=a((r,e)=>o(r,"name",{value:e,configurable:!0}),"u");const c=u((r,e)=>{if(Array.isArray(r))return[...r,...e]},"customizer");export{c as o};
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var t=(r,e)=>a(r,"name",{value:e,configurable:!0});var u=Object.defineProperty,i=t((r,e)=>u(r,"name",{value:e,configurable:!0}),"u");const o=i((r,e)=>{if(Array.isArray(r))return[...r,...e]},"customizer");exports.o=o;
@@ -0,0 +1 @@
1
+ "use strict";var s=Object.defineProperty;var t=(e,o)=>s(e,"name",{value:o,configurable:!0});const p=require("node:process"),c=require("./generateCommand-DPOEw62Z.cjs");var u=Object.defineProperty,g=t((e,o)=>u(e,"name",{value:o,configurable:!0}),"t");const m=g((e,o="generate",r=".openapirc.js")=>{e.command(o).description("Generates OpenAPI (Swagger) documentation from JSDoc's").usage("[options] <path ...>").argument("[path ...]","Paths to files or directories to parse").option("-c, --config [.openapirc.js]","@visulima/jsdoc-open-api config file path.").option("-o, --output [swaggerSpec.json]","Output swagger specification.").option("-v, --verbose","Verbose output.").option("-d, --very-verbose","Very verbose output.").action(async(a,n)=>{try{await c(r,a,n)}catch(i){console.error(i),p.exit(1)}})},"generateCommand");module.exports=m;
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var t=(e,o)=>p(e,"name",{value:o,configurable:!0});import{exit as s}from"node:process";import c from"./generateCommand-DLJ2Ac1D.mjs";var u=Object.defineProperty,g=t((e,o)=>u(e,"name",{value:o,configurable:!0}),"t");const v=g((e,o="generate",r=".openapirc.js")=>{e.command(o).description("Generates OpenAPI (Swagger) documentation from JSDoc's").usage("[options] <path ...>").argument("[path ...]","Paths to files or directories to parse").option("-c, --config [.openapirc.js]","@visulima/jsdoc-open-api config file path.").option("-o, --output [swaggerSpec.json]","Output swagger specification.").option("-v, --verbose","Verbose output.").option("-d, --very-verbose","Very verbose output.").action(async(a,i)=>{try{await c(r,a,i)}catch(n){console.error(n),s(1)}})},"generateCommand");export{v as default};
@@ -0,0 +1,4 @@
1
+ var y=Object.defineProperty;var g=(t,i)=>y(t,"name",{value:i,configurable:!0});import{lstat as b,realpath as h,mkdir as $,writeFile as j}from"node:fs/promises";import{normalize as D,dirname as S}from"node:path";import{pathToFileURL as x}from"node:url";import{collect as k}from"@visulima/fs";import{MultiBar as C,Presets as E}from"cli-progress";import{r as F,D as O}from"./validate-_k84qawx.mjs";import P from"./jsDocumentCommentsToOpenApi-Bvfi25DQ.mjs";import p from"./parseFile-CtAVjmPd.mjs";import V from"./SpecBuilder-DjnDJFpv.mjs";import L from"./swaggerJsDocumentCommentsToOpenApi-xKOqHvN2.mjs";var N=Object.defineProperty,U=g((t,i)=>N(t,"name",{value:i,configurable:!0}),"g");const G=U(async(t,i,e)=>{let r;try{let o=await import(x(D(e.config??t)).href);o?.default&&(o=o.default),r=o}catch{throw new Error(`No config file found, on: ${e.config??".openapirc.js"}
2
+ `)}const f=new C({clearOnComplete:!1,format:"{value}/{total} | {bar} | {filename}",hideCursor:!0},E.shades_grey),a=new V(r.swaggerDefinition),d=new Set([...O,...r.exclude]);for(const o of i){(await b(o)).isDirectory();const l=await h(o),n=await k(l,{extensions:r.extensions??[".js",".cjs",".mjs",".ts",".tsx",".jsx",".yaml",".yml"],followSymlinks:r.followSymlinks??!1,match:r.include,skip:[...d]});(e.verbose??e.veryVerbose)&&console.log(`
3
+ Found ${String(n.length)} files in ${l}`),e.veryVerbose&&console.log(n);const u=f.create(n.length,0);n.forEach(c=>{e.verbose&&console.log(`Parsing file ${c}`),u.increment(1,{filename:l});const w=p(c,P,e.verbose);a.addData(w.map(m=>m.spec));const v=p(c,L,e.verbose);a.addData(v.map(m=>m.spec))})}e.verbose&&console.log("Validating swagger spec"),e.veryVerbose&&console.log(JSON.stringify(a,void 0,2)),await F(structuredClone(a));const s=e.output??"swagger.json";f.stop(),e.verbose&&console.log(`Written swagger spec to "${s}" file`),await $(S(s),{recursive:!0}),await j(s,JSON.stringify(a,void 0,2)),console.log(`
4
+ Swagger specification is ready, check the "${s}" file.`)},"generateCommand");export{G as default};
@@ -0,0 +1,4 @@
1
+ "use strict";var j=Object.defineProperty;var m=(s,t)=>j(s,"name",{value:t,configurable:!0});const l=require("node:fs/promises"),d=require("node:path"),S=require("node:url"),D=require("@visulima/fs"),p=require("cli-progress"),w=require("./validate-tZa-jyuN.cjs"),x=require("./jsDocumentCommentsToOpenApi-DBYlHL5i.cjs"),v=require("./parseFile-C7tyTcIn.cjs"),C=require("./SpecBuilder-CR4EZk93.cjs"),O=require("./swaggerJsDocumentCommentsToOpenApi-Bo1geBuG.cjs");var $=Object.defineProperty,k=m((s,t)=>$(s,"name",{value:t,configurable:!0}),"g");const F=k(async(s,t,e)=>{let o;try{let r=await import(S.pathToFileURL(d.normalize(e.config??s)).href);r?.default&&(r=r.default),o=r}catch{throw new Error(`No config file found, on: ${e.config??".openapirc.js"}
2
+ `)}const f=new p.MultiBar({clearOnComplete:!1,format:"{value}/{total} | {bar} | {filename}",hideCursor:!0},p.Presets.shades_grey),i=new C(o.swaggerDefinition),y=new Set([...w.D,...o.exclude]);for(const r of t){(await l.lstat(r)).isDirectory();const c=await l.realpath(r),n=await D.collect(c,{extensions:o.extensions??[".js",".cjs",".mjs",".ts",".tsx",".jsx",".yaml",".yml"],followSymlinks:o.followSymlinks??!1,match:o.include,skip:[...y]});(e.verbose??e.veryVerbose)&&console.log(`
3
+ Found ${String(n.length)} files in ${c}`),e.veryVerbose&&console.log(n);const b=f.create(n.length,0);n.forEach(u=>{e.verbose&&console.log(`Parsing file ${u}`),b.increment(1,{filename:c});const h=v(u,x,e.verbose);i.addData(h.map(g=>g.spec));const q=v(u,O,e.verbose);i.addData(q.map(g=>g.spec))})}e.verbose&&console.log("Validating swagger spec"),e.veryVerbose&&console.log(JSON.stringify(i,void 0,2)),await w.r(structuredClone(i));const a=e.output??"swagger.json";f.stop(),e.verbose&&console.log(`Written swagger spec to "${a}" file`),await l.mkdir(d.dirname(a),{recursive:!0}),await l.writeFile(a,JSON.stringify(i,void 0,2)),console.log(`
4
+ Swagger specification is ready, check the "${a}" file.`)},"generateCommand");module.exports=F;
@@ -0,0 +1 @@
1
+ var a=Object.defineProperty;var o=(e,i)=>a(e,"name",{value:i,configurable:!0});import{exit as c}from"node:process";import m from"./initCommand-CwoPwelm.mjs";var p=Object.defineProperty,d=o((e,i)=>p(e,"name",{value:i,configurable:!0}),"m");const u=d((e,i="init",r="Inits a pre-configured @visulima/jsdoc-open-api config file.",t=".openapirc.js")=>{e.command(i).description(r).action(()=>{try{m(t)}catch(n){console.error(n),c(1)}})},"initCommand");export{u as default};
@@ -0,0 +1,35 @@
1
+ "use strict";var r=Object.defineProperty;var t=(e,s)=>r(e,"name",{value:s,configurable:!0});const n=require("node:fs"),c=require("@visulima/fs");var i=Object.defineProperty,m=t((e,s)=>i(e,"name",{value:s,configurable:!0}),"a");const p=m((e,s=process.cwd())=>{if(n.existsSync(e))throw new Error("Config file already exists");const o=c.findUpSync("package.json",{cwd:n.realpathSync(s)});let a="module.exports =";if(o){const l=c.readJsonSync(o);console.info(`Found package.json at "${o}"`),l.type==="module"&&(console.info("Found package.json with type: module, using ES6 as export for the config file"),a="export default")}else console.info("No package.json found");n.writeFileSync(e,`${a} {
2
+ exclude: [
3
+ 'coverage/**',
4
+ '.github/**',
5
+ 'packages/*/test{,s}/**',
6
+ '**/*.d.ts',
7
+ 'test{,s}/**',
8
+ 'test{,-*}.{js,cjs,mjs,ts,tsx,jsx,yaml,yml}',
9
+ '**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx,yaml,yml}',
10
+ '**/__tests__/**',
11
+ '**/{ava,babel,nyc}.config.{js,cjs,mjs}',
12
+ '**/jest.config.{js,cjs,mjs,ts}',
13
+ '**/{karma,rollup,webpack}.config.js',
14
+ '**/.{eslint,mocha}rc.{js,cjs}',
15
+ '**/.{travis,yarnrc}.yml',
16
+ '**/{docker-compose,docker}.yml',
17
+ '**/.yamllint.{yaml,yml}',
18
+ '**/node_modules/**',
19
+ '**/pnpm-lock.yaml',
20
+ '**/pnpm-workspace.yaml',
21
+ '**/{package,package-lock}.json',
22
+ '**/yarn.lock',
23
+ '**/package.json5',
24
+ '**/.next/**',
25
+ ],
26
+ followSymlinks: false,
27
+ swaggerDefinition: {
28
+ openapi: '3.0.0',
29
+ info: {
30
+ title: 'API',
31
+ version: '1.0.0',
32
+ },
33
+ },
34
+ };
35
+ `),console.log(`Created "${e}"`)},"initCommand");module.exports=p;
@@ -0,0 +1,35 @@
1
+ var c=Object.defineProperty;var n=(e,o)=>c(e,"name",{value:o,configurable:!0});import{existsSync as l,realpathSync as r,writeFileSync as i}from"node:fs";import{findUpSync as m,readJsonSync as p}from"@visulima/fs";var j=Object.defineProperty,f=n((e,o)=>j(e,"name",{value:o,configurable:!0}),"a");const k=f((e,o=process.cwd())=>{if(l(e))throw new Error("Config file already exists");const s=m("package.json",{cwd:r(o)});let a="module.exports =";if(s){const t=p(s);console.info(`Found package.json at "${s}"`),t.type==="module"&&(console.info("Found package.json with type: module, using ES6 as export for the config file"),a="export default")}else console.info("No package.json found");i(e,`${a} {
2
+ exclude: [
3
+ 'coverage/**',
4
+ '.github/**',
5
+ 'packages/*/test{,s}/**',
6
+ '**/*.d.ts',
7
+ 'test{,s}/**',
8
+ 'test{,-*}.{js,cjs,mjs,ts,tsx,jsx,yaml,yml}',
9
+ '**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx,yaml,yml}',
10
+ '**/__tests__/**',
11
+ '**/{ava,babel,nyc}.config.{js,cjs,mjs}',
12
+ '**/jest.config.{js,cjs,mjs,ts}',
13
+ '**/{karma,rollup,webpack}.config.js',
14
+ '**/.{eslint,mocha}rc.{js,cjs}',
15
+ '**/.{travis,yarnrc}.yml',
16
+ '**/{docker-compose,docker}.yml',
17
+ '**/.yamllint.{yaml,yml}',
18
+ '**/node_modules/**',
19
+ '**/pnpm-lock.yaml',
20
+ '**/pnpm-workspace.yaml',
21
+ '**/{package,package-lock}.json',
22
+ '**/yarn.lock',
23
+ '**/package.json5',
24
+ '**/.next/**',
25
+ ],
26
+ followSymlinks: false,
27
+ swaggerDefinition: {
28
+ openapi: '3.0.0',
29
+ info: {
30
+ title: 'API',
31
+ version: '1.0.0',
32
+ },
33
+ },
34
+ };
35
+ `),console.log(`Created "${e}"`)},"initCommand");export{k as default};