@kubb/core 5.0.0-beta.18 → 5.0.0-beta.19
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/{PluginDriver-Bc-k8EUQ.cjs → PluginDriver-DXp767s2.cjs} +72 -31
- package/dist/PluginDriver-DXp767s2.cjs.map +1 -0
- package/dist/{PluginDriver-T4-THx8t.js → PluginDriver-uNex0SAr.js} +72 -31
- package/dist/PluginDriver-uNex0SAr.js.map +1 -0
- package/dist/{createKubb-DajERI4b.d.ts → createKubb-BJGymYhe.d.ts} +200 -72
- package/dist/index.cjs +203 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +203 -144
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +25 -13
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +25 -13
- package/dist/mocks.js.map +1 -1
- package/package.json +5 -5
- package/src/FileProcessor.ts +15 -16
- package/src/PluginDriver.ts +31 -14
- package/src/createKubb.ts +357 -174
- package/src/createRenderer.ts +1 -2
- package/src/defineParser.ts +1 -1
- package/src/defineResolver.ts +62 -60
- package/src/mocks.ts +3 -3
- package/dist/PluginDriver-Bc-k8EUQ.cjs.map +0 -1
- package/dist/PluginDriver-T4-THx8t.js.map +0 -1
|
@@ -33,7 +33,7 @@ declare class AsyncEventEmitter<TEvents extends { [K in keyof TEvents]: unknown[
|
|
|
33
33
|
* await emitter.emit('build', 'petstore')
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void
|
|
36
|
+
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void> | void;
|
|
37
37
|
/**
|
|
38
38
|
* Registers a persistent listener for `eventName`.
|
|
39
39
|
*
|
|
@@ -269,9 +269,8 @@ type Renderer<TElement = unknown> = {
|
|
|
269
269
|
/**
|
|
270
270
|
* When present, core calls this instead of {@link render} and {@link files},
|
|
271
271
|
* forwarding each file to `FileManager` as soon as it is ready.
|
|
272
|
-
* Implementing this method enables per-file streaming without buffering the full result set.
|
|
273
272
|
*/
|
|
274
|
-
stream?(element: TElement):
|
|
273
|
+
stream?(element: TElement): Iterable<FileNode>;
|
|
275
274
|
};
|
|
276
275
|
/**
|
|
277
276
|
* A factory function that produces a fresh {@link Renderer} per render cycle.
|
|
@@ -391,7 +390,7 @@ type Parser<TMeta extends object = any> = {
|
|
|
391
390
|
/**
|
|
392
391
|
* Convert a resolved file to a string.
|
|
393
392
|
*/
|
|
394
|
-
parse(file: FileNode<TMeta>, options?: PrintOptions):
|
|
393
|
+
parse(file: FileNode<TMeta>, options?: PrintOptions): string;
|
|
395
394
|
};
|
|
396
395
|
/**
|
|
397
396
|
* Defines a parser with type safety. Creates parsers that transform generated files to strings based on their extension.
|
|
@@ -448,15 +447,8 @@ declare class FileProcessor {
|
|
|
448
447
|
parse(file: FileNode, {
|
|
449
448
|
parsers,
|
|
450
449
|
extension
|
|
451
|
-
}?: ParseOptions):
|
|
452
|
-
|
|
453
|
-
* Streams parsed files one at a time as each is processed.
|
|
454
|
-
*
|
|
455
|
-
* Unlike `run()`, files are yielded immediately after parsing rather than batched.
|
|
456
|
-
* Storage writes can begin as soon as the first file is ready, keeping peak
|
|
457
|
-
* memory proportional to one file at a time instead of the full batch.
|
|
458
|
-
*/
|
|
459
|
-
stream(files: ReadonlyArray<FileNode>, options?: ParseOptions): AsyncGenerator<ParsedFile>;
|
|
450
|
+
}?: ParseOptions): string;
|
|
451
|
+
stream(files: ReadonlyArray<FileNode>, options?: ParseOptions): Generator<ParsedFile>;
|
|
460
452
|
run(files: Array<FileNode>, options?: ParseOptions): Promise<Array<FileNode>>;
|
|
461
453
|
}
|
|
462
454
|
//#endregion
|
|
@@ -720,29 +712,6 @@ type ResolverBuilder<T extends PluginFactoryOptions> = () => Omit<T['resolver'],
|
|
|
720
712
|
name: string;
|
|
721
713
|
pluginName: T['name'];
|
|
722
714
|
} & ThisType<T['resolver']>;
|
|
723
|
-
/**
|
|
724
|
-
* Default option resolver — applies include/exclude filters and merges matching override options.
|
|
725
|
-
*
|
|
726
|
-
* Returns `null` when the node is filtered out by an `exclude` rule or not matched by any `include` rule.
|
|
727
|
-
*
|
|
728
|
-
* @example Include/exclude filtering
|
|
729
|
-
* ```ts
|
|
730
|
-
* const options = defaultResolveOptions(operationNode, {
|
|
731
|
-
* options: { output: 'types' },
|
|
732
|
-
* exclude: [{ type: 'tag', pattern: 'internal' }],
|
|
733
|
-
* })
|
|
734
|
-
* // → null when node has tag 'internal'
|
|
735
|
-
* ```
|
|
736
|
-
*
|
|
737
|
-
* @example Override merging
|
|
738
|
-
* ```ts
|
|
739
|
-
* const options = defaultResolveOptions(operationNode, {
|
|
740
|
-
* options: { enumType: 'asConst' },
|
|
741
|
-
* override: [{ type: 'operationId', pattern: 'listPets', options: { enumType: 'enum' } }],
|
|
742
|
-
* })
|
|
743
|
-
* // → { enumType: 'enum' } when operationId matches
|
|
744
|
-
* ```
|
|
745
|
-
*/
|
|
746
715
|
/**
|
|
747
716
|
* Defines a resolver for a plugin, injecting built-in defaults for name casing,
|
|
748
717
|
* include/exclude/override filtering, path resolution, and file construction.
|
|
@@ -987,7 +956,7 @@ type KubbPluginSetupContext<TFactory extends PluginFactoryOptions = PluginFactor
|
|
|
987
956
|
* Register a generator dynamically. Generators fire during the AST walk (schema/operation/operations)
|
|
988
957
|
* just like generators declared statically on `createPlugin`.
|
|
989
958
|
*/
|
|
990
|
-
addGenerator<TElement = unknown>(generator: Generator<TFactory, TElement>): void;
|
|
959
|
+
addGenerator<TElement = unknown>(generator: Generator$1<TFactory, TElement>): void;
|
|
991
960
|
/**
|
|
992
961
|
* Set or override the resolver for this plugin.
|
|
993
962
|
* The resolver controls file naming and path resolution.
|
|
@@ -1078,7 +1047,7 @@ type NormalizedPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptio
|
|
|
1078
1047
|
resolver: TOptions['resolver'];
|
|
1079
1048
|
transformer?: Visitor;
|
|
1080
1049
|
renderer?: RendererFactory;
|
|
1081
|
-
generators?: Array<Generator>;
|
|
1050
|
+
generators?: Array<Generator$1>;
|
|
1082
1051
|
apply?: (config: Config) => boolean;
|
|
1083
1052
|
version?: string;
|
|
1084
1053
|
};
|
|
@@ -1246,7 +1215,7 @@ declare class PluginDriver {
|
|
|
1246
1215
|
*
|
|
1247
1216
|
* Call this method inside `addGenerator()` (in `kubb:plugin:setup`) to wire up a generator.
|
|
1248
1217
|
*/
|
|
1249
|
-
registerGenerator(pluginName: string, gen: Generator): void;
|
|
1218
|
+
registerGenerator(pluginName: string, gen: Generator$1): void;
|
|
1250
1219
|
/**
|
|
1251
1220
|
* Returns `true` when at least one generator was registered for the given plugin
|
|
1252
1221
|
* via `addGenerator()` in `kubb:plugin:setup` (event-based path).
|
|
@@ -1398,7 +1367,7 @@ type GeneratorContext<TOptions extends PluginFactoryOptions = PluginFactoryOptio
|
|
|
1398
1367
|
* })
|
|
1399
1368
|
* ```
|
|
1400
1369
|
*/
|
|
1401
|
-
type Generator<TOptions extends PluginFactoryOptions = PluginFactoryOptions, TElement = unknown> = {
|
|
1370
|
+
type Generator$1<TOptions extends PluginFactoryOptions = PluginFactoryOptions, TElement = unknown> = {
|
|
1402
1371
|
/**
|
|
1403
1372
|
* Used in diagnostic messages and debug output.
|
|
1404
1373
|
*/
|
|
@@ -1448,7 +1417,7 @@ type Generator<TOptions extends PluginFactoryOptions = PluginFactoryOptions, TEl
|
|
|
1448
1417
|
* `applyHookResult` handles renderer elements and `File[]` uniformly using
|
|
1449
1418
|
* the generator's declared `renderer` factory.
|
|
1450
1419
|
*/
|
|
1451
|
-
declare function defineGenerator<TOptions extends PluginFactoryOptions = PluginFactoryOptions, TElement = unknown>(generator: Generator<TOptions, TElement>): Generator<TOptions, TElement>;
|
|
1420
|
+
declare function defineGenerator<TOptions extends PluginFactoryOptions = PluginFactoryOptions, TElement = unknown>(generator: Generator$1<TOptions, TElement>): Generator$1<TOptions, TElement>;
|
|
1452
1421
|
//#endregion
|
|
1453
1422
|
//#region src/createKubb.d.ts
|
|
1454
1423
|
/**
|
|
@@ -1903,21 +1872,16 @@ declare global {
|
|
|
1903
1872
|
}
|
|
1904
1873
|
/**
|
|
1905
1874
|
* Lifecycle events emitted during Kubb code generation.
|
|
1906
|
-
*
|
|
1875
|
+
* Attach listeners before calling `setup()` or `build()` to observe and react to build progress.
|
|
1907
1876
|
*
|
|
1908
1877
|
* @example
|
|
1909
|
-
* ```
|
|
1910
|
-
*
|
|
1911
|
-
* import type { KubbHooks } from '@kubb/core'
|
|
1912
|
-
*
|
|
1913
|
-
* const hooks: AsyncEventEmitter<KubbHooks> = new AsyncEventEmitter()
|
|
1914
|
-
*
|
|
1915
|
-
* hooks.on('kubb:lifecycle:start', () => {
|
|
1878
|
+
* ```ts
|
|
1879
|
+
* kubb.hooks.on('kubb:lifecycle:start', () => {
|
|
1916
1880
|
* console.log('Starting Kubb generation')
|
|
1917
1881
|
* })
|
|
1918
1882
|
*
|
|
1919
|
-
* hooks.on('kubb:plugin:end', ({ plugin, duration }) => {
|
|
1920
|
-
* console.log(
|
|
1883
|
+
* kubb.hooks.on('kubb:plugin:end', ({ plugin, duration }) => {
|
|
1884
|
+
* console.log(`${plugin.name} completed in ${duration}ms`)
|
|
1921
1885
|
* })
|
|
1922
1886
|
* ```
|
|
1923
1887
|
*/
|
|
@@ -1957,45 +1921,90 @@ interface KubbHooks {
|
|
|
1957
1921
|
'kubb:generate:operations': [nodes: Array<OperationNode>, ctx: GeneratorContext];
|
|
1958
1922
|
}
|
|
1959
1923
|
type KubbBuildStartContext = {
|
|
1924
|
+
/**
|
|
1925
|
+
* Resolved configuration for this build.
|
|
1926
|
+
*/
|
|
1960
1927
|
config: Config;
|
|
1928
|
+
/**
|
|
1929
|
+
* Adapter that parsed the input into the universal AST.
|
|
1930
|
+
*/
|
|
1961
1931
|
adapter: Adapter;
|
|
1932
|
+
/**
|
|
1933
|
+
* Parsed input node. For streaming builds the node is a synthetic empty shell
|
|
1934
|
+
* with only `meta` populated — use `kubb:generate:schema` / `kubb:generate:operation` to observe individual nodes.
|
|
1935
|
+
*/
|
|
1962
1936
|
inputNode: InputNode;
|
|
1937
|
+
/**
|
|
1938
|
+
* Looks up a registered plugin by name, typed by the plugin registry.
|
|
1939
|
+
*/
|
|
1963
1940
|
getPlugin<TName extends keyof Kubb$1.PluginRegistry>(name: TName): Plugin<Kubb$1.PluginRegistry[TName]> | undefined;
|
|
1964
1941
|
getPlugin(name: string): Plugin | undefined;
|
|
1942
|
+
/**
|
|
1943
|
+
* Snapshot of all files accumulated so far.
|
|
1944
|
+
*/
|
|
1965
1945
|
readonly files: ReadonlyArray<FileNode>;
|
|
1946
|
+
/**
|
|
1947
|
+
* Adds or merges one or more files into the file manager.
|
|
1948
|
+
*/
|
|
1966
1949
|
upsertFile: (...files: Array<FileNode>) => void;
|
|
1967
1950
|
};
|
|
1968
1951
|
type KubbPluginsEndContext = {
|
|
1952
|
+
/**
|
|
1953
|
+
* Resolved configuration for this build.
|
|
1954
|
+
*/
|
|
1969
1955
|
config: Config;
|
|
1956
|
+
/**
|
|
1957
|
+
* Snapshot of all files accumulated across all plugins.
|
|
1958
|
+
*/
|
|
1970
1959
|
readonly files: ReadonlyArray<FileNode>;
|
|
1960
|
+
/**
|
|
1961
|
+
* Adds or merges one or more files into the file manager.
|
|
1962
|
+
*/
|
|
1971
1963
|
upsertFile: (...files: Array<FileNode>) => void;
|
|
1972
1964
|
};
|
|
1973
1965
|
type KubbBuildEndContext = {
|
|
1966
|
+
/**
|
|
1967
|
+
* All files generated during this build.
|
|
1968
|
+
*/
|
|
1974
1969
|
files: Array<FileNode>;
|
|
1970
|
+
/**
|
|
1971
|
+
* Resolved configuration for this build.
|
|
1972
|
+
*/
|
|
1975
1973
|
config: Config;
|
|
1974
|
+
/**
|
|
1975
|
+
* Absolute path to the output directory.
|
|
1976
|
+
*/
|
|
1976
1977
|
outputDir: string;
|
|
1977
1978
|
};
|
|
1978
1979
|
type KubbLifecycleStartContext = {
|
|
1980
|
+
/**
|
|
1981
|
+
* Current Kubb version string.
|
|
1982
|
+
*/
|
|
1979
1983
|
version: string;
|
|
1980
1984
|
};
|
|
1981
1985
|
type KubbConfigEndContext = {
|
|
1986
|
+
/**
|
|
1987
|
+
* All resolved configs after defaults are applied.
|
|
1988
|
+
*/
|
|
1982
1989
|
configs: Array<Config>;
|
|
1983
1990
|
};
|
|
1984
1991
|
type KubbGenerationStartContext = {
|
|
1992
|
+
/**
|
|
1993
|
+
* Resolved configuration for this generation run.
|
|
1994
|
+
*/
|
|
1985
1995
|
config: Config;
|
|
1986
1996
|
};
|
|
1987
1997
|
type KubbGenerationEndContext = {
|
|
1998
|
+
/**
|
|
1999
|
+
* Resolved configuration for this generation run.
|
|
2000
|
+
*/
|
|
1988
2001
|
config: Config;
|
|
1989
2002
|
/**
|
|
1990
|
-
* Read-only view of the files
|
|
1991
|
-
*
|
|
1992
|
-
* Keys are scoped to this run; files from earlier builds are not included.
|
|
1993
|
-
* Reads go directly to `config.storage`, so nothing is buffered in memory.
|
|
2003
|
+
* Read-only view of the files written during this build.
|
|
2004
|
+
* Reads go directly to `config.storage` — nothing extra is held in memory.
|
|
1994
2005
|
*
|
|
1995
2006
|
* @example Read a generated file
|
|
1996
|
-
*
|
|
1997
|
-
* const code = await storage.getItem('/src/gen/pet.ts')
|
|
1998
|
-
* ```
|
|
2007
|
+
* `const code = await storage.getItem('/src/gen/pet.ts')`
|
|
1999
2008
|
*
|
|
2000
2009
|
* @example Walk every generated file
|
|
2001
2010
|
* ```ts
|
|
@@ -2007,73 +2016,189 @@ type KubbGenerationEndContext = {
|
|
|
2007
2016
|
storage: Storage;
|
|
2008
2017
|
};
|
|
2009
2018
|
type KubbGenerationSummaryContext = {
|
|
2019
|
+
/**
|
|
2020
|
+
* Resolved configuration for this generation run.
|
|
2021
|
+
*/
|
|
2010
2022
|
config: Config;
|
|
2023
|
+
/**
|
|
2024
|
+
* Plugins that threw during generation, paired with their errors.
|
|
2025
|
+
*/
|
|
2011
2026
|
failedPlugins: Set<{
|
|
2012
2027
|
plugin: Plugin;
|
|
2013
2028
|
error: Error;
|
|
2014
2029
|
}>;
|
|
2030
|
+
/**
|
|
2031
|
+
* `'success'` when all plugins completed without errors, `'failed'` otherwise.
|
|
2032
|
+
*/
|
|
2015
2033
|
status: 'success' | 'failed';
|
|
2034
|
+
/**
|
|
2035
|
+
* High-resolution start time from `process.hrtime()`.
|
|
2036
|
+
*/
|
|
2016
2037
|
hrStart: [number, number];
|
|
2038
|
+
/**
|
|
2039
|
+
* Total number of files created during this run.
|
|
2040
|
+
*/
|
|
2017
2041
|
filesCreated: number;
|
|
2042
|
+
/**
|
|
2043
|
+
* Elapsed milliseconds per plugin, keyed by plugin name.
|
|
2044
|
+
*/
|
|
2018
2045
|
pluginTimings?: Map<Plugin['name'], number>;
|
|
2019
2046
|
};
|
|
2020
2047
|
type KubbVersionNewContext = {
|
|
2048
|
+
/**
|
|
2049
|
+
* The installed Kubb version.
|
|
2050
|
+
*/
|
|
2021
2051
|
currentVersion: string;
|
|
2052
|
+
/**
|
|
2053
|
+
* The newest available version on npm.
|
|
2054
|
+
*/
|
|
2022
2055
|
latestVersion: string;
|
|
2023
2056
|
};
|
|
2024
2057
|
type KubbInfoContext = {
|
|
2058
|
+
/**
|
|
2059
|
+
* Human-readable info message.
|
|
2060
|
+
*/
|
|
2025
2061
|
message: string;
|
|
2062
|
+
/**
|
|
2063
|
+
* Optional supplementary detail.
|
|
2064
|
+
*/
|
|
2026
2065
|
info?: string;
|
|
2027
2066
|
};
|
|
2028
2067
|
type KubbErrorContext = {
|
|
2068
|
+
/**
|
|
2069
|
+
* The caught error.
|
|
2070
|
+
*/
|
|
2029
2071
|
error: Error;
|
|
2072
|
+
/**
|
|
2073
|
+
* Optional structured metadata for additional context.
|
|
2074
|
+
*/
|
|
2030
2075
|
meta?: Record<string, unknown>;
|
|
2031
2076
|
};
|
|
2032
2077
|
type KubbSuccessContext = {
|
|
2078
|
+
/**
|
|
2079
|
+
* Human-readable success message.
|
|
2080
|
+
*/
|
|
2033
2081
|
message: string;
|
|
2082
|
+
/**
|
|
2083
|
+
* Optional supplementary detail.
|
|
2084
|
+
*/
|
|
2034
2085
|
info?: string;
|
|
2035
2086
|
};
|
|
2036
2087
|
type KubbWarnContext = {
|
|
2088
|
+
/**
|
|
2089
|
+
* Human-readable warning message.
|
|
2090
|
+
*/
|
|
2037
2091
|
message: string;
|
|
2092
|
+
/**
|
|
2093
|
+
* Optional supplementary detail.
|
|
2094
|
+
*/
|
|
2038
2095
|
info?: string;
|
|
2039
2096
|
};
|
|
2040
2097
|
type KubbDebugContext = {
|
|
2098
|
+
/**
|
|
2099
|
+
* Timestamp when the debug entry was created.
|
|
2100
|
+
*/
|
|
2041
2101
|
date: Date;
|
|
2102
|
+
/**
|
|
2103
|
+
* One or more log lines to emit.
|
|
2104
|
+
*/
|
|
2042
2105
|
logs: Array<string>;
|
|
2106
|
+
/**
|
|
2107
|
+
* Optional source file name associated with this entry.
|
|
2108
|
+
*/
|
|
2043
2109
|
fileName?: string;
|
|
2044
2110
|
};
|
|
2045
2111
|
type KubbFilesProcessingStartContext = {
|
|
2112
|
+
/**
|
|
2113
|
+
* Files about to be serialised and written.
|
|
2114
|
+
*/
|
|
2046
2115
|
files: Array<FileNode>;
|
|
2047
2116
|
};
|
|
2048
2117
|
type KubbFileProcessingUpdateContext = {
|
|
2118
|
+
/**
|
|
2119
|
+
* Number of files processed so far in this batch.
|
|
2120
|
+
*/
|
|
2049
2121
|
processed: number;
|
|
2122
|
+
/**
|
|
2123
|
+
* Total number of files in this batch.
|
|
2124
|
+
*/
|
|
2050
2125
|
total: number;
|
|
2126
|
+
/**
|
|
2127
|
+
* Completion percentage (`0`–`100`).
|
|
2128
|
+
*/
|
|
2051
2129
|
percentage: number;
|
|
2130
|
+
/**
|
|
2131
|
+
* Serialised file content, or `undefined` when the file produced no output.
|
|
2132
|
+
*/
|
|
2052
2133
|
source?: string;
|
|
2134
|
+
/**
|
|
2135
|
+
* The file that was just processed.
|
|
2136
|
+
*/
|
|
2053
2137
|
file: FileNode;
|
|
2138
|
+
/**
|
|
2139
|
+
* Resolved configuration for this build.
|
|
2140
|
+
*/
|
|
2054
2141
|
config: Config;
|
|
2055
2142
|
};
|
|
2056
2143
|
type KubbFilesProcessingEndContext = {
|
|
2144
|
+
/**
|
|
2145
|
+
* All files that were serialised in this batch.
|
|
2146
|
+
*/
|
|
2057
2147
|
files: Array<FileNode>;
|
|
2058
2148
|
};
|
|
2059
2149
|
type KubbHookStartContext = {
|
|
2150
|
+
/**
|
|
2151
|
+
* Optional identifier for correlating start/end events.
|
|
2152
|
+
*/
|
|
2060
2153
|
id?: string;
|
|
2154
|
+
/**
|
|
2155
|
+
* The shell command that is about to run.
|
|
2156
|
+
*/
|
|
2061
2157
|
command: string;
|
|
2158
|
+
/**
|
|
2159
|
+
* Parsed argument list, when available.
|
|
2160
|
+
*/
|
|
2062
2161
|
args?: readonly string[];
|
|
2063
2162
|
};
|
|
2064
2163
|
type KubbHookEndContext = {
|
|
2164
|
+
/**
|
|
2165
|
+
* Optional identifier matching the corresponding `kubb:hook:start` event.
|
|
2166
|
+
*/
|
|
2065
2167
|
id?: string;
|
|
2168
|
+
/**
|
|
2169
|
+
* The shell command that ran.
|
|
2170
|
+
*/
|
|
2066
2171
|
command: string;
|
|
2172
|
+
/**
|
|
2173
|
+
* Parsed argument list, when available.
|
|
2174
|
+
*/
|
|
2067
2175
|
args?: readonly string[];
|
|
2176
|
+
/**
|
|
2177
|
+
* `true` when the command exited with code `0`.
|
|
2178
|
+
*/
|
|
2068
2179
|
success: boolean;
|
|
2180
|
+
/**
|
|
2181
|
+
* Error thrown by the command, or `null` on success.
|
|
2182
|
+
*/
|
|
2069
2183
|
error: Error | null;
|
|
2070
2184
|
};
|
|
2071
2185
|
/**
|
|
2072
2186
|
* CLI options derived from command-line flags.
|
|
2073
2187
|
*/
|
|
2074
2188
|
type CLIOptions = {
|
|
2189
|
+
/**
|
|
2190
|
+
* Path to the Kubb config file.
|
|
2191
|
+
*/
|
|
2075
2192
|
config?: string;
|
|
2076
|
-
|
|
2193
|
+
/**
|
|
2194
|
+
* Re-run generation whenever input files change.
|
|
2195
|
+
*/
|
|
2196
|
+
watch?: boolean;
|
|
2197
|
+
/**
|
|
2198
|
+
* Controls how much output the CLI prints.
|
|
2199
|
+
*
|
|
2200
|
+
* @default 'silent'
|
|
2201
|
+
*/
|
|
2077
2202
|
logLevel?: 'silent' | 'info' | 'debug';
|
|
2078
2203
|
};
|
|
2079
2204
|
/**
|
|
@@ -2086,34 +2211,37 @@ type PossibleConfig<TCliOptions = undefined> = PossiblePromise<Config | Config[]
|
|
|
2086
2211
|
*/
|
|
2087
2212
|
type BuildOutput = {
|
|
2088
2213
|
/**
|
|
2089
|
-
* Plugins that threw during
|
|
2214
|
+
* Plugins that threw during generation, paired with their errors.
|
|
2090
2215
|
*/
|
|
2091
2216
|
failedPlugins: Set<{
|
|
2092
2217
|
plugin: Plugin;
|
|
2093
2218
|
error: Error;
|
|
2094
2219
|
}>;
|
|
2220
|
+
/**
|
|
2221
|
+
* All files generated during this build.
|
|
2222
|
+
*/
|
|
2095
2223
|
files: Array<FileNode>;
|
|
2224
|
+
/**
|
|
2225
|
+
* The plugin driver that orchestrated this build.
|
|
2226
|
+
*/
|
|
2096
2227
|
driver: PluginDriver;
|
|
2097
2228
|
/**
|
|
2098
|
-
* Elapsed
|
|
2229
|
+
* Elapsed milliseconds per plugin, keyed by plugin name.
|
|
2099
2230
|
*/
|
|
2100
2231
|
pluginTimings: Map<string, number>;
|
|
2232
|
+
/**
|
|
2233
|
+
* Top-level error when the build threw before completing, otherwise `undefined`.
|
|
2234
|
+
*/
|
|
2101
2235
|
error?: Error;
|
|
2102
2236
|
/**
|
|
2103
2237
|
* Read-only view of every file written during this build.
|
|
2104
|
-
*
|
|
2105
|
-
* Keys are limited to this run. Reads go straight to `config.storage`,
|
|
2106
|
-
* so nothing extra is held in memory.
|
|
2238
|
+
* Reads go straight to `config.storage` — nothing extra is held in memory.
|
|
2107
2239
|
*
|
|
2108
2240
|
* @example Read a generated file
|
|
2109
|
-
*
|
|
2110
|
-
* const code = await buildOutput.storage.getItem('/src/gen/pet.ts')
|
|
2111
|
-
* ```
|
|
2241
|
+
* `const code = await buildOutput.storage.getItem('/src/gen/pet.ts')`
|
|
2112
2242
|
*
|
|
2113
2243
|
* @example List all generated file paths
|
|
2114
|
-
*
|
|
2115
|
-
* const paths = await buildOutput.storage.getKeys()
|
|
2116
|
-
* ```
|
|
2244
|
+
* `const paths = await buildOutput.storage.getKeys()`
|
|
2117
2245
|
*/
|
|
2118
2246
|
storage: Storage;
|
|
2119
2247
|
};
|
|
@@ -2203,5 +2331,5 @@ type CreateKubbOptions = {
|
|
|
2203
2331
|
*/
|
|
2204
2332
|
declare function createKubb(userConfig: UserConfig, options?: CreateKubbOptions): Kubb$1;
|
|
2205
2333
|
//#endregion
|
|
2206
|
-
export { ResolverPathParams as $, isInputPath as A, KubbPluginSetupContext as B, KubbPluginsEndContext as C, logLevel as Ct, PossibleConfig as D, KubbWarnContext as E, FileManager as F, Plugin as G, NormalizedPlugin as H, Exclude as I, ResolveBannerContext as J, PluginFactoryOptions as K, Group as L, GeneratorContext as M, defineGenerator as N, UserConfig as O, PluginDriver as P, ResolverFileParams as Q, Include as R, KubbLifecycleStartContext as S, createAdapter as St, KubbVersionNewContext as T, Output as U, KubbPluginStartContext as V, Override as W, Resolver as X, ResolveOptionsContext as Y, ResolverContext as Z, KubbGenerationSummaryContext as _, RendererFactory as _t, InputPath as a, LoggerOptions as at, KubbHooks as b, AdapterFactoryOptions as bt, KubbBuildStartContext as c, FileProcessor as ct, KubbErrorContext as d, Parser as dt, defineResolver as et, KubbFileProcessingUpdateContext as f, defineParser as ft, KubbGenerationStartContext as g, Renderer as gt, KubbGenerationEndContext as h, createStorage as ht, InputData as i, LoggerContext as it, Generator as j, createKubb as k, KubbConfigEndContext as l, FileProcessorEvents as lt, KubbFilesProcessingStartContext as m, Storage as mt, CLIOptions as n, defineMiddleware as nt, Kubb$1 as o, UserLogger as ot, KubbFilesProcessingEndContext as p, DevtoolsOptions as pt, definePlugin as q, Config as r, Logger as rt, KubbBuildEndContext as s, defineLogger as st, BuildOutput as t, Middleware as tt, KubbDebugContext as u, ParsedFile as ut, KubbHookEndContext as v, createRenderer as vt, KubbSuccessContext as w, AsyncEventEmitter as wt, KubbInfoContext as x, AdapterSource as xt, KubbHookStartContext as y, Adapter as yt, KubbPluginEndContext as z };
|
|
2207
|
-
//# sourceMappingURL=createKubb-
|
|
2334
|
+
export { ResolverPathParams as $, isInputPath as A, KubbPluginSetupContext as B, KubbPluginsEndContext as C, logLevel as Ct, PossibleConfig as D, KubbWarnContext as E, FileManager as F, Plugin as G, NormalizedPlugin as H, Exclude as I, ResolveBannerContext as J, PluginFactoryOptions as K, Group as L, GeneratorContext as M, defineGenerator as N, UserConfig as O, PluginDriver as P, ResolverFileParams as Q, Include as R, KubbLifecycleStartContext as S, createAdapter as St, KubbVersionNewContext as T, Output as U, KubbPluginStartContext as V, Override as W, Resolver as X, ResolveOptionsContext as Y, ResolverContext as Z, KubbGenerationSummaryContext as _, RendererFactory as _t, InputPath as a, LoggerOptions as at, KubbHooks as b, AdapterFactoryOptions as bt, KubbBuildStartContext as c, FileProcessor as ct, KubbErrorContext as d, Parser as dt, defineResolver as et, KubbFileProcessingUpdateContext as f, defineParser as ft, KubbGenerationStartContext as g, Renderer as gt, KubbGenerationEndContext as h, createStorage as ht, InputData as i, LoggerContext as it, Generator$1 as j, createKubb as k, KubbConfigEndContext as l, FileProcessorEvents as lt, KubbFilesProcessingStartContext as m, Storage as mt, CLIOptions as n, defineMiddleware as nt, Kubb$1 as o, UserLogger as ot, KubbFilesProcessingEndContext as p, DevtoolsOptions as pt, definePlugin as q, Config as r, Logger as rt, KubbBuildEndContext as s, defineLogger as st, BuildOutput as t, Middleware as tt, KubbDebugContext as u, ParsedFile as ut, KubbHookEndContext as v, createRenderer as vt, KubbSuccessContext as w, AsyncEventEmitter as wt, KubbInfoContext as x, AdapterSource as xt, KubbHookStartContext as y, Adapter as yt, KubbPluginEndContext as z };
|
|
2335
|
+
//# sourceMappingURL=createKubb-BJGymYhe.d.ts.map
|