@kubb/core 5.0.0-beta.88 → 5.0.0-beta.89
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/{Diagnostics-C2HF9H7A.d.ts → Diagnostics-CM0-Ae30.d.ts} +13 -2
- package/dist/index.cjs +17 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/dist/mocks.d.ts +1 -1
- package/package.json +2 -2
|
@@ -696,6 +696,13 @@ type ResolverPatch<T extends Resolver = Resolver> = { [K in keyof Omit<T, keyof
|
|
|
696
696
|
name?: T['name'];
|
|
697
697
|
file?: ResolverFile;
|
|
698
698
|
} & ThisType<T>;
|
|
699
|
+
/**
|
|
700
|
+
* Shared brand for reaching a resolver's build options. `Resolver.merge` reads this instead of
|
|
701
|
+
* relying on `instanceof`, which fails when a CommonJS config and the ESM CLI each load their own
|
|
702
|
+
* copy of `@kubb/core`. `Symbol.for` resolves to one key across those copies, so the options stay
|
|
703
|
+
* reachable and a `file` override is never dropped.
|
|
704
|
+
*/
|
|
705
|
+
declare const resolverOptions: unique symbol;
|
|
699
706
|
/**
|
|
700
707
|
* Base constraint for all plugin resolver objects.
|
|
701
708
|
*
|
|
@@ -724,6 +731,8 @@ declare class Resolver {
|
|
|
724
731
|
#private;
|
|
725
732
|
readonly pluginName: string;
|
|
726
733
|
constructor(options: ResolverBuildOptions);
|
|
734
|
+
/** Exposes the raw build options so `Resolver.merge` can read them across `@kubb/core` copies. */
|
|
735
|
+
get [resolverOptions](): ResolverBuildOptions;
|
|
727
736
|
/**
|
|
728
737
|
* The built-in resolution machinery. Always reaches the untouched defaults, even when a
|
|
729
738
|
* plugin overrides the top-level `name` or `file`.
|
|
@@ -734,7 +743,9 @@ declare class Resolver {
|
|
|
734
743
|
/**
|
|
735
744
|
* Merges `override` over `base` and returns a new resolver with helpers re-bound. Top-level
|
|
736
745
|
* keys replace, and a namespace (or `file`) merges per method, so overriding `query.name`
|
|
737
|
-
* keeps the base `query.keyName`. Used when applying `setResolver` partial overrides.
|
|
746
|
+
* keeps the base `query.keyName`. Used when applying `setResolver` partial overrides. Reads a
|
|
747
|
+
* resolver's options through the shared brand rather than `instanceof`, so a `file` override
|
|
748
|
+
* survives even when `base` and `override` come from different `@kubb/core` copies.
|
|
738
749
|
*/
|
|
739
750
|
static merge<T extends Resolver>(base: T, override: ResolverPatch<T> | Resolver): T;
|
|
740
751
|
}
|
|
@@ -2840,4 +2851,4 @@ declare class Diagnostics {
|
|
|
2840
2851
|
}
|
|
2841
2852
|
//#endregion
|
|
2842
2853
|
export { Include as $, KubbHookStartContext as A, Reporter as At, Kubb$1 as B, KubbFilesProcessingEndContext as C, ResolverPathParams as Ct, KubbGenerationStartContext as D, Storage as Dt, KubbGenerationEndContext as E, createRenderer as Et, KubbSuccessContext as F, logLevel as Ft, KubbDriver as G, Generator as H, KubbWarnContext as I, Adapter as It, Parser as J, FileManagerHooks as K, PossibleConfig as L, AdapterFactoryOptions as Lt, KubbInfoContext as M, ReporterName as Mt, KubbLifecycleStartContext as N, UserReporter as Nt, KubbHookEndContext as O, createStorage as Ot, KubbPluginsEndContext as P, createReporter as Pt, Group as Q, UserConfig as R, AdapterSource as Rt, KubbFileProcessingUpdate as S, ResolverPatch as St, KubbFilesProcessingUpdateContext as T, RendererFactory as Tt, GeneratorContext as U, createKubb as V, defineGenerator as W, Exclude$1 as X, defineParser as Y, Filter as Z, InputPath as _, Resolver as _t, DiagnosticLocation as a, OutputMode as at, KubbDiagnosticContext as b, ResolverFileParams as bt, PerformanceDiagnostic as c, Plugin as ct, SerializedDiagnostic as d, BannerMeta as dt, KubbPluginEndContext as et, UpdateDiagnostic as f, ResolveBannerContext as ft, InputData as g, ResolvePathOptions as gt, Config as h, ResolveOptionsContext as ht, DiagnosticKind as i, Output as it, KubbHooks as j, ReporterContext as jt, KubbHookLineContext as k, GenerationResult as kt, ProblemCode as l, PluginFactoryOptions as lt, CLIOptions as m, ResolveFileOptions as mt, DiagnosticByCode as n, KubbPluginStartContext as nt, DiagnosticSeverity as o, OutputOptions as ot, BuildOutput as p, ResolveBannerFile as pt, Hookable as q, DiagnosticDoc as r, NormalizedPlugin as rt, Diagnostics as s, Override as st, Diagnostic as t, KubbPluginSetupContext as tt, ProblemDiagnostic as u, definePlugin as ut, KubbBuildEndContext as v, ResolverDefault as vt, KubbFilesProcessingStartContext as w, Renderer as wt, KubbErrorContext as x, ResolverFilePathParams as xt, KubbBuildStartContext as y, ResolverFile as yt, CreateKubbOptions as z, createAdapter as zt };
|
|
2843
|
-
//# sourceMappingURL=Diagnostics-
|
|
2854
|
+
//# sourceMappingURL=Diagnostics-CM0-Ae30.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -172,7 +172,7 @@ function memoize(store, factory) {
|
|
|
172
172
|
}
|
|
173
173
|
//#endregion
|
|
174
174
|
//#region package.json
|
|
175
|
-
var version = "5.0.0-beta.
|
|
175
|
+
var version = "5.0.0-beta.89";
|
|
176
176
|
//#endregion
|
|
177
177
|
//#region src/constants.ts
|
|
178
178
|
/**
|
|
@@ -747,6 +747,13 @@ function isNamespace(value) {
|
|
|
747
747
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
748
748
|
}
|
|
749
749
|
/**
|
|
750
|
+
* Shared brand for reaching a resolver's build options. `Resolver.merge` reads this instead of
|
|
751
|
+
* relying on `instanceof`, which fails when a CommonJS config and the ESM CLI each load their own
|
|
752
|
+
* copy of `@kubb/core`. `Symbol.for` resolves to one key across those copies, so the options stay
|
|
753
|
+
* reachable and a `file` override is never dropped.
|
|
754
|
+
*/
|
|
755
|
+
const resolverOptions = Symbol.for("@kubb/core/resolver/options");
|
|
756
|
+
/**
|
|
750
757
|
* Built-in `file.baseName`: casts the identifier with `toFilePath` and appends the extension.
|
|
751
758
|
*/
|
|
752
759
|
function toBaseName({ name, extname }) {
|
|
@@ -790,6 +797,10 @@ var Resolver = class Resolver {
|
|
|
790
797
|
this.#filePath = options.file?.path ? options.file.path.bind(this) : void 0;
|
|
791
798
|
this.#apply(options);
|
|
792
799
|
}
|
|
800
|
+
/** Exposes the raw build options so `Resolver.merge` can read them across `@kubb/core` copies. */
|
|
801
|
+
get [resolverOptions]() {
|
|
802
|
+
return this.#options;
|
|
803
|
+
}
|
|
793
804
|
/**
|
|
794
805
|
* The built-in resolution machinery. Always reaches the untouched defaults, even when a
|
|
795
806
|
* plugin overrides the top-level `name` or `file`.
|
|
@@ -813,11 +824,13 @@ var Resolver = class Resolver {
|
|
|
813
824
|
/**
|
|
814
825
|
* Merges `override` over `base` and returns a new resolver with helpers re-bound. Top-level
|
|
815
826
|
* keys replace, and a namespace (or `file`) merges per method, so overriding `query.name`
|
|
816
|
-
* keeps the base `query.keyName`. Used when applying `setResolver` partial overrides.
|
|
827
|
+
* keeps the base `query.keyName`. Used when applying `setResolver` partial overrides. Reads a
|
|
828
|
+
* resolver's options through the shared brand rather than `instanceof`, so a `file` override
|
|
829
|
+
* survives even when `base` and `override` come from different `@kubb/core` copies.
|
|
817
830
|
*/
|
|
818
831
|
static merge(base, override) {
|
|
819
|
-
const patch =
|
|
820
|
-
const merged = { ...base
|
|
832
|
+
const patch = resolverOptions in override ? override[resolverOptions] : override;
|
|
833
|
+
const merged = { ...base[resolverOptions] };
|
|
821
834
|
for (const [key, value] of Object.entries(patch)) {
|
|
822
835
|
if (value === void 0) continue;
|
|
823
836
|
const current = merged[key];
|