@kubb/core 5.0.0-alpha.9 → 5.0.0-beta.10

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 (62) hide show
  1. package/README.md +13 -40
  2. package/dist/PluginDriver-Cu1Kj9S-.cjs +1075 -0
  3. package/dist/PluginDriver-Cu1Kj9S-.cjs.map +1 -0
  4. package/dist/PluginDriver-D8Z0Htid.js +978 -0
  5. package/dist/PluginDriver-D8Z0Htid.js.map +1 -0
  6. package/dist/createKubb-ALdb8lmq.d.ts +2082 -0
  7. package/dist/index.cjs +747 -1667
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +175 -269
  10. package/dist/index.js +734 -1638
  11. package/dist/index.js.map +1 -1
  12. package/dist/mocks.cjs +145 -0
  13. package/dist/mocks.cjs.map +1 -0
  14. package/dist/mocks.d.ts +80 -0
  15. package/dist/mocks.js +140 -0
  16. package/dist/mocks.js.map +1 -0
  17. package/package.json +47 -60
  18. package/src/FileManager.ts +115 -0
  19. package/src/FileProcessor.ts +86 -0
  20. package/src/PluginDriver.ts +355 -561
  21. package/src/constants.ts +21 -48
  22. package/src/createAdapter.ts +88 -5
  23. package/src/createKubb.ts +1266 -0
  24. package/src/createRenderer.ts +57 -0
  25. package/src/createStorage.ts +13 -1
  26. package/src/defineGenerator.ts +160 -119
  27. package/src/defineLogger.ts +46 -5
  28. package/src/defineMiddleware.ts +62 -0
  29. package/src/defineParser.ts +44 -0
  30. package/src/definePlugin.ts +379 -0
  31. package/src/defineResolver.ts +548 -25
  32. package/src/devtools.ts +22 -15
  33. package/src/index.ts +13 -15
  34. package/src/mocks.ts +177 -0
  35. package/src/storages/fsStorage.ts +13 -8
  36. package/src/storages/memoryStorage.ts +4 -2
  37. package/src/types.ts +40 -547
  38. package/dist/PluginDriver-BkFepPdm.d.ts +0 -1054
  39. package/dist/chunk-ByKO4r7w.cjs +0 -38
  40. package/dist/hooks.cjs +0 -103
  41. package/dist/hooks.cjs.map +0 -1
  42. package/dist/hooks.d.ts +0 -77
  43. package/dist/hooks.js +0 -98
  44. package/dist/hooks.js.map +0 -1
  45. package/src/Kubb.ts +0 -224
  46. package/src/build.ts +0 -418
  47. package/src/config.ts +0 -56
  48. package/src/createPlugin.ts +0 -28
  49. package/src/hooks/index.ts +0 -4
  50. package/src/hooks/useKubb.ts +0 -143
  51. package/src/hooks/useMode.ts +0 -11
  52. package/src/hooks/usePlugin.ts +0 -11
  53. package/src/hooks/usePluginDriver.ts +0 -11
  54. package/src/utils/FunctionParams.ts +0 -155
  55. package/src/utils/TreeNode.ts +0 -215
  56. package/src/utils/diagnostics.ts +0 -15
  57. package/src/utils/executeStrategies.ts +0 -81
  58. package/src/utils/formatters.ts +0 -56
  59. package/src/utils/getBarrelFiles.ts +0 -141
  60. package/src/utils/getConfigs.ts +0 -12
  61. package/src/utils/linters.ts +0 -25
  62. package/src/utils/packageJSON.ts +0 -61
@@ -0,0 +1,1075 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", {
5
+ value,
6
+ configurable: true
7
+ });
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+ //#endregion
27
+ let node_path = require("node:path");
28
+ node_path = __toESM(node_path, 1);
29
+ let _kubb_ast = require("@kubb/ast");
30
+ let fflate = require("fflate");
31
+ let tinyexec = require("tinyexec");
32
+ //#region ../../internals/utils/src/casing.ts
33
+ /**
34
+ * Shared implementation for camelCase and PascalCase conversion.
35
+ * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
36
+ * and capitalizes each word according to `pascal`.
37
+ *
38
+ * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
39
+ */
40
+ function toCamelOrPascal(text, pascal) {
41
+ return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
42
+ if (word.length > 1 && word === word.toUpperCase()) return word;
43
+ if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1);
44
+ return word.charAt(0).toUpperCase() + word.slice(1);
45
+ }).join("").replace(/[^a-zA-Z0-9]/g, "");
46
+ }
47
+ /**
48
+ * Splits `text` on `.` and applies `transformPart` to each segment.
49
+ * The last segment receives `isLast = true`, all earlier segments receive `false`.
50
+ * Segments are joined with `/` to form a file path.
51
+ *
52
+ * Only splits on dots followed by a letter so that version numbers
53
+ * embedded in operationIds (e.g. `v2025.0`) are kept intact.
54
+ *
55
+ * Empty segments are filtered before joining. They arise when the text starts with
56
+ * a dot followed immediately by a letter (e.g. `..Schema` splits into `['..', 'Schema']`
57
+ * and `'..'` transforms to an empty string). Without this filter the join would produce
58
+ * a leading `/`, which `path.resolve` would interpret as an absolute path, allowing
59
+ * generated files to escape the configured output directory.
60
+ */
61
+ function applyToFileParts(text, transformPart) {
62
+ const parts = text.split(/\.(?=[a-zA-Z])/);
63
+ return parts.map((part, i) => transformPart(part, i === parts.length - 1)).filter(Boolean).join("/");
64
+ }
65
+ /**
66
+ * Converts `text` to camelCase.
67
+ * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.
68
+ *
69
+ * @example
70
+ * camelCase('hello-world') // 'helloWorld'
71
+ * camelCase('pet.petId', { isFile: true }) // 'pet/petId'
72
+ */
73
+ function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
74
+ if (isFile) return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? {
75
+ prefix,
76
+ suffix
77
+ } : {}));
78
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
79
+ }
80
+ /**
81
+ * Converts `text` to PascalCase.
82
+ * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.
83
+ *
84
+ * @example
85
+ * pascalCase('hello-world') // 'HelloWorld'
86
+ * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'
87
+ */
88
+ function pascalCase(text, { isFile, prefix = "", suffix = "" } = {}) {
89
+ if (isFile) return applyToFileParts(text, (part, isLast) => isLast ? pascalCase(part, {
90
+ prefix,
91
+ suffix
92
+ }) : camelCase(part));
93
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
94
+ }
95
+ //#endregion
96
+ //#region src/constants.ts
97
+ /**
98
+ * Base URL for the Kubb Studio web app.
99
+ */
100
+ const DEFAULT_STUDIO_URL = "https://kubb.studio";
101
+ /**
102
+ * Default banner style written at the top of every generated file.
103
+ */
104
+ const DEFAULT_BANNER = "simple";
105
+ /**
106
+ * Default file-extension mapping used when no explicit mapping is configured.
107
+ */
108
+ const DEFAULT_EXTENSION = { ".ts": ".ts" };
109
+ /**
110
+ * Numeric log-level thresholds used internally to compare verbosity.
111
+ *
112
+ * Higher numbers are more verbose.
113
+ */
114
+ const logLevel = {
115
+ silent: Number.NEGATIVE_INFINITY,
116
+ error: 0,
117
+ warn: 1,
118
+ info: 3,
119
+ verbose: 4,
120
+ debug: 5
121
+ };
122
+ //#endregion
123
+ //#region src/definePlugin.ts
124
+ /**
125
+ * Wraps a factory function and returns a typed `Plugin` with lifecycle handlers grouped under `hooks`.
126
+ *
127
+ * Handlers live in a single `hooks` object (inspired by Astro integrations).
128
+ * All lifecycle events from `KubbHooks` are available for subscription.
129
+ *
130
+ * @note For real plugins, use a `PluginFactoryOptions` type parameter to get type-safe context in `kubb:plugin:setup`.
131
+ * Plugin names should follow the convention `plugin-<feature>` (e.g., `plugin-react-query`, `plugin-zod`).
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * import { definePlugin } from '@kubb/core'
136
+ *
137
+ * export const pluginTs = definePlugin((options: { prefix?: string } = {}) => ({
138
+ * name: 'plugin-ts',
139
+ * hooks: {
140
+ * 'kubb:plugin:setup'(ctx) {
141
+ * ctx.setResolver(resolverTs)
142
+ * },
143
+ * },
144
+ * }))
145
+ * ```
146
+ */
147
+ function definePlugin(factory) {
148
+ return (options) => factory(options ?? {});
149
+ }
150
+ /**
151
+ * Returns `'single'` when `fileOrFolder` has a file extension, `'split'` otherwise.
152
+ * Used to determine whether an output path targets a single file or a directory.
153
+ */
154
+ function getMode(fileOrFolder) {
155
+ if (!fileOrFolder) return "split";
156
+ return (0, node_path.extname)(fileOrFolder) ? "single" : "split";
157
+ }
158
+ //#endregion
159
+ //#region src/defineResolver.ts
160
+ const stringPatternCache = /* @__PURE__ */ new Map();
161
+ function testPattern(value, pattern) {
162
+ if (typeof pattern === "string") {
163
+ let regex = stringPatternCache.get(pattern);
164
+ if (!regex) {
165
+ regex = new RegExp(pattern);
166
+ stringPatternCache.set(pattern, regex);
167
+ }
168
+ return regex.test(value);
169
+ }
170
+ return value.match(pattern) !== null;
171
+ }
172
+ /**
173
+ * Checks if an operation matches a pattern for a given filter type (`tag`, `operationId`, `path`, `method`).
174
+ */
175
+ function matchesOperationPattern(node, type, pattern) {
176
+ switch (type) {
177
+ case "tag": return node.tags.some((tag) => testPattern(tag, pattern));
178
+ case "operationId": return testPattern(node.operationId, pattern);
179
+ case "path": return testPattern(node.path, pattern);
180
+ case "method": return testPattern(node.method.toLowerCase(), pattern);
181
+ case "contentType": return node.requestBody?.content?.some((c) => testPattern(c.contentType, pattern)) ?? false;
182
+ default: return false;
183
+ }
184
+ }
185
+ /**
186
+ * Checks if a schema matches a pattern for a given filter type (`schemaName`).
187
+ *
188
+ * Returns `null` when the filter type doesn't apply to schemas.
189
+ */
190
+ function matchesSchemaPattern(node, type, pattern) {
191
+ switch (type) {
192
+ case "schemaName": return node.name ? testPattern(node.name, pattern) : false;
193
+ default: return null;
194
+ }
195
+ }
196
+ /**
197
+ * Default name resolver used by `defineResolver`.
198
+ *
199
+ * - `camelCase` for `function` and `file` types.
200
+ * - `PascalCase` for `type`.
201
+ * - `camelCase` for everything else.
202
+ */
203
+ function defaultResolver(name, type) {
204
+ let resolvedName = camelCase(name);
205
+ if (type === "file" || type === "function") resolvedName = camelCase(name, { isFile: type === "file" });
206
+ if (type === "type") resolvedName = pascalCase(name);
207
+ return resolvedName;
208
+ }
209
+ /**
210
+ * Default option resolver — applies include/exclude filters and merges matching override options.
211
+ *
212
+ * Returns `null` when the node is filtered out by an `exclude` rule or not matched by any `include` rule.
213
+ *
214
+ * @example Include/exclude filtering
215
+ * ```ts
216
+ * const options = defaultResolveOptions(operationNode, {
217
+ * options: { output: 'types' },
218
+ * exclude: [{ type: 'tag', pattern: 'internal' }],
219
+ * })
220
+ * // → null when node has tag 'internal'
221
+ * ```
222
+ *
223
+ * @example Override merging
224
+ * ```ts
225
+ * const options = defaultResolveOptions(operationNode, {
226
+ * options: { enumType: 'asConst' },
227
+ * override: [{ type: 'operationId', pattern: 'listPets', options: { enumType: 'enum' } }],
228
+ * })
229
+ * // → { enumType: 'enum' } when operationId matches
230
+ * ```
231
+ */
232
+ function defaultResolveOptions(node, { options, exclude = [], include, override = [] }) {
233
+ if ((0, _kubb_ast.isOperationNode)(node)) {
234
+ if (exclude.some(({ type, pattern }) => matchesOperationPattern(node, type, pattern))) return null;
235
+ if (include && !include.some(({ type, pattern }) => matchesOperationPattern(node, type, pattern))) return null;
236
+ const overrideOptions = override.find(({ type, pattern }) => matchesOperationPattern(node, type, pattern))?.options;
237
+ return {
238
+ ...options,
239
+ ...overrideOptions
240
+ };
241
+ }
242
+ if ((0, _kubb_ast.isSchemaNode)(node)) {
243
+ if (exclude.some(({ type, pattern }) => matchesSchemaPattern(node, type, pattern) === true)) return null;
244
+ if (include) {
245
+ const applicable = include.map(({ type, pattern }) => matchesSchemaPattern(node, type, pattern)).filter((r) => r !== null);
246
+ if (applicable.length > 0 && !applicable.includes(true)) return null;
247
+ }
248
+ const overrideOptions = override.find(({ type, pattern }) => matchesSchemaPattern(node, type, pattern) === true)?.options;
249
+ return {
250
+ ...options,
251
+ ...overrideOptions
252
+ };
253
+ }
254
+ return options;
255
+ }
256
+ /**
257
+ * Default path resolver used by `defineResolver`.
258
+ *
259
+ * - Returns the output directory in `single` mode.
260
+ * - Resolves into a tag- or path-based subdirectory when `group` and a `tag`/`path` value are provided.
261
+ * - Falls back to a flat `output/baseName` path otherwise.
262
+ *
263
+ * A custom `group.name` function overrides the default subdirectory naming.
264
+ * For `tag` groups the default is `${camelCase(tag)}Controller`.
265
+ * For `path` groups the default is the first path segment after `/`.
266
+ *
267
+ * @example Flat output
268
+ * ```ts
269
+ * defaultResolvePath({ baseName: 'petTypes.ts' }, { root: '/src', output: { path: 'types' } })
270
+ * // → '/src/types/petTypes.ts'
271
+ * ```
272
+ *
273
+ * @example Tag-based grouping
274
+ * ```ts
275
+ * defaultResolvePath(
276
+ * { baseName: 'petTypes.ts', tag: 'pets' },
277
+ * { root: '/src', output: { path: 'types' }, group: { type: 'tag' } },
278
+ * )
279
+ * // → '/src/types/petsController/petTypes.ts'
280
+ * ```
281
+ *
282
+ * @example Path-based grouping
283
+ * ```ts
284
+ * defaultResolvePath(
285
+ * { baseName: 'petTypes.ts', path: '/pets/list' },
286
+ * { root: '/src', output: { path: 'types' }, group: { type: 'path' } },
287
+ * )
288
+ * // → '/src/types/pets/petTypes.ts'
289
+ * ```
290
+ *
291
+ * @example Single-file mode
292
+ * ```ts
293
+ * defaultResolvePath(
294
+ * { baseName: 'petTypes.ts', pathMode: 'single' },
295
+ * { root: '/src', output: { path: 'types' } },
296
+ * )
297
+ * // → '/src/types'
298
+ * ```
299
+ */
300
+ function defaultResolvePath({ baseName, pathMode, tag, path: groupPath }, { root, output, group }) {
301
+ if ((pathMode ?? getMode(node_path.default.resolve(root, output.path))) === "single") return node_path.default.resolve(root, output.path);
302
+ let result;
303
+ if (group && (groupPath || tag)) {
304
+ const groupValue = group.type === "path" ? groupPath : tag;
305
+ const defaultName = group.type === "tag" ? ({ group: g }) => `${camelCase(g)}Controller` : ({ group: g }) => {
306
+ const segment = g.split("/").filter((s) => s !== "" && s !== "." && s !== "..")[0];
307
+ return segment ? camelCase(segment) : "";
308
+ };
309
+ const resolveName = group.name ?? defaultName;
310
+ result = node_path.default.resolve(root, output.path, resolveName({ group: groupValue }), baseName);
311
+ } else result = node_path.default.resolve(root, output.path, baseName);
312
+ const outputDir = node_path.default.resolve(root, output.path);
313
+ const outputDirWithSep = outputDir.endsWith(node_path.default.sep) ? outputDir : `${outputDir}${node_path.default.sep}`;
314
+ if (result !== outputDir && !result.startsWith(outputDirWithSep)) throw new Error(`[Kubb] Resolved path "${result}" is outside the output directory "${outputDir}". This may indicate a path traversal attempt in the OpenAPI specification or a misconfigured group.name function.`);
315
+ return result;
316
+ }
317
+ /**
318
+ * Default file resolver used by `defineResolver`.
319
+ *
320
+ * Resolves a `FileNode` by combining name resolution (`resolver.default`) with
321
+ * path resolution (`resolver.resolvePath`). The resolved file always has empty
322
+ * `sources`, `imports`, and `exports` arrays — consumers populate those separately.
323
+ *
324
+ * In `single` mode the name is omitted and the file sits directly in the output directory.
325
+ *
326
+ * @example Resolve a schema file
327
+ * ```ts
328
+ * const file = defaultResolveFile.call(
329
+ * resolver,
330
+ * { name: 'pet', extname: '.ts' },
331
+ * { root: '/src', output: { path: 'types' } },
332
+ * )
333
+ * // → { baseName: 'pet.ts', path: '/src/types/pet.ts', sources: [], ... }
334
+ * ```
335
+ *
336
+ * @example Resolve an operation file with tag grouping
337
+ * ```ts
338
+ * const file = defaultResolveFile.call(
339
+ * resolver,
340
+ * { name: 'listPets', extname: '.ts', tag: 'pets' },
341
+ * { root: '/src', output: { path: 'types' }, group: { type: 'tag' } },
342
+ * )
343
+ * // → { baseName: 'listPets.ts', path: '/src/types/petsController/listPets.ts', ... }
344
+ * ```
345
+ */
346
+ function defaultResolveFile({ name, extname, tag, path: groupPath }, context) {
347
+ const pathMode = getMode(node_path.default.resolve(context.root, context.output.path));
348
+ const baseName = `${pathMode === "single" ? "" : this.default(name, "file")}${extname}`;
349
+ const filePath = this.resolvePath({
350
+ baseName,
351
+ pathMode,
352
+ tag,
353
+ path: groupPath
354
+ }, context);
355
+ return (0, _kubb_ast.createFile)({
356
+ path: filePath,
357
+ baseName: node_path.default.basename(filePath),
358
+ meta: { pluginName: this.pluginName },
359
+ sources: [],
360
+ imports: [],
361
+ exports: []
362
+ });
363
+ }
364
+ /**
365
+ * Generates the default "Generated by Kubb" banner from config and optional node metadata.
366
+ */
367
+ function buildDefaultBanner({ title, description, version, config }) {
368
+ try {
369
+ let source = "";
370
+ if (Array.isArray(config.input)) {
371
+ const first = config.input[0];
372
+ if (first && "path" in first) source = node_path.default.basename(first.path);
373
+ } else if (config.input && "path" in config.input) source = node_path.default.basename(config.input.path);
374
+ else if (config.input && "data" in config.input) source = "text content";
375
+ let banner = "/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n";
376
+ if (config.output.defaultBanner === "simple") {
377
+ banner += "*/\n";
378
+ return banner;
379
+ }
380
+ if (source) banner += `* Source: ${source}\n`;
381
+ if (title) banner += `* Title: ${title}\n`;
382
+ if (description) {
383
+ const formattedDescription = description.replace(/\n/gm, "\n* ");
384
+ banner += `* Description: ${formattedDescription}\n`;
385
+ }
386
+ if (version) banner += `* OpenAPI spec version: ${version}\n`;
387
+ banner += "*/\n";
388
+ return banner;
389
+ } catch (_error) {
390
+ return "/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/";
391
+ }
392
+ }
393
+ /**
394
+ * Default banner resolver — returns the banner string for a generated file.
395
+ *
396
+ * A user-supplied `output.banner` overrides the default Kubb "Generated by Kubb" notice.
397
+ * When no `output.banner` is set, the Kubb notice is used (including `title` and `version`
398
+ * from the OAS spec when a `node` is provided).
399
+ *
400
+ * - When `output.banner` is a function and `node` is provided, returns `output.banner(node)`.
401
+ * - When `output.banner` is a function and `node` is absent, falls back to the Kubb notice.
402
+ * - When `output.banner` is a string, returns it directly.
403
+ * - When `config.output.defaultBanner` is `false`, returns `undefined`.
404
+ * - Otherwise returns the Kubb "Generated by Kubb" notice.
405
+ *
406
+ * @example String banner overrides default
407
+ * ```ts
408
+ * defaultResolveBanner(undefined, { output: { banner: '// my banner' }, config })
409
+ * // → '// my banner'
410
+ * ```
411
+ *
412
+ * @example Function banner with node
413
+ * ```ts
414
+ * defaultResolveBanner(inputNode, { output: { banner: (node) => `// v${node.version}` }, config })
415
+ * // → '// v3.0.0'
416
+ * ```
417
+ *
418
+ * @example No user banner — Kubb notice with OAS metadata
419
+ * ```ts
420
+ * defaultResolveBanner(inputNode, { config })
421
+ * // → '/** Generated by Kubb ... Title: Pet Store ... *\/'
422
+ * ```
423
+ *
424
+ * @example Disabled default banner
425
+ * ```ts
426
+ * defaultResolveBanner(undefined, { config: { output: { defaultBanner: false }, ...config } })
427
+ * // → undefined
428
+ * ```
429
+ */
430
+ function defaultResolveBanner(node, { output, config }) {
431
+ if (typeof output?.banner === "function") return output.banner(node);
432
+ if (typeof output?.banner === "string") return output.banner;
433
+ if (config.output.defaultBanner === false) return;
434
+ return buildDefaultBanner({
435
+ title: node?.meta?.title,
436
+ version: node?.meta?.version,
437
+ config
438
+ });
439
+ }
440
+ /**
441
+ * Default footer resolver — returns the footer string for a generated file.
442
+ *
443
+ * - When `output.footer` is a function and `node` is provided, calls it with the node.
444
+ * - When `output.footer` is a function and `node` is absent, returns `undefined`.
445
+ * - When `output.footer` is a string, returns it directly.
446
+ * - Otherwise returns `undefined`.
447
+ *
448
+ * @example String footer
449
+ * ```ts
450
+ * defaultResolveFooter(undefined, { output: { footer: '// end of file' }, config })
451
+ * // → '// end of file'
452
+ * ```
453
+ *
454
+ * @example Function footer with node
455
+ * ```ts
456
+ * defaultResolveFooter(inputNode, { output: { footer: (node) => `// ${node.title}` }, config })
457
+ * // → '// Pet Store'
458
+ * ```
459
+ */
460
+ function defaultResolveFooter(node, { output }) {
461
+ if (typeof output?.footer === "function") return node ? output.footer(node) : void 0;
462
+ if (typeof output?.footer === "string") return output.footer;
463
+ }
464
+ /**
465
+ * Defines a resolver for a plugin, injecting built-in defaults for name casing,
466
+ * include/exclude/override filtering, path resolution, and file construction.
467
+ *
468
+ * All four defaults can be overridden by providing them in the builder function:
469
+ * - `default` — name casing strategy (camelCase / PascalCase)
470
+ * - `resolveOptions` — include/exclude/override filtering
471
+ * - `resolvePath` — output path computation
472
+ * - `resolveFile` — full `FileNode` construction
473
+ *
474
+ * Methods in the returned object can call sibling resolver methods via `this`.
475
+ *
476
+ * @example Basic resolver with naming helpers
477
+ * ```ts
478
+ * export const resolver = defineResolver<PluginTs>(() => ({
479
+ * name: 'default',
480
+ * resolveName(node) {
481
+ * return this.default(node.name, 'function')
482
+ * },
483
+ * resolveTypedName(node) {
484
+ * return this.default(node.name, 'type')
485
+ * },
486
+ * }))
487
+ * ```
488
+ *
489
+ * @example Override resolvePath for a custom output structure
490
+ * ```ts
491
+ * export const resolver = defineResolver<PluginTs>(() => ({
492
+ * name: 'custom',
493
+ * resolvePath({ baseName }, { root, output }) {
494
+ * return path.resolve(root, output.path, 'generated', baseName)
495
+ * },
496
+ * }))
497
+ * ```
498
+ *
499
+ * @example Use this.default inside a helper
500
+ * ```ts
501
+ * export const resolver = defineResolver<PluginTs>(() => ({
502
+ * name: 'default',
503
+ * resolveParamName(node, param) {
504
+ * return this.default(`${node.operationId} ${param.in} ${param.name}`, 'type')
505
+ * },
506
+ * }))
507
+ * ```
508
+ */
509
+ function defineResolver(build) {
510
+ let resolver;
511
+ resolver = {
512
+ default: defaultResolver,
513
+ resolveOptions: defaultResolveOptions,
514
+ resolvePath: defaultResolvePath,
515
+ resolveFile: (params, context) => defaultResolveFile.call(resolver, params, context),
516
+ resolveBanner: defaultResolveBanner,
517
+ resolveFooter: defaultResolveFooter,
518
+ ...build()
519
+ };
520
+ return resolver;
521
+ }
522
+ //#endregion
523
+ //#region src/devtools.ts
524
+ /**
525
+ * Encodes an `InputNode` as a compressed, URL-safe string.
526
+ *
527
+ * The JSON representation is deflate-compressed with {@link deflateSync} before
528
+ * base64url encoding, which typically reduces payload size by 70–80 % and
529
+ * keeps URLs well within browser and server path-length limits.
530
+ *
531
+ * Use {@link decodeAst} to reverse.
532
+ */
533
+ function encodeAst(input) {
534
+ const compressed = (0, fflate.deflateSync)(new TextEncoder().encode(JSON.stringify(input)));
535
+ return Buffer.from(compressed).toString("base64url");
536
+ }
537
+ /**
538
+ * Constructs the Kubb Studio URL for the given `InputNode`.
539
+ * When `options.ast` is `true`, navigates to the AST inspector (`/ast`).
540
+ * The `input` is encoded and attached as the `?root=` query parameter so Studio
541
+ * can decode and render it without a round-trip to any server.
542
+ */
543
+ function getStudioUrl(input, studioUrl, options = {}) {
544
+ return `${studioUrl.replace(/\/$/, "")}${options.ast ? "/ast" : ""}?root=${encodeAst(input)}`;
545
+ }
546
+ /**
547
+ * Opens the Kubb Studio URL for the given `InputNode` in the default browser —
548
+ *
549
+ * Falls back to printing the URL if the browser cannot be launched.
550
+ */
551
+ async function openInStudio(input, studioUrl, options = {}) {
552
+ const url = getStudioUrl(input, studioUrl, options);
553
+ const cmd = process.platform === "win32" ? "cmd" : process.platform === "darwin" ? "open" : "xdg-open";
554
+ const args = process.platform === "win32" ? [
555
+ "/c",
556
+ "start",
557
+ "",
558
+ url
559
+ ] : [url];
560
+ try {
561
+ await (0, tinyexec.x)(cmd, args);
562
+ } catch {
563
+ console.log(`\n ${url}\n`);
564
+ }
565
+ }
566
+ //#endregion
567
+ //#region src/FileManager.ts
568
+ function mergeFile(a, b) {
569
+ return {
570
+ ...a,
571
+ banner: b.banner,
572
+ footer: b.footer,
573
+ sources: [...a.sources || [], ...b.sources || []],
574
+ imports: [...a.imports || [], ...b.imports || []],
575
+ exports: [...a.exports || [], ...b.exports || []]
576
+ };
577
+ }
578
+ /**
579
+ * Collapses a list of files so that duplicates sharing the same `path` are merged
580
+ * in arrival order. Keeps the original order of first occurrence.
581
+ */
582
+ function mergeFilesByPath(files) {
583
+ const merged = /* @__PURE__ */ new Map();
584
+ for (const file of files) {
585
+ const existing = merged.get(file.path);
586
+ merged.set(file.path, existing ? mergeFile(existing, file) : file);
587
+ }
588
+ return merged;
589
+ }
590
+ /**
591
+ * In-memory file store for generated files.
592
+ *
593
+ * Files with the same `path` are merged — sources, imports, and exports are concatenated.
594
+ * The `files` getter returns all stored files sorted by path length (shortest first).
595
+ *
596
+ * @example
597
+ * ```ts
598
+ * import { FileManager } from '@kubb/core'
599
+ *
600
+ * const manager = new FileManager()
601
+ * manager.upsert(myFile)
602
+ * console.log(manager.files) // all stored files
603
+ * ```
604
+ */
605
+ var FileManager = class {
606
+ #cache = /* @__PURE__ */ new Map();
607
+ #filesCache = null;
608
+ /**
609
+ * Adds one or more files. Incoming files with the same path are merged
610
+ * (sources/imports/exports concatenated), but existing cache entries are
611
+ * replaced — use {@link upsert} when you want to merge into the cache too.
612
+ */
613
+ add(...files) {
614
+ return this.#store(files, false);
615
+ }
616
+ /**
617
+ * Adds or merges one or more files.
618
+ * If a file with the same path already exists in the cache, its
619
+ * sources/imports/exports are merged into the incoming file.
620
+ */
621
+ upsert(...files) {
622
+ return this.#store(files, true);
623
+ }
624
+ #store(files, mergeExisting) {
625
+ const resolvedFiles = [];
626
+ for (const file of mergeFilesByPath(files).values()) {
627
+ const existing = mergeExisting ? this.#cache.get(file.path) : void 0;
628
+ const resolvedFile = (0, _kubb_ast.createFile)(existing ? mergeFile(existing, file) : file);
629
+ this.#cache.set(resolvedFile.path, resolvedFile);
630
+ resolvedFiles.push(resolvedFile);
631
+ }
632
+ this.#filesCache = null;
633
+ return resolvedFiles;
634
+ }
635
+ getByPath(path) {
636
+ return this.#cache.get(path) ?? null;
637
+ }
638
+ deleteByPath(path) {
639
+ this.#cache.delete(path);
640
+ this.#filesCache = null;
641
+ }
642
+ clear() {
643
+ this.#cache.clear();
644
+ this.#filesCache = null;
645
+ }
646
+ /**
647
+ * All stored files, sorted by path length (shorter paths first).
648
+ */
649
+ get files() {
650
+ if (this.#filesCache) return this.#filesCache;
651
+ this.#filesCache = [...this.#cache.values()].sort((a, b) => {
652
+ const lenDiff = a.path.length - b.path.length;
653
+ if (lenDiff !== 0) return lenDiff;
654
+ const aIsIndex = a.path.endsWith("/index.ts") || a.path === "index.ts";
655
+ const bIsIndex = b.path.endsWith("/index.ts") || b.path === "index.ts";
656
+ if (aIsIndex && !bIsIndex) return 1;
657
+ if (!aIsIndex && bIsIndex) return -1;
658
+ return 0;
659
+ });
660
+ return this.#filesCache;
661
+ }
662
+ };
663
+ //#endregion
664
+ //#region src/PluginDriver.ts
665
+ function enforceOrder(enforce) {
666
+ return enforce === "pre" ? -1 : enforce === "post" ? 1 : 0;
667
+ }
668
+ var PluginDriver = class PluginDriver {
669
+ config;
670
+ options;
671
+ /**
672
+ * Returns `'single'` when `fileOrFolder` has a file extension, `'split'` otherwise.
673
+ *
674
+ * @example
675
+ * ```ts
676
+ * PluginDriver.getMode('src/gen/types.ts') // 'single'
677
+ * PluginDriver.getMode('src/gen/types') // 'split'
678
+ * ```
679
+ */
680
+ static getMode(fileOrFolder) {
681
+ return getMode(fileOrFolder);
682
+ }
683
+ /**
684
+ * The universal `@kubb/ast` `InputNode` produced by the adapter, set by
685
+ * the build pipeline after the adapter's `parse()` resolves.
686
+ */
687
+ inputNode = void 0;
688
+ adapter = void 0;
689
+ #studioIsOpen = false;
690
+ /**
691
+ * Central file store for all generated files.
692
+ * Plugins should use `this.addFile()` / `this.upsertFile()` (via their context) to
693
+ * add files; this property gives direct read/write access when needed.
694
+ */
695
+ fileManager = new FileManager();
696
+ plugins = /* @__PURE__ */ new Map();
697
+ /**
698
+ * Tracks which plugins have generators registered via `addGenerator()` (event-based path).
699
+ * Used by the build loop to decide whether to emit generator events for a given plugin.
700
+ */
701
+ #pluginsWithEventGenerators = /* @__PURE__ */ new Set();
702
+ #resolvers = /* @__PURE__ */ new Map();
703
+ #defaultResolvers = /* @__PURE__ */ new Map();
704
+ #hookListeners = /* @__PURE__ */ new Map();
705
+ constructor(config, options) {
706
+ this.config = config;
707
+ this.options = options;
708
+ config.plugins.map((rawPlugin) => this.#normalizePlugin(rawPlugin)).filter((plugin) => {
709
+ if (typeof plugin.apply === "function") return plugin.apply(config);
710
+ return true;
711
+ }).sort((a, b) => {
712
+ if (b.dependencies?.includes(a.name)) return -1;
713
+ if (a.dependencies?.includes(b.name)) return 1;
714
+ return enforceOrder(a.enforce) - enforceOrder(b.enforce);
715
+ }).forEach((plugin) => {
716
+ this.plugins.set(plugin.name, plugin);
717
+ });
718
+ }
719
+ get hooks() {
720
+ return this.options.hooks;
721
+ }
722
+ /**
723
+ * Creates an `NormalizedPlugin` from a hook-style plugin and registers
724
+ * its lifecycle handlers on the `AsyncEventEmitter`.
725
+ */
726
+ #normalizePlugin(hookPlugin) {
727
+ const normalizedPlugin = {
728
+ name: hookPlugin.name,
729
+ dependencies: hookPlugin.dependencies,
730
+ enforce: hookPlugin.enforce,
731
+ options: {
732
+ output: { path: "." },
733
+ exclude: [],
734
+ override: []
735
+ }
736
+ };
737
+ this.registerPluginHooks(hookPlugin, normalizedPlugin);
738
+ return normalizedPlugin;
739
+ }
740
+ /**
741
+ * Registers a hook-style plugin's lifecycle handlers on the shared `AsyncEventEmitter`.
742
+ *
743
+ * For `kubb:plugin:setup`, the registered listener wraps the globally emitted context with a
744
+ * plugin-specific one so that `addGenerator`, `setResolver`, `setTransformer`, and
745
+ * `setRenderer` all target the correct `normalizedPlugin` entry in the plugins map.
746
+ *
747
+ * All other hooks are iterated and registered directly as pass-through listeners.
748
+ * Any event key present in the global `KubbHooks` interface can be subscribed to.
749
+ *
750
+ * External tooling can subscribe to any of these events via `hooks.on(...)` to observe
751
+ * the plugin lifecycle without modifying plugin behavior.
752
+ *
753
+ * @internal
754
+ */
755
+ registerPluginHooks(hookPlugin, normalizedPlugin) {
756
+ const { hooks } = hookPlugin;
757
+ if (!hooks) return;
758
+ if (hooks["kubb:plugin:setup"]) {
759
+ const setupHandler = (globalCtx) => {
760
+ const pluginCtx = {
761
+ ...globalCtx,
762
+ options: hookPlugin.options ?? {},
763
+ addGenerator: (gen) => {
764
+ this.registerGenerator(normalizedPlugin.name, gen);
765
+ },
766
+ setResolver: (resolver) => {
767
+ this.setPluginResolver(normalizedPlugin.name, resolver);
768
+ },
769
+ setTransformer: (visitor) => {
770
+ normalizedPlugin.transformer = visitor;
771
+ },
772
+ setRenderer: (renderer) => {
773
+ normalizedPlugin.renderer = renderer;
774
+ },
775
+ setOptions: (opts) => {
776
+ normalizedPlugin.options = {
777
+ ...normalizedPlugin.options,
778
+ ...opts
779
+ };
780
+ },
781
+ injectFile: (userFileNode) => {
782
+ this.fileManager.add((0, _kubb_ast.createFile)(userFileNode));
783
+ }
784
+ };
785
+ return hooks["kubb:plugin:setup"](pluginCtx);
786
+ };
787
+ this.hooks.on("kubb:plugin:setup", setupHandler);
788
+ this.#trackHookListener("kubb:plugin:setup", setupHandler);
789
+ }
790
+ for (const [event, handler] of Object.entries(hooks)) {
791
+ if (event === "kubb:plugin:setup" || !handler) continue;
792
+ this.hooks.on(event, handler);
793
+ this.#trackHookListener(event, handler);
794
+ }
795
+ }
796
+ /**
797
+ * Emits the `kubb:plugin:setup` event so that all registered hook-style plugin listeners
798
+ * can configure generators, resolvers, transformers and renderers before `buildStart` runs.
799
+ *
800
+ * Call this once from `safeBuild` before the plugin execution loop begins.
801
+ */
802
+ async emitSetupHooks() {
803
+ const noop = () => {};
804
+ await this.hooks.emit("kubb:plugin:setup", {
805
+ config: this.config,
806
+ options: {},
807
+ addGenerator: noop,
808
+ setResolver: noop,
809
+ setTransformer: noop,
810
+ setRenderer: noop,
811
+ setOptions: noop,
812
+ injectFile: noop,
813
+ updateConfig: noop
814
+ });
815
+ }
816
+ /**
817
+ * Registers a generator for the given plugin on the shared event emitter.
818
+ *
819
+ * The generator's `schema`, `operation`, and `operations` methods are registered as
820
+ * listeners on `kubb:generate:schema`, `kubb:generate:operation`, and `kubb:generate:operations`
821
+ * respectively. Each listener is scoped to the owning plugin via a `ctx.plugin.name` check
822
+ * so that generators from different plugins do not cross-fire.
823
+ *
824
+ * The renderer resolution chain is: `generator.renderer → plugin.renderer → config.renderer`.
825
+ * Set `generator.renderer = null` to explicitly opt out of rendering even when the plugin
826
+ * declares a renderer.
827
+ *
828
+ * Call this method inside `addGenerator()` (in `kubb:plugin:setup`) to wire up a generator.
829
+ */
830
+ registerGenerator(pluginName, gen) {
831
+ const resolveRenderer = () => {
832
+ const plugin = this.plugins.get(pluginName);
833
+ return gen.renderer === null ? void 0 : gen.renderer ?? plugin?.renderer ?? this.config.renderer;
834
+ };
835
+ if (gen.schema) {
836
+ const schemaHandler = async (node, ctx) => {
837
+ if (ctx.plugin.name !== pluginName) return;
838
+ await applyHookResult(await gen.schema(node, ctx), this, resolveRenderer());
839
+ };
840
+ this.hooks.on("kubb:generate:schema", schemaHandler);
841
+ this.#trackHookListener("kubb:generate:schema", schemaHandler);
842
+ }
843
+ if (gen.operation) {
844
+ const operationHandler = async (node, ctx) => {
845
+ if (ctx.plugin.name !== pluginName) return;
846
+ await applyHookResult(await gen.operation(node, ctx), this, resolveRenderer());
847
+ };
848
+ this.hooks.on("kubb:generate:operation", operationHandler);
849
+ this.#trackHookListener("kubb:generate:operation", operationHandler);
850
+ }
851
+ if (gen.operations) {
852
+ const operationsHandler = async (nodes, ctx) => {
853
+ if (ctx.plugin.name !== pluginName) return;
854
+ await applyHookResult(await gen.operations(nodes, ctx), this, resolveRenderer());
855
+ };
856
+ this.hooks.on("kubb:generate:operations", operationsHandler);
857
+ this.#trackHookListener("kubb:generate:operations", operationsHandler);
858
+ }
859
+ this.#pluginsWithEventGenerators.add(pluginName);
860
+ }
861
+ /**
862
+ * Returns `true` when at least one generator was registered for the given plugin
863
+ * via `addGenerator()` in `kubb:plugin:setup` (event-based path).
864
+ *
865
+ * Used by the build loop to decide whether to walk the AST and emit generator events
866
+ * for a plugin that has no static `plugin.generators`.
867
+ */
868
+ hasRegisteredGenerators(pluginName) {
869
+ return this.#pluginsWithEventGenerators.has(pluginName);
870
+ }
871
+ /**
872
+ * Unregisters all plugin lifecycle listeners from the shared event emitter.
873
+ * Called at the end of a build to prevent listener leaks across repeated builds.
874
+ *
875
+ * @internal
876
+ */
877
+ dispose() {
878
+ for (const [event, handlers] of this.#hookListeners) for (const handler of handlers) this.hooks.off(event, handler);
879
+ this.#hookListeners.clear();
880
+ this.#pluginsWithEventGenerators.clear();
881
+ }
882
+ #trackHookListener(event, handler) {
883
+ let handlers = this.#hookListeners.get(event);
884
+ if (!handlers) {
885
+ handlers = /* @__PURE__ */ new Set();
886
+ this.#hookListeners.set(event, handlers);
887
+ }
888
+ handlers.add(handler);
889
+ }
890
+ #createDefaultResolver(pluginName) {
891
+ const existingResolver = this.#defaultResolvers.get(pluginName);
892
+ if (existingResolver) return existingResolver;
893
+ const resolver = defineResolver(() => ({
894
+ name: "default",
895
+ pluginName
896
+ }));
897
+ this.#defaultResolvers.set(pluginName, resolver);
898
+ return resolver;
899
+ }
900
+ /**
901
+ * Merges `partial` with the plugin's default resolver and stores the result.
902
+ * Also mirrors it onto `plugin.resolver` so callers using `getPlugin(name).resolver`
903
+ * get the up-to-date resolver without going through `getResolver()`.
904
+ */
905
+ setPluginResolver(pluginName, partial) {
906
+ const merged = {
907
+ ...this.#createDefaultResolver(pluginName),
908
+ ...partial
909
+ };
910
+ this.#resolvers.set(pluginName, merged);
911
+ const plugin = this.plugins.get(pluginName);
912
+ if (plugin) plugin.resolver = merged;
913
+ }
914
+ getResolver(pluginName) {
915
+ return this.#resolvers.get(pluginName) ?? this.plugins.get(pluginName)?.resolver ?? this.#createDefaultResolver(pluginName);
916
+ }
917
+ getContext(plugin) {
918
+ const driver = this;
919
+ return {
920
+ config: driver.config,
921
+ get root() {
922
+ return (0, node_path.resolve)(driver.config.root, driver.config.output.path);
923
+ },
924
+ getMode(output) {
925
+ return PluginDriver.getMode((0, node_path.resolve)(driver.config.root, driver.config.output.path, output.path));
926
+ },
927
+ hooks: driver.hooks,
928
+ plugin,
929
+ getPlugin: driver.getPlugin.bind(driver),
930
+ requirePlugin: driver.requirePlugin.bind(driver),
931
+ getResolver: driver.getResolver.bind(driver),
932
+ driver,
933
+ addFile: async (...files) => {
934
+ driver.fileManager.add(...files);
935
+ },
936
+ upsertFile: async (...files) => {
937
+ driver.fileManager.upsert(...files);
938
+ },
939
+ get inputNode() {
940
+ return driver.inputNode;
941
+ },
942
+ get adapter() {
943
+ return driver.adapter;
944
+ },
945
+ get resolver() {
946
+ return driver.getResolver(plugin.name);
947
+ },
948
+ get transformer() {
949
+ return plugin.transformer;
950
+ },
951
+ warn(message) {
952
+ driver.hooks.emit("kubb:warn", { message });
953
+ },
954
+ error(error) {
955
+ driver.hooks.emit("kubb:error", { error: typeof error === "string" ? new Error(error) : error });
956
+ },
957
+ info(message) {
958
+ driver.hooks.emit("kubb:info", { message });
959
+ },
960
+ openInStudio(options) {
961
+ if (!driver.config.devtools || driver.#studioIsOpen) return;
962
+ if (typeof driver.config.devtools !== "object") throw new Error("Devtools must be an object");
963
+ if (!driver.inputNode || !driver.adapter) throw new Error("adapter is not defined, make sure you have set the parser in kubb.config.ts");
964
+ driver.#studioIsOpen = true;
965
+ const studioUrl = driver.config.devtools?.studioUrl ?? "https://kubb.studio";
966
+ return openInStudio(driver.inputNode, studioUrl, options);
967
+ }
968
+ };
969
+ }
970
+ getPlugin(pluginName) {
971
+ return this.plugins.get(pluginName);
972
+ }
973
+ requirePlugin(pluginName) {
974
+ const plugin = this.plugins.get(pluginName);
975
+ if (!plugin) throw new Error(`[kubb] Plugin "${pluginName}" is required but not found. Make sure it is included in your Kubb config.`);
976
+ return plugin;
977
+ }
978
+ };
979
+ /**
980
+ * Handles the return value of a plugin AST hook or generator method.
981
+ *
982
+ * - Renderer output → rendered via the provided `rendererFactory` (e.g. JSX), files stored in `driver.fileManager`
983
+ * - `Array<FileNode>` → added directly into `driver.fileManager`
984
+ * - `void` / `null` / `undefined` → no-op (plugin handled it via `this.upsertFile`)
985
+ *
986
+ * Pass a `rendererFactory` (e.g. `jsxRenderer` from `@kubb/renderer-jsx`) when the result
987
+ * may be a renderer element. Generators that only return `Array<FileNode>` do not need one.
988
+ */
989
+ async function applyHookResult(result, driver, rendererFactory) {
990
+ if (!result) return;
991
+ if (Array.isArray(result)) {
992
+ driver.fileManager.upsert(...result);
993
+ return;
994
+ }
995
+ if (!rendererFactory) return;
996
+ const renderer = rendererFactory();
997
+ await renderer.render(result);
998
+ driver.fileManager.upsert(...renderer.files);
999
+ renderer.unmount();
1000
+ }
1001
+ //#endregion
1002
+ Object.defineProperty(exports, "DEFAULT_BANNER", {
1003
+ enumerable: true,
1004
+ get: function() {
1005
+ return DEFAULT_BANNER;
1006
+ }
1007
+ });
1008
+ Object.defineProperty(exports, "DEFAULT_EXTENSION", {
1009
+ enumerable: true,
1010
+ get: function() {
1011
+ return DEFAULT_EXTENSION;
1012
+ }
1013
+ });
1014
+ Object.defineProperty(exports, "DEFAULT_STUDIO_URL", {
1015
+ enumerable: true,
1016
+ get: function() {
1017
+ return DEFAULT_STUDIO_URL;
1018
+ }
1019
+ });
1020
+ Object.defineProperty(exports, "FileManager", {
1021
+ enumerable: true,
1022
+ get: function() {
1023
+ return FileManager;
1024
+ }
1025
+ });
1026
+ Object.defineProperty(exports, "PluginDriver", {
1027
+ enumerable: true,
1028
+ get: function() {
1029
+ return PluginDriver;
1030
+ }
1031
+ });
1032
+ Object.defineProperty(exports, "__name", {
1033
+ enumerable: true,
1034
+ get: function() {
1035
+ return __name;
1036
+ }
1037
+ });
1038
+ Object.defineProperty(exports, "__toESM", {
1039
+ enumerable: true,
1040
+ get: function() {
1041
+ return __toESM;
1042
+ }
1043
+ });
1044
+ Object.defineProperty(exports, "applyHookResult", {
1045
+ enumerable: true,
1046
+ get: function() {
1047
+ return applyHookResult;
1048
+ }
1049
+ });
1050
+ Object.defineProperty(exports, "camelCase", {
1051
+ enumerable: true,
1052
+ get: function() {
1053
+ return camelCase;
1054
+ }
1055
+ });
1056
+ Object.defineProperty(exports, "definePlugin", {
1057
+ enumerable: true,
1058
+ get: function() {
1059
+ return definePlugin;
1060
+ }
1061
+ });
1062
+ Object.defineProperty(exports, "defineResolver", {
1063
+ enumerable: true,
1064
+ get: function() {
1065
+ return defineResolver;
1066
+ }
1067
+ });
1068
+ Object.defineProperty(exports, "logLevel", {
1069
+ enumerable: true,
1070
+ get: function() {
1071
+ return logLevel;
1072
+ }
1073
+ });
1074
+
1075
+ //# sourceMappingURL=PluginDriver-Cu1Kj9S-.cjs.map