@kubb/core 5.0.0-beta.5 → 5.0.0-beta.7
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/README.md +8 -38
- package/dist/PluginDriver-BkTRD2H2.js.map +1 -1
- package/dist/PluginDriver-Cadu4ORh.cjs.map +1 -1
- package/dist/index.cjs +17 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js.map +1 -1
- package/dist/{types-CestVgap.d.ts → types-ChyWgIgi.d.ts} +10 -4
- package/package.json +5 -12
- package/src/defineLogger.ts +19 -2
- package/src/types.ts +7 -3
package/package.json
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
4
|
-
"description": "Core
|
|
3
|
+
"version": "5.0.0-beta.7",
|
|
4
|
+
"description": "Core engine for Kubb's plugin-based code generation system. Provides the plugin driver, file manager, defineConfig, and build orchestration used by every Kubb plugin.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"ast",
|
|
7
6
|
"code-generator",
|
|
8
7
|
"codegen",
|
|
9
|
-
"core-library",
|
|
10
|
-
"file-system",
|
|
11
8
|
"kubb",
|
|
12
|
-
"oas",
|
|
13
9
|
"openapi",
|
|
14
|
-
"plugin-framework",
|
|
15
10
|
"plugin-system",
|
|
16
|
-
"plugins",
|
|
17
|
-
"swagger",
|
|
18
11
|
"typescript"
|
|
19
12
|
],
|
|
20
13
|
"license": "MIT",
|
|
@@ -65,15 +58,15 @@
|
|
|
65
58
|
"dependencies": {
|
|
66
59
|
"fflate": "^0.8.2",
|
|
67
60
|
"tinyexec": "^1.1.2",
|
|
68
|
-
"@kubb/ast": "5.0.0-beta.
|
|
61
|
+
"@kubb/ast": "5.0.0-beta.7"
|
|
69
62
|
},
|
|
70
63
|
"devDependencies": {
|
|
71
64
|
"p-limit": "^7.3.0",
|
|
72
65
|
"@internals/utils": "0.0.0",
|
|
73
|
-
"@kubb/renderer-jsx": "5.0.0-beta.
|
|
66
|
+
"@kubb/renderer-jsx": "5.0.0-beta.7"
|
|
74
67
|
},
|
|
75
68
|
"peerDependencies": {
|
|
76
|
-
"@kubb/renderer-jsx": "5.0.0-beta.
|
|
69
|
+
"@kubb/renderer-jsx": "5.0.0-beta.7"
|
|
77
70
|
},
|
|
78
71
|
"size-limit": [
|
|
79
72
|
{
|
package/src/defineLogger.ts
CHANGED
|
@@ -3,7 +3,11 @@ import type { Logger, LoggerOptions, UserLogger } from './types.ts'
|
|
|
3
3
|
/**
|
|
4
4
|
* Wraps a logger definition into a typed {@link Logger}.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* The optional second type parameter `TInstallReturn` allows loggers to return
|
|
7
|
+
* a value from `install` — for example, a sink factory that the caller can
|
|
8
|
+
* forward to hook execution.
|
|
9
|
+
*
|
|
10
|
+
* @example Basic logger
|
|
7
11
|
* ```ts
|
|
8
12
|
* export const myLogger = defineLogger({
|
|
9
13
|
* name: 'my-logger',
|
|
@@ -13,7 +17,20 @@ import type { Logger, LoggerOptions, UserLogger } from './types.ts'
|
|
|
13
17
|
* },
|
|
14
18
|
* })
|
|
15
19
|
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Logger that returns a hook sink factory
|
|
22
|
+
* ```ts
|
|
23
|
+
* export const myLogger = defineLogger<LoggerOptions, HookSinkFactory>({
|
|
24
|
+
* name: 'my-logger',
|
|
25
|
+
* install(context, options) {
|
|
26
|
+
* // … register event handlers …
|
|
27
|
+
* return (commandWithArgs) => ({ onStdout: console.log })
|
|
28
|
+
* },
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
16
31
|
*/
|
|
17
|
-
export function defineLogger<Options extends LoggerOptions = LoggerOptions
|
|
32
|
+
export function defineLogger<Options extends LoggerOptions = LoggerOptions, TInstallReturn = void>(
|
|
33
|
+
logger: UserLogger<Options, TInstallReturn>,
|
|
34
|
+
): Logger<Options, TInstallReturn> {
|
|
18
35
|
return logger
|
|
19
36
|
}
|
package/src/types.ts
CHANGED
|
@@ -130,6 +130,10 @@ export type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptio
|
|
|
130
130
|
* return `{ name, path }` for the import, or `undefined` to skip it.
|
|
131
131
|
*/
|
|
132
132
|
getImports: (node: SchemaNode, resolve: (schemaName: string) => { name: string; path: string }) => Array<ImportNode>
|
|
133
|
+
/**
|
|
134
|
+
* Validate the document at the given path or URL.
|
|
135
|
+
*/
|
|
136
|
+
validate: (input: string, options?: { throwOnError?: boolean }) => Promise<void>
|
|
133
137
|
}
|
|
134
138
|
|
|
135
139
|
export type DevtoolsOptions = {
|
|
@@ -796,12 +800,12 @@ export type LoggerOptions = {
|
|
|
796
800
|
*/
|
|
797
801
|
export type LoggerContext = AsyncEventEmitter<KubbHooks>
|
|
798
802
|
|
|
799
|
-
export type Logger<TOptions extends LoggerOptions = LoggerOptions> = {
|
|
803
|
+
export type Logger<TOptions extends LoggerOptions = LoggerOptions, TInstallReturn = void> = {
|
|
800
804
|
name: string
|
|
801
|
-
install: (context: LoggerContext, options?: TOptions) =>
|
|
805
|
+
install: (context: LoggerContext, options?: TOptions) => TInstallReturn | Promise<TInstallReturn>
|
|
802
806
|
}
|
|
803
807
|
|
|
804
|
-
export type UserLogger<TOptions extends LoggerOptions = LoggerOptions> = Logger<TOptions>
|
|
808
|
+
export type UserLogger<TOptions extends LoggerOptions = LoggerOptions, TInstallReturn = void> = Logger<TOptions, TInstallReturn>
|
|
805
809
|
|
|
806
810
|
export type { Storage } from './createStorage.ts'
|
|
807
811
|
export type { Generator } from './defineGenerator.ts'
|