@kubb/core 5.11.3 → 5.11.5
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/{Hookable-Ce-Xu-KB.js → Hookable-7Kv_oj72.js} +139 -82
- package/dist/Hookable-7Kv_oj72.js.map +1 -0
- package/dist/{createAdapter-D6osJ_0O.d.ts → createAdapter-DtX_MKL-.d.ts} +77 -14
- package/dist/index.cjs +194 -120
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -16
- package/dist/index.d.ts +3 -5
- package/dist/index.js +65 -47
- package/dist/index.js.map +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +2 -2
- package/dist/Hookable-Ce-Xu-KB.js.map +0 -1
|
@@ -320,6 +320,16 @@ type DiagnosticFormatOptions = {
|
|
|
320
320
|
* @default 0
|
|
321
321
|
*/
|
|
322
322
|
width?: number;
|
|
323
|
+
/**
|
|
324
|
+
* Where the diagnostic's pointer sits in the input file, when the host resolved it. Replaces the
|
|
325
|
+
* pointer on the `at` row, and an error's `human` layout draws `frame` under it.
|
|
326
|
+
*/
|
|
327
|
+
position?: {
|
|
328
|
+
file: string;
|
|
329
|
+
line: number;
|
|
330
|
+
column: number;
|
|
331
|
+
frame?: Array<string>;
|
|
332
|
+
};
|
|
323
333
|
};
|
|
324
334
|
/**
|
|
325
335
|
* A {@link Diagnostic} reduced to its JSON-safe fields plus a `docsUrl`, for
|
|
@@ -371,7 +381,7 @@ declare function serialize(diagnostic: Diagnostic): SerializedDiagnostic;
|
|
|
371
381
|
* with `at`, `fix`, the first cause, and `Learn more` for an error, and one row for a warning.
|
|
372
382
|
* `verbose` adds the full stack.
|
|
373
383
|
*/
|
|
374
|
-
declare function format(diagnostic: Diagnostic, { audience, verbose, width }?: DiagnosticFormatOptions): Array<string>;
|
|
384
|
+
declare function format(diagnostic: Diagnostic, { audience, verbose, width, position }?: DiagnosticFormatOptions): Array<string>;
|
|
375
385
|
//#endregion
|
|
376
386
|
//#region src/createReporter.d.ts
|
|
377
387
|
/**
|
|
@@ -414,9 +424,28 @@ type GenerationResult = {
|
|
|
414
424
|
*/
|
|
415
425
|
diagnostics: Array<Diagnostic>;
|
|
416
426
|
/**
|
|
417
|
-
* Number of files
|
|
427
|
+
* Number of generated files for this config, including unchanged files.
|
|
418
428
|
*/
|
|
419
429
|
filesCreated: number;
|
|
430
|
+
/**
|
|
431
|
+
* Number of generated files whose content matches the previous output.
|
|
432
|
+
*/
|
|
433
|
+
filesUnchanged?: number;
|
|
434
|
+
/**
|
|
435
|
+
* Changes compared with the output before this run, when the host collected them.
|
|
436
|
+
* Line totals include added and deleted files.
|
|
437
|
+
*/
|
|
438
|
+
fileChanges?: {
|
|
439
|
+
added: number;
|
|
440
|
+
modified: number;
|
|
441
|
+
deleted: number;
|
|
442
|
+
linesAdded: number;
|
|
443
|
+
linesRemoved: number;
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* The result previews generation without writing output.
|
|
447
|
+
*/
|
|
448
|
+
dryRun?: boolean;
|
|
420
449
|
status: 'success' | 'failed';
|
|
421
450
|
/**
|
|
422
451
|
* `process.hrtime()` snapshot taken when this config started generating.
|
|
@@ -453,10 +482,10 @@ type Reporter = {
|
|
|
453
482
|
*/
|
|
454
483
|
report: (result: GenerationResult, context: ReporterContext) => void | Promise<void>;
|
|
455
484
|
/**
|
|
456
|
-
*
|
|
457
|
-
*
|
|
485
|
+
* Runs once after the run's last config, on `kubb:lifecycle:end`. Only a reporter that collects
|
|
486
|
+
* its configs' reports into one document, such as `json`, has one.
|
|
458
487
|
*/
|
|
459
|
-
drain
|
|
488
|
+
drain?: (context: ReporterContext) => void | Promise<void>;
|
|
460
489
|
/**
|
|
461
490
|
* Whether the host should collect files from `kubb:plugin:end` hooks.
|
|
462
491
|
*/
|
|
@@ -675,6 +704,19 @@ type OutputManifest = {
|
|
|
675
704
|
*/
|
|
676
705
|
commit(): Promise<void>;
|
|
677
706
|
};
|
|
707
|
+
/**
|
|
708
|
+
* Loads the stored manifest, starting empty when it is missing, unreadable, or from an older
|
|
709
|
+
* version. `storage` holds the generated files, `cache` holds the manifest itself.
|
|
710
|
+
*
|
|
711
|
+
* @example
|
|
712
|
+
* ```ts
|
|
713
|
+
* const manifest = await createOutputManifest({ storage: config.storage, cache: cacheStorage({ root: config.root }) })
|
|
714
|
+
* ```
|
|
715
|
+
*/
|
|
716
|
+
declare function createOutputManifest({ storage, cache }: {
|
|
717
|
+
storage: Storage;
|
|
718
|
+
cache: Storage;
|
|
719
|
+
}): Promise<OutputManifest>;
|
|
678
720
|
//#endregion
|
|
679
721
|
//#region src/Hookable.d.ts
|
|
680
722
|
/**
|
|
@@ -774,7 +816,7 @@ type WriteOptions = ParseOptions & {
|
|
|
774
816
|
*/
|
|
775
817
|
manifest?: OutputManifest;
|
|
776
818
|
/**
|
|
777
|
-
* Receives `kubb:files:processing:start`, `:update` (
|
|
819
|
+
* Receives `kubb:files:processing:start`, `:update` (in input order, as files finish) and `:end` for the write. `config` fills the update rows.
|
|
778
820
|
*/
|
|
779
821
|
hooks?: Hookable<KubbHooks>;
|
|
780
822
|
config?: Config;
|
|
@@ -819,11 +861,12 @@ declare class FileManager {
|
|
|
819
861
|
* Parses and writes every file through a bounded pool of workers. A small spec runs all its files
|
|
820
862
|
* at once; a spec with thousands of files keeps at most {@link FILE_CONCURRENCY} parsed sources in
|
|
821
863
|
* memory rather than holding every source, while still overlapping each file's write with the
|
|
822
|
-
* next file's parse. Files finish in whatever order they parse, so
|
|
823
|
-
*
|
|
864
|
+
* next file's parse. Files finish in whatever order they parse, so each finished file flushes the
|
|
865
|
+
* run of finished files ahead of it as one `kubb:files:processing:update`, keeping rows in input order.
|
|
824
866
|
*
|
|
825
867
|
* A file the storage already holds is skipped, so a rebuild that generates identical output
|
|
826
|
-
* writes nothing and leaves every mtime where it was.
|
|
868
|
+
* writes nothing and leaves every mtime where it was. `kubb:files:processing:end` lists the
|
|
869
|
+
* skipped paths as `unchanged`.
|
|
827
870
|
*/
|
|
828
871
|
write(files: Array<FileNode>, { storage, parsers, manifest, signal, hooks, config }: WriteOptions): Promise<void>;
|
|
829
872
|
}
|
|
@@ -1368,6 +1411,13 @@ type KubbBuildStartContext = FilesContext & {
|
|
|
1368
1411
|
* To observe individual schemas and operations use the `kubb:generate:schema` / `kubb:generate:operation` hooks.
|
|
1369
1412
|
*/
|
|
1370
1413
|
meta: InputMeta | undefined;
|
|
1414
|
+
/**
|
|
1415
|
+
* How many schemas and operations the parsed document holds, the totals for a progress display.
|
|
1416
|
+
*/
|
|
1417
|
+
nodeCounts: {
|
|
1418
|
+
schemas: number;
|
|
1419
|
+
operations: number;
|
|
1420
|
+
};
|
|
1371
1421
|
/**
|
|
1372
1422
|
* Looks up a registered plugin by name, typed by the plugin registry.
|
|
1373
1423
|
*/
|
|
@@ -1519,6 +1569,10 @@ type KubbFilesProcessingEndContext = {
|
|
|
1519
1569
|
* All files that were serialized in this batch.
|
|
1520
1570
|
*/
|
|
1521
1571
|
files: Array<FileNode>;
|
|
1572
|
+
/**
|
|
1573
|
+
* Paths of the files the storage already held with the same content, so they were not written.
|
|
1574
|
+
*/
|
|
1575
|
+
unchanged: Array<string>;
|
|
1522
1576
|
};
|
|
1523
1577
|
type KubbHookStartContext = {
|
|
1524
1578
|
/**
|
|
@@ -1756,7 +1810,7 @@ type Diagnostic = ProblemDiagnostic | PerformanceDiagnostic | UpdateDiagnostic;
|
|
|
1756
1810
|
* Static helpers for working with {@link Diagnostic}s, plus the run-scoped sink
|
|
1757
1811
|
* that lets deep code report a diagnostic without threading a callback.
|
|
1758
1812
|
*
|
|
1759
|
-
* The sink lives in a single `AsyncLocalStorage`
|
|
1813
|
+
* The sink lives in a single `AsyncLocalStorage` on `globalThis`, shared by every copy of `@kubb/core`.
|
|
1760
1814
|
* `Diagnostics.scope` activates it for a run, so anything inside that run (the
|
|
1761
1815
|
* adapter parse, a generator) reports through `Diagnostics.report` and lands
|
|
1762
1816
|
* in the same run.
|
|
@@ -3096,9 +3150,11 @@ type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
|
3096
3150
|
name: TOptions['name'];
|
|
3097
3151
|
meta?: ExtensionMeta<TOptions['name']>;
|
|
3098
3152
|
/**
|
|
3099
|
-
*
|
|
3153
|
+
* The options the adapter was created with, before `setup` applied defaults, as a plugin keeps its
|
|
3154
|
+
* own. Kubb Studio merges its overrides onto these, so a default derived from another option, such
|
|
3155
|
+
* as `emptySchemaType` from `unknownType`, follows a change to it.
|
|
3100
3156
|
*/
|
|
3101
|
-
options: TOptions['
|
|
3157
|
+
options: TOptions['options'];
|
|
3102
3158
|
/**
|
|
3103
3159
|
* Parsed source document after the first `parse()` call. `null` before parsing.
|
|
3104
3160
|
*/
|
|
@@ -3120,6 +3176,13 @@ type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
|
3120
3176
|
validate: (input: string, options?: {
|
|
3121
3177
|
throwOnError?: boolean;
|
|
3122
3178
|
}) => Promise<void>;
|
|
3179
|
+
/**
|
|
3180
|
+
* Zero-based UTF-16 offsets of a diagnostic in `source` for a code frame, `end` exclusive; `undefined` when it cannot be found.
|
|
3181
|
+
*/
|
|
3182
|
+
locate?: (source: string, location: DiagnosticLocation) => {
|
|
3183
|
+
start: number;
|
|
3184
|
+
end: number;
|
|
3185
|
+
} | undefined;
|
|
3123
3186
|
};
|
|
3124
3187
|
/**
|
|
3125
3188
|
* The object passed to `defineExtension` with `kind: 'adapter'`.
|
|
@@ -3152,5 +3215,5 @@ type AdapterFactory<T extends AdapterFactoryOptions = AdapterFactoryOptions> = E
|
|
|
3152
3215
|
*/
|
|
3153
3216
|
declare function createAdapter<T extends AdapterFactoryOptions = AdapterFactoryOptions>(definition: AdapterDefinition<T>): AdapterFactory<T>;
|
|
3154
3217
|
//#endregion
|
|
3155
|
-
export { NodeCache as $,
|
|
3156
|
-
//# sourceMappingURL=createAdapter-
|
|
3218
|
+
export { NodeCache as $, ReporterContext as $t, PluginFactory as A, KubbInfoContext as At, ResolveImportsOptions as B, RunHookOptions as Bt, NormalizedPlugin as C, KubbGenerationEndContext as Ct, Override as D, KubbHookLineContext as Dt, OutputOptions as E, KubbHookEndContext as Et, definePlugin as F, KubbWarnContext as Ft, ResolverFile as G, createOutputManifest as Gt, ResolvePathOptions as H, KubbDriver as Ht, BannerMeta as I, PossibleConfig as It, ResolverPatch as J, createRenderer as Jt, ResolverFileParams as K, Renderer as Kt, ResolveBannerContext as L, PostGenerateCommand as Lt, PluginType as M, KubbMessageContext as Mt, ResolvePluginOptions as N, KubbPluginsEndContext as Nt, Plugin as O, KubbHookStartContext as Ot, assertPluginOption as P, KubbSuccessContext as Pt, defineGenerator as Q, Reporter as Qt, ResolveBannerFile as R, UserConfig as Rt, KubbPluginStartContext as S, KubbFilesProcessingUpdateContext as St, OutputMode as T, KubbGenerationSummaryContext as Tt, Resolver as U, Hookable as Ut, ResolveOptionsContext as V, runHook as Vt, ResolverDefault as W, OutputManifest as Wt, Generator as X, createStorage as Xt, ResolverPathParams as Y, Storage as Yt, GeneratorContext as Z, GenerationResult as Zt, Filter as _, KubbDiagnosticContext as _t, AdapterSource as a, DiagnosticFormatOptions as an, Diagnostics as at, KubbPluginEndContext as b, KubbFilesProcessingEndContext as bt, ExtensionDependency as c, ParserDefinition as cn, ProblemDiagnostic as ct, ExtensionKind as d, CLIOptions as dt, ReporterName as en, Diagnostic as et, ExtensionMeta as f, Config as ft, Exclude$1 as g, KubbBuildStartContext as gt, resolveMeta as h, KubbBuildEndContext as ht, AdapterFactoryOptions as i, logLevel as in, DiagnosticSeverity as it, PluginName as j, KubbLifecycleStartContext as jt, PluginDefinition as k, KubbHooks as kt, ExtensionDependencyRecord as l, ParserFactory as ln, UpdateDiagnostic as lt, defineExtension as m, Input as mt, AdapterDefinition as n, UserReporter as nn, DiagnosticKind as nt, createAdapter as o, SerializedDiagnostic as on, PerformanceDiagnostic as ot, checkCompatibility as p, FilesContext as pt, ResolverFilePathParams as q, RendererFactory as qt, AdapterFactory as r, createReporter as rn, DiagnosticLocation as rt, ExtensionDependencies as s, Parser as sn, ProblemCode as st, Adapter as t, ReporterPluginFiles as tn, DiagnosticDoc as tt, ExtensionFactory as u, defineParser as un, BuildOutput as ut, Group as v, KubbErrorContext as vt, Output as w, KubbGenerationStartContext as wt, KubbPluginSetupContext as x, KubbFilesProcessingStartContext as xt, Include as y, KubbFileProcessingUpdate as yt, ResolveFileOptions as z, HookResult as zt };
|
|
3219
|
+
//# sourceMappingURL=createAdapter-DtX_MKL-.d.ts.map
|