@kubb/core 0.44.0 → 0.44.2
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.ts +9 -2
- package/dist/index.global.js +19 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ type KubbConfig = {
|
|
|
40
40
|
* the defined root option.
|
|
41
41
|
*/
|
|
42
42
|
path: string;
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
44
|
output: {
|
|
45
45
|
/**
|
|
46
46
|
* Path to be used to export all generated files. Can be an absolute path, or a path relative based of the defined root option.
|
|
@@ -50,6 +50,11 @@ type KubbConfig = {
|
|
|
50
50
|
* Remove previous generated files and folders.
|
|
51
51
|
*/
|
|
52
52
|
clean?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Write output to the fileSystem
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
write?: boolean;
|
|
53
58
|
};
|
|
54
59
|
/**
|
|
55
60
|
* Array of Kubb plugins to use.
|
|
@@ -186,6 +191,8 @@ type PathMode = 'file' | 'directory';
|
|
|
186
191
|
declare const getPathMode: (path: string | undefined | null) => PathMode;
|
|
187
192
|
declare const read: (path: string) => Promise<string>;
|
|
188
193
|
|
|
194
|
+
declare const isURL: (data: string) => boolean;
|
|
195
|
+
|
|
189
196
|
type Import = {
|
|
190
197
|
name: string | string[];
|
|
191
198
|
path: string;
|
|
@@ -368,4 +375,4 @@ declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput>
|
|
|
368
375
|
abstract build(schema: TInput, name: string, description?: string): TOutput;
|
|
369
376
|
}
|
|
370
377
|
|
|
371
|
-
export { Argument0, CLIOptions, Cache, CacheStore, CorePluginOptions, File, FileManager, FileName, Generator, KubbBuild, KubbConfig, KubbJSONPlugin, KubbPlugin, KubbPluginKind, KubbUserConfig, LogLevel, LogType, Logger, MaybePromise, OptionalPath, Path, PathMode, PluginContext, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, ResolveIdParams, SchemaGenerator, Status, Strategy, TransformResult, TreeNode, UUID, ValidationPluginError, build, clean, createPlugin, createPluginCache, build as default, defineConfig, getPathMode, getRelativePath, hooks, isPromise, name, read, validatePlugins, write };
|
|
378
|
+
export { Argument0, CLIOptions, Cache, CacheStore, CorePluginOptions, File, FileManager, FileName, Generator, KubbBuild, KubbConfig, KubbJSONPlugin, KubbPlugin, KubbPluginKind, KubbUserConfig, LogLevel, LogType, Logger, MaybePromise, OptionalPath, Path, PathMode, PluginContext, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, ResolveIdParams, SchemaGenerator, Status, Strategy, TransformResult, TreeNode, UUID, ValidationPluginError, build, clean, createPlugin, createPluginCache, build as default, defineConfig, getPathMode, getRelativePath, hooks, isPromise, isURL, name, read, validatePlugins, write };
|
package/dist/index.global.js
CHANGED
|
@@ -16904,6 +16904,20 @@ var kubb = (function (exports) {
|
|
|
16904
16904
|
init_define_process();
|
|
16905
16905
|
var import_path4 = __toESM(require_path_browserify());
|
|
16906
16906
|
|
|
16907
|
+
// src/utils/isURL.ts
|
|
16908
|
+
init_define_process();
|
|
16909
|
+
var isURL = (data) => {
|
|
16910
|
+
try {
|
|
16911
|
+
const url = new URL(data);
|
|
16912
|
+
if (url?.href) {
|
|
16913
|
+
return true;
|
|
16914
|
+
}
|
|
16915
|
+
} catch (error) {
|
|
16916
|
+
return false;
|
|
16917
|
+
}
|
|
16918
|
+
return false;
|
|
16919
|
+
};
|
|
16920
|
+
|
|
16907
16921
|
// src/managers/pluginManager/PluginManager.ts
|
|
16908
16922
|
init_define_process();
|
|
16909
16923
|
|
|
@@ -17618,7 +17632,7 @@ ${curr.source}`,
|
|
|
17618
17632
|
}
|
|
17619
17633
|
if (code) {
|
|
17620
17634
|
const transformedCode = await pluginManager.hookReduceArg0("transform", [code, path], transformReducer);
|
|
17621
|
-
if (
|
|
17635
|
+
if (config.output.write || config.output.write === void 0) {
|
|
17622
17636
|
await pluginManager.hookParallel("writeFile", [transformedCode, path]);
|
|
17623
17637
|
}
|
|
17624
17638
|
fileManager.setStatus(id, "success");
|
|
@@ -17627,9 +17641,9 @@ ${curr.source}`,
|
|
|
17627
17641
|
});
|
|
17628
17642
|
await pluginManager.hookParallel("buildStart", [config]);
|
|
17629
17643
|
pluginManager.fileManager.add({
|
|
17630
|
-
path:
|
|
17631
|
-
fileName:
|
|
17632
|
-
source:
|
|
17644
|
+
path: isURL(config.input.path) ? config.input.path : import_path4.default.resolve(config.root, config.input.path),
|
|
17645
|
+
fileName: isURL(config.input.path) ? "input" : config.input.path,
|
|
17646
|
+
source: isURL(config.input.path) ? config.input.path : await read(import_path4.default.resolve(config.root, config.input.path))
|
|
17633
17647
|
});
|
|
17634
17648
|
}
|
|
17635
17649
|
function build(options) {
|
|
@@ -17717,6 +17731,7 @@ ${curr.source}`,
|
|
|
17717
17731
|
exports.getRelativePath = getRelativePath;
|
|
17718
17732
|
exports.hooks = hooks;
|
|
17719
17733
|
exports.isPromise = isPromise;
|
|
17734
|
+
exports.isURL = isURL;
|
|
17720
17735
|
exports.name = name;
|
|
17721
17736
|
exports.read = read;
|
|
17722
17737
|
exports.validatePlugins = validatePlugins;
|