@kubb/core 5.0.0-alpha.2 → 5.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/{types-B7eZvqwD.d.ts → PluginDriver-CEQPafXV.d.ts} +687 -298
  2. package/dist/hooks.cjs +15 -9
  3. package/dist/hooks.cjs.map +1 -1
  4. package/dist/hooks.d.ts +11 -5
  5. package/dist/hooks.js +16 -10
  6. package/dist/hooks.js.map +1 -1
  7. package/dist/index.cjs +1131 -536
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +674 -89
  10. package/dist/index.js +1114 -532
  11. package/dist/index.js.map +1 -1
  12. package/package.json +6 -6
  13. package/src/Kubb.ts +37 -55
  14. package/src/{PluginManager.ts → PluginDriver.ts} +51 -40
  15. package/src/build.ts +74 -29
  16. package/src/config.ts +9 -8
  17. package/src/constants.ts +44 -1
  18. package/src/createAdapter.ts +25 -0
  19. package/src/createPlugin.ts +28 -0
  20. package/src/createStorage.ts +58 -0
  21. package/src/defineBuilder.ts +26 -0
  22. package/src/defineGenerator.ts +137 -0
  23. package/src/defineLogger.ts +13 -3
  24. package/src/definePreset.ts +27 -0
  25. package/src/definePresets.ts +16 -0
  26. package/src/defineResolver.ts +448 -0
  27. package/src/hooks/index.ts +1 -1
  28. package/src/hooks/useDriver.ts +8 -0
  29. package/src/hooks/useMode.ts +5 -2
  30. package/src/hooks/usePlugin.ts +5 -2
  31. package/src/index.ts +21 -6
  32. package/src/renderNode.tsx +105 -0
  33. package/src/storages/fsStorage.ts +2 -2
  34. package/src/storages/memoryStorage.ts +2 -2
  35. package/src/types.ts +342 -42
  36. package/src/utils/FunctionParams.ts +2 -2
  37. package/src/utils/TreeNode.ts +24 -1
  38. package/src/utils/diagnostics.ts +4 -1
  39. package/src/utils/executeStrategies.ts +23 -10
  40. package/src/utils/formatters.ts +10 -21
  41. package/src/utils/getBarrelFiles.ts +79 -9
  42. package/src/utils/getConfigs.ts +8 -22
  43. package/src/utils/getPreset.ts +52 -0
  44. package/src/utils/linters.ts +23 -3
  45. package/src/utils/mergeResolvers.ts +8 -0
  46. package/src/utils/packageJSON.ts +76 -0
  47. package/src/BarrelManager.ts +0 -74
  48. package/src/PackageManager.ts +0 -180
  49. package/src/PromiseManager.ts +0 -40
  50. package/src/defineAdapter.ts +0 -22
  51. package/src/definePlugin.ts +0 -12
  52. package/src/defineStorage.ts +0 -56
  53. package/src/errors.ts +0 -1
  54. package/src/hooks/usePluginManager.ts +0 -8
  55. package/src/utils/getPlugins.ts +0 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/core",
3
- "version": "5.0.0-alpha.2",
3
+ "version": "5.0.0-alpha.21",
4
4
  "description": "Core functionality for Kubb's plugin-based code generation system, providing the foundation for transforming OpenAPI specifications.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -64,14 +64,14 @@
64
64
  }
65
65
  ],
66
66
  "dependencies": {
67
- "@kubb/fabric-core": "0.13.3",
68
- "@kubb/react-fabric": "0.13.3",
67
+ "@kubb/fabric-core": "0.15.1",
68
+ "@kubb/react-fabric": "0.15.1",
69
69
  "empathic": "^2.0.0",
70
70
  "fflate": "^0.8.2",
71
71
  "remeda": "^2.33.6",
72
72
  "semver": "^7.7.4",
73
73
  "tinyexec": "^1.0.4",
74
- "@kubb/ast": "5.0.0-alpha.2"
74
+ "@kubb/ast": "5.0.0-alpha.21"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@types/semver": "^7.7.1",
@@ -79,8 +79,8 @@
79
79
  "@internals/utils": "0.0.0"
80
80
  },
81
81
  "peerDependencies": {
82
- "@kubb/fabric-core": "0.13.3",
83
- "@kubb/react-fabric": "0.13.3"
82
+ "@kubb/fabric-core": "0.14.0",
83
+ "@kubb/react-fabric": "0.14.0"
84
84
  },
85
85
  "engines": {
86
86
  "node": ">=22"
package/src/Kubb.ts CHANGED
@@ -1,36 +1,32 @@
1
1
  import type { KubbFile } from '@kubb/fabric-core/types'
2
- import type { Strategy } from './PluginManager.ts'
2
+ import type { Strategy } from './PluginDriver.ts'
3
3
  import type { Config, Plugin, PluginLifecycleHooks } from './types'
4
4
 
5
- type DebugEvent = {
5
+ type DebugInfo = {
6
6
  date: Date
7
- logs: string[]
7
+ logs: Array<string>
8
8
  fileName?: string
9
9
  }
10
10
 
11
- type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
11
+ type HookProgress<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
12
12
  hookName: H
13
13
  plugins: Array<Plugin>
14
14
  }
15
15
 
16
- type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
17
- hookName: H
18
- }
19
-
20
- type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
16
+ type HookExecution<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
21
17
  strategy: Strategy
22
18
  hookName: H
23
19
  plugin: Plugin
24
- parameters?: unknown[] | undefined
20
+ parameters?: Array<unknown>
25
21
  output?: unknown
26
22
  }
27
23
 
28
- type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
24
+ type HookResult<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
29
25
  duration: number
30
26
  strategy: Strategy
31
27
  hookName: H
32
28
  plugin: Plugin
33
- parameters?: unknown[] | undefined
29
+ parameters?: Array<unknown>
34
30
  output?: unknown
35
31
  }
36
32
 
@@ -40,7 +36,7 @@ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
40
36
  *
41
37
  * @example
42
38
  * ```typescript
43
- * import type { AsyncEventEmitter } from '@kubb/core'
39
+ * import type { AsyncEventEmitter } from '@internals/utils'
44
40
  * import type { KubbEvents } from '@kubb/core'
45
41
  *
46
42
  * const events: AsyncEventEmitter<KubbEvents> = new AsyncEventEmitter()
@@ -59,7 +55,6 @@ export interface KubbEvents {
59
55
  * Emitted at the beginning of the Kubb lifecycle, before any code generation starts.
60
56
  */
61
57
  'lifecycle:start': [version: string]
62
-
63
58
  /**
64
59
  * Emitted at the end of the Kubb lifecycle, after all code generation is complete.
65
60
  */
@@ -69,7 +64,6 @@ export interface KubbEvents {
69
64
  * Emitted when configuration loading starts.
70
65
  */
71
66
  'config:start': []
72
-
73
67
  /**
74
68
  * Emitted when configuration loading is complete.
75
69
  */
@@ -79,24 +73,22 @@ export interface KubbEvents {
79
73
  * Emitted when code generation phase starts.
80
74
  */
81
75
  'generation:start': [config: Config]
82
-
83
76
  /**
84
77
  * Emitted when code generation phase completes.
85
78
  */
86
- 'generation:end': [Config: Config, files: Array<KubbFile.ResolvedFile>, sources: Map<KubbFile.Path, string>]
87
-
79
+ 'generation:end': [config: Config, files: Array<KubbFile.ResolvedFile>, sources: Map<KubbFile.Path, string>]
88
80
  /**
89
81
  * Emitted with a summary of the generation results.
90
82
  * Contains summary lines, title, and success status.
91
83
  */
92
84
  'generation:summary': [
93
- Config: Config,
85
+ config: Config,
94
86
  {
95
87
  failedPlugins: Set<{ plugin: Plugin; error: Error }>
96
88
  status: 'success' | 'failed'
97
89
  hrStart: [number, number]
98
90
  filesCreated: number
99
- pluginTimings?: Map<string, number>
91
+ pluginTimings?: Map<Plugin['name'], number>
100
92
  },
101
93
  ]
102
94
 
@@ -104,7 +96,6 @@ export interface KubbEvents {
104
96
  * Emitted when code formatting starts (e.g., running Biome or Prettier).
105
97
  */
106
98
  'format:start': []
107
-
108
99
  /**
109
100
  * Emitted when code formatting completes.
110
101
  */
@@ -114,7 +105,6 @@ export interface KubbEvents {
114
105
  * Emitted when linting starts.
115
106
  */
116
107
  'lint:start': []
117
-
118
108
  /**
119
109
  * Emitted when linting completes.
120
110
  */
@@ -124,29 +114,20 @@ export interface KubbEvents {
124
114
  * Emitted when plugin hooks execution starts.
125
115
  */
126
116
  'hooks:start': []
127
-
128
117
  /**
129
118
  * Emitted when plugin hooks execution completes.
130
119
  */
131
120
  'hooks:end': []
132
121
 
133
122
  /**
134
- * Emitted when a single hook execution starts. (e.g., format or lint).
123
+ * Emitted when a single hook execution starts (e.g., format or lint).
135
124
  * The callback should be invoked when the command completes.
136
125
  */
137
126
  'hook:start': [{ id?: string; command: string; args?: readonly string[] }]
138
127
  /**
139
128
  * Emitted when a single hook execution completes.
140
129
  */
141
- 'hook:end': [
142
- {
143
- id?: string
144
- command: string
145
- args?: readonly string[]
146
- success: boolean
147
- error: Error | null
148
- },
149
- ]
130
+ 'hook:end': [{ id?: string; command: string; args?: readonly string[]; success: boolean; error: Error | null }]
150
131
 
151
132
  /**
152
133
  * Emitted when a new version of Kubb is available.
@@ -157,49 +138,54 @@ export interface KubbEvents {
157
138
  * Informational message event.
158
139
  */
159
140
  info: [message: string, info?: string]
160
-
161
141
  /**
162
142
  * Error event. Emitted when an error occurs during code generation.
163
143
  */
164
144
  error: [error: Error, meta?: Record<string, unknown>]
165
-
166
145
  /**
167
146
  * Success message event.
168
147
  */
169
148
  success: [message: string, info?: string]
170
-
171
149
  /**
172
150
  * Warning message event.
173
151
  */
174
152
  warn: [message: string, info?: string]
175
-
176
153
  /**
177
154
  * Debug event for detailed logging.
178
155
  * Contains timestamp, log messages, and optional filename.
179
156
  */
180
- debug: [meta: DebugEvent]
157
+ debug: [info: DebugInfo]
181
158
 
182
159
  /**
183
160
  * Emitted when file processing starts.
184
161
  * Contains the list of files to be processed.
185
162
  */
186
163
  'files:processing:start': [files: Array<KubbFile.ResolvedFile>]
187
-
188
164
  /**
189
165
  * Emitted for each file being processed, providing progress updates.
190
166
  * Contains processed count, total count, percentage, and file details.
191
167
  */
192
168
  'file:processing:update': [
193
169
  {
194
- /** Number of files processed so far */
170
+ /**
171
+ * Number of files processed so far.
172
+ */
195
173
  processed: number
196
- /** Total number of files to process */
174
+ /**
175
+ * Total number of files to process.
176
+ */
197
177
  total: number
198
- /** Processing percentage (0-100) */
178
+ /**
179
+ * Processing percentage (0–100).
180
+ */
199
181
  percentage: number
200
- /** Optional source identifier */
182
+ /**
183
+ * Optional source identifier.
184
+ */
201
185
  source?: string
202
- /** The file being processed */
186
+ /**
187
+ * The file being processed.
188
+ */
203
189
  file: KubbFile.ResolvedFile
204
190
  /**
205
191
  * Kubb configuration (not present in Fabric).
@@ -208,45 +194,41 @@ export interface KubbEvents {
208
194
  config: Config
209
195
  },
210
196
  ]
211
-
212
197
  /**
213
198
  * Emitted when file processing completes.
214
199
  * Contains the list of processed files.
215
200
  */
216
- 'files:processing:end': [files: KubbFile.ResolvedFile[]]
201
+ 'files:processing:end': [files: Array<KubbFile.ResolvedFile>]
217
202
 
218
203
  /**
219
204
  * Emitted when a plugin starts executing.
220
205
  */
221
206
  'plugin:start': [plugin: Plugin]
222
-
223
207
  /**
224
208
  * Emitted when a plugin completes execution.
225
- * Duration in ms
209
+ * Duration in ms.
226
210
  */
227
- 'plugin:end': [plugin: Plugin, meta: { duration: number; success: boolean; error?: Error }]
211
+ 'plugin:end': [plugin: Plugin, result: { duration: number; success: boolean; error?: Error }]
228
212
 
229
213
  /**
230
214
  * Emitted when plugin hook progress tracking starts.
231
215
  * Contains the hook name and list of plugins to execute.
232
216
  */
233
- 'plugins:hook:progress:start': [meta: ProgressStartMeta]
234
-
217
+ 'plugins:hook:progress:start': [progress: HookProgress]
235
218
  /**
236
219
  * Emitted when plugin hook progress tracking ends.
237
220
  * Contains the hook name that completed.
238
221
  */
239
- 'plugins:hook:progress:end': [meta: ProgressStopMeta]
222
+ 'plugins:hook:progress:end': [{ hookName: PluginLifecycleHooks }]
240
223
 
241
224
  /**
242
225
  * Emitted when a plugin hook starts processing.
243
226
  * Contains strategy, hook name, plugin, parameters, and output.
244
227
  */
245
- 'plugins:hook:processing:start': [meta: ExecutingMeta]
246
-
228
+ 'plugins:hook:processing:start': [execution: HookExecution]
247
229
  /**
248
230
  * Emitted when a plugin hook completes processing.
249
231
  * Contains duration, strategy, hook name, plugin, parameters, and output.
250
232
  */
251
- 'plugins:hook:processing:end': [meta: ExecutedMeta]
233
+ 'plugins:hook:processing:end': [result: HookResult]
252
234
  }
@@ -1,15 +1,14 @@
1
- import path from 'node:path'
1
+ import { basename, extname, resolve } from 'node:path'
2
2
  import { performance } from 'node:perf_hooks'
3
3
  import type { AsyncEventEmitter } from '@internals/utils'
4
- import { setUniqueName, transformReservedWord } from '@internals/utils'
4
+ import { isPromiseRejectedResult, setUniqueName, transformReservedWord, ValidationPluginError } from '@internals/utils'
5
5
  import type { RootNode } from '@kubb/ast/types'
6
- import type { KubbFile } from '@kubb/fabric-core/types'
7
- import type { Fabric } from '@kubb/react-fabric'
6
+ import type { Fabric as FabricType, KubbFile } from '@kubb/fabric-core/types'
8
7
  import { CORE_PLUGIN_NAME, DEFAULT_STUDIO_URL } from './constants.ts'
9
8
  import { openInStudio as openInStudioFn } from './devtools.ts'
10
- import { ValidationPluginError } from './errors.ts'
11
- import { isPromiseRejectedResult, PromiseManager } from './PromiseManager.ts'
9
+
12
10
  import type {
11
+ Adapter,
13
12
  Config,
14
13
  DevtoolsOptions,
15
14
  KubbEvents,
@@ -24,6 +23,7 @@ import type {
24
23
  ResolvePathParams,
25
24
  UserPlugin,
26
25
  } from './types.ts'
26
+ import { hookFirst, hookParallel, hookSeq } from './utils/executeStrategies.ts'
27
27
 
28
28
  type RequiredPluginLifecycle = Required<PluginLifecycle>
29
29
 
@@ -39,7 +39,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
39
39
  // inspired by: https://github.com/rollup/rollup/blob/master/src/utils/PluginDriver.ts#
40
40
 
41
41
  type Options = {
42
- fabric: Fabric
42
+ fabric: FabricType
43
43
  events: AsyncEventEmitter<KubbEvents>
44
44
  /**
45
45
  * @default Number.POSITIVE_INFINITY
@@ -47,7 +47,7 @@ type Options = {
47
47
  concurrency?: number
48
48
  }
49
49
 
50
- type GetFileProps<TOptions = object> = {
50
+ export type GetFileOptions<TOptions = object> = {
51
51
  name: string
52
52
  mode?: KubbFile.Mode
53
53
  extname: KubbFile.Extname
@@ -59,10 +59,12 @@ export function getMode(fileOrFolder: string | undefined | null): KubbFile.Mode
59
59
  if (!fileOrFolder) {
60
60
  return 'split'
61
61
  }
62
- return path.extname(fileOrFolder) ? 'single' : 'split'
62
+ return extname(fileOrFolder) ? 'single' : 'split'
63
63
  }
64
64
 
65
- export class PluginManager {
65
+ const hookFirstNullCheck = (state: unknown) => !!(state as SafeParseResult<'resolveName'> | null)?.result
66
+
67
+ export class PluginDriver {
66
68
  readonly config: Config
67
69
  readonly options: Options
68
70
 
@@ -71,18 +73,15 @@ export class PluginManager {
71
73
  * the build pipeline after the adapter's `parse()` resolves.
72
74
  */
73
75
  rootNode: RootNode | undefined = undefined
76
+ adapter: Adapter | undefined = undefined
74
77
  #studioIsOpen = false
75
78
 
76
79
  readonly #plugins = new Set<Plugin>()
77
80
  readonly #usedPluginNames: Record<string, number> = {}
78
- readonly #promiseManager
79
81
 
80
82
  constructor(config: Config, options: Options) {
81
83
  this.config = config
82
84
  this.options = options
83
- this.#promiseManager = new PromiseManager({
84
- nullCheck: (state: SafeParseResult<'resolveName'> | null) => !!state?.result,
85
- })
86
85
  ;[...(config.plugins || [])].forEach((plugin) => {
87
86
  const parsedPlugin = this.#parse(plugin as UserPlugin)
88
87
 
@@ -96,15 +95,15 @@ export class PluginManager {
96
95
 
97
96
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, unknown> {
98
97
  const plugins = [...this.#plugins]
99
- const pluginManager = this
98
+ const driver = this
100
99
 
101
100
  const baseContext = {
102
101
  fabric: this.options.fabric,
103
102
  config: this.config,
104
103
  plugin,
105
104
  events: this.options.events,
106
- pluginManager: this,
107
- mode: getMode(path.resolve(this.config.root, this.config.output.path)),
105
+ driver: this,
106
+ mode: getMode(resolve(this.config.root, this.config.output.path)),
108
107
  addFile: async (...files: Array<KubbFile.File>) => {
109
108
  await this.options.fabric.addFile(...files)
110
109
  },
@@ -112,26 +111,29 @@ export class PluginManager {
112
111
  await this.options.fabric.upsertFile(...files)
113
112
  },
114
113
  get rootNode(): RootNode | undefined {
115
- return pluginManager.rootNode
114
+ return driver.rootNode
115
+ },
116
+ get adapter(): Adapter | undefined {
117
+ return driver.adapter
116
118
  },
117
119
  openInStudio(options?: DevtoolsOptions) {
118
- if (typeof pluginManager.config.devtools !== 'object') {
119
- throw new Error('Devtools must be an object')
120
+ if (!driver.config.devtools || driver.#studioIsOpen) {
121
+ return
120
122
  }
121
123
 
122
- if (!pluginManager.rootNode) {
123
- throw new Error('RootNode is not defined, make sure you have set the parser in kubb.config.ts')
124
+ if (typeof driver.config.devtools !== 'object') {
125
+ throw new Error('Devtools must be an object')
124
126
  }
125
127
 
126
- if (pluginManager.#studioIsOpen) {
127
- return
128
+ if (!driver.rootNode || !driver.adapter) {
129
+ throw new Error('adapter is not defined, make sure you have set the parser in kubb.config.ts')
128
130
  }
129
131
 
130
- pluginManager.#studioIsOpen = true
132
+ driver.#studioIsOpen = true
131
133
 
132
- const studioUrl = pluginManager.config.devtools?.studioUrl ?? DEFAULT_STUDIO_URL
134
+ const studioUrl = driver.config.devtools?.studioUrl ?? DEFAULT_STUDIO_URL
133
135
 
134
- return openInStudioFn(pluginManager.rootNode, studioUrl, options)
136
+ return openInStudioFn(driver.rootNode, studioUrl, options)
135
137
  },
136
138
  } as unknown as PluginContext<TOptions>
137
139
 
@@ -158,17 +160,23 @@ export class PluginManager {
158
160
  return this.#getSortedPlugins()
159
161
  }
160
162
 
161
- getFile<TOptions = object>({ name, mode, extname, pluginName, options }: GetFileProps<TOptions>): KubbFile.File<{ pluginName: string }> {
162
- const baseName = `${name}${extname}` as const
163
- const path = this.resolvePath({ baseName, mode, pluginName, options })
163
+ getFile<TOptions = object>({ name, mode, extname, pluginName, options }: GetFileOptions<TOptions>): KubbFile.File<{ pluginName: string }> {
164
+ const resolvedName = mode ? (mode === 'single' ? '' : this.resolveName({ name, pluginName, type: 'file' })) : name
165
+
166
+ const path = this.resolvePath({
167
+ baseName: `${resolvedName}${extname}` as const,
168
+ mode,
169
+ pluginName,
170
+ options,
171
+ })
164
172
 
165
173
  if (!path) {
166
- throw new Error(`Filepath should be defined for resolvedName "${name}" and pluginName "${pluginName}"`)
174
+ throw new Error(`Filepath should be defined for resolvedName "${resolvedName}" and pluginName "${pluginName}"`)
167
175
  }
168
176
 
169
177
  return {
170
178
  path,
171
- baseName,
179
+ baseName: basename(path) as KubbFile.File['baseName'],
172
180
  meta: {
173
181
  pluginName,
174
182
  },
@@ -179,8 +187,8 @@ export class PluginManager {
179
187
  }
180
188
 
181
189
  resolvePath = <TOptions = object>(params: ResolvePathParams<TOptions>): KubbFile.Path => {
182
- const root = path.resolve(this.config.root, this.config.output.path)
183
- const defaultPath = path.resolve(root, params.baseName)
190
+ const root = resolve(this.config.root, this.config.output.path)
191
+ const defaultPath = resolve(root, params.baseName)
184
192
 
185
193
  if (params.pluginName) {
186
194
  const paths = this.hookForPluginSync({
@@ -322,7 +330,7 @@ export class PluginManager {
322
330
  }
323
331
  })
324
332
 
325
- const result = await this.#promiseManager.run('first', promises)
333
+ const result = await hookFirst(promises, hookFirstNullCheck)
326
334
 
327
335
  this.events.emit('plugins:hook:progress:end', { hookName })
328
336
 
@@ -392,9 +400,7 @@ export class PluginManager {
392
400
  }
393
401
  })
394
402
 
395
- const results = await this.#promiseManager.run('parallel', promises, {
396
- concurrency: this.options.concurrency,
397
- })
403
+ const results = await hookParallel(promises, this.options.concurrency)
398
404
 
399
405
  results.forEach((result, index) => {
400
406
  if (isPromiseRejectedResult<Error>(result)) {
@@ -440,7 +446,7 @@ export class PluginManager {
440
446
  })
441
447
  })
442
448
 
443
- await this.#promiseManager.run('seq', promises)
449
+ await hookSeq(promises)
444
450
 
445
451
  this.events.emit('plugins:hook:progress:end', { hookName })
446
452
  }
@@ -456,7 +462,12 @@ export class PluginManager {
456
462
  return plugins
457
463
  .map((plugin) => {
458
464
  if (plugin.pre) {
459
- const missingPlugins = plugin.pre.filter((pluginName) => !plugins.find((pluginToFind) => pluginToFind.name === pluginName))
465
+ let missingPlugins = plugin.pre.filter((pluginName) => !plugins.find((pluginToFind) => pluginToFind.name === pluginName))
466
+
467
+ // when adapter is set, we can ignore the depends on plugin-oas, in v5 this will not be needed anymore
468
+ if (missingPlugins.includes('plugin-oas') && this.adapter) {
469
+ missingPlugins = missingPlugins.filter((pluginName) => pluginName !== 'plugin-oas')
470
+ }
460
471
 
461
472
  if (missingPlugins.length > 0) {
462
473
  throw new ValidationPluginError(`The plugin '${plugin.name}' has a pre set that references missing plugins for '${missingPlugins.join(', ')}'`)