@kubb/core 2.0.0-alpha.8 → 2.0.0-alpha.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/core",
3
- "version": "2.0.0-alpha.8",
3
+ "version": "2.0.0-alpha.9",
4
4
  "description": "Generator core",
5
5
  "keywords": [
6
6
  "typescript",
@@ -57,8 +57,8 @@
57
57
  "picocolors": "^1.0.0",
58
58
  "seedrandom": "^3.0.5",
59
59
  "semver": "^7.5.4",
60
- "@kubb/parser": "2.0.0-alpha.8",
61
- "@kubb/types": "2.0.0-alpha.8"
60
+ "@kubb/parser": "2.0.0-alpha.9",
61
+ "@kubb/types": "2.0.0-alpha.9"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/fs-extra": "^11.0.4",
@@ -71,8 +71,8 @@
71
71
  "tsup": "^7.2.0",
72
72
  "typescript": "rc",
73
73
  "@kubb/eslint-config": "1.1.8",
74
- "@kubb/ts-config": "0.1.0",
75
- "@kubb/tsup-config": "1.1.8"
74
+ "@kubb/tsup-config": "1.1.8",
75
+ "@kubb/ts-config": "0.1.0"
76
76
  },
77
77
  "packageManager": "pnpm@8.3.0",
78
78
  "engines": {
@@ -121,12 +121,12 @@ export class PluginManager {
121
121
  return this
122
122
  }
123
123
 
124
- resolvePath = (params: ResolvePathParams): KubbFile.OptionalPath => {
124
+ resolvePath = <TOptions = object>(params: ResolvePathParams<TOptions>): KubbFile.OptionalPath => {
125
125
  if (params.pluginKey) {
126
126
  const paths = this.hookForPluginSync({
127
127
  pluginKey: params.pluginKey,
128
128
  hookName: 'resolvePath',
129
- parameters: [params.baseName, params.directory, params.options],
129
+ parameters: [params.baseName, params.directory, params.options as object],
130
130
  })
131
131
 
132
132
  if (paths && paths?.length > 1) {
@@ -141,7 +141,7 @@ export class PluginManager {
141
141
  }
142
142
  return this.hookFirstSync({
143
143
  hookName: 'resolvePath',
144
- parameters: [params.baseName, params.directory, params.options],
144
+ parameters: [params.baseName, params.directory, params.options as object],
145
145
  }).result
146
146
  }
147
147
 
@@ -338,7 +338,7 @@ export class PluginManager {
338
338
  this.#catcher<H>(result.reason, plugin, hookName)
339
339
  }
340
340
  })
341
-
341
+ // TODO replace by promiseManager
342
342
  return results.filter((result) => result.status === 'fulfilled').map((result) => (result as PromiseFulfilledResult<Awaited<TOuput>>).value)
343
343
  }
344
344
 
@@ -370,6 +370,7 @@ export class PluginManager {
370
370
  })
371
371
  .then((result) => reduce.call(this.#core.api, argument0, result as ReturnType<ParseResult<H>>, plugin)) as Promise<Argument0<H>>
372
372
  }
373
+ // TODO replace by promiseManager
373
374
  return promise
374
375
  }
375
376
 
package/src/types.ts CHANGED
@@ -320,6 +320,11 @@ export type ResolvePathParams<TOptions = object> = {
320
320
  export type ResolveNameParams = {
321
321
  name: string
322
322
  pluginKey?: KubbPlugin['key']
323
+ /**
324
+ * `file` will be used to customize the name of the created file(use of camelCase)
325
+ * `function` can be used used to customize the exported functions(use of camelCase)
326
+ * `type` is a special type for TypeScript(use of PascalCase)
327
+ */
323
328
  type?: 'file' | 'function' | 'type'
324
329
  }
325
330
 
@@ -58,7 +58,7 @@ export function hookFirst<TInput extends Array<PromiseFunc<TValue, null>>, TValu
58
58
  return promise as TOutput
59
59
  }
60
60
 
61
- export type Strategy = 'seq' | 'first'
61
+ export type Strategy = 'seq' | 'first' | 'parallel' | 'reduceArg0'
62
62
 
63
63
  export type StrategySwitch<TStrategy extends Strategy, TInput extends Array<PromiseFunc<TValue, null>>, TValue> = TStrategy extends 'first'
64
64
  ? HookFirstOutput<TInput, TValue>