@visulima/jsdoc-open-api 3.0.0-alpha.37 → 3.0.0-alpha.39

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 (54) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/bin/index.js +12 -9
  3. package/dist/cli/commander/index.js +1 -0
  4. package/dist/cli/index.js +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/packem_shared/SwaggerCompilerPlugin-PUOALp2i.js +1 -0
  7. package/dist/packem_shared/{generateCommand-CkcShFNr.mjs → generateCommand-C_XPsbS6.js} +1 -1
  8. package/dist/packem_shared/generateCommand-ClL9Mnc3.js +1 -0
  9. package/dist/packem_shared/initCommand-TixxsVQU.js +1 -0
  10. package/dist/packem_shared/jsDocumentCommentsToOpenApi-TjPhUj5G.js +1 -0
  11. package/dist/packem_shared/parseFile-RDlR4tEF.js +1 -0
  12. package/dist/packem_shared/swaggerJsDocumentCommentsToOpenApi-Bm9R1BnW.js +10 -0
  13. package/package.json +10 -28
  14. package/dist/cli/commander/index.cjs +0 -1
  15. package/dist/cli/commander/index.d.cts +0 -1000
  16. package/dist/cli/commander/index.d.mts +0 -1000
  17. package/dist/cli/commander/index.mjs +0 -1
  18. package/dist/cli/index.cjs +0 -1
  19. package/dist/cli/index.d.cts +0 -9
  20. package/dist/cli/index.d.mts +0 -9
  21. package/dist/cli/index.mjs +0 -1
  22. package/dist/index.cjs +0 -1
  23. package/dist/index.d.cts +0 -266
  24. package/dist/index.d.mts +0 -266
  25. package/dist/index.mjs +0 -1
  26. package/dist/packem_shared/DEFAULT_OPTIONS-CP1lNs-k.cjs +0 -1
  27. package/dist/packem_shared/SpecBuilder-C_KcIxW-.cjs +0 -1
  28. package/dist/packem_shared/SwaggerCompilerPlugin-Bd9L4Djt.cjs +0 -1
  29. package/dist/packem_shared/SwaggerCompilerPlugin-wRdVpHJS.mjs +0 -1
  30. package/dist/packem_shared/constants-DnbfJ7Id.cjs +0 -1
  31. package/dist/packem_shared/customizer-Bo8QD_ti.cjs +0 -1
  32. package/dist/packem_shared/generateCommand-CEP0sWth.cjs +0 -5
  33. package/dist/packem_shared/generateCommand-CmoN8jyY.cjs +0 -1
  34. package/dist/packem_shared/generateCommand-DEhmHbRZ.mjs +0 -1
  35. package/dist/packem_shared/initCommand-1O6IuWJv.mjs +0 -1
  36. package/dist/packem_shared/initCommand-C8s0kkim.cjs +0 -1
  37. package/dist/packem_shared/initCommand-DvNH61Z4.cjs +0 -35
  38. package/dist/packem_shared/jsDocumentCommentsToOpenApi-BEQrWgpQ.mjs +0 -1
  39. package/dist/packem_shared/jsDocumentCommentsToOpenApi-CMbdb0uR.cjs +0 -1
  40. package/dist/packem_shared/loadDefinition-ah20Zy-G.cjs +0 -1
  41. package/dist/packem_shared/parseFile-CPb-Kglh.cjs +0 -1
  42. package/dist/packem_shared/parseFile-Wxs3O0wy.mjs +0 -1
  43. package/dist/packem_shared/swaggerJsDocumentCommentsToOpenApi-BnPWbZoe.mjs +0 -10
  44. package/dist/packem_shared/swaggerJsDocumentCommentsToOpenApi-rMEaS4lg.cjs +0 -10
  45. package/dist/packem_shared/validate-DLmCjOPl.cjs +0 -1
  46. package/dist/packem_shared/yamlLoc-DC_7PYVS.cjs +0 -1
  47. /package/dist/packem_shared/{DEFAULT_OPTIONS-C7o6qjwP.mjs → DEFAULT_OPTIONS-C7o6qjwP.js} +0 -0
  48. /package/dist/packem_shared/{SpecBuilder-Vbq42UbW.mjs → SpecBuilder-Vbq42UbW.js} +0 -0
  49. /package/dist/packem_shared/{constants-CdEv9ZcD.mjs → constants-CdEv9ZcD.js} +0 -0
  50. /package/dist/packem_shared/{customizer-BXFVpImq.mjs → customizer-BXFVpImq.js} +0 -0
  51. /package/dist/packem_shared/{initCommand-Ca1hGdYS.mjs → initCommand-Ca1hGdYS.js} +0 -0
  52. /package/dist/packem_shared/{loadDefinition-7r9qpfuE.mjs → loadDefinition-7r9qpfuE.js} +0 -0
  53. /package/dist/packem_shared/{validate-9Rwe2A3r.mjs → validate-9Rwe2A3r.js} +0 -0
  54. /package/dist/packem_shared/{yamlLoc-DPq-xUM4.mjs → yamlLoc-DPq-xUM4.js} +0 -0
@@ -1 +0,0 @@
1
- import{default as m}from"../../packem_shared/generateCommand-DEhmHbRZ.mjs";import{default as t}from"../../packem_shared/initCommand-1O6IuWJv.mjs";export{m as generateCommand,t as initCommand};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../packem_shared/generateCommand-CEP0sWth.cjs"),t=require("../packem_shared/initCommand-DvNH61Z4.cjs");exports.generateCommand=e;exports.initCommand=t;
@@ -1,9 +0,0 @@
1
- declare const generateCommand: (configName: string, paths: string[], options: {
2
- config?: string;
3
- definition?: string;
4
- output?: string;
5
- verbose?: boolean;
6
- veryVerbose?: boolean;
7
- }) => Promise<void>;
8
- declare const initCommand: (configName: string, packageJsonPath?: string) => void;
9
- export { generateCommand, initCommand };
@@ -1,9 +0,0 @@
1
- declare const generateCommand: (configName: string, paths: string[], options: {
2
- config?: string;
3
- definition?: string;
4
- output?: string;
5
- verbose?: boolean;
6
- veryVerbose?: boolean;
7
- }) => Promise<void>;
8
- declare const initCommand: (configName: string, packageJsonPath?: string) => void;
9
- export { generateCommand, initCommand };
@@ -1 +0,0 @@
1
- import{default as m}from"../packem_shared/generateCommand-CkcShFNr.mjs";import{default as t}from"../packem_shared/initCommand-Ca1hGdYS.mjs";export{m as generateCommand,t as initCommand};
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./packem_shared/jsDocumentCommentsToOpenApi-CMbdb0uR.cjs"),r=require("./packem_shared/DEFAULT_OPTIONS-CP1lNs-k.cjs"),e=require("./packem_shared/parseFile-CPb-Kglh.cjs"),o=require("./packem_shared/SpecBuilder-C_KcIxW-.cjs"),u=require("./packem_shared/swaggerJsDocumentCommentsToOpenApi-rMEaS4lg.cjs"),l=require("./packem_shared/loadDefinition-ah20Zy-G.cjs"),t=require("./packem_shared/yamlLoc-DC_7PYVS.cjs"),n=require("./packem_shared/validate-DLmCjOPl.cjs"),a=require("./packem_shared/SwaggerCompilerPlugin-Bd9L4Djt.cjs");exports.jsDocumentCommentsToOpenApi=i;exports.DEFAULT_OPTIONS=r;exports.parseFile=e.default;exports.parseFileMulti=e.parseFileMulti;exports.SpecBuilder=o;exports.swaggerJsDocumentCommentsToOpenApi=u;exports.loadDefinition=l;exports.yamlLoc=t;exports.validate=n;exports.SwaggerCompilerPlugin=a;
package/dist/index.d.cts DELETED
@@ -1,266 +0,0 @@
1
- import { Block } from 'comment-parser';
2
- import 'buffer';
3
- import 'http';
4
- import 'https';
5
- import 'inspector';
6
- import 'net';
7
- import 'url';
8
- import 'vm';
9
- interface BaseDefinition {
10
- components?: ComponentsObject;
11
- externalDocs?: ExternalDocumentationObject;
12
- info: InfoObject;
13
- openapi: string;
14
- paths?: PathsObject;
15
- security?: SecurityRequirementObject[];
16
- servers?: ServerObject[];
17
- tags?: TagObject[];
18
- }
19
- interface OpenApiObject extends BaseDefinition {
20
- paths?: PathsObject;
21
- }
22
- interface InfoObject {
23
- contact?: ContactObject;
24
- description?: string;
25
- license?: LicenseObject;
26
- termsOfService?: string;
27
- title: string;
28
- version: string;
29
- }
30
- interface ContactObject {
31
- email?: string;
32
- name?: string;
33
- url?: string;
34
- }
35
- interface LicenseObject {
36
- name: string;
37
- url?: string;
38
- }
39
- interface ServerObject {
40
- description?: string;
41
- url: string;
42
- variables?: Map<ServerVariable>;
43
- }
44
- interface ServerVariable {
45
- default: string;
46
- description?: string;
47
- enum?: string[];
48
- }
49
- interface ComponentsObject {
50
- callbacks?: Map<CallbackObject | ReferenceObject>;
51
- examples?: Map<ExampleObject | ReferenceObject>;
52
- headers?: Map<HeaderObject | ReferenceObject>;
53
- links?: Map<LinkObject | ReferenceObject>;
54
- parameters?: Map<ParameterObject | ReferenceObject>;
55
- requestBodies?: Map<ReferenceObject | RequestBodyObject>;
56
- responses?: Map<ReferenceObject | ResponseObject>;
57
- schemas?: Map<ReferenceObject | SchemaObject>;
58
- securitySchemes?: Map<ApiKeySecuritySchemeObject | HttpSecuritySchemeObject | Oauth2SecuritySchemeObject | OpenIdConnectSecuritySchemeObject | ReferenceObject>;
59
- }
60
- type PathsObject = Record<string, PathItemObject>;
61
- interface PathItemObject {
62
- $ref?: string;
63
- delete?: OperationObject;
64
- description?: string;
65
- get?: OperationObject;
66
- head?: OperationObject;
67
- options?: OperationObject;
68
- parameters?: (ParameterObject | ReferenceObject)[];
69
- patch?: OperationObject;
70
- post?: OperationObject;
71
- put?: OperationObject;
72
- servers?: ServerObject[];
73
- summary?: string;
74
- trace?: OperationObject;
75
- }
76
- interface OperationObject {
77
- callbacks?: Map<CallbackObject | ReferenceObject>;
78
- deprecated?: boolean;
79
- description?: string;
80
- externalDocs?: ExternalDocumentationObject;
81
- operationId?: string;
82
- parameters?: (ParameterObject | ReferenceObject)[];
83
- requestBody?: ReferenceObject | RequestBodyObject;
84
- responses: ResponsesObject;
85
- security?: SecurityRequirementObject[];
86
- servers?: ServerObject[];
87
- summary?: string;
88
- tags?: string[];
89
- }
90
- interface ExternalDocumentationObject {
91
- description?: string;
92
- url: string;
93
- }
94
- interface ParameterObject {
95
- allowEmptyValue?: boolean;
96
- allowReserved?: boolean;
97
- content?: Map<MediaTypeObject>;
98
- deprecated?: boolean;
99
- description?: string;
100
- example?: any;
101
- examples?: Map<ExampleObject | ReferenceObject>;
102
- explode?: string;
103
- in: string;
104
- name: string;
105
- required?: boolean;
106
- schema?: ReferenceObject | SchemaObject;
107
- style?: string;
108
- }
109
- interface RequestBodyObject {
110
- content: Map<MediaTypeObject>;
111
- description?: string;
112
- required?: boolean;
113
- }
114
- interface MediaTypeObject {
115
- encoding?: Map<EncodingObject>;
116
- example?: any;
117
- examples?: Map<ExampleObject | ReferenceObject>;
118
- schema?: ReferenceObject | SchemaObject;
119
- }
120
- interface EncodingObject {
121
- allowReserved?: boolean;
122
- contentType?: string;
123
- explode?: boolean;
124
- headers?: Map<HeaderObject | ReferenceObject>;
125
- style?: string;
126
- }
127
- type ResponsesObject = Record<string, ReferenceObject | ResponseObject>;
128
- interface ResponseObject {
129
- content?: Map<MediaTypeObject>;
130
- description: string;
131
- headers?: Map<HeaderObject | ReferenceObject>;
132
- links?: Map<LinkObject | ReferenceObject>;
133
- }
134
- type CallbackObject = Record<string, PathItemObject>;
135
- interface ExampleObject {
136
- description?: string;
137
- externalValue?: string;
138
- summary?: string;
139
- value?: any;
140
- }
141
- interface LinkObject {
142
- description?: string;
143
- operationId?: string;
144
- operationRef?: string;
145
- parameters?: Map<any>;
146
- requestBody?: any;
147
- server?: ServerObject;
148
- }
149
- interface HeaderObject {
150
- allowEmptyValue?: boolean;
151
- allowReserved?: boolean;
152
- content?: Map<MediaTypeObject>;
153
- deprecated?: boolean;
154
- description?: string;
155
- example?: any;
156
- examples?: Map<ExampleObject | ReferenceObject>;
157
- explode?: string;
158
- required?: boolean;
159
- schema?: ReferenceObject | SchemaObject;
160
- style?: string;
161
- }
162
- interface TagObject {
163
- description?: string;
164
- externalDocs?: ExternalDocumentationObject;
165
- name: string;
166
- }
167
- interface ReferenceObject {
168
- $ref: string;
169
- }
170
- type SchemaObject = Record<string, any>;
171
- interface ApiKeySecuritySchemeObject {
172
- description?: string;
173
- in: string;
174
- name: string;
175
- type: string;
176
- }
177
- interface HttpSecuritySchemeObject {
178
- bearerFormat?: string;
179
- description?: string;
180
- scheme: string;
181
- type: string;
182
- }
183
- interface Oauth2SecuritySchemeObject {
184
- description?: string;
185
- flows: OAuthFlowsObject;
186
- type: string;
187
- }
188
- interface OpenIdConnectSecuritySchemeObject {
189
- description?: string;
190
- openIdConnectUrl: string;
191
- type: string;
192
- }
193
- interface OAuthFlowsObject {
194
- authorizationCode?: OAuthFlowObject;
195
- clientCredentials?: OAuthFlowObject;
196
- implicit?: OAuthFlowObject;
197
- password?: OAuthFlowObject;
198
- }
199
- interface OAuthFlowObject {
200
- authorizationUrl?: string;
201
- refreshUrl: string;
202
- scopes: Map<string>;
203
- tokenUrl?: string;
204
- }
205
- type SecurityRequirementObject = Record<string, string[]>;
206
- type Map<T> = Record<string, T>;
207
- declare const commentsToOpenApi$1: (fileContents: string, verbose?: boolean, comments?: Block[]) => {
208
- loc: number;
209
- spec: OpenApiObject;
210
- }[];
211
- declare const DEFAULT_OPTIONS: {
212
- cwd: undefined;
213
- exclude: string[];
214
- excludeNodeModules: boolean;
215
- extension: string[];
216
- include: string[];
217
- verbose: boolean;
218
- };
219
- type CommentsToOpenApi = (fileContent: string, verbose?: boolean, comments?: Block[]) => {
220
- loc: number;
221
- spec: OpenApiObject;
222
- }[];
223
- declare const parseFile$1: (file: string, commentsToOpenApi: CommentsToOpenApi, verbose?: boolean) => {
224
- loc: number;
225
- spec: OpenApiObject;
226
- }[];
227
- declare const parseFileMulti: (file: string, translators: CommentsToOpenApi[], verbose?: boolean) => {
228
- loc: number;
229
- spec: OpenApiObject;
230
- }[];
231
- declare class SpecBuilder implements OpenApiObject {
232
- components?: ComponentsObject;
233
- externalDocs?: ExternalDocumentationObject;
234
- info: InfoObject;
235
- openapi: string;
236
- paths: PathsObject;
237
- security?: SecurityRequirementObject[];
238
- servers?: ServerObject[];
239
- tags?: TagObject[];
240
- constructor(baseDefinition: BaseDefinition);
241
- addData(parsedFile: OpenApiObject[]): void;
242
- }
243
- declare const commentsToOpenApi: (fileContents: string, verbose?: boolean, comments?: Block[]) => {
244
- loc: number;
245
- spec: OpenApiObject;
246
- }[];
247
- declare const parseFile: (file: string) => BaseDefinition;
248
- declare const yamlLoc: (string: string) => number;
249
- declare const validate: (spec: Record<string, unknown>) => Promise<void>;
250
- type WebpackCompiler = undefined;
251
- declare class SwaggerCompilerPlugin {
252
- private readonly assetsPath;
253
- private readonly ignore;
254
- private readonly silent;
255
- private readonly sources;
256
- private readonly swaggerDefinition;
257
- private readonly verbose;
258
- constructor(assetsPath: string, sources: string[], swaggerDefinition: BaseDefinition, options: {
259
- ignore?: (RegExp | string)[];
260
- silent?: boolean;
261
- verbose?: boolean;
262
- });
263
- apply(compiler: WebpackCompiler): void;
264
- private log;
265
- }
266
- export { type BaseDefinition, type CommentsToOpenApi, DEFAULT_OPTIONS, type OpenApiObject, SpecBuilder, SwaggerCompilerPlugin, commentsToOpenApi$1 as jsDocumentCommentsToOpenApi, parseFile as loadDefinition, parseFile$1 as parseFile, parseFileMulti, commentsToOpenApi as swaggerJsDocumentCommentsToOpenApi, validate, yamlLoc };
package/dist/index.d.mts DELETED
@@ -1,266 +0,0 @@
1
- import { Block } from 'comment-parser';
2
- import 'buffer';
3
- import 'http';
4
- import 'https';
5
- import 'inspector';
6
- import 'net';
7
- import 'url';
8
- import 'vm';
9
- interface BaseDefinition {
10
- components?: ComponentsObject;
11
- externalDocs?: ExternalDocumentationObject;
12
- info: InfoObject;
13
- openapi: string;
14
- paths?: PathsObject;
15
- security?: SecurityRequirementObject[];
16
- servers?: ServerObject[];
17
- tags?: TagObject[];
18
- }
19
- interface OpenApiObject extends BaseDefinition {
20
- paths?: PathsObject;
21
- }
22
- interface InfoObject {
23
- contact?: ContactObject;
24
- description?: string;
25
- license?: LicenseObject;
26
- termsOfService?: string;
27
- title: string;
28
- version: string;
29
- }
30
- interface ContactObject {
31
- email?: string;
32
- name?: string;
33
- url?: string;
34
- }
35
- interface LicenseObject {
36
- name: string;
37
- url?: string;
38
- }
39
- interface ServerObject {
40
- description?: string;
41
- url: string;
42
- variables?: Map<ServerVariable>;
43
- }
44
- interface ServerVariable {
45
- default: string;
46
- description?: string;
47
- enum?: string[];
48
- }
49
- interface ComponentsObject {
50
- callbacks?: Map<CallbackObject | ReferenceObject>;
51
- examples?: Map<ExampleObject | ReferenceObject>;
52
- headers?: Map<HeaderObject | ReferenceObject>;
53
- links?: Map<LinkObject | ReferenceObject>;
54
- parameters?: Map<ParameterObject | ReferenceObject>;
55
- requestBodies?: Map<ReferenceObject | RequestBodyObject>;
56
- responses?: Map<ReferenceObject | ResponseObject>;
57
- schemas?: Map<ReferenceObject | SchemaObject>;
58
- securitySchemes?: Map<ApiKeySecuritySchemeObject | HttpSecuritySchemeObject | Oauth2SecuritySchemeObject | OpenIdConnectSecuritySchemeObject | ReferenceObject>;
59
- }
60
- type PathsObject = Record<string, PathItemObject>;
61
- interface PathItemObject {
62
- $ref?: string;
63
- delete?: OperationObject;
64
- description?: string;
65
- get?: OperationObject;
66
- head?: OperationObject;
67
- options?: OperationObject;
68
- parameters?: (ParameterObject | ReferenceObject)[];
69
- patch?: OperationObject;
70
- post?: OperationObject;
71
- put?: OperationObject;
72
- servers?: ServerObject[];
73
- summary?: string;
74
- trace?: OperationObject;
75
- }
76
- interface OperationObject {
77
- callbacks?: Map<CallbackObject | ReferenceObject>;
78
- deprecated?: boolean;
79
- description?: string;
80
- externalDocs?: ExternalDocumentationObject;
81
- operationId?: string;
82
- parameters?: (ParameterObject | ReferenceObject)[];
83
- requestBody?: ReferenceObject | RequestBodyObject;
84
- responses: ResponsesObject;
85
- security?: SecurityRequirementObject[];
86
- servers?: ServerObject[];
87
- summary?: string;
88
- tags?: string[];
89
- }
90
- interface ExternalDocumentationObject {
91
- description?: string;
92
- url: string;
93
- }
94
- interface ParameterObject {
95
- allowEmptyValue?: boolean;
96
- allowReserved?: boolean;
97
- content?: Map<MediaTypeObject>;
98
- deprecated?: boolean;
99
- description?: string;
100
- example?: any;
101
- examples?: Map<ExampleObject | ReferenceObject>;
102
- explode?: string;
103
- in: string;
104
- name: string;
105
- required?: boolean;
106
- schema?: ReferenceObject | SchemaObject;
107
- style?: string;
108
- }
109
- interface RequestBodyObject {
110
- content: Map<MediaTypeObject>;
111
- description?: string;
112
- required?: boolean;
113
- }
114
- interface MediaTypeObject {
115
- encoding?: Map<EncodingObject>;
116
- example?: any;
117
- examples?: Map<ExampleObject | ReferenceObject>;
118
- schema?: ReferenceObject | SchemaObject;
119
- }
120
- interface EncodingObject {
121
- allowReserved?: boolean;
122
- contentType?: string;
123
- explode?: boolean;
124
- headers?: Map<HeaderObject | ReferenceObject>;
125
- style?: string;
126
- }
127
- type ResponsesObject = Record<string, ReferenceObject | ResponseObject>;
128
- interface ResponseObject {
129
- content?: Map<MediaTypeObject>;
130
- description: string;
131
- headers?: Map<HeaderObject | ReferenceObject>;
132
- links?: Map<LinkObject | ReferenceObject>;
133
- }
134
- type CallbackObject = Record<string, PathItemObject>;
135
- interface ExampleObject {
136
- description?: string;
137
- externalValue?: string;
138
- summary?: string;
139
- value?: any;
140
- }
141
- interface LinkObject {
142
- description?: string;
143
- operationId?: string;
144
- operationRef?: string;
145
- parameters?: Map<any>;
146
- requestBody?: any;
147
- server?: ServerObject;
148
- }
149
- interface HeaderObject {
150
- allowEmptyValue?: boolean;
151
- allowReserved?: boolean;
152
- content?: Map<MediaTypeObject>;
153
- deprecated?: boolean;
154
- description?: string;
155
- example?: any;
156
- examples?: Map<ExampleObject | ReferenceObject>;
157
- explode?: string;
158
- required?: boolean;
159
- schema?: ReferenceObject | SchemaObject;
160
- style?: string;
161
- }
162
- interface TagObject {
163
- description?: string;
164
- externalDocs?: ExternalDocumentationObject;
165
- name: string;
166
- }
167
- interface ReferenceObject {
168
- $ref: string;
169
- }
170
- type SchemaObject = Record<string, any>;
171
- interface ApiKeySecuritySchemeObject {
172
- description?: string;
173
- in: string;
174
- name: string;
175
- type: string;
176
- }
177
- interface HttpSecuritySchemeObject {
178
- bearerFormat?: string;
179
- description?: string;
180
- scheme: string;
181
- type: string;
182
- }
183
- interface Oauth2SecuritySchemeObject {
184
- description?: string;
185
- flows: OAuthFlowsObject;
186
- type: string;
187
- }
188
- interface OpenIdConnectSecuritySchemeObject {
189
- description?: string;
190
- openIdConnectUrl: string;
191
- type: string;
192
- }
193
- interface OAuthFlowsObject {
194
- authorizationCode?: OAuthFlowObject;
195
- clientCredentials?: OAuthFlowObject;
196
- implicit?: OAuthFlowObject;
197
- password?: OAuthFlowObject;
198
- }
199
- interface OAuthFlowObject {
200
- authorizationUrl?: string;
201
- refreshUrl: string;
202
- scopes: Map<string>;
203
- tokenUrl?: string;
204
- }
205
- type SecurityRequirementObject = Record<string, string[]>;
206
- type Map<T> = Record<string, T>;
207
- declare const commentsToOpenApi$1: (fileContents: string, verbose?: boolean, comments?: Block[]) => {
208
- loc: number;
209
- spec: OpenApiObject;
210
- }[];
211
- declare const DEFAULT_OPTIONS: {
212
- cwd: undefined;
213
- exclude: string[];
214
- excludeNodeModules: boolean;
215
- extension: string[];
216
- include: string[];
217
- verbose: boolean;
218
- };
219
- type CommentsToOpenApi = (fileContent: string, verbose?: boolean, comments?: Block[]) => {
220
- loc: number;
221
- spec: OpenApiObject;
222
- }[];
223
- declare const parseFile$1: (file: string, commentsToOpenApi: CommentsToOpenApi, verbose?: boolean) => {
224
- loc: number;
225
- spec: OpenApiObject;
226
- }[];
227
- declare const parseFileMulti: (file: string, translators: CommentsToOpenApi[], verbose?: boolean) => {
228
- loc: number;
229
- spec: OpenApiObject;
230
- }[];
231
- declare class SpecBuilder implements OpenApiObject {
232
- components?: ComponentsObject;
233
- externalDocs?: ExternalDocumentationObject;
234
- info: InfoObject;
235
- openapi: string;
236
- paths: PathsObject;
237
- security?: SecurityRequirementObject[];
238
- servers?: ServerObject[];
239
- tags?: TagObject[];
240
- constructor(baseDefinition: BaseDefinition);
241
- addData(parsedFile: OpenApiObject[]): void;
242
- }
243
- declare const commentsToOpenApi: (fileContents: string, verbose?: boolean, comments?: Block[]) => {
244
- loc: number;
245
- spec: OpenApiObject;
246
- }[];
247
- declare const parseFile: (file: string) => BaseDefinition;
248
- declare const yamlLoc: (string: string) => number;
249
- declare const validate: (spec: Record<string, unknown>) => Promise<void>;
250
- type WebpackCompiler = undefined;
251
- declare class SwaggerCompilerPlugin {
252
- private readonly assetsPath;
253
- private readonly ignore;
254
- private readonly silent;
255
- private readonly sources;
256
- private readonly swaggerDefinition;
257
- private readonly verbose;
258
- constructor(assetsPath: string, sources: string[], swaggerDefinition: BaseDefinition, options: {
259
- ignore?: (RegExp | string)[];
260
- silent?: boolean;
261
- verbose?: boolean;
262
- });
263
- apply(compiler: WebpackCompiler): void;
264
- private log;
265
- }
266
- export { type BaseDefinition, type CommentsToOpenApi, DEFAULT_OPTIONS, type OpenApiObject, SpecBuilder, SwaggerCompilerPlugin, commentsToOpenApi$1 as jsDocumentCommentsToOpenApi, parseFile as loadDefinition, parseFile$1 as parseFile, parseFileMulti, commentsToOpenApi as swaggerJsDocumentCommentsToOpenApi, validate, yamlLoc };
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import{default as a}from"./packem_shared/jsDocumentCommentsToOpenApi-BEQrWgpQ.mjs";import{default as r}from"./packem_shared/DEFAULT_OPTIONS-C7o6qjwP.mjs";import{default as l,parseFileMulti as m}from"./packem_shared/parseFile-Wxs3O0wy.mjs";import{default as s}from"./packem_shared/SpecBuilder-Vbq42UbW.mjs";import{default as d}from"./packem_shared/swaggerJsDocumentCommentsToOpenApi-BnPWbZoe.mjs";import{default as n}from"./packem_shared/loadDefinition-7r9qpfuE.mjs";import{default as g}from"./packem_shared/yamlLoc-DPq-xUM4.mjs";import{default as D}from"./packem_shared/validate-9Rwe2A3r.mjs";import{default as T}from"./packem_shared/SwaggerCompilerPlugin-wRdVpHJS.mjs";export{r as DEFAULT_OPTIONS,s as SpecBuilder,T as SwaggerCompilerPlugin,a as jsDocumentCommentsToOpenApi,n as loadDefinition,l as parseFile,m as parseFileMulti,d as swaggerJsDocumentCommentsToOpenApi,D as validate,g as yamlLoc};
@@ -1 +0,0 @@
1
- "use strict";const s={cwd:void 0,exclude:["coverage/**","packages/*/test{,s}/**","**/*.d.ts","test{,s}/**","test{,-*}.{js,cjs,mjs,ts,tsx,jsx,yaml,yml}","**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx,yaml,yml}","**/__tests__/**","**/{ava,babel,nyc}.config.{js,cjs,mjs}","**/jest.config.{js,cjs,mjs,ts}","**/{karma,rollup,webpack}.config.js","**/.{eslint,mocha}rc.{js,cjs}","**/.{travis,yarnrc}.yml","**/{docker-compose}.yml"],excludeNodeModules:!0,extension:[".js",".cjs",".mjs",".ts",".tsx",".jsx",".yaml",".yml"],include:["**"],verbose:!0};module.exports=s;
@@ -1 +0,0 @@
1
- "use strict";const c=new Set(["__proto__","constructor","prototype"]),i=(o,s)=>{Object.keys(s).forEach(t=>{c.has(t)||(o[t]===void 0?o[t]={...s[t]}:Object.keys(s[t]).forEach(e=>{c.has(e)||(o[t][e]={...o[t][e],...s[t][e]})}))})},h=new Set(["__proto__","constructor","prototype"]);class u{components;externalDocs;info;openapi;paths;security;servers;tags;constructor(s){this.openapi=s.openapi,this.info=s.info,this.paths=s.paths??{},s.servers&&(this.servers=s.servers),s.components&&(this.components=s.components),s.security&&(this.security=s.security),s.tags&&(this.tags=s.tags),s.externalDocs&&(this.externalDocs=s.externalDocs)}addData(s){s.forEach(t=>{const{components:e,paths:n,...a}=t;i(this,{components:e??{},paths:n??{}}),Object.entries(a).forEach(([r,p])=>{h.has(r)||(this[r]=p)})})}}module.exports=u;
@@ -1 +0,0 @@
1
- "use strict";const c=require("node:fs/promises"),u=require("node:path"),p=require("@visulima/fs"),w=require("./constants-DnbfJ7Id.cjs"),f=require("./jsDocumentCommentsToOpenApi-CMbdb0uR.cjs"),m=require("./parseFile-CPb-Kglh.cjs"),d=require("./SpecBuilder-C_KcIxW-.cjs"),v=require("./swaggerJsDocumentCommentsToOpenApi-rMEaS4lg.cjs"),b=require("./validate-DLmCjOPl.cjs"),y=[f,v],q=t=>t instanceof Error?t:new Error(String(t));class D{assetsPath;ignore;silent;sources;swaggerDefinition;verbose;constructor(e,a,r,s){this.assetsPath=e,this.swaggerDefinition=r,this.sources=a,this.verbose=s.verbose??!1,this.silent=s.silent??!1,this.ignore=s.ignore??[]}apply(e){const a=new Set([...w.D,...this.ignore]);e.hooks.make.tapAsync("SwaggerCompilerPlugin",async(r,s)=>{this.log("Build paused, switching to swagger build");const o=new d(this.swaggerDefinition);try{for(const i of this.sources){const l=await p.collect(i,{extensions:[".js",".cjs",".mjs",".ts",".tsx",".jsx",".yaml",".yml"],includeDirs:!1,skip:[...a]});this.verbose&&(this.log(`Found ${String(l.length)} files in ${i}`),this.log(JSON.stringify(l))),l.forEach(g=>{this.verbose&&this.log(`Parsing file ${g}`),o.addData(m.parseFileMulti(g,y,this.verbose).map(h=>h.spec))})}this.verbose&&(this.log("Validating swagger spec"),this.log(JSON.stringify(o,void 0,2))),await b(structuredClone(o));const{assetsPath:n}=this;await c.mkdir(u.dirname(n),{recursive:!0}),await c.writeFile(n,JSON.stringify(o,void 0,2)),this.verbose&&this.log(`Written swagger spec to "${this.assetsPath}" file`)}catch(n){const i=q(n);Array.isArray(r.errors)&&r.errors.push(i),s(i);return}this.log("switching back to normal build"),s()})}log(e){this.silent||console.log(e)}}module.exports=D;
@@ -1 +0,0 @@
1
- import{mkdir as c,writeFile as m}from"node:fs/promises";import{dirname as f}from"node:path";import{collect as p}from"@visulima/fs";import{D as u}from"./constants-CdEv9ZcD.mjs";import w from"./jsDocumentCommentsToOpenApi-BEQrWgpQ.mjs";import{parseFileMulti as d}from"./parseFile-Wxs3O0wy.mjs";import b from"./SpecBuilder-Vbq42UbW.mjs";import v from"./swaggerJsDocumentCommentsToOpenApi-BnPWbZoe.mjs";import y from"./validate-9Rwe2A3r.mjs";const D=[w,v],E=r=>r instanceof Error?r:new Error(String(r));class J{assetsPath;ignore;silent;sources;swaggerDefinition;verbose;constructor(t,n,o,s){this.assetsPath=t,this.swaggerDefinition=o,this.sources=n,this.verbose=s.verbose??!1,this.silent=s.silent??!1,this.ignore=s.ignore??[]}apply(t){const n=new Set([...u,...this.ignore]);t.hooks.make.tapAsync("SwaggerCompilerPlugin",async(o,s)=>{this.log("Build paused, switching to swagger build");const e=new b(this.swaggerDefinition);try{for(const i of this.sources){const l=await p(i,{extensions:[".js",".cjs",".mjs",".ts",".tsx",".jsx",".yaml",".yml"],includeDirs:!1,skip:[...n]});this.verbose&&(this.log(`Found ${String(l.length)} files in ${i}`),this.log(JSON.stringify(l))),l.forEach(g=>{this.verbose&&this.log(`Parsing file ${g}`),e.addData(d(g,D,this.verbose).map(h=>h.spec))})}this.verbose&&(this.log("Validating swagger spec"),this.log(JSON.stringify(e,void 0,2))),await y(structuredClone(e));const{assetsPath:a}=this;await c(f(a),{recursive:!0}),await m(a,JSON.stringify(e,void 0,2)),this.verbose&&this.log(`Written swagger spec to "${this.assetsPath}" file`)}catch(a){const i=E(a);Array.isArray(o.errors)&&o.errors.push(i),s(i);return}this.log("switching back to normal build"),s()})}log(t){this.silent||console.log(t)}}export{J as default};
@@ -1 +0,0 @@
1
- "use strict";const s=["coverage/**",".github/**","**/*.d.ts","**/test{,s}/**","**/test{,-*}.{js,cjs,mjs,ts,tsx,jsx,yaml,yml}","**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx,yaml,yml}","**/__tests__/**","**/{ava,babel,nyc}.config.{js,cjs,mjs}","**/jest.config.{js,cjs,mjs,ts}","**/{karma,rollup,webpack}.config.js","**/.{eslint,mocha}rc.{js,cjs}","**/.{travis,yarnrc}.yml","**/{docker-compose,docker}.yml","**/.yamllint.{yaml,yml}","**/node_modules/**","**/{pnpm-workspace,pnpm-lock}.yaml","**/{package,package-lock}.json","**/yarn.lock","**/package.json5","**/.next/**"];exports.D=s;
@@ -1 +0,0 @@
1
- "use strict";const t=(r,s)=>{if(Array.isArray(r))return[...r,...s]};exports.u=t;
@@ -1,5 +0,0 @@
1
- "use strict";const c=require("node:fs/promises"),f=require("node:path"),b=require("node:process"),_=require("node:url"),S=require("@visulima/fs"),m=require("cli-progress"),F=require("yaml"),$=require("./constants-DnbfJ7Id.cjs"),j=require("./jsDocumentCommentsToOpenApi-CMbdb0uR.cjs"),p=require("./parseFile-CPb-Kglh.cjs"),E=require("./SpecBuilder-C_KcIxW-.cjs"),x=require("./swaggerJsDocumentCommentsToOpenApi-rMEaS4lg.cjs"),C=require("./loadDefinition-ah20Zy-G.cjs"),N=require("./validate-DLmCjOPl.cjs"),M=t=>t&&typeof t=="object"&&"default"in t?t.default:t,R=M(F),U=new Set([".yaml",".yml"]),h="-",w=[j,x],k=async t=>{try{let e=await import(_.pathToFileURL(f.normalize(t)).href);return e?.default&&(e=e.default),e}catch(e){if(e?.code==="ERR_MODULE_NOT_FOUND"||e?.code==="MODULE_NOT_FOUND"||e?.code==="ERR_LOAD_URL")throw new Error(`No config file found, on: ${t}
2
- `,{cause:e});const r=e instanceof Error?e.message:String(e);throw new Error(`Failed to load config file "${t}": ${r}`,{cause:e})}},L=async(t,e,r)=>{const i=await k(r.config??t),o=r.definition??i.definition;let{swaggerDefinition:u}=i;o&&(u={...C(o),...u});const d=r.output===h?void 0:new m.MultiBar({clearOnComplete:!1,format:"{value}/{total} | {bar} | {filename}",hideCursor:!0},m.Presets.shades_grey),s=new E(u),v=new Set([...$.D,...i.exclude]);for(const g of e){const q=(await c.lstat(g)).isDirectory(),n=await c.realpath(g);if(!q){s.addData(p.parseFileMulti(n,w,r.verbose).map(l=>l.spec));continue}const a=await S.collect(n,{extensions:i.extensions??[".js",".cjs",".mjs",".ts",".tsx",".jsx",".yaml",".yml"],followSymlinks:i.followSymlinks??!1,match:i.include,skip:[...v]});(r.verbose??r.veryVerbose)&&console.log(`
3
- Found ${String(a.length)} files in ${n}`),r.veryVerbose&&console.log(a);const D=d?.create(a.length,0);a.forEach(l=>{r.verbose&&console.log(`Parsing file ${l}`),D?.increment(1,{filename:n}),s.addData(p.parseFileMulti(l,w,r.verbose).map(O=>O.spec))})}return r.verbose&&console.log("Validating swagger spec"),r.veryVerbose&&console.log(JSON.stringify(s,void 0,2)),await N(structuredClone(s)),d?.stop(),s},y=(t,e)=>U.has(f.extname(e))?R.stringify(structuredClone(t)):JSON.stringify(t,void 0,2),T=async(t,e,r)=>{const i=await L(t,e,r),o=r.output??"swagger.json";if(o===h){b.stdout.write(`${y(i,"swagger.json")}
4
- `);return}r.verbose&&console.log(`Written swagger spec to "${o}" file`),await c.mkdir(f.dirname(o),{recursive:!0}),await c.writeFile(o,y(i,o)),console.log(`
5
- Swagger specification is ready, check the "${o}" file.`)};module.exports=T;
@@ -1 +0,0 @@
1
- "use strict";const f=require("node:fs"),s=require("node:process"),u=require("./generateCommand-CEP0sWth.cjs"),h=e=>e&&typeof e=="object"&&"default"in e?e.default:e,p=h(s),c=e=>{console.error(e)},d=async(e,i,n)=>{const t=async()=>{await u(e,i,n)},o=i.map(a=>f.watch(a,{recursive:!0},()=>{t().catch(c)})),r=()=>{o.forEach(a=>{a.close()}),s.exit(0)};p.once("SIGINT",r),p.once("SIGTERM",r);try{await t()}catch(a){c(a)}console.log("Watching for changes... (press Ctrl+C to exit)")},g=(e,i="generate",n=".openapirc.js")=>{e.command(i).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("-d, --definition [definition.yaml]","Base OpenAPI definition file (YAML/JSON) to seed info/servers/components.").option("-o, --output [swaggerSpec.json]",'Output swagger specification. Use "-" to write to stdout, or a .yaml/.yml path for YAML output.').option("-w, --watch","Re-generate the specification whenever a watched path changes.").option("-v, --verbose","Verbose output.").option("--very-verbose","Very verbose output.").action(async(t,o)=>{if(o.watch){await d(n,t,o);return}try{await u(n,t,o)}catch(r){c(r),s.exit(1)}})};module.exports=g;
@@ -1 +0,0 @@
1
- import{watch as u}from"node:fs";import s,{exit as p}from"node:process";import f from"./generateCommand-CkcShFNr.mjs";const c=o=>{console.error(o)},h=async(o,a,r)=>{const e=async()=>{await f(o,a,r)},t=a.map(i=>u(i,{recursive:!0},()=>{e().catch(c)})),n=()=>{t.forEach(i=>{i.close()}),p(0)};s.once("SIGINT",n),s.once("SIGTERM",n);try{await e()}catch(i){c(i)}console.log("Watching for changes... (press Ctrl+C to exit)")},d=(o,a="generate",r=".openapirc.js")=>{o.command(a).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("-d, --definition [definition.yaml]","Base OpenAPI definition file (YAML/JSON) to seed info/servers/components.").option("-o, --output [swaggerSpec.json]",'Output swagger specification. Use "-" to write to stdout, or a .yaml/.yml path for YAML output.').option("-w, --watch","Re-generate the specification whenever a watched path changes.").option("-v, --verbose","Verbose output.").option("--very-verbose","Very verbose output.").action(async(e,t)=>{if(t.watch){await h(r,e,t);return}try{await f(r,e,t)}catch(n){c(n),p(1)}})};export{d as default};
@@ -1 +0,0 @@
1
- import{exit as c}from"node:process";import e from"./initCommand-Ca1hGdYS.mjs";const s=(o,i="init",r="Inits a pre-configured @visulima/jsdoc-open-api config file.",n=".openapirc.js")=>{o.command(i).description(r).action(()=>{try{e(n)}catch(t){console.error(t),c(1)}})};export{s as default};
@@ -1 +0,0 @@
1
- "use strict";const r=require("node:process"),t=require("./initCommand-DvNH61Z4.cjs"),s=(i,e="init",n="Inits a pre-configured @visulima/jsdoc-open-api config file.",o=".openapirc.js")=>{i.command(e).description(n).action(()=>{try{t(o)}catch(c){console.error(c),r.exit(1)}})};module.exports=s;
@@ -1,35 +0,0 @@
1
- "use strict";const o=require("node:fs"),c=require("@visulima/fs"),l=(e,t=process.cwd())=>{if(o.existsSync(e))throw new Error("Config file already exists");const s=c.findUpSync("package.json",{cwd:o.realpathSync(t)});let n="module.exports =";if(s){const a=c.readJsonSync(s);console.info(`Found package.json at "${s}"`),a.type==="module"&&(console.info("Found package.json with type: module, using ES6 as export for the config file"),n="export default")}else console.info("No package.json found");o.writeFileSync(e,`${n} {
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}"`)};module.exports=l;