@kubb/core 5.15.2 → 5.15.3

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/index.d.cts CHANGED
@@ -907,6 +907,7 @@ declare class FileManager {
907
907
  * memory rather than holding every source, while still overlapping each file's write with the
908
908
  * next file's parse. Files finish in whatever order they parse, so each finished file flushes the
909
909
  * run of finished files ahead of it as one `kubb:files:processing:update`, keeping rows in input order.
910
+ * Each parsed source goes out once on `kubb:file:processed`, so listeners read it without the pool holding it.
910
911
  *
911
912
  * A file the storage already holds is skipped, so a rebuild that generates identical output
912
913
  * writes nothing and leaves every mtime where it was. `kubb:files:processing:end` lists the
@@ -1407,6 +1408,7 @@ declare global {
1407
1408
  'kubb:diagnostic': [ctx: KubbDiagnosticContext];
1408
1409
  'kubb:files:processing:start': [ctx: KubbFilesProcessingStartContext];
1409
1410
  'kubb:files:processing:update': [ctx: KubbFilesProcessingUpdateContext];
1411
+ 'kubb:file:processed': [ctx: KubbFileProcessedContext];
1410
1412
  'kubb:files:processing:end': [ctx: KubbFilesProcessingEndContext];
1411
1413
  'kubb:plugin:start': [ctx: KubbPluginStartContext];
1412
1414
  'kubb:plugin:end': [ctx: KubbPluginEndContext];
@@ -1611,6 +1613,12 @@ export type KubbFilesProcessingUpdateContext = {
1611
1613
  */
1612
1614
  files: Array<KubbFileProcessingUpdate>;
1613
1615
  };
1616
+ export type KubbFileProcessedContext = {
1617
+ /** The file that was just parsed and handed to the storage. */
1618
+ file: FileNode;
1619
+ /** The parsed content handed to the storage, before it trims the content or an output pass such as a formatter rewrites it. */
1620
+ source: string;
1621
+ };
1614
1622
  export type KubbFilesProcessingEndContext = {
1615
1623
  /**
1616
1624
  * All files that were serialized in this batch.
@@ -3347,6 +3355,11 @@ type RunOutputPassesOptions = {
3347
3355
  * ```
3348
3356
  */
3349
3357
  export declare function runOutputPasses({ config, outputPath, hooks, signal }: RunOutputPassesOptions): Promise<Array<Diagnostic>>;
3358
+ /**
3359
+ * Whether anything runs over the output directory after the files are written. Only then can the
3360
+ * bytes on disk stop matching what Kubb wrote, which is what the manifest exists to track.
3361
+ */
3362
+ export declare function hasOutputPasses({ output, storage }: Pick<Config, 'output' | 'storage'>): boolean;
3350
3363
  type CreateKubbOptions = {
3351
3364
  /**
3352
3365
  * Receives Kubb lifecycle hooks for the run.
package/dist/index.d.ts CHANGED
@@ -907,6 +907,7 @@ declare class FileManager {
907
907
  * memory rather than holding every source, while still overlapping each file's write with the
908
908
  * next file's parse. Files finish in whatever order they parse, so each finished file flushes the
909
909
  * run of finished files ahead of it as one `kubb:files:processing:update`, keeping rows in input order.
910
+ * Each parsed source goes out once on `kubb:file:processed`, so listeners read it without the pool holding it.
910
911
  *
911
912
  * A file the storage already holds is skipped, so a rebuild that generates identical output
912
913
  * writes nothing and leaves every mtime where it was. `kubb:files:processing:end` lists the
@@ -1407,6 +1408,7 @@ declare global {
1407
1408
  'kubb:diagnostic': [ctx: KubbDiagnosticContext];
1408
1409
  'kubb:files:processing:start': [ctx: KubbFilesProcessingStartContext];
1409
1410
  'kubb:files:processing:update': [ctx: KubbFilesProcessingUpdateContext];
1411
+ 'kubb:file:processed': [ctx: KubbFileProcessedContext];
1410
1412
  'kubb:files:processing:end': [ctx: KubbFilesProcessingEndContext];
1411
1413
  'kubb:plugin:start': [ctx: KubbPluginStartContext];
1412
1414
  'kubb:plugin:end': [ctx: KubbPluginEndContext];
@@ -1611,6 +1613,12 @@ export type KubbFilesProcessingUpdateContext = {
1611
1613
  */
1612
1614
  files: Array<KubbFileProcessingUpdate>;
1613
1615
  };
1616
+ export type KubbFileProcessedContext = {
1617
+ /** The file that was just parsed and handed to the storage. */
1618
+ file: FileNode;
1619
+ /** The parsed content handed to the storage, before it trims the content or an output pass such as a formatter rewrites it. */
1620
+ source: string;
1621
+ };
1614
1622
  export type KubbFilesProcessingEndContext = {
1615
1623
  /**
1616
1624
  * All files that were serialized in this batch.
@@ -3347,6 +3355,11 @@ type RunOutputPassesOptions = {
3347
3355
  * ```
3348
3356
  */
3349
3357
  export declare function runOutputPasses({ config, outputPath, hooks, signal }: RunOutputPassesOptions): Promise<Array<Diagnostic>>;
3358
+ /**
3359
+ * Whether anything runs over the output directory after the files are written. Only then can the
3360
+ * bytes on disk stop matching what Kubb wrote, which is what the manifest exists to track.
3361
+ */
3362
+ export declare function hasOutputPasses({ output, storage }: Pick<Config, 'output' | 'storage'>): boolean;
3350
3363
  type CreateKubbOptions = {
3351
3364
  /**
3352
3365
  * Receives Kubb lifecycle hooks for the run.
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ var __name = (target, value) => __defProp(target, "name", {
21
21
  configurable: true
22
22
  });
23
23
  // package.json
24
- var version = "5.15.2";
24
+ var version = "5.15.3";
25
25
  // ../../internals/utils/src/casing.ts
26
26
  /**
27
27
  * Shared implementation for camelCase and PascalCase conversion.
@@ -2457,6 +2457,7 @@ var FileManager = class {
2457
2457
  * memory rather than holding every source, while still overlapping each file's write with the
2458
2458
  * next file's parse. Files finish in whatever order they parse, so each finished file flushes the
2459
2459
  * run of finished files ahead of it as one `kubb:files:processing:update`, keeping rows in input order.
2460
+ * Each parsed source goes out once on `kubb:file:processed`, so listeners read it without the pool holding it.
2460
2461
  *
2461
2462
  * A file the storage already holds is skipped, so a rebuild that generates identical output
2462
2463
  * writes nothing and leaves every mtime where it was. `kubb:files:processing:end` lists the
@@ -2473,14 +2474,20 @@ var FileManager = class {
2473
2474
  run: async (file, index) => {
2474
2475
  signal?.throwIfAborted();
2475
2476
  const source = await this.parse(file, { parsers });
2476
- if (source && !await writeChanged({
2477
- storage,
2478
- manifest,
2479
- file,
2480
- source,
2481
- signal,
2482
- cleaned
2483
- })) unchanged.push(file.path);
2477
+ if (source) {
2478
+ if (!await writeChanged({
2479
+ storage,
2480
+ manifest,
2481
+ file,
2482
+ source,
2483
+ signal,
2484
+ cleaned
2485
+ })) unchanged.push(file.path);
2486
+ await hooks?.callHook("kubb:file:processed", {
2487
+ file,
2488
+ source
2489
+ });
2490
+ }
2484
2491
  await progress?.(index);
2485
2492
  }
2486
2493
  });
@@ -4528,6 +4535,6 @@ async function readInstalledPackages({ root, packages = [], resolveFrom = [] })
4528
4535
  }
4529
4536
  }));
4530
4537
  }
4531
- export { Diagnostics, Hookable, KubbDriver, Resolver, addGenerator, addMacro, assertPluginOption, cacheStorage, camelCase, checkCompatibility, checkoutGitInput, cliReporter, createAdapter, createCliReporter, createKubb, createOutputManifest, createRenderer, createReporter, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, htmlReporter, injectFile, isExtensionManifest, isPackageName, isPublicAddress, isRegistryEntry, jsonReporter, kubbContext, kubbStorage, logLevel, manifestProblems, memo, memoryStorage, pascalCase, readInstalledPackages, requirePlugin, resolveCacheDir, resolveKubbDir, resolveMeta, runHook, runOutputPasses, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
4538
+ export { Diagnostics, Hookable, KubbDriver, Resolver, addGenerator, addMacro, assertPluginOption, cacheStorage, camelCase, checkCompatibility, checkoutGitInput, cliReporter, createAdapter, createCliReporter, createKubb, createOutputManifest, createRenderer, createReporter, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, hasOutputPasses, htmlReporter, injectFile, isExtensionManifest, isPackageName, isPublicAddress, isRegistryEntry, jsonReporter, kubbContext, kubbStorage, logLevel, manifestProblems, memo, memoryStorage, pascalCase, readInstalledPackages, requirePlugin, resolveCacheDir, resolveKubbDir, resolveMeta, runHook, runOutputPasses, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
4532
4539
 
4533
4540
  //# sourceMappingURL=index.js.map