@kubb/core 5.0.0-beta.98 → 5.0.0

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.
@@ -152,10 +152,30 @@ declare const diagnosticCode: {
152
152
  * The file or URL set as `input` could not be read.
153
153
  */
154
154
  readonly inputNotFound: "KUBB_INPUT_NOT_FOUND";
155
+ /**
156
+ * A URL set as `input` (or referenced by a `$ref`) answered with a 4xx or 5xx status
157
+ * instead of the document.
158
+ */
159
+ readonly inputRequestFailed: "KUBB_INPUT_REQUEST_FAILED";
160
+ /**
161
+ * A URL set as `input` (or referenced by a `$ref`) never answered, so the request failed
162
+ * before a status was returned.
163
+ */
164
+ readonly inputUnreachable: "KUBB_INPUT_UNREACHABLE";
155
165
  /**
156
166
  * An adapter was configured without an `input`.
157
167
  */
158
168
  readonly inputRequired: "KUBB_INPUT_REQUIRED";
169
+ /**
170
+ * `input` uses the v4 `{ path }` / `{ data }` wrapper, which v5 reads as a parsed
171
+ * document instead of a pointer to one.
172
+ */
173
+ readonly legacyInput: "KUBB_LEGACY_INPUT";
174
+ /**
175
+ * The parsed `input` carries no `openapi` or `swagger` version, so it is not a
176
+ * document the adapter can read.
177
+ */
178
+ readonly invalidDocument: "KUBB_INVALID_DOCUMENT";
159
179
  /**
160
180
  * A `$ref` (or equivalent reference) could not be resolved in the source document.
161
181
  */
@@ -498,7 +518,11 @@ declare class Diagnostics {
498
518
  static code: {
499
519
  readonly unknown: "KUBB_UNKNOWN";
500
520
  readonly inputNotFound: "KUBB_INPUT_NOT_FOUND";
521
+ readonly inputRequestFailed: "KUBB_INPUT_REQUEST_FAILED";
522
+ readonly inputUnreachable: "KUBB_INPUT_UNREACHABLE";
501
523
  readonly inputRequired: "KUBB_INPUT_REQUIRED";
524
+ readonly legacyInput: "KUBB_LEGACY_INPUT";
525
+ readonly invalidDocument: "KUBB_INVALID_DOCUMENT";
502
526
  readonly refNotFound: "KUBB_REF_NOT_FOUND";
503
527
  readonly invalidServerVariable: "KUBB_INVALID_SERVER_VARIABLE";
504
528
  readonly pluginNotFound: "KUBB_PLUGIN_NOT_FOUND";
@@ -766,6 +790,9 @@ declare function createReporter<T = void>(reporter: UserReporter<T>): Reporter;
766
790
  * Backend that persists generated files. Kubb ships with `fsStorage` (writes
767
791
  * to disk) and `memoryStorage` (keeps everything in RAM). Implement this
768
792
  * interface to write somewhere else, such as S3 or a database.
793
+ *
794
+ * Method names follow Node's filesystem vocabulary, so `readItem` reads like
795
+ * `readFile` and `writeItem` like `writeFile`.
769
796
  */
770
797
  type Storage = {
771
798
  /**
@@ -775,16 +802,16 @@ type Storage = {
775
802
  /**
776
803
  * Returns `true` when an entry for `key` exists.
777
804
  */
778
- hasItem(key: string): Promise<boolean>;
805
+ existsItem(key: string): Promise<boolean>;
779
806
  /**
780
807
  * Reads the stored string. Returns `null` when the key is missing.
781
808
  */
782
- getItem(key: string): Promise<string | null>;
809
+ readItem(key: string): Promise<string | null>;
783
810
  /**
784
811
  * Stores `value` under `key`, creating any required structure (directories,
785
812
  * buckets, ...).
786
813
  */
787
- setItem(key: string, value: string): Promise<void>;
814
+ writeItem(key: string, value: string): Promise<void>;
788
815
  /**
789
816
  * Deletes the entry for `key`. No-op when the key does not exist.
790
817
  */
@@ -792,15 +819,15 @@ type Storage = {
792
819
  /**
793
820
  * Returns every key. Pass `base` to filter to keys starting with that prefix.
794
821
  */
795
- getKeys(base?: string): Promise<Array<string>>;
822
+ readKeys(base?: string): Promise<Array<string>>;
796
823
  /**
797
824
  * Removes stored entries. Pass `base` to scope the wipe to a key prefix.
798
825
  *
799
826
  * Omitting `base` is implementation-defined: in-memory stores wipe every
800
827
  * entry, while filesystem-backed stores treat a missing `base` as a no-op so
801
- * a bare `clear()` can never delete outside a known output directory.
828
+ * a bare `empty()` can never delete outside a known output directory.
802
829
  */
803
- clear(base?: string): Promise<void>;
830
+ empty(base?: string): Promise<void>;
804
831
  };
805
832
  /**
806
833
  * Defines a custom storage backend. The builder receives user options and
@@ -817,23 +844,23 @@ type Storage = {
817
844
  *
818
845
  * return {
819
846
  * name: 'memory',
820
- * async hasItem(key) {
847
+ * async existsItem(key) {
821
848
  * return store.has(key)
822
849
  * },
823
- * async getItem(key) {
850
+ * async readItem(key) {
824
851
  * return store.get(key) ?? null
825
852
  * },
826
- * async setItem(key, value) {
853
+ * async writeItem(key, value) {
827
854
  * store.set(key, value)
828
855
  * },
829
856
  * async removeItem(key) {
830
857
  * store.delete(key)
831
858
  * },
832
- * async getKeys(base) {
859
+ * async readKeys(base) {
833
860
  * const keys = [...store.keys()]
834
861
  * return base ? keys.filter((k) => k.startsWith(base)) : keys
835
862
  * },
836
- * async clear(base) {
863
+ * async empty(base) {
837
864
  * if (!base) store.clear()
838
865
  * },
839
866
  * }
@@ -1207,6 +1234,10 @@ declare class Resolver {
1207
1234
  * schemas (`targetName`) import the emitted name. Names and paths go through the top-level
1208
1235
  * `name` and `file`, so import entries follow the plugin's conventions, and a per-call
1209
1236
  * `name` override wins over both.
1237
+ *
1238
+ * The subtree scan runs through `collectImportedRefNames`, which memoizes by node identity, so a
1239
+ * schema shared across the ts, zod, and faker plugins is walked once and every plugin's resolver
1240
+ * reads the same ref set instead of re-scanning it per plugin.
1210
1241
  */
1211
1242
  imports(options: ResolveImportsOptions): Array<ImportNode>;
1212
1243
  /**
@@ -1240,8 +1271,8 @@ type PluginName = LiteralUnion<keyof Kubb.PluginRegistry>;
1240
1271
  type ResolvePluginOptions<TName> = TName extends keyof Kubb.PluginRegistry ? Kubb.PluginRegistry[TName] : PluginFactoryOptions;
1241
1272
  /**
1242
1273
  * How a plugin consolidates its generated code into files.
1243
- * - `'directory'` writes one file per operation or schema under `path`.
1244
1274
  * - `'file'` writes everything into a single file.
1275
+ * - `'directory'` writes one file per operation or schema under `path`.
1245
1276
  */
1246
1277
  type OutputMode = 'directory' | 'file';
1247
1278
  /**
@@ -1257,10 +1288,10 @@ type Output = {
1257
1288
  path: string;
1258
1289
  /**
1259
1290
  * How generated code is consolidated into files.
1260
- * - `'directory'` writes one file per operation or schema under `path`.
1261
1291
  * - `'file'` writes everything into a single file. The `path` must include the file extension.
1292
+ * - `'directory'` writes one file per operation or schema under `path`.
1262
1293
  *
1263
- * @default 'directory'
1294
+ * Defaults to `'file'` when `path` carries an extension and `'directory'` when it does not.
1264
1295
  */
1265
1296
  mode?: OutputMode;
1266
1297
  /**
@@ -1303,9 +1334,13 @@ type Group = {
1303
1334
  };
1304
1335
  /**
1305
1336
  * Couples `output.mode` with the plugin's `group` option at the type level.
1306
- * - `mode: 'file'` forbids `group` (a single file has nothing to group).
1307
- * - `mode: 'directory'` (or no mode) allows an optional `group` to organize
1308
- * files into per-group subdirectories.
1337
+ * - An explicit `mode: 'file'` forbids `group` (a single file has nothing to group).
1338
+ * - Omitting `mode`, or setting it to `'directory'`, allows an optional `group`.
1339
+ *
1340
+ * `mode` is normally inferred from `output.path` (an extension means `'file'`, anything
1341
+ * else `'directory'`), so `group` rarely needs `mode` spelled out alongside it. Set
1342
+ * `mode: 'directory'` explicitly only to override that inference, such as a directory
1343
+ * name that carries a dot (`path: 'clients.v2'`).
1309
1344
  *
1310
1345
  * Intersect into a plugin's `Options` type instead of declaring `output` and
1311
1346
  * `group` directly, since `mode` lives inside `output` while `group` is its sibling.
@@ -1324,7 +1359,7 @@ type OutputOptions<TOutput extends Output = Output> = {
1324
1359
  };
1325
1360
  group?: Group;
1326
1361
  } | {
1327
- output: TOutput & {
1362
+ output?: TOutput & {
1328
1363
  mode: 'file';
1329
1364
  };
1330
1365
  group?: never;
@@ -1682,6 +1717,39 @@ type Parser<TMeta extends object = object, TNode = unknown> = {
1682
1717
  */
1683
1718
  declare function defineParser<TOptions extends object = object, TMeta extends object = object, TNode = unknown>(factory: (options: TOptions) => Parser<TMeta, TNode>): (options?: TOptions) => Parser<TMeta, TNode>;
1684
1719
  //#endregion
1720
+ //#region src/outputManifest.d.ts
1721
+ /**
1722
+ * Remembers what the output passes did to each generated file, so the next run can tell "the
1723
+ * formatter already turned this exact source into what is stored" apart from a real change.
1724
+ * Without it the storage compares Kubb's bytes against the formatter's, never matches, and
1725
+ * rewrites the whole output tree on every build.
1726
+ */
1727
+ type OutputManifest = {
1728
+ /**
1729
+ * `true` when `source` is known to come out of the output passes as exactly the content stored,
1730
+ * meaning the write can be skipped.
1731
+ */
1732
+ isUpToDate(options: {
1733
+ key: string;
1734
+ source: string;
1735
+ disk: string;
1736
+ }): boolean;
1737
+ /**
1738
+ * Records the source Kubb wrote for `key`, marking it as the only kind of file the output passes
1739
+ * can have changed and so the only kind `commit` has to re-read.
1740
+ */
1741
+ track(options: {
1742
+ key: string;
1743
+ source: string;
1744
+ }): void;
1745
+ /**
1746
+ * Re-reads the files written this run and persists their source/output pairs on top of what is
1747
+ * stored. Nothing is pruned: a run generating a different set of files, or writing to a different
1748
+ * storage in the same root, must not evict what another run recorded.
1749
+ */
1750
+ commit(): Promise<void>;
1751
+ };
1752
+ //#endregion
1685
1753
  //#region src/FileManager.d.ts
1686
1754
  /**
1687
1755
  * Hooks fired around a `FileManager#write` batch: `start` before it, `update` per file, `end` after.
@@ -1702,6 +1770,11 @@ type ParseOptions = {
1702
1770
  };
1703
1771
  type WriteOptions = ParseOptions & {
1704
1772
  storage: Storage;
1773
+ /**
1774
+ * Consulted before each write so a file the output passes already normalized is recognized as
1775
+ * unchanged. Omitted when no formatter, linter, or `postGenerate` step is configured.
1776
+ */
1777
+ manifest?: OutputManifest;
1705
1778
  };
1706
1779
  /**
1707
1780
  * In-memory file store for generated files, and the writer that turns them into source
@@ -1738,15 +1811,25 @@ declare class FileManager {
1738
1811
  */
1739
1812
  parse(file: FileNode, { parsers }?: ParseOptions): Promise<string>;
1740
1813
  /**
1741
- * Converts and writes every file at once, letting `storage.setItem` decide how much of
1742
- * that runs concurrently.
1814
+ * Parses and writes every file through a bounded pool of workers. A small spec runs all its files
1815
+ * at once; a spec with thousands of files keeps at most {@link FILE_CONCURRENCY} parsed sources in
1816
+ * memory rather than holding every source, while still overlapping each file's write with the
1817
+ * next file's parse. Each `update` carries the file's input position, so a consumer can present
1818
+ * the files in generation order even though they finish in whatever order they parse.
1819
+ *
1820
+ * A file the storage already holds is skipped, so a rebuild that generates identical output
1821
+ * writes nothing and leaves every mtime where it was.
1743
1822
  */
1744
- write(files: Array<FileNode>, { storage, parsers }: WriteOptions): Promise<void>;
1823
+ write(files: Array<FileNode>, { storage, parsers, manifest }: WriteOptions): Promise<void>;
1745
1824
  }
1746
1825
  //#endregion
1747
1826
  //#region src/KubbDriver.d.ts
1748
1827
  type Options = {
1749
1828
  hooks: Hookable<KubbHooks>;
1829
+ /**
1830
+ * Passed to `fileManager.write` so files the output passes already normalized are left alone.
1831
+ */
1832
+ manifest?: OutputManifest;
1750
1833
  };
1751
1834
  type RequirePluginContext = {
1752
1835
  /**
@@ -1788,15 +1871,13 @@ declare class KubbDriver {
1788
1871
  */
1789
1872
  setupHooks(): Promise<void>;
1790
1873
  /**
1791
- * Registers a generator for the given plugin on the shared hook emitter.
1874
+ * Appends a generator to its owning plugin so the generate loop can call it directly.
1792
1875
  *
1793
- * The generator's `schema`, `operation`, and `operations` methods are registered as
1794
- * listeners on `kubb:generate:schema`, `kubb:generate:operation`, and `kubb:generate:operations`
1795
- * respectively. Each listener is scoped to the owning plugin via a `ctx.plugin.name` check
1796
- * so that generators from different plugins do not cross-fire.
1797
- *
1798
- * The renderer comes from `generator.renderer`. Set `generator.renderer = null` (or leave it
1799
- * unset) to opt out of rendering.
1876
+ * The generator's `schema`, `operation`, and `operations` methods run per node during the AST
1877
+ * walk in `#runGenerators`, and their result is routed through `dispatch`. Because a generator is
1878
+ * bound to a plugin, generators from different plugins never cross-fire without a name check. The
1879
+ * renderer comes from `generator.renderer`; set it to `null` (or leave it unset) to opt out of
1880
+ * rendering.
1800
1881
  *
1801
1882
  * Call this method inside `addGenerator()` (in `kubb:plugin:setup`) to wire up a generator.
1802
1883
  */
@@ -1805,7 +1886,7 @@ declare class KubbDriver {
1805
1886
  * Returns `true` when at least one generator was registered for the given plugin
1806
1887
  * via `addGenerator()` in `kubb:plugin:setup`.
1807
1888
  *
1808
- * Used by the build loop to decide whether to walk the AST and emit generator hooks
1889
+ * Used by the build loop to decide whether to walk the AST and run the generators
1809
1890
  * for a plugin.
1810
1891
  */
1811
1892
  hasHookGenerators(pluginName: string): boolean;
@@ -1843,19 +1924,17 @@ declare class KubbDriver {
1843
1924
  dispose(): void;
1844
1925
  [Symbol.dispose](): void;
1845
1926
  /**
1846
- * Merges `partial` with the plugin's default resolver and stores the result.
1847
- * Also mirrors it onto `plugin.resolver` so callers using `getPlugin(name).resolver`
1848
- * get the up-to-date resolver without going through `getResolver()`.
1927
+ * Merges `partial` onto a fresh default resolver and stores the result on `plugin.resolver`,
1928
+ * which is the single source `getResolver` and `getPlugin(name).resolver` both read.
1849
1929
  */
1850
1930
  setPluginResolver(pluginName: string, partial: ResolverPatch | Resolver): void;
1851
1931
  /**
1852
- * Returns the resolver for the given plugin.
1853
- *
1854
- * Resolution order: resolver set via `setPluginResolver` → lazily created default
1855
- * resolver (identity name, no path transforms).
1932
+ * Returns the resolver for the given plugin. It reads `plugin.resolver` (seeded with the default
1933
+ * at registration and replaced by `setPluginResolver`), falling back to a fresh default for a
1934
+ * name that is not a registered plugin.
1856
1935
  */
1857
1936
  getResolver<TName extends PluginName>(pluginName: TName): ResolvePluginOptions<TName>['resolver'];
1858
- getContext<TOptions extends PluginFactoryOptions>(plugin: NormalizedPlugin<TOptions>): Omit<GeneratorContext<TOptions>, 'options'>;
1937
+ getContext<TOptions extends PluginFactoryOptions>(plugin: NormalizedPlugin<TOptions>): Omit<GeneratorContext<TOptions>, 'options' | 'cache'>;
1859
1938
  getPlugin<TName extends PluginName>(pluginName: TName): Plugin<ResolvePluginOptions<TName>> | undefined;
1860
1939
  /**
1861
1940
  * Like `getPlugin` but throws a descriptive error when the plugin is not found.
@@ -1863,6 +1942,38 @@ declare class KubbDriver {
1863
1942
  requirePlugin<TName extends PluginName>(pluginName: TName, context?: RequirePluginContext): Plugin<ResolvePluginOptions<TName>>;
1864
1943
  }
1865
1944
  //#endregion
1945
+ //#region src/nodeCache.d.ts
1946
+ /**
1947
+ * Per-node memo shared by every plugin that generates from the same schema or operation node in
1948
+ * one generate pass. The driver creates one `NodeCache` per node during the walk and hands the
1949
+ * same instance to each plugin's generator context, so work derived purely from the node (its
1950
+ * resolved name, imports, parameters) is computed by the first plugin that needs it and reused by
1951
+ * the rest instead of being recomputed per plugin.
1952
+ *
1953
+ * Keys are namespaced by convention (`'plugin-ts:imports'`) so two plugins caching different
1954
+ * derivations of the same node never collide.
1955
+ *
1956
+ * @example Fill on first read, reuse afterwards
1957
+ * ```ts
1958
+ * const imports = ctx.cache.ensureItem('plugin-ts:imports', () => ctx.resolver.imports({ node, root, output }))
1959
+ * ```
1960
+ */
1961
+ type NodeCache = {
1962
+ /**
1963
+ * Returns the value stored under `key`, or `undefined` when nothing is stored yet.
1964
+ */
1965
+ readItem<TValue>(key: string): TValue | undefined;
1966
+ /**
1967
+ * Stores `value` under `key`, overwriting any previous value, and returns it.
1968
+ */
1969
+ writeItem<TValue>(key: string, value: TValue): TValue;
1970
+ /**
1971
+ * Returns the value stored under `key`, computing and storing it with `factory` on the first
1972
+ * call. Later calls with the same key return the stored value without running `factory` again.
1973
+ */
1974
+ ensureItem<TValue>(key: string, factory: () => TValue): TValue;
1975
+ };
1976
+ //#endregion
1866
1977
  //#region src/defineGenerator.d.ts
1867
1978
  /**
1868
1979
  * Context passed to a generator's `schema`, `operation`, and `operations` methods.
@@ -1957,6 +2068,13 @@ type GeneratorContext<TOptions extends PluginFactoryOptions = PluginFactoryOptio
1957
2068
  * Resolved options after exclude/include/override filtering.
1958
2069
  */
1959
2070
  options: TOptions['resolvedOptions'];
2071
+ /**
2072
+ * Cache scoped to the node being generated, shared by every plugin that generates from that
2073
+ * same node in the current pass. Use it to compute node-derived work (resolved names, imports,
2074
+ * parameters) once and let the other plugins reuse it. For the `operations` batch call, where
2075
+ * there is no single node, the cache is a fresh scratch scope for that call.
2076
+ */
2077
+ cache: NodeCache;
1960
2078
  };
1961
2079
  /**
1962
2080
  * Declares a named generator unit that walks the AST and emits files.
@@ -2008,6 +2126,24 @@ type Generator<TOptions extends PluginFactoryOptions = PluginFactoryOptions, TEl
2008
2126
  * ```
2009
2127
  */
2010
2128
  renderer?: RendererFactory<TElement> | null;
2129
+ /**
2130
+ * Predicate checked before `schema` or `operation` runs for a node, mirroring `Macro['match']`
2131
+ * in `@kubb/ast`. Returning `false` skips the call for that node entirely, with no context work
2132
+ * beyond what the driver already builds per node and no render call, instead of the generator
2133
+ * itself being invoked and returning early. Omit it to run for every node, the default when
2134
+ * unset.
2135
+ *
2136
+ * Does not gate `operations`, which already runs once per plugin on the full batch rather than
2137
+ * per node.
2138
+ *
2139
+ * @example Only match GET operations
2140
+ * ```ts
2141
+ * match(node, ctx) {
2142
+ * return ast.isHttpOperationNode(node) && node.method.toLowerCase() === 'get'
2143
+ * }
2144
+ * ```
2145
+ */
2146
+ match?: (node: SchemaNode | OperationNode, ctx: GeneratorContext<TOptions>) => PossiblePromise<boolean>;
2011
2147
  /**
2012
2148
  * Called for each schema node in the AST walk.
2013
2149
  * `ctx` carries the plugin context with `adapter` and `meta` (document metadata),
@@ -2061,6 +2197,37 @@ declare function defineGenerator<TOptions extends PluginFactoryOptions = PluginF
2061
2197
  type CreateKubbOptions = {
2062
2198
  hooks?: Hookable<KubbHooks>;
2063
2199
  };
2200
+ /**
2201
+ * Host hooks for a single {@link Kubb.generate} call. All optional. Progress narration rides the
2202
+ * `kubb:*` lifecycle hooks on `.hooks`, so hosts subscribe there rather than pass a callback.
2203
+ */
2204
+ type GenerateOptions = {
2205
+ /**
2206
+ * Format, lint, and run `postGenerate` over the generated output after an error-free build, and
2207
+ * return the diagnostics they emitted. CLI-only.
2208
+ */
2209
+ processOutput?: (context: {
2210
+ config: Config;
2211
+ outputPath: string;
2212
+ }) => Promise<Array<Diagnostic>>;
2213
+ };
2214
+ /**
2215
+ * What a {@link Kubb.generate} call produced, for the host to map onto its own result shape.
2216
+ */
2217
+ type GenerateResult = {
2218
+ /**
2219
+ * `true` when the build and every output pass completed without an error-level diagnostic.
2220
+ */
2221
+ success: boolean;
2222
+ /**
2223
+ * All files generated during the build.
2224
+ */
2225
+ files: Array<FileNode>;
2226
+ /**
2227
+ * Build diagnostics plus any collected from the output passes.
2228
+ */
2229
+ diagnostics: Array<Diagnostic>;
2230
+ };
2064
2231
  /**
2065
2232
  * Kubb code-generation instance bound to a single config entry. Resolves the user
2066
2233
  * config in the constructor, so `config` is available right away, and shares `hooks`,
@@ -2100,6 +2267,19 @@ declare class Kubb$1 {
2100
2267
  * plugin errors, so callers stay in control of how failures surface.
2101
2268
  */
2102
2269
  safeBuild(): Promise<BuildOutput>;
2270
+ /**
2271
+ * Run one build and its output passes end to end, emitting the surrounding `kubb:generation:*`
2272
+ * hooks. Never throws on a build error: the outcome comes back in {@link GenerateResult} so the
2273
+ * host decides how failures surface. Telemetry and progress narration stay with the host, which
2274
+ * reads the result and subscribes to the `kubb:*` hooks.
2275
+ *
2276
+ * @example
2277
+ * ```ts
2278
+ * const result = await createKubb(config, { hooks }).generate()
2279
+ * if (!result.success) process.exitCode = 1
2280
+ * ```
2281
+ */
2282
+ generate(options?: GenerateOptions): Promise<GenerateResult>;
2103
2283
  dispose(): void;
2104
2284
  [Symbol.dispose](): void;
2105
2285
  }
@@ -2483,6 +2663,8 @@ interface KubbHooks {
2483
2663
  'kubb:lifecycle:end': [];
2484
2664
  'kubb:generation:start': [ctx: KubbGenerationStartContext];
2485
2665
  'kubb:generation:end': [ctx: KubbGenerationEndContext];
2666
+ 'kubb:setup:start': [];
2667
+ 'kubb:setup:end': [];
2486
2668
  'kubb:format:start': [];
2487
2669
  'kubb:format:end': [];
2488
2670
  'kubb:lint:start': [];
@@ -2587,12 +2769,12 @@ type KubbGenerationEndContext = {
2587
2769
  * Reads go directly to `config.storage`, nothing extra is held in memory.
2588
2770
  *
2589
2771
  * @example Read a generated file
2590
- * `const code = await storage.getItem('/src/gen/pet.ts')`
2772
+ * `const code = await storage.readItem('/src/gen/pet.ts')`
2591
2773
  *
2592
2774
  * @example Walk every generated file
2593
2775
  * ```ts
2594
- * for (const path of await storage.getKeys()) {
2595
- * const code = await storage.getItem(path)
2776
+ * for (const path of await storage.readKeys()) {
2777
+ * const code = await storage.readItem(path)
2596
2778
  * }
2597
2779
  * ```
2598
2780
  */
@@ -2681,10 +2863,6 @@ type KubbFileProcessingUpdate = {
2681
2863
  * Completion percentage, `0` to `100`.
2682
2864
  */
2683
2865
  percentage: number;
2684
- /**
2685
- * Serialized file content, or `undefined` when the file produced no output.
2686
- */
2687
- source?: string;
2688
2866
  /**
2689
2867
  * The file that was just processed.
2690
2868
  */
@@ -2829,10 +3007,10 @@ type BuildOutput = {
2829
3007
  * Use `files` to list what this build produced.
2830
3008
  *
2831
3009
  * @example Read a generated file
2832
- * `const code = await buildOutput.storage.getItem('/src/gen/pet.ts')`
3010
+ * `const code = await buildOutput.storage.readItem('/src/gen/pet.ts')`
2833
3011
  */
2834
3012
  storage: Storage;
2835
3013
  };
2836
3014
  //#endregion
2837
- export { definePlugin as $, Generator as A, DiagnosticSeverity as At, Include as B, AdapterSource as Bt, KubbWarnContext as C, UserReporter as Ct, CreateKubbOptions as D, DiagnosticDoc as Dt, UserConfig as E, Diagnostic as Et, Parser as F, SerializedDiagnostic as Ft, Output as G, KubbPluginSetupContext as H, defineParser as I, UpdateDiagnostic as It, Override as J, OutputMode as K, Exclude$1 as L, Hookable as Lt, defineGenerator as M, PerformanceDiagnostic as Mt, KubbDriver as N, ProblemCode as Nt, Kubb$1 as O, DiagnosticKind as Ot, FileManagerHooks as P, ProblemDiagnostic as Pt, ResolvePluginOptions as Q, Filter as R, Adapter as Rt, KubbSuccessContext as S, ReporterName as St, PostGenerateCommand as T, logLevel as Tt, KubbPluginStartContext as U, KubbPluginEndContext as V, createAdapter as Vt, NormalizedPlugin as W, PluginFactoryOptions as X, Plugin as Y, PluginName as Z, KubbHookStartContext as _, Storage as _t, KubbBuildEndContext as a, ResolveOptionsContext as at, KubbLifecycleStartContext as b, Reporter as bt, KubbErrorContext as c, ResolverDefault as ct, KubbFilesProcessingStartContext as d, ResolverFilePathParams as dt, BannerMeta as et, KubbFilesProcessingUpdateContext as f, ResolverPatch as ft, KubbHookLineContext as g, createRenderer as gt, KubbHookEndContext as h, RendererFactory as ht, Input as i, ResolveImportsOptions as it, GeneratorContext as j, Diagnostics as jt, createKubb as k, DiagnosticLocation as kt, KubbFileProcessingUpdate as l, ResolverFile as lt, KubbGenerationStartContext as m, Renderer as mt, CLIOptions as n, ResolveBannerFile as nt, KubbBuildStartContext as o, ResolvePathOptions as ot, KubbGenerationEndContext as p, ResolverPathParams as pt, OutputOptions as q, Config as r, ResolveFileOptions as rt, KubbDiagnosticContext as s, Resolver as st, BuildOutput as t, ResolveBannerContext as tt, KubbFilesProcessingEndContext as u, ResolverFileParams as ut, KubbHooks as v, createStorage as vt, PossibleConfig as w, createReporter as wt, KubbPluginsEndContext as x, ReporterContext as xt, KubbInfoContext as y, GenerationResult as yt, Group as z, AdapterFactoryOptions as zt };
2838
- //# sourceMappingURL=types-CK6CfipY.d.ts.map
3015
+ export { PluginFactoryOptions as $, Kubb$1 as A, DiagnosticDoc as At, Exclude$1 as B, Hookable as Bt, KubbWarnContext as C, Reporter as Ct, CreateKubbOptions as D, createReporter as Dt, UserConfig as E, UserReporter as Et, NodeCache as F, PerformanceDiagnostic as Ft, KubbPluginSetupContext as G, Group as H, AdapterFactoryOptions as Ht, KubbDriver as I, ProblemCode as It, Output as J, KubbPluginStartContext as K, FileManagerHooks as L, ProblemDiagnostic as Lt, Generator as M, DiagnosticLocation as Mt, GeneratorContext as N, DiagnosticSeverity as Nt, GenerateOptions as O, logLevel as Ot, defineGenerator as P, Diagnostics as Pt, Plugin as Q, Parser as R, SerializedDiagnostic as Rt, KubbSuccessContext as S, GenerationResult as St, PostGenerateCommand as T, ReporterName as Tt, Include as U, AdapterSource as Ut, Filter as V, Adapter as Vt, KubbPluginEndContext as W, createAdapter as Wt, OutputOptions as X, OutputMode as Y, Override as Z, KubbHookStartContext as _, Renderer as _t, KubbBuildEndContext as a, ResolveBannerFile as at, KubbLifecycleStartContext as b, Storage as bt, KubbErrorContext as c, ResolveOptionsContext as ct, KubbFilesProcessingStartContext as d, ResolverDefault as dt, PluginName as et, KubbFilesProcessingUpdateContext as f, ResolverFile as ft, KubbHookLineContext as g, ResolverPathParams as gt, KubbHookEndContext as h, ResolverPatch as ht, Input as i, ResolveBannerContext as it, createKubb as j, DiagnosticKind as jt, GenerateResult as k, Diagnostic as kt, KubbFileProcessingUpdate as l, ResolvePathOptions as lt, KubbGenerationStartContext as m, ResolverFilePathParams as mt, CLIOptions as n, definePlugin as nt, KubbBuildStartContext as o, ResolveFileOptions as ot, KubbGenerationEndContext as p, ResolverFileParams as pt, NormalizedPlugin as q, Config as r, BannerMeta as rt, KubbDiagnosticContext as s, ResolveImportsOptions as st, BuildOutput as t, ResolvePluginOptions as tt, KubbFilesProcessingEndContext as u, Resolver as ut, KubbHooks as v, RendererFactory as vt, PossibleConfig as w, ReporterContext as wt, KubbPluginsEndContext as x, createStorage as xt, KubbInfoContext as y, createRenderer as yt, defineParser as z, UpdateDiagnostic as zt };
3016
+ //# sourceMappingURL=types-Ba5Mo-G8.d.ts.map