@kubb/core 1.12.0-canary.20231018T095854 → 1.13.0-canary.20231018T144635
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.cjs +422 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +73 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/dist/index.d.cts
CHANGED
|
@@ -468,6 +468,21 @@ declare class ParallelPluginError extends Error {
|
|
|
468
468
|
findError<T extends Error = Error>(searchError: T | undefined): T | undefined;
|
|
469
469
|
}
|
|
470
470
|
|
|
471
|
+
type PackageJSON = {
|
|
472
|
+
dependencies?: Record<string, string>;
|
|
473
|
+
devDependencies?: Record<string, string>;
|
|
474
|
+
};
|
|
475
|
+
declare class PackageManager {
|
|
476
|
+
private cwd;
|
|
477
|
+
constructor(workspace?: string);
|
|
478
|
+
getPackageJSON(): Promise<PackageJSON | undefined>;
|
|
479
|
+
getPackageJSONSync(): PackageJSON | undefined;
|
|
480
|
+
getVersion(dependency: string): Promise<string | undefined>;
|
|
481
|
+
getVersionSync(dependency: string): string | undefined;
|
|
482
|
+
isValid(dependency: string, version: string): Promise<boolean>;
|
|
483
|
+
isValidSync(dependency: string, version: string): boolean;
|
|
484
|
+
}
|
|
485
|
+
|
|
471
486
|
/**
|
|
472
487
|
* Config used in `kubb.config.js`
|
|
473
488
|
*
|
|
@@ -768,4 +783,4 @@ declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput>
|
|
|
768
783
|
abstract build(schema: TInput, name: string, description?: string): TOutput;
|
|
769
784
|
}
|
|
770
785
|
|
|
771
|
-
export { AppMeta, Argument0, BuildOutput, CLIOptions, Cache, CacheItem, Executer, FileManager, FunctionParams, FunctionParamsAST, Generator, KubbConfig, KubbFile, KubbJSONPlugins, KubbObjectPlugin, KubbObjectPlugins, KubbPlugin, KubbPluginKind, KubbUserConfig, KubbUserPlugin, LogLevel, LogType, Logger, ParallelPluginError, ParseResult, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PossiblePromise, Prettify, Queue, QueueJob, ResolveNameParams, ResolvePathParams, SafeParseResult, SchemaGenerator, Strategy, SummaryError, TransformResult, TreeNode, TreeNodeOptions, URLObject, URLPath, ValidationPluginError, Warning, build, clean, combineCodes, combineExports, combineFiles, combineImports, createFileSource, createJSDocBlockText, createLogger, createPlugin, createPluginCache, build as default, defaultColours, defineConfig, escape, extensions, getDependedPlugins, getIndexes, getLocation, getPathMode, getRelativePath, getUniqueName, hooks, importModule, isExtensionAllowed, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, jsStringEscape, pluginName as name, nameSorter, normalizeDirectory, pluginName, randomColour, randomPicoColour, read, readSync, renderTemplate, throttle, timeout, transformReservedWord, uniqueIdFactory, write };
|
|
786
|
+
export { AppMeta, Argument0, BuildOutput, CLIOptions, Cache, CacheItem, Executer, FileManager, FunctionParams, FunctionParamsAST, Generator, KubbConfig, KubbFile, KubbJSONPlugins, KubbObjectPlugin, KubbObjectPlugins, KubbPlugin, KubbPluginKind, KubbUserConfig, KubbUserPlugin, LogLevel, LogType, Logger, PackageManager, ParallelPluginError, ParseResult, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PossiblePromise, Prettify, Queue, QueueJob, ResolveNameParams, ResolvePathParams, SafeParseResult, SchemaGenerator, Strategy, SummaryError, TransformResult, TreeNode, TreeNodeOptions, URLObject, URLPath, ValidationPluginError, Warning, build, clean, combineCodes, combineExports, combineFiles, combineImports, createFileSource, createJSDocBlockText, createLogger, createPlugin, createPluginCache, build as default, defaultColours, defineConfig, escape, extensions, getDependedPlugins, getIndexes, getLocation, getPathMode, getRelativePath, getUniqueName, hooks, importModule, isExtensionAllowed, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, jsStringEscape, pluginName as name, nameSorter, normalizeDirectory, pluginName, randomColour, randomPicoColour, read, readSync, renderTemplate, throttle, timeout, transformReservedWord, uniqueIdFactory, write };
|
package/dist/index.d.ts
CHANGED
|
@@ -468,6 +468,21 @@ declare class ParallelPluginError extends Error {
|
|
|
468
468
|
findError<T extends Error = Error>(searchError: T | undefined): T | undefined;
|
|
469
469
|
}
|
|
470
470
|
|
|
471
|
+
type PackageJSON = {
|
|
472
|
+
dependencies?: Record<string, string>;
|
|
473
|
+
devDependencies?: Record<string, string>;
|
|
474
|
+
};
|
|
475
|
+
declare class PackageManager {
|
|
476
|
+
private cwd;
|
|
477
|
+
constructor(workspace?: string);
|
|
478
|
+
getPackageJSON(): Promise<PackageJSON | undefined>;
|
|
479
|
+
getPackageJSONSync(): PackageJSON | undefined;
|
|
480
|
+
getVersion(dependency: string): Promise<string | undefined>;
|
|
481
|
+
getVersionSync(dependency: string): string | undefined;
|
|
482
|
+
isValid(dependency: string, version: string): Promise<boolean>;
|
|
483
|
+
isValidSync(dependency: string, version: string): boolean;
|
|
484
|
+
}
|
|
485
|
+
|
|
471
486
|
/**
|
|
472
487
|
* Config used in `kubb.config.js`
|
|
473
488
|
*
|
|
@@ -768,4 +783,4 @@ declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput>
|
|
|
768
783
|
abstract build(schema: TInput, name: string, description?: string): TOutput;
|
|
769
784
|
}
|
|
770
785
|
|
|
771
|
-
export { AppMeta, Argument0, BuildOutput, CLIOptions, Cache, CacheItem, Executer, FileManager, FunctionParams, FunctionParamsAST, Generator, KubbConfig, KubbFile, KubbJSONPlugins, KubbObjectPlugin, KubbObjectPlugins, KubbPlugin, KubbPluginKind, KubbUserConfig, KubbUserPlugin, LogLevel, LogType, Logger, ParallelPluginError, ParseResult, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PossiblePromise, Prettify, Queue, QueueJob, ResolveNameParams, ResolvePathParams, SafeParseResult, SchemaGenerator, Strategy, SummaryError, TransformResult, TreeNode, TreeNodeOptions, URLObject, URLPath, ValidationPluginError, Warning, build, clean, combineCodes, combineExports, combineFiles, combineImports, createFileSource, createJSDocBlockText, createLogger, createPlugin, createPluginCache, build as default, defaultColours, defineConfig, escape, extensions, getDependedPlugins, getIndexes, getLocation, getPathMode, getRelativePath, getUniqueName, hooks, importModule, isExtensionAllowed, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, jsStringEscape, pluginName as name, nameSorter, normalizeDirectory, pluginName, randomColour, randomPicoColour, read, readSync, renderTemplate, throttle, timeout, transformReservedWord, uniqueIdFactory, write };
|
|
786
|
+
export { AppMeta, Argument0, BuildOutput, CLIOptions, Cache, CacheItem, Executer, FileManager, FunctionParams, FunctionParamsAST, Generator, KubbConfig, KubbFile, KubbJSONPlugins, KubbObjectPlugin, KubbObjectPlugins, KubbPlugin, KubbPluginKind, KubbUserConfig, KubbUserPlugin, LogLevel, LogType, Logger, PackageManager, ParallelPluginError, ParseResult, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PossiblePromise, Prettify, Queue, QueueJob, ResolveNameParams, ResolvePathParams, SafeParseResult, SchemaGenerator, Strategy, SummaryError, TransformResult, TreeNode, TreeNodeOptions, URLObject, URLPath, ValidationPluginError, Warning, build, clean, combineCodes, combineExports, combineFiles, combineImports, createFileSource, createJSDocBlockText, createLogger, createPlugin, createPluginCache, build as default, defaultColours, defineConfig, escape, extensions, getDependedPlugins, getIndexes, getLocation, getPathMode, getRelativePath, getUniqueName, hooks, importModule, isExtensionAllowed, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, jsStringEscape, pluginName as name, nameSorter, normalizeDirectory, pluginName, randomColour, randomPicoColour, read, readSync, renderTemplate, throttle, timeout, transformReservedWord, uniqueIdFactory, write };
|
package/dist/index.js
CHANGED
|
@@ -15,8 +15,18 @@ import { orderBy } from 'natural-orderby';
|
|
|
15
15
|
import { createImportDeclaration, print, createExportDeclaration } from '@kubb/parser';
|
|
16
16
|
import isEqual from 'lodash.isequal';
|
|
17
17
|
import { EventEmitter as EventEmitter$1 } from 'events';
|
|
18
|
+
import { findUp, findUpSync } from 'find-up';
|
|
19
|
+
import { coerce, satisfies } from 'semver';
|
|
18
20
|
|
|
19
|
-
createRequire(import.meta.url);
|
|
21
|
+
const require = createRequire(import.meta.url);
|
|
22
|
+
|
|
23
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
24
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
25
|
+
}) : x)(function(x) {
|
|
26
|
+
if (typeof require !== "undefined")
|
|
27
|
+
return require.apply(this, arguments);
|
|
28
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
29
|
+
});
|
|
20
30
|
|
|
21
31
|
// src/utils/isPromise.ts
|
|
22
32
|
function isPromise(result) {
|
|
@@ -1639,6 +1649,67 @@ async function build(options) {
|
|
|
1639
1649
|
function defineConfig(options) {
|
|
1640
1650
|
return options;
|
|
1641
1651
|
}
|
|
1652
|
+
var PackageManager = class {
|
|
1653
|
+
cwd;
|
|
1654
|
+
constructor(workspace = process.cwd()) {
|
|
1655
|
+
this.cwd = workspace;
|
|
1656
|
+
return this;
|
|
1657
|
+
}
|
|
1658
|
+
async getPackageJSON() {
|
|
1659
|
+
const pkgPath = await findUp(["package.json"], {
|
|
1660
|
+
cwd: this.cwd
|
|
1661
|
+
});
|
|
1662
|
+
if (!pkgPath) {
|
|
1663
|
+
return void 0;
|
|
1664
|
+
}
|
|
1665
|
+
return __require(pkgPath);
|
|
1666
|
+
}
|
|
1667
|
+
getPackageJSONSync() {
|
|
1668
|
+
const pkgPath = findUpSync(["package.json"], {
|
|
1669
|
+
cwd: this.cwd
|
|
1670
|
+
});
|
|
1671
|
+
if (!pkgPath) {
|
|
1672
|
+
return void 0;
|
|
1673
|
+
}
|
|
1674
|
+
return __require(pkgPath);
|
|
1675
|
+
}
|
|
1676
|
+
async getVersion(dependency) {
|
|
1677
|
+
const packageJSON = await this.getPackageJSON();
|
|
1678
|
+
if (!packageJSON) {
|
|
1679
|
+
return void 0;
|
|
1680
|
+
}
|
|
1681
|
+
return packageJSON["dependencies"]?.[dependency] || packageJSON["devDependencies"]?.[dependency];
|
|
1682
|
+
}
|
|
1683
|
+
getVersionSync(dependency) {
|
|
1684
|
+
const packageJSON = this.getPackageJSONSync();
|
|
1685
|
+
if (!packageJSON) {
|
|
1686
|
+
return void 0;
|
|
1687
|
+
}
|
|
1688
|
+
return packageJSON["dependencies"]?.[dependency] || packageJSON["devDependencies"]?.[dependency];
|
|
1689
|
+
}
|
|
1690
|
+
async isValid(dependency, version) {
|
|
1691
|
+
const packageVersion = await this.getVersion(dependency);
|
|
1692
|
+
if (!packageVersion) {
|
|
1693
|
+
return false;
|
|
1694
|
+
}
|
|
1695
|
+
const semVer = coerce(packageVersion);
|
|
1696
|
+
if (!semVer) {
|
|
1697
|
+
throw new Error(`${packageVersion} is not valid`);
|
|
1698
|
+
}
|
|
1699
|
+
return satisfies(semVer, version);
|
|
1700
|
+
}
|
|
1701
|
+
isValidSync(dependency, version) {
|
|
1702
|
+
const packageVersion = this.getVersionSync(dependency);
|
|
1703
|
+
if (!packageVersion) {
|
|
1704
|
+
return false;
|
|
1705
|
+
}
|
|
1706
|
+
const semVer = coerce(packageVersion);
|
|
1707
|
+
if (!semVer) {
|
|
1708
|
+
throw new Error(`${packageVersion} is not valid`);
|
|
1709
|
+
}
|
|
1710
|
+
return satisfies(semVer, version);
|
|
1711
|
+
}
|
|
1712
|
+
};
|
|
1642
1713
|
|
|
1643
1714
|
// src/generators/Generator.ts
|
|
1644
1715
|
var Generator = class {
|
|
@@ -1664,6 +1735,6 @@ var SchemaGenerator = class extends Generator {
|
|
|
1664
1735
|
// src/index.ts
|
|
1665
1736
|
var src_default = build;
|
|
1666
1737
|
|
|
1667
|
-
export { FileManager, FunctionParams, Generator, LogLevel, ParallelPluginError, PluginError, PluginManager, Queue, SchemaGenerator, SummaryError, TreeNode, URLPath, ValidationPluginError, Warning, build, clean, combineCodes, combineExports, combineFiles, combineImports, createFileSource, createJSDocBlockText, createLogger, createPlugin, createPluginCache, src_default as default, defaultColours, defineConfig, escape, extensions, getDependedPlugins, getIndexes, getLocation, getPathMode, getRelativePath, getUniqueName, hooks, importModule, isExtensionAllowed, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, jsStringEscape, pluginName as name, nameSorter, normalizeDirectory, pluginName, randomColour, randomPicoColour, read, readSync, renderTemplate, throttle, timeout, transformReservedWord, uniqueIdFactory, write };
|
|
1738
|
+
export { FileManager, FunctionParams, Generator, LogLevel, PackageManager, ParallelPluginError, PluginError, PluginManager, Queue, SchemaGenerator, SummaryError, TreeNode, URLPath, ValidationPluginError, Warning, build, clean, combineCodes, combineExports, combineFiles, combineImports, createFileSource, createJSDocBlockText, createLogger, createPlugin, createPluginCache, src_default as default, defaultColours, defineConfig, escape, extensions, getDependedPlugins, getIndexes, getLocation, getPathMode, getRelativePath, getUniqueName, hooks, importModule, isExtensionAllowed, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, jsStringEscape, pluginName as name, nameSorter, normalizeDirectory, pluginName, randomColour, randomPicoColour, read, readSync, renderTemplate, throttle, timeout, transformReservedWord, uniqueIdFactory, write };
|
|
1668
1739
|
//# sourceMappingURL=out.js.map
|
|
1669
1740
|
//# sourceMappingURL=index.js.map
|