@kubb/core 5.11.5 → 5.12.0
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/dist/{Hookable-7Kv_oj72.js → Hookable-Cqx0g2T-.js} +139 -10
- package/dist/Hookable-Cqx0g2T-.js.map +1 -0
- package/dist/{createAdapter-DtX_MKL-.d.ts → createAdapter-DFXvZLZC.d.ts} +138 -131
- package/dist/index.cjs +134 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +155 -135
- package/dist/index.d.ts +19 -6
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +2 -2
- package/dist/Hookable-7Kv_oj72.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -92,209 +92,215 @@ export declare function defineParser<TOptions extends object = object, TMeta ext
|
|
|
92
92
|
*/
|
|
93
93
|
declare const diagnosticCatalog: {
|
|
94
94
|
readonly unknown: {
|
|
95
|
-
readonly code:
|
|
96
|
-
readonly title:
|
|
97
|
-
readonly cause:
|
|
98
|
-
readonly fix:
|
|
95
|
+
readonly code: 'KUBB_UNKNOWN';
|
|
96
|
+
readonly title: 'Unknown error';
|
|
97
|
+
readonly cause: 'An error was thrown without a stable Kubb code, so it is reported as-is.';
|
|
98
|
+
readonly fix: 'Read the underlying message and stack. If it comes from a plugin or adapter, check its configuration; otherwise report it as a possible Kubb bug.';
|
|
99
99
|
};
|
|
100
100
|
readonly inputNotFound: {
|
|
101
|
-
readonly code:
|
|
102
|
-
readonly title:
|
|
103
|
-
readonly cause:
|
|
104
|
-
readonly fix:
|
|
101
|
+
readonly code: 'KUBB_INPUT_NOT_FOUND';
|
|
102
|
+
readonly title: 'Input not found';
|
|
103
|
+
readonly cause: 'The file set as `input` (or passed as `kubb generate PATH`) could not be read. A URL reports `KUBB_INPUT_REQUEST_FAILED` or `KUBB_INPUT_UNREACHABLE` instead.';
|
|
104
|
+
readonly fix: 'Check that the path exists and is readable, then set it as `input` or pass it on the CLI.';
|
|
105
105
|
};
|
|
106
106
|
readonly inputRequestFailed: {
|
|
107
|
-
readonly code:
|
|
108
|
-
readonly title:
|
|
109
|
-
readonly cause:
|
|
110
|
-
readonly fix:
|
|
107
|
+
readonly code: 'KUBB_INPUT_REQUEST_FAILED';
|
|
108
|
+
readonly title: 'Input request failed';
|
|
109
|
+
readonly cause: 'A URL set as `input` (or reached through a `$ref`) answered with a 4xx or 5xx status instead of the document.';
|
|
110
|
+
readonly fix: 'Open the URL to see what the server returns. A 401 or 403 needs credentials Kubb does not send, so download the document and point `input` at the local file. A 404 means the path is wrong, and a 5xx means the server itself failed.';
|
|
111
111
|
};
|
|
112
112
|
readonly inputUnreachable: {
|
|
113
|
-
readonly code:
|
|
114
|
-
readonly title:
|
|
115
|
-
readonly cause:
|
|
116
|
-
readonly fix:
|
|
113
|
+
readonly code: 'KUBB_INPUT_UNREACHABLE';
|
|
114
|
+
readonly title: 'Input unreachable';
|
|
115
|
+
readonly cause: 'A URL set as `input` (or reached through a `$ref`) never answered, so the request failed before a status came back. A refused connection, an unknown host, an expired certificate, and a timeout all land here.';
|
|
116
|
+
readonly fix: 'Check that the host is running and reachable from this machine. For a local server, start it and confirm the port matches the one in `input`.';
|
|
117
|
+
};
|
|
118
|
+
readonly gitInputFailed: {
|
|
119
|
+
readonly code: 'KUBB_GIT_INPUT_FAILED';
|
|
120
|
+
readonly title: 'Git input failed';
|
|
121
|
+
readonly cause: 'A git `input` (`git+<repo>#<ref>:<path>`) is malformed, or `git` could not fetch it: git is not installed, the repository or ref does not exist, or the credentials were refused.';
|
|
122
|
+
readonly fix: 'Write the input as `git+<repo>#<ref>:<path>`. Run `git fetch --depth 1 <repo> <ref>` yourself to see the git error, and set up a credential helper or SSH key for a private repository.';
|
|
117
123
|
};
|
|
118
124
|
readonly inputRequired: {
|
|
119
|
-
readonly code:
|
|
120
|
-
readonly title:
|
|
121
|
-
readonly cause:
|
|
122
|
-
readonly fix:
|
|
125
|
+
readonly code: 'KUBB_INPUT_REQUIRED';
|
|
126
|
+
readonly title: 'Input required';
|
|
127
|
+
readonly cause: 'An adapter is configured but no `input` was provided.';
|
|
128
|
+
readonly fix: 'Set `input` to a file path, a URL, an inline spec (JSON/YAML string), or a parsed object in your Kubb config.';
|
|
123
129
|
};
|
|
124
130
|
readonly legacyInput: {
|
|
125
|
-
readonly code:
|
|
126
|
-
readonly title:
|
|
127
|
-
readonly cause:
|
|
128
|
-
readonly fix:
|
|
131
|
+
readonly code: 'KUBB_LEGACY_INPUT';
|
|
132
|
+
readonly title: 'Legacy input shape';
|
|
133
|
+
readonly cause: '`input` is a `{ path }` or `{ data }` wrapper, which v4 used to point at a document and v5 reads as the document itself.';
|
|
134
|
+
readonly fix: 'Unwrap it: `input: { path: "./petStore.yaml" }` becomes `input: "./petStore.yaml"`, and `input: { data: spec }` becomes `input: spec`.';
|
|
129
135
|
};
|
|
130
136
|
readonly invalidDocument: {
|
|
131
|
-
readonly code:
|
|
132
|
-
readonly title:
|
|
133
|
-
readonly cause:
|
|
134
|
-
readonly fix:
|
|
137
|
+
readonly code: 'KUBB_INVALID_DOCUMENT';
|
|
138
|
+
readonly title: 'Invalid document';
|
|
139
|
+
readonly cause: 'The `input` cannot be read as an OpenAPI or Swagger document: its JSON or YAML has a syntax error, it declares no `openapi` or `swagger` version field, or its version cannot be upgraded to OpenAPI 3.1.';
|
|
140
|
+
readonly fix: 'Fix the syntax at the reported line, and check that `input` points at the spec and not an HTML page. Point `input` at a Swagger 2.0, OpenAPI 3.0, or OpenAPI 3.1 document, and check that a passed object is the spec itself rather than a wrapper around it.';
|
|
135
141
|
};
|
|
136
142
|
readonly invalidSpec: {
|
|
137
|
-
readonly code:
|
|
138
|
-
readonly title:
|
|
139
|
-
readonly cause:
|
|
140
|
-
readonly fix:
|
|
143
|
+
readonly code: 'KUBB_INVALID_SPEC';
|
|
144
|
+
readonly title: 'Invalid spec';
|
|
145
|
+
readonly cause: 'The document does not pass OpenAPI schema validation. Kubb still generates from it, but the output can be incomplete or wrong.';
|
|
146
|
+
readonly fix: 'Fix the reported problem in the spec. Run `kubb validate` to list every error, or set `validate: false` on the adapter to skip the check.';
|
|
141
147
|
};
|
|
142
148
|
readonly refNotFound: {
|
|
143
|
-
readonly code:
|
|
144
|
-
readonly title:
|
|
145
|
-
readonly cause:
|
|
146
|
-
readonly fix:
|
|
149
|
+
readonly code: 'KUBB_REF_NOT_FOUND';
|
|
150
|
+
readonly title: 'Reference not found';
|
|
151
|
+
readonly cause: 'A `$ref` could not be resolved in the source document.';
|
|
152
|
+
readonly fix: 'Add the missing definition (for example under `components.schemas`) or fix the `$ref`. Run `kubb validate` to check the spec.';
|
|
147
153
|
};
|
|
148
154
|
readonly invalidServerVariable: {
|
|
149
|
-
readonly code:
|
|
150
|
-
readonly title:
|
|
151
|
-
readonly cause:
|
|
152
|
-
readonly fix:
|
|
155
|
+
readonly code: 'KUBB_INVALID_SERVER_VARIABLE';
|
|
156
|
+
readonly title: 'Invalid server variable';
|
|
157
|
+
readonly cause: 'A server variable value is not allowed by its `enum`.';
|
|
158
|
+
readonly fix: 'Use one of the values listed in the server variable `enum`, or update the spec.';
|
|
153
159
|
};
|
|
154
160
|
readonly pluginNotFound: {
|
|
155
|
-
readonly code:
|
|
156
|
-
readonly title:
|
|
157
|
-
readonly cause:
|
|
158
|
-
readonly fix:
|
|
161
|
+
readonly code: 'KUBB_PLUGIN_NOT_FOUND';
|
|
162
|
+
readonly title: 'Plugin not found';
|
|
163
|
+
readonly cause: 'A plugin that another plugin depends on is missing from the config.';
|
|
164
|
+
readonly fix: 'Add the required plugin to the `plugins` array in kubb.config.ts, or remove the dependency on it.';
|
|
159
165
|
};
|
|
160
166
|
readonly incompatibleExtension: {
|
|
161
|
-
readonly code:
|
|
162
|
-
readonly title:
|
|
163
|
-
readonly cause:
|
|
164
|
-
readonly fix:
|
|
167
|
+
readonly code: 'KUBB_INCOMPATIBLE_EXTENSION';
|
|
168
|
+
readonly title: 'Incompatible extension';
|
|
169
|
+
readonly cause: 'A plugin sets `meta.compatibility.kubb` or `meta.compatibility.node` to a range the running Kubb or Node.js version does not satisfy.';
|
|
170
|
+
readonly fix: 'Upgrade Kubb or Node.js to a version in the range, or install a version of the plugin that supports your current Kubb and Node.js.';
|
|
165
171
|
};
|
|
166
172
|
readonly missingDependency: {
|
|
167
|
-
readonly code:
|
|
168
|
-
readonly title:
|
|
169
|
-
readonly cause:
|
|
170
|
-
readonly fix:
|
|
173
|
+
readonly code: 'KUBB_MISSING_DEPENDENCY';
|
|
174
|
+
readonly title: 'Missing dependency';
|
|
175
|
+
readonly cause: 'A plugin lists another plugin in its `dependencies` record without `optional: true`, and the config does not include it.';
|
|
176
|
+
readonly fix: 'Add the missing plugin to the `plugins` array in kubb.config.ts.';
|
|
171
177
|
};
|
|
172
178
|
readonly incompatibleDependency: {
|
|
173
|
-
readonly code:
|
|
174
|
-
readonly title:
|
|
179
|
+
readonly code: 'KUBB_INCOMPATIBLE_DEPENDENCY';
|
|
180
|
+
readonly title: 'Incompatible dependency';
|
|
175
181
|
readonly cause: "A plugin's `dependencies` record sets a `version` range, and the configured plugin's `meta.version` falls outside it.";
|
|
176
|
-
readonly fix:
|
|
182
|
+
readonly fix: 'Install a version of the dependency inside the range, or a version of the dependent plugin that supports the installed dependency.';
|
|
177
183
|
};
|
|
178
184
|
readonly pluginFailed: {
|
|
179
|
-
readonly code:
|
|
180
|
-
readonly title:
|
|
181
|
-
readonly cause:
|
|
182
|
-
readonly fix:
|
|
185
|
+
readonly code: 'KUBB_PLUGIN_FAILED';
|
|
186
|
+
readonly title: 'Plugin failed';
|
|
187
|
+
readonly cause: 'A plugin threw while generating, or reported an error through `ctx.error`.';
|
|
188
|
+
readonly fix: 'Check the plugin options and the node at `at:`. If it is a bug, report it with the stack at `report:`.';
|
|
183
189
|
};
|
|
184
190
|
readonly adapterFailed: {
|
|
185
|
-
readonly code:
|
|
186
|
-
readonly title:
|
|
187
|
-
readonly cause:
|
|
188
|
-
readonly fix:
|
|
191
|
+
readonly code: 'KUBB_ADAPTER_FAILED';
|
|
192
|
+
readonly title: 'Adapter failed';
|
|
193
|
+
readonly cause: 'The adapter threw an unexpected error while parsing the input.';
|
|
194
|
+
readonly fix: 'Check the input and the adapter options. If it is a bug, report it with the stack at `report:`.';
|
|
189
195
|
};
|
|
190
196
|
readonly parserFailed: {
|
|
191
|
-
readonly code:
|
|
192
|
-
readonly title:
|
|
193
|
-
readonly cause:
|
|
194
|
-
readonly fix:
|
|
197
|
+
readonly code: 'KUBB_PARSER_FAILED';
|
|
198
|
+
readonly title: 'Parser failed';
|
|
199
|
+
readonly cause: 'A parser threw an unexpected error while printing a generated file.';
|
|
200
|
+
readonly fix: 'Check the parser options. If it is a bug, report it with the stack at `report:`.';
|
|
195
201
|
};
|
|
196
202
|
readonly pluginWarning: {
|
|
197
|
-
readonly code:
|
|
198
|
-
readonly title:
|
|
199
|
-
readonly cause:
|
|
200
|
-
readonly fix:
|
|
203
|
+
readonly code: 'KUBB_PLUGIN_WARNING';
|
|
204
|
+
readonly title: 'Plugin warning';
|
|
205
|
+
readonly cause: 'A plugin reported a non-fatal warning through `ctx.warn`.';
|
|
206
|
+
readonly fix: 'Review the message. It does not fail the build; adjust the plugin options or input if the warning is unwanted.';
|
|
201
207
|
};
|
|
202
208
|
readonly pluginInfo: {
|
|
203
|
-
readonly code:
|
|
204
|
-
readonly title:
|
|
205
|
-
readonly cause:
|
|
206
|
-
readonly fix:
|
|
209
|
+
readonly code: 'KUBB_PLUGIN_INFO';
|
|
210
|
+
readonly title: 'Plugin info';
|
|
211
|
+
readonly cause: 'A plugin reported an informational message through `ctx.info`.';
|
|
212
|
+
readonly fix: 'Informational only. No action is required.';
|
|
207
213
|
};
|
|
208
214
|
readonly noContext: {
|
|
209
|
-
readonly code:
|
|
210
|
-
readonly title:
|
|
211
|
-
readonly cause:
|
|
212
|
-
readonly fix:
|
|
215
|
+
readonly code: 'KUBB_NO_CONTEXT';
|
|
216
|
+
readonly title: 'No plugin context';
|
|
217
|
+
readonly cause: 'A `kubb/kit` composable such as `useKubb()` or `addGenerator()` ran outside the `setup` and `kubb:plugin:setup` of a plugin, so there is no plugin to apply it to.';
|
|
218
|
+
readonly fix: 'Call the composable inside `setup` or `kubb:plugin:setup`, including in code that setup awaits.';
|
|
213
219
|
};
|
|
214
220
|
readonly unsupportedFormat: {
|
|
215
|
-
readonly code:
|
|
216
|
-
readonly title:
|
|
217
|
-
readonly cause:
|
|
218
|
-
readonly fix:
|
|
221
|
+
readonly code: 'KUBB_UNSUPPORTED_FORMAT';
|
|
222
|
+
readonly title: 'Unsupported format';
|
|
223
|
+
readonly cause: 'A schema uses a `format` Kubb does not map to a specific type, so it falls back to the base type.';
|
|
224
|
+
readonly fix: 'Use a format Kubb supports, or handle the custom format with a parser or plugin.';
|
|
219
225
|
};
|
|
220
226
|
readonly deprecated: {
|
|
221
|
-
readonly code:
|
|
222
|
-
readonly title:
|
|
223
|
-
readonly cause:
|
|
224
|
-
readonly fix:
|
|
227
|
+
readonly code: 'KUBB_DEPRECATED';
|
|
228
|
+
readonly title: 'Deprecated';
|
|
229
|
+
readonly cause: 'A referenced schema or operation is marked `deprecated`.';
|
|
230
|
+
readonly fix: 'Migrate off the deprecated definition if the warning is unwanted.';
|
|
225
231
|
};
|
|
226
232
|
readonly adapterRequired: {
|
|
227
|
-
readonly code:
|
|
228
|
-
readonly title:
|
|
229
|
-
readonly cause:
|
|
230
|
-
readonly fix:
|
|
233
|
+
readonly code: 'KUBB_ADAPTER_REQUIRED';
|
|
234
|
+
readonly title: 'Adapter required';
|
|
235
|
+
readonly cause: 'An action needs an adapter but none is configured.';
|
|
236
|
+
readonly fix: 'Set `adapter` in kubb.config.ts, for example `adapterOas()`.';
|
|
231
237
|
};
|
|
232
238
|
readonly pathTraversal: {
|
|
233
|
-
readonly code:
|
|
234
|
-
readonly title:
|
|
235
|
-
readonly cause:
|
|
236
|
-
readonly fix:
|
|
239
|
+
readonly code: 'KUBB_PATH_TRAVERSAL';
|
|
240
|
+
readonly title: 'Path traversal';
|
|
241
|
+
readonly cause: 'A resolved output path escaped the output directory, which can stem from a path traversal in the spec or a misconfigured `group.name`.';
|
|
242
|
+
readonly fix: 'Keep generated paths within the output directory. Review the `group.name` function and the names coming from the spec.';
|
|
237
243
|
};
|
|
238
244
|
readonly cleanRoot: {
|
|
239
|
-
readonly code:
|
|
240
|
-
readonly title:
|
|
241
|
-
readonly cause:
|
|
242
|
-
readonly fix:
|
|
245
|
+
readonly code: 'KUBB_CLEAN_ROOT';
|
|
246
|
+
readonly title: 'Clean targets the project root';
|
|
247
|
+
readonly cause: '`output.clean` is enabled and `output.path` resolves to the project root or a parent of it, so cleaning would delete `kubb.config` and every source file.';
|
|
248
|
+
readonly fix: 'Point `output.path` at a subdirectory such as `./src/gen` so clean only removes generated code, or disable `output.clean`.';
|
|
243
249
|
};
|
|
244
250
|
readonly invalidPluginOptions: {
|
|
245
|
-
readonly code:
|
|
246
|
-
readonly title:
|
|
251
|
+
readonly code: 'KUBB_INVALID_PLUGIN_OPTIONS';
|
|
252
|
+
readonly title: 'Invalid plugin options';
|
|
247
253
|
readonly cause: "A plugin was configured with options that cannot be honored, for example `output.mode: 'file'` paired with a `group` option.";
|
|
248
254
|
readonly fix: "Fix the plugin options. A single-file output has nothing to group, so remove the `group` option or use `output.mode: 'directory'`.";
|
|
249
255
|
};
|
|
250
256
|
readonly postGenerateFailed: {
|
|
251
|
-
readonly code:
|
|
252
|
-
readonly title:
|
|
253
|
-
readonly cause:
|
|
254
|
-
readonly fix:
|
|
257
|
+
readonly code: 'KUBB_POST_GENERATE_FAILED';
|
|
258
|
+
readonly title: 'Post-generate command failed';
|
|
259
|
+
readonly cause: 'A post-generate command (`output.postGenerate`) exited with a non-zero status.';
|
|
260
|
+
readonly fix: 'Check the command is installed and correct, and run it manually to see the error.';
|
|
255
261
|
};
|
|
256
262
|
readonly formatFailed: {
|
|
257
|
-
readonly code:
|
|
258
|
-
readonly title:
|
|
259
|
-
readonly cause:
|
|
260
|
-
readonly fix:
|
|
263
|
+
readonly code: 'KUBB_FORMAT_FAILED';
|
|
264
|
+
readonly title: 'Format failed';
|
|
265
|
+
readonly cause: 'The formatter pass over the generated files failed.';
|
|
266
|
+
readonly fix: 'Check the formatter (oxfmt, biome, or prettier) is installed and its config is valid, then run it manually on the output.';
|
|
261
267
|
};
|
|
262
268
|
readonly lintFailed: {
|
|
263
|
-
readonly code:
|
|
264
|
-
readonly title:
|
|
265
|
-
readonly cause:
|
|
266
|
-
readonly fix:
|
|
269
|
+
readonly code: 'KUBB_LINT_FAILED';
|
|
270
|
+
readonly title: 'Lint failed';
|
|
271
|
+
readonly cause: 'The linter pass over the generated files failed.';
|
|
272
|
+
readonly fix: 'Check the linter (oxlint, biome, or eslint) is installed and its config is valid, then run it manually on the output.';
|
|
267
273
|
};
|
|
268
274
|
readonly barrelDuplicateExport: {
|
|
269
|
-
readonly code:
|
|
270
|
-
readonly title:
|
|
271
|
-
readonly cause:
|
|
272
|
-
readonly fix:
|
|
275
|
+
readonly code: 'KUBB_BARREL_DUPLICATE_EXPORT';
|
|
276
|
+
readonly title: 'Duplicate barrel export';
|
|
277
|
+
readonly cause: 'Two generated modules export the same name, so the barrel cannot re-export both.';
|
|
278
|
+
readonly fix: 'Rename one of the colliding declarations, or configure the plugin resolver to produce distinct names.';
|
|
273
279
|
};
|
|
274
280
|
readonly internalError: {
|
|
275
|
-
readonly code:
|
|
276
|
-
readonly title:
|
|
277
|
-
readonly cause:
|
|
278
|
-
readonly fix:
|
|
281
|
+
readonly code: 'KUBB_INTERNAL_ERROR';
|
|
282
|
+
readonly title: 'Internal error';
|
|
283
|
+
readonly cause: 'Kubb hit a state it does not expect. This is a bug in Kubb, not in your config.';
|
|
284
|
+
readonly fix: 'Rerun with `--reporter json` or `--verbose` to get the stack. Then report it at https://github.com/kubb-labs/kubb/issues with the spec and config that trigger it.';
|
|
279
285
|
};
|
|
280
286
|
readonly performance: {
|
|
281
|
-
readonly code:
|
|
282
|
-
readonly title:
|
|
283
|
-
readonly cause:
|
|
284
|
-
readonly fix:
|
|
287
|
+
readonly code: 'KUBB_PERFORMANCE';
|
|
288
|
+
readonly title: 'Performance';
|
|
289
|
+
readonly cause: 'Not a failure. Records a plugin’s elapsed time, summed into the run total.';
|
|
290
|
+
readonly fix: 'No action. This is an informational metric.';
|
|
285
291
|
};
|
|
286
292
|
readonly updateAvailable: {
|
|
287
|
-
readonly code:
|
|
288
|
-
readonly title:
|
|
289
|
-
readonly cause:
|
|
290
|
-
readonly fix:
|
|
293
|
+
readonly code: 'KUBB_UPDATE_AVAILABLE';
|
|
294
|
+
readonly title: 'Update available';
|
|
295
|
+
readonly cause: 'A newer Kubb version is published on npm than the one running.';
|
|
296
|
+
readonly fix: 'Update the `@kubb/*` packages, for example `npm install -g @kubb/cli`, to get the latest fixes.';
|
|
291
297
|
};
|
|
292
298
|
};
|
|
293
299
|
/**
|
|
294
300
|
* Stable codes Kubb attaches to a `Diagnostic`, derived from {@link diagnosticCatalog}. Reference
|
|
295
301
|
* these instead of inlining the string at a throw site.
|
|
296
302
|
*/
|
|
297
|
-
declare const diagnosticCode: { readonly [K in keyof typeof diagnosticCatalog]: (typeof diagnosticCatalog)[K][
|
|
303
|
+
declare const diagnosticCode: { readonly [K in keyof typeof diagnosticCatalog]: (typeof diagnosticCatalog)[K]['code']; };
|
|
298
304
|
/**
|
|
299
305
|
* Union of the stable {@link diagnosticCode} values.
|
|
300
306
|
*/
|
|
@@ -1826,6 +1832,7 @@ export declare class Diagnostics {
|
|
|
1826
1832
|
readonly inputNotFound: "KUBB_INPUT_NOT_FOUND";
|
|
1827
1833
|
readonly inputRequestFailed: "KUBB_INPUT_REQUEST_FAILED";
|
|
1828
1834
|
readonly inputUnreachable: "KUBB_INPUT_UNREACHABLE";
|
|
1835
|
+
readonly gitInputFailed: "KUBB_GIT_INPUT_FAILED";
|
|
1829
1836
|
readonly inputRequired: "KUBB_INPUT_REQUIRED";
|
|
1830
1837
|
readonly legacyInput: "KUBB_LEGACY_INPUT";
|
|
1831
1838
|
readonly invalidDocument: "KUBB_INVALID_DOCUMENT";
|
|
@@ -3531,22 +3538,35 @@ type ResolverOptions<T extends PluginType> = Omit<T['resolver'], keyof Resolver>
|
|
|
3531
3538
|
*/
|
|
3532
3539
|
export declare function createResolver<T extends PluginType>(options: ResolverOptions<T>): T['resolver'];
|
|
3533
3540
|
//#endregion
|
|
3541
|
+
//#region src/gitInput.d.ts
|
|
3542
|
+
/**
|
|
3543
|
+
* Fetches one commit of a git repository into a temporary directory with a shallow `git fetch`,
|
|
3544
|
+
* so any host and the user's own git credentials work, and relative `$ref` files resolve.
|
|
3545
|
+
* Resolves to the spec path on disk and a `dispose` that deletes the checkout.
|
|
3546
|
+
*/
|
|
3547
|
+
export declare function checkoutGitInput(input: string, signal?: AbortSignal): Promise<{
|
|
3548
|
+
path: string;
|
|
3549
|
+
dispose: () => Promise<void>;
|
|
3550
|
+
}>;
|
|
3551
|
+
//#endregion
|
|
3534
3552
|
//#region src/input.d.ts
|
|
3535
3553
|
/**
|
|
3536
3554
|
* What an `input` value points at, once Kubb has looked at it.
|
|
3537
3555
|
*
|
|
3538
3556
|
* - `file` is a local file path, absolute or relative to the config file.
|
|
3539
3557
|
* - `url` is a remote document to fetch.
|
|
3558
|
+
* - `git` is a spec file in a git repository, written as `git+<repo>#<ref>:<path>`.
|
|
3540
3559
|
* - `inline` is OpenAPI content held in the string itself (JSON or YAML).
|
|
3541
3560
|
* - `object` is an already-parsed spec.
|
|
3542
3561
|
*/
|
|
3543
|
-
type InputKind = 'file' | 'url' | 'inline' | 'object';
|
|
3562
|
+
type InputKind = 'file' | 'url' | 'git' | 'inline' | 'object';
|
|
3544
3563
|
/**
|
|
3545
3564
|
* Classifies an `input` value so callers branch on it once instead of repeating the checks.
|
|
3546
3565
|
*
|
|
3547
3566
|
* A non-string is a parsed spec (`object`). A string is `inline` when it holds OpenAPI content,
|
|
3548
3567
|
* meaning it starts with `{` or `[`, spans multiple lines, or opens with a YAML `openapi:` or
|
|
3549
|
-
* `swagger:` key. Otherwise a string is
|
|
3568
|
+
* `swagger:` key. Otherwise a string is `git` when it starts with `git+`, a `url` when it parses as
|
|
3569
|
+
* one, or a `file` path.
|
|
3550
3570
|
*/
|
|
3551
3571
|
export declare function getInputKind(input: NonNullable<Input>): InputKind;
|
|
3552
3572
|
//#endregion
|
|
@@ -3580,7 +3600,7 @@ export declare function resolveCacheDir(root: string): string;
|
|
|
3580
3600
|
* await cache.writeItem('output-manifest.json', JSON.stringify(entries))
|
|
3581
3601
|
* ```
|
|
3582
3602
|
*/
|
|
3583
|
-
export declare const cacheStorage: (options?: CacheStorageOptions | undefined) => Storage;
|
|
3603
|
+
export declare const cacheStorage: (options?: CacheStorageOptions | undefined) => import("@kubb/kit").Storage;
|
|
3584
3604
|
//#endregion
|
|
3585
3605
|
//#region src/storages/fsStorage.d.ts
|
|
3586
3606
|
/**
|
|
@@ -3609,7 +3629,7 @@ export declare const cacheStorage: (options?: CacheStorageOptions | undefined) =
|
|
|
3609
3629
|
* })
|
|
3610
3630
|
* ```
|
|
3611
3631
|
*/
|
|
3612
|
-
export declare const fsStorage: (options?: Record<string, never> | undefined) => Storage;
|
|
3632
|
+
export declare const fsStorage: (options?: Record<string, never> | undefined) => import("@kubb/kit").Storage;
|
|
3613
3633
|
//#endregion
|
|
3614
3634
|
//#region src/storages/kubbStorage.d.ts
|
|
3615
3635
|
type KubbStorageOptions = {
|
|
@@ -3658,7 +3678,7 @@ export declare function kubbStorage({ base }?: KubbStorageOptions): import("unst
|
|
|
3658
3678
|
* })
|
|
3659
3679
|
* ```
|
|
3660
3680
|
*/
|
|
3661
|
-
export declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
|
|
3681
|
+
export declare const memoryStorage: (options?: Record<string, never> | undefined) => import("@kubb/kit").Storage;
|
|
3662
3682
|
//#endregion
|
|
3663
3683
|
//#region src/manifest.d.ts
|
|
3664
3684
|
/** A value that survives `JSON.stringify` and `JSON.parse` unchanged. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as NodeCache, $t as ReporterContext, A as PluginFactory, At as KubbInfoContext, B as ResolveImportsOptions, Bt as RunHookOptions, C as NormalizedPlugin, Ct as KubbGenerationEndContext, D as Override, Dt as KubbHookLineContext, E as OutputOptions, Et as KubbHookEndContext, F as definePlugin, Ft as KubbWarnContext, G as ResolverFile, Gt as createOutputManifest, H as ResolvePathOptions, Ht as KubbDriver, I as BannerMeta, It as PossibleConfig, J as ResolverPatch, Jt as createRenderer, K as ResolverFileParams, Kt as Renderer, L as ResolveBannerContext, Lt as PostGenerateCommand, M as PluginType, Mt as KubbMessageContext, N as ResolvePluginOptions, Nt as KubbPluginsEndContext, O as Plugin, Ot as KubbHookStartContext, P as assertPluginOption, Pt as KubbSuccessContext, Q as defineGenerator, Qt as Reporter, R as ResolveBannerFile, Rt as UserConfig, S as KubbPluginStartContext, St as KubbFilesProcessingUpdateContext, T as OutputMode, Tt as KubbGenerationSummaryContext, U as Resolver, Ut as Hookable, V as ResolveOptionsContext, Vt as runHook, W as ResolverDefault, Wt as OutputManifest, X as Generator, Xt as createStorage, Y as ResolverPathParams, Yt as Storage, Z as GeneratorContext, Zt as GenerationResult, _ as Filter, _t as KubbDiagnosticContext, a as AdapterSource, an as DiagnosticFormatOptions, at as Diagnostics, b as KubbPluginEndContext, bt as KubbFilesProcessingEndContext, c as ExtensionDependency, cn as ParserDefinition, ct as ProblemDiagnostic, d as ExtensionKind, dt as CLIOptions, en as ReporterName, et as Diagnostic, f as ExtensionMeta, ft as Config, g as Exclude, gt as KubbBuildStartContext, h as resolveMeta, ht as KubbBuildEndContext, i as AdapterFactoryOptions, in as logLevel, it as DiagnosticSeverity, j as PluginName, jt as KubbLifecycleStartContext, k as PluginDefinition, kt as KubbHooks, l as ExtensionDependencyRecord, ln as ParserFactory, lt as UpdateDiagnostic, m as defineExtension, mt as Input, n as AdapterDefinition, nn as UserReporter, nt as DiagnosticKind, o as createAdapter, on as SerializedDiagnostic, ot as PerformanceDiagnostic, p as checkCompatibility, pt as FilesContext, q as ResolverFilePathParams, qt as RendererFactory, r as AdapterFactory, rn as createReporter, rt as DiagnosticLocation, s as ExtensionDependencies, sn as Parser, st as ProblemCode, t as Adapter, tn as ReporterPluginFiles, tt as DiagnosticDoc, u as ExtensionFactory, un as defineParser, ut as BuildOutput, v as Group, vt as KubbErrorContext, w as Output, wt as KubbGenerationStartContext, x as KubbPluginSetupContext, xt as KubbFilesProcessingStartContext, y as Include, yt as KubbFileProcessingUpdate, z as ResolveFileOptions, zt as HookResult } from "./createAdapter-
|
|
1
|
+
import { $ as NodeCache, $t as ReporterContext, A as PluginFactory, At as KubbInfoContext, B as ResolveImportsOptions, Bt as RunHookOptions, C as NormalizedPlugin, Ct as KubbGenerationEndContext, D as Override, Dt as KubbHookLineContext, E as OutputOptions, Et as KubbHookEndContext, F as definePlugin, Ft as KubbWarnContext, G as ResolverFile, Gt as createOutputManifest, H as ResolvePathOptions, Ht as KubbDriver, I as BannerMeta, It as PossibleConfig, J as ResolverPatch, Jt as createRenderer, K as ResolverFileParams, Kt as Renderer, L as ResolveBannerContext, Lt as PostGenerateCommand, M as PluginType, Mt as KubbMessageContext, N as ResolvePluginOptions, Nt as KubbPluginsEndContext, O as Plugin, Ot as KubbHookStartContext, P as assertPluginOption, Pt as KubbSuccessContext, Q as defineGenerator, Qt as Reporter, R as ResolveBannerFile, Rt as UserConfig, S as KubbPluginStartContext, St as KubbFilesProcessingUpdateContext, T as OutputMode, Tt as KubbGenerationSummaryContext, U as Resolver, Ut as Hookable, V as ResolveOptionsContext, Vt as runHook, W as ResolverDefault, Wt as OutputManifest, X as Generator, Xt as createStorage, Y as ResolverPathParams, Yt as Storage, Z as GeneratorContext, Zt as GenerationResult, _ as Filter, _t as KubbDiagnosticContext, a as AdapterSource, an as DiagnosticFormatOptions, at as Diagnostics, b as KubbPluginEndContext, bt as KubbFilesProcessingEndContext, c as ExtensionDependency, cn as ParserDefinition, ct as ProblemDiagnostic, d as ExtensionKind, dt as CLIOptions, en as ReporterName, et as Diagnostic, f as ExtensionMeta, ft as Config, g as Exclude, gt as KubbBuildStartContext, h as resolveMeta, ht as KubbBuildEndContext, i as AdapterFactoryOptions, in as logLevel, it as DiagnosticSeverity, j as PluginName, jt as KubbLifecycleStartContext, k as PluginDefinition, kt as KubbHooks, l as ExtensionDependencyRecord, ln as ParserFactory, lt as UpdateDiagnostic, m as defineExtension, mt as Input, n as AdapterDefinition, nn as UserReporter, nt as DiagnosticKind, o as createAdapter, on as SerializedDiagnostic, ot as PerformanceDiagnostic, p as checkCompatibility, pt as FilesContext, q as ResolverFilePathParams, qt as RendererFactory, r as AdapterFactory, rn as createReporter, rt as DiagnosticLocation, s as ExtensionDependencies, sn as Parser, st as ProblemCode, t as Adapter, tn as ReporterPluginFiles, tt as DiagnosticDoc, u as ExtensionFactory, un as defineParser, ut as BuildOutput, v as Group, vt as KubbErrorContext, w as Output, wt as KubbGenerationStartContext, x as KubbPluginSetupContext, xt as KubbFilesProcessingStartContext, y as Include, yt as KubbFileProcessingUpdate, z as ResolveFileOptions, zt as HookResult } from "./createAdapter-DFXvZLZC.js";
|
|
2
2
|
import { FileNode, Macro, UserFileNode } from "@kubb/ast";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
//#region src/composables.d.ts
|
|
@@ -316,22 +316,35 @@ type ResolverOptions<T extends PluginType> = Omit<T['resolver'], keyof Resolver>
|
|
|
316
316
|
*/
|
|
317
317
|
export declare function createResolver<T extends PluginType>(options: ResolverOptions<T>): T['resolver'];
|
|
318
318
|
//#endregion
|
|
319
|
+
//#region src/gitInput.d.ts
|
|
320
|
+
/**
|
|
321
|
+
* Fetches one commit of a git repository into a temporary directory with a shallow `git fetch`,
|
|
322
|
+
* so any host and the user's own git credentials work, and relative `$ref` files resolve.
|
|
323
|
+
* Resolves to the spec path on disk and a `dispose` that deletes the checkout.
|
|
324
|
+
*/
|
|
325
|
+
export declare function checkoutGitInput(input: string, signal?: AbortSignal): Promise<{
|
|
326
|
+
path: string;
|
|
327
|
+
dispose: () => Promise<void>;
|
|
328
|
+
}>;
|
|
329
|
+
//#endregion
|
|
319
330
|
//#region src/input.d.ts
|
|
320
331
|
/**
|
|
321
332
|
* What an `input` value points at, once Kubb has looked at it.
|
|
322
333
|
*
|
|
323
334
|
* - `file` is a local file path, absolute or relative to the config file.
|
|
324
335
|
* - `url` is a remote document to fetch.
|
|
336
|
+
* - `git` is a spec file in a git repository, written as `git+<repo>#<ref>:<path>`.
|
|
325
337
|
* - `inline` is OpenAPI content held in the string itself (JSON or YAML).
|
|
326
338
|
* - `object` is an already-parsed spec.
|
|
327
339
|
*/
|
|
328
|
-
type InputKind = 'file' | 'url' | 'inline' | 'object';
|
|
340
|
+
type InputKind = 'file' | 'url' | 'git' | 'inline' | 'object';
|
|
329
341
|
/**
|
|
330
342
|
* Classifies an `input` value so callers branch on it once instead of repeating the checks.
|
|
331
343
|
*
|
|
332
344
|
* A non-string is a parsed spec (`object`). A string is `inline` when it holds OpenAPI content,
|
|
333
345
|
* meaning it starts with `{` or `[`, spans multiple lines, or opens with a YAML `openapi:` or
|
|
334
|
-
* `swagger:` key. Otherwise a string is
|
|
346
|
+
* `swagger:` key. Otherwise a string is `git` when it starts with `git+`, a `url` when it parses as
|
|
347
|
+
* one, or a `file` path.
|
|
335
348
|
*/
|
|
336
349
|
export declare function getInputKind(input: NonNullable<Input>): InputKind;
|
|
337
350
|
//#endregion
|
|
@@ -365,7 +378,7 @@ export declare function resolveCacheDir(root: string): string;
|
|
|
365
378
|
* await cache.writeItem('output-manifest.json', JSON.stringify(entries))
|
|
366
379
|
* ```
|
|
367
380
|
*/
|
|
368
|
-
export declare const cacheStorage: (options?: CacheStorageOptions | undefined) => Storage;
|
|
381
|
+
export declare const cacheStorage: (options?: CacheStorageOptions | undefined) => import("@kubb/kit").Storage;
|
|
369
382
|
//#endregion
|
|
370
383
|
//#region src/storages/fsStorage.d.ts
|
|
371
384
|
/**
|
|
@@ -394,7 +407,7 @@ export declare const cacheStorage: (options?: CacheStorageOptions | undefined) =
|
|
|
394
407
|
* })
|
|
395
408
|
* ```
|
|
396
409
|
*/
|
|
397
|
-
export declare const fsStorage: (options?: Record<string, never> | undefined) => Storage;
|
|
410
|
+
export declare const fsStorage: (options?: Record<string, never> | undefined) => import("@kubb/kit").Storage;
|
|
398
411
|
//#endregion
|
|
399
412
|
//#region src/storages/kubbStorage.d.ts
|
|
400
413
|
type KubbStorageOptions = {
|
|
@@ -443,7 +456,7 @@ export declare function kubbStorage({ base }?: KubbStorageOptions): import("unst
|
|
|
443
456
|
* })
|
|
444
457
|
* ```
|
|
445
458
|
*/
|
|
446
|
-
export declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
|
|
459
|
+
export declare const memoryStorage: (options?: Record<string, never> | undefined) => import("@kubb/kit").Storage;
|
|
447
460
|
//#endregion
|
|
448
461
|
//#region src/manifest.d.ts
|
|
449
462
|
/** A value that survives `JSON.stringify` and `JSON.parse` unchanged. */
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as getElapsedMs, C as useKubb, D as resolveMeta, E as defineExtension, F as read, I as rm$1, L as write, M as existsSync$1, N as isPathInside, O as Diagnostics, P as listFiles, R as writeRaw, S as useConfig, T as checkCompatibility, _ as requirePlugin, b as setResolver, c as Resolver, d as assertPluginOption, f as definePlugin, g as kubbContext, h as injectFile, j as inParallel, k as formatMs, l as getInputKind, m as addMacro, n as KubbDriver, o as _usingCtx, p as addGenerator, s as createResolver, t as Hookable, u as checkoutGitInput, v as setMacros, w as useOptions, x as tryUseKubb, y as setOptions, z as toError } from "./Hookable-Cqx0g2T-.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { isValid } from "verkit";
|
|
4
4
|
import process$1 from "node:process";
|
|
@@ -7,8 +7,8 @@ import { readFile } from "node:fs/promises";
|
|
|
7
7
|
import path, { isAbsolute, join, relative, resolve } from "node:path";
|
|
8
8
|
import { chmodSync, existsSync, mkdirSync } from "node:fs";
|
|
9
9
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
10
|
-
import { hash, randomUUID } from "node:crypto";
|
|
11
10
|
import { homedir, tmpdir } from "node:os";
|
|
11
|
+
import { hash, randomUUID } from "node:crypto";
|
|
12
12
|
import { createInterface } from "node:readline";
|
|
13
13
|
import { createStorage as createStorage$1 } from "unstorage";
|
|
14
14
|
import fsDriver from "unstorage/drivers/fs";
|
|
@@ -313,7 +313,7 @@ const fsStorage = createStorage(() => ({
|
|
|
313
313
|
});
|
|
314
314
|
},
|
|
315
315
|
async removeItem(key) {
|
|
316
|
-
await rm(resolve(key), { force: true });
|
|
316
|
+
await rm$1(resolve(key), { force: true });
|
|
317
317
|
},
|
|
318
318
|
async readKeys(base) {
|
|
319
319
|
const resolvedBase = resolve(base ?? process.cwd());
|
|
@@ -325,7 +325,7 @@ const fsStorage = createStorage(() => ({
|
|
|
325
325
|
},
|
|
326
326
|
async empty(base) {
|
|
327
327
|
if (!base) return;
|
|
328
|
-
await rm(resolve(base), {
|
|
328
|
+
await rm$1(resolve(base), {
|
|
329
329
|
recursive: true,
|
|
330
330
|
force: true
|
|
331
331
|
});
|
|
@@ -1384,6 +1384,6 @@ async function readInstalledPackages({ root, packages = [], resolveFrom = [] })
|
|
|
1384
1384
|
}));
|
|
1385
1385
|
}
|
|
1386
1386
|
//#endregion
|
|
1387
|
-
export { Diagnostics, Hookable, KubbDriver, Resolver, addGenerator, addMacro, assertPluginOption, cacheStorage, checkCompatibility, cliReporter, createAdapter, createCliReporter, createKubb, createOutputManifest, createRenderer, createReporter, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, htmlReporter, injectFile, isExtensionManifest, isPackageName, isRegistryEntry, jsonReporter, kubbContext, kubbStorage, logLevel, manifestProblems, memoryStorage, readInstalledPackages, requirePlugin, resolveCacheDir, resolveKubbDir, resolveMeta, runHook, runOutputPasses, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
|
|
1387
|
+
export { Diagnostics, Hookable, KubbDriver, Resolver, addGenerator, addMacro, assertPluginOption, cacheStorage, checkCompatibility, checkoutGitInput, cliReporter, createAdapter, createCliReporter, createKubb, createOutputManifest, createRenderer, createReporter, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, htmlReporter, injectFile, isExtensionManifest, isPackageName, isRegistryEntry, jsonReporter, kubbContext, kubbStorage, logLevel, manifestProblems, memoryStorage, readInstalledPackages, requirePlugin, resolveCacheDir, resolveKubbDir, resolveMeta, runHook, runOutputPasses, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
|
|
1388
1388
|
|
|
1389
1389
|
//# sourceMappingURL=index.js.map
|